Merge "maintenance: Detect "unknown module name" error in manageForeignResources"
[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 !! wikitext
2050 a <blockquote>foo</blockquote>
2051
2052 b
2053 !! html
2054 a <blockquote>foo</blockquote>
2055 <p>b
2056 </p>
2057 !! html+tidy
2058 <p>a </p><blockquote><p>foo</p></blockquote>
2059 <p>b
2060 </p>
2061 !! end
2062
2063 !! test
2064 Block tag on both lines (<div>)
2065 !! wikitext
2066 a <div>foo</div>
2067
2068 b <div>foo</div>
2069 !! html
2070 a <div>foo</div>
2071 b <div>foo</div>
2072
2073 !! html+tidy
2074 <p>a </p><div>foo</div><p>
2075 b </p><div>foo</div>
2076 !! end
2077
2078 !! test
2079 Block tag on both lines (<blockquote>)
2080 !! wikitext
2081 a <blockquote>foo</blockquote>
2082
2083 b <blockquote>foo</blockquote>
2084 !! html
2085 a <blockquote>foo</blockquote>
2086 b <blockquote>foo</blockquote>
2087
2088 !! html+tidy
2089 <p>a </p><blockquote><p>foo</p></blockquote><p>
2090 b </p><blockquote><p>foo</p></blockquote>
2091 !! end
2092
2093 !! test
2094 Multiple lines without block tags
2095 !! wikitext
2096 <div>foo</div> a
2097 b
2098 c
2099 d<!--foo--> e
2100 x <div>foo</div> z
2101 !! html
2102 <div>foo</div> a
2103 <p>b
2104 c
2105 d e
2106 </p>
2107 x <div>foo</div> z
2108
2109 !! html+tidy
2110 <div>foo</div><p> a
2111 </p><p>b
2112 c
2113 d e
2114 </p><p>
2115 x </p><div>foo</div><p> z
2116 </p>
2117 !! end
2118
2119 !! test
2120 Empty lines between lines with block tags
2121 !! wikitext
2122 <div></div>
2123
2124
2125 <div></div>a
2126
2127 b
2128 <div>a</div>b
2129
2130 <div>b</div>d
2131
2132
2133 <div>e</div>
2134 !! html
2135 <div></div>
2136 <p><br />
2137 </p>
2138 <div></div>a
2139 <p>b
2140 </p>
2141 <div>a</div>b
2142 <div>b</div>d
2143 <p><br />
2144 </p>
2145 <div>e</div>
2146
2147 !! html+tidy
2148 <div></div>
2149 <p><br />
2150 </p>
2151 <div></div><p>a
2152 </p><p>b
2153 </p>
2154 <div>a</div><p>b
2155 </p><div>b</div><p>d
2156 </p><p><br />
2157 </p>
2158 <div>e</div>
2159 !! html/parsoid
2160 <div data-parsoid='{"stx":"html"}'></div>
2161
2162 <p><br /></p>
2163 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2164
2165 <p>b</p>
2166 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2167
2168 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2169
2170 <p><br /></p>
2171 <div data-parsoid='{"stx":"html"}'>e</div>
2172 !! end
2173
2174 !! test
2175 Unclosed HTML p-tags should be handled properly
2176 !! wikitext
2177 <div><p>foo</div>
2178 a
2179
2180 b
2181 !! html/php+tidy
2182 <div><p>foo</p></div>
2183 <p>a
2184 </p><p>b
2185 </p>
2186 !! html/parsoid
2187 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2188 <p>a</p>
2189 <p>b</p>
2190 !! end
2191
2192 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2193 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2194 ## them for now.
2195 !! test
2196 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2197 !! options
2198 parsoid=wt2html
2199 !! wikitext
2200 a [[Category:A1]] [[Category:A2]]
2201 [[Category:A3]]
2202 [[Category:A4]]
2203 !! html/parsoid
2204 <p>a</p>
2205 <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"/>
2206 !! end
2207
2208 !! test
2209 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2210 !! options
2211 parsoid=wt2html
2212 !! wikitext
2213 [[Category:A1]]a
2214 !! html/parsoid
2215 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2216 !! end
2217
2218 !! test
2219 No paragraph necessary for SOL transparent template
2220 !! wikitext
2221 <span><div>foo</div></span>
2222 [[Category:Foo]]
2223
2224 <span><div>foo</div></span>
2225 {{echo|[[Category:Foo]]}}
2226 !! html/php
2227 <span><div>foo</div></span>
2228 <span><div>foo</div></span>
2229
2230 !! html/parsoid
2231 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2232 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2233
2234 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2235 <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}}]}'/>
2236 !! end
2237
2238 !! test
2239 Avoid expanding multiline sol transparent template ranges unnecessarily
2240 !! wikitext
2241 hi
2242
2243
2244 {{echo|<br/>
2245 }}
2246
2247 [[Category:Ho]]
2248 !! html/php
2249 <p>hi
2250 </p><p><br />
2251 <br />
2252 </p>
2253 !! html/parsoid
2254 <p>hi</p>
2255
2256 <p><br />
2257 <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">
2258 </span></p>
2259
2260 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2261 !! end
2262
2263 !! test
2264 Paragraph wrapping following unclosed table
2265 !! options
2266 parsoid=wt2html,html2html
2267 !! wikitext
2268 {|
2269 |-
2270
2271 {|
2272 | x
2273 |}
2274
2275 a
2276
2277 b
2278
2279 c
2280 !! html/php+tidy
2281 <table>
2282
2283
2284 </table><table>
2285 <tbody><tr>
2286 <td>x
2287 </td></tr></tbody></table>
2288 <p>a
2289 </p><p>b
2290 </p><p>c
2291 </p>
2292 !! html/parsoid
2293 <table data-parsoid='{"autoInsertedEnd":true}'>
2294 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2295
2296 </tbody></table><table>
2297 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2298 </tbody></table>
2299
2300 <p>a</p>
2301
2302 <p>b</p>
2303
2304 <p>c</p>
2305 !! end
2306
2307 !! test
2308 Paragraph wrapping suppressed in html p
2309 !! options
2310 parsoid=wt2html,html2html
2311 !! wikitext
2312 <p>
2313
2314
2315 hi
2316
2317
2318
2319 </p>
2320 !! html/php+tidy
2321 <p>
2322
2323
2324 hi
2325
2326
2327
2328 </p>
2329 !! html/parsoid
2330 <p data-parsoid='{"stx":"html"}'>
2331
2332
2333 hi
2334
2335
2336
2337 </p>
2338 !! end
2339
2340 !! test
2341 Dangling table row doesn't prevent p-wrapping
2342 !! options
2343 parsoid=wt2html,html2html
2344 !! wikitext
2345 {|
2346 | hi
2347 |-
2348 |} ho
2349 !! html/parsoid
2350 <table>
2351 <tbody><tr><td>hi</td></tr>
2352 <tr class="mw-empty-elt"></tr>
2353 </tbody></table><p> ho</p>
2354 !! end
2355
2356 ###
2357 ### Preformatted text
2358 ###
2359
2360 !! test
2361 Preformatted text
2362 !! wikitext
2363 This is some
2364 Preformatted text
2365 With ''italic''
2366 And '''bold'''
2367 And a [[Main Page|link]]
2368 !! html
2369 <pre>This is some
2370 Preformatted text
2371 With <i>italic</i>
2372 And <b>bold</b>
2373 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2374 </pre>
2375 !! end
2376
2377 !! test
2378 Tabs don't trigger preformatted text
2379 !! wikitext
2380 This is not
2381 preformatted text.
2382 This is preformatted text.
2383 So is this.
2384 !! html/php
2385 <p> This is not
2386 preformatted text.
2387 </p>
2388 <pre>This is preformatted text.
2389 So is this.
2390 </pre>
2391 !! html/parsoid
2392 <p> This is not
2393 preformatted text.</p>
2394 <pre>This is preformatted text.
2395 So is this.</pre>
2396 !! end
2397
2398 !! test
2399 Space before tab needs nowiki pre protection
2400 !! options
2401 parsoid=html2wt
2402 !! html/parsoid
2403 <p> a</p>
2404 !! wikitext
2405 <nowiki> </nowiki> a
2406 !! end
2407
2408 !! test
2409 Ident preformatting with inline content
2410 !! wikitext
2411 a
2412 ''b''
2413 !! html
2414 <pre>a
2415 <i>b</i>
2416 </pre>
2417 !! end
2418
2419 !! test
2420 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2421 !! wikitext
2422 <pre><nowiki>
2423 <b>
2424 <cite>
2425 <em>
2426 </nowiki></pre>
2427 !! html
2428 <pre>
2429 &lt;b&gt;
2430 &lt;cite&gt;
2431 &lt;em&gt;
2432 </pre>
2433
2434 !! end
2435
2436 !! test
2437 Regression with preformatted in <center>
2438 !! wikitext
2439 <center>
2440 Blah
2441 </center>
2442 !! html
2443 <center>
2444 <pre>Blah
2445 </pre>
2446 </center>
2447
2448 !! end
2449
2450 !! test
2451 T54763: Preformatted in <blockquote>
2452 !! wikitext
2453 <blockquote>
2454 Blah
2455 {|
2456 |
2457 indented cell (no pre-wrapping!)
2458 |}
2459 </blockquote>
2460 !! html
2461 <blockquote>
2462 <p> Blah
2463 </p>
2464 <table>
2465 <tr>
2466 <td>
2467 <p> indented cell (no pre-wrapping!)
2468 </p>
2469 </td></tr></table>
2470 </blockquote>
2471
2472 !! end
2473
2474 !! test
2475 T53086: Double newlines in blockquotes should be turned into paragraphs
2476 !! wikitext
2477 <blockquote>
2478 Foo
2479
2480 Bar
2481 </blockquote>
2482 !! html
2483 <blockquote>
2484 <p>Foo
2485 </p><p>Bar
2486 </p>
2487 </blockquote>
2488
2489 !! end
2490
2491 !! test
2492 T17491: <ins>/<del> in blockquote
2493 !! wikitext
2494 <blockquote>
2495 Foo <del>bar</del> <ins>baz</ins> quux
2496 </blockquote>
2497 !! html
2498 <blockquote>
2499 <p>Foo <del>bar</del> <ins>baz</ins> quux
2500 </p>
2501 </blockquote>
2502
2503 !! html+tidy
2504 <blockquote>
2505 <p>Foo <del>bar</del> <ins>baz</ins> quux
2506 </p>
2507 </blockquote>
2508 !! end
2509
2510 !! test
2511 T17491: <ins>/<del> in blockquote (2)
2512 !! wikitext
2513 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2514 </blockquote>
2515 !! html
2516 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2517 </blockquote>
2518
2519 !! html+tidy
2520 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2521 </p></blockquote>
2522 !! end
2523
2524 !! test
2525 <pre> with attributes (T5202)
2526 !! wikitext
2527 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2528 !! html
2529 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2530
2531 !! end
2532
2533 !! test
2534 <pre> with width attribute (T5202)
2535 !! wikitext
2536 <pre width="8">Narrow screen goodies</pre>
2537 !! html
2538 <pre width="8">Narrow screen goodies</pre>
2539
2540 !! end
2541
2542 !! test
2543 <pre> with forbidden attribute (T5202)
2544 !! wikitext
2545 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2546 !! html
2547 <pre width="8">Narrow screen goodies</pre>
2548
2549 !! end
2550
2551 !! test
2552 Entities inside <pre>
2553 !! wikitext
2554 <pre>&lt;</pre>
2555 !! html
2556 <pre>&lt;</pre>
2557
2558 !! end
2559
2560 !! test
2561 <pre> with forbidden attribute values (T5202)
2562 !! wikitext
2563 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2564 !! html
2565 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2566
2567 !! end
2568
2569 !! test
2570 <nowiki> inside <pre> (T15238)
2571 !! wikitext
2572 <pre>
2573 <nowiki>
2574 </pre>
2575 <pre>
2576 <nowiki></nowiki>
2577 </pre>
2578 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2579 !! html
2580 <pre>
2581 &lt;nowiki&gt;
2582 </pre>
2583 <pre>
2584
2585 </pre>
2586 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2587
2588 !! end
2589
2590 !! test
2591 <nowiki> inside of #tag:pre
2592 !! wikitext
2593 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2594 !! html/php
2595 <pre>Foo &#8594;bar</pre>
2596
2597 !! html/parsoid
2598 <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>
2599 !! end
2600
2601 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2602 ## aren't enclosed in nowikis.
2603 !! test
2604 <nowiki> and <pre> preference (first one wins)
2605 !! options
2606 parsoid=wt2html
2607 !! wikitext
2608 <pre>
2609 <nowiki>
2610 </pre>
2611 </nowiki>
2612 </pre>
2613
2614 <nowiki>
2615 <pre>
2616 <nowiki>
2617 </pre>
2618 </nowiki>
2619 </pre>
2620
2621 !! html/php
2622 <pre>
2623 &lt;nowiki&gt;
2624 </pre>
2625 <p>&lt;/nowiki&gt;
2626 &lt;/pre&gt;
2627 </p><p>
2628 &lt;pre&gt;
2629 &lt;nowiki&gt;
2630 &lt;/pre&gt;
2631
2632 &lt;/pre&gt;
2633 </p>
2634 !! html/parsoid
2635 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2636 </pre>
2637 <p>&lt;/nowiki></p>
2638
2639
2640 <p><span typeof="mw:Nowiki">
2641 &lt;pre>
2642 &lt;nowiki>
2643 &lt;/pre>
2644 </span></p>
2645 !! end
2646
2647 !! test
2648 </pre> inside nowiki
2649 !! wikitext
2650 <nowiki></pre></nowiki>
2651 !! html
2652 <p>&lt;/pre&gt;
2653 </p>
2654 !! end
2655
2656 !! test
2657 Empty pre; pre inside other HTML tags (T56946)
2658 !! wikitext
2659 a
2660
2661 <div><pre>
2662 foo
2663 </pre></div>
2664 <pre></pre>
2665 !! html/php+tidy
2666 <p>a
2667 </p>
2668 <div><pre>foo
2669 </pre></div>
2670 <pre></pre>
2671 !! html/parsoid
2672 <p>a</p>
2673
2674 <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
2675 </pre></div>
2676 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2677 !! end
2678
2679 !! test
2680 HTML pre followed by indent-pre
2681 !! wikitext
2682 <pre>foo</pre>
2683 bar
2684 !! html
2685 <pre>foo</pre>
2686 <pre>bar
2687 </pre>
2688 !! end
2689
2690 !! test
2691 Block tag pre
2692 !! wikitext
2693 <p><pre>foo</pre></p>
2694 !! html/php+tidy
2695 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2696 !! html/parsoid
2697 <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>
2698 !! end
2699
2700 !!test
2701 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2702 !! wikitext
2703 {{echo|}}
2704 !! html
2705
2706 !!end
2707
2708 !!test
2709 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2710 !! wikitext
2711 {{echo|
2712 foo}}
2713 !! html
2714 <p>foo
2715 </p>
2716 !!end
2717
2718 !! test
2719 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2720 !! wikitext
2721 {{echo|a
2722 b}}
2723 !! html
2724 <pre>a
2725 </pre>
2726 <p>b
2727 </p>
2728 !!end
2729
2730 !! test
2731 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2732 !! wikitext
2733 {{echo|a
2734 b
2735 c
2736 d
2737 e
2738 }}
2739 !! html
2740 <pre>a
2741 </pre>
2742 <p>b
2743 c
2744 </p>
2745 <pre>d
2746 </pre>
2747 <p>e
2748 </p>
2749 !!end
2750
2751 !!test
2752 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2753 !! wikitext
2754 {{echo| foo}}
2755
2756 {{echo| foo}}{{echo| bar}}
2757
2758 {{echo| foo}}
2759 {{echo| bar}}
2760
2761 {{echo|<!--cmt--> foo}}
2762
2763 <!--cmt-->{{echo| foo}}
2764
2765 {{echo|{{echo| }}bar}}
2766 !! html
2767 <pre>foo
2768 </pre>
2769 <pre>foo bar
2770 </pre>
2771 <pre>foo
2772 bar
2773 </pre>
2774 <pre>foo
2775 </pre>
2776 <pre>foo
2777 </pre>
2778 <pre>bar
2779 </pre>
2780 !!end
2781
2782 !! test
2783 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2784 !! wikitext
2785 {{echo| }}a
2786
2787 {{echo|
2788 }}a
2789
2790 {{echo|
2791 b}}
2792
2793 {{echo|a
2794 }}b
2795
2796 {{echo|a
2797 }} b
2798 !! html
2799 <pre>a
2800 </pre>
2801 <p><br />
2802 </p>
2803 <pre>a
2804 </pre>
2805 <p><br />
2806 </p>
2807 <pre>b
2808 </pre>
2809 <p>a
2810 </p>
2811 <pre>b
2812 </pre>
2813 <p>a
2814 </p>
2815 <pre>b
2816 </pre>
2817 !!end
2818
2819 ## Hmm, should Parsoid rt this?
2820 !! test
2821 Pres with newline attributes
2822 !! options
2823 parsoid=wt2html,html2html
2824 !! wikitext
2825 <pre class="one
2826 two">hi</pre>
2827 !! html/php
2828 <pre class="one two">hi</pre>
2829
2830 !! html/parsoid
2831 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2832 !! end
2833
2834 !! test
2835 Things that look like <pre> tags aren't treated as such
2836 !! wikitext
2837 Barack Obama <President> of the United States
2838 <President></President>
2839 !! html
2840 <p>Barack Obama &lt;President&gt; of the United States
2841 &lt;President&gt;&lt;/President&gt;
2842 </p>
2843 !! end
2844
2845 ## Remex doesn't account for fostered content.
2846 ## The difference between Parsoid and the PHP parser can be attributed to core
2847 ## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
2848 ## tokenize unmatched extension tags that shadow html tags as strings to ease
2849 ## an escaping mechanism. See the comment in `maybeExtensionTag`.
2850 !! test
2851 Handle broken pre-like tags (T66025)
2852 !! options
2853 parsoid=wt2html
2854 !! wikitext
2855 {{echo|<pre <pre>x</pre>}}
2856
2857 <table><pre </table>
2858 !! html/php
2859 <pre>x</pre>
2860 <table>&lt;pre </table>
2861
2862 !! html/php+tidy
2863 <pre>x</pre>
2864 &lt;pre <table></table>
2865 !! html/parsoid
2866 <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>
2867
2868 <pre data-parsoid='{"stx":"html","src":"&lt;pre &lt;/table>","tagWidths":[13,0],"a":{"&lt;":null,"table":null},"sa":{"&lt;":"","table":""},"fostered":true,"autoInsertedEnd":true}'></pre><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'></table>
2869 !! end
2870
2871 ## Similar to the above, but shows the difference between extension and html tags
2872 !! test
2873 Less than in attribute position
2874 !! wikitext
2875 <pre <pre>123</pre>
2876
2877 <div <div>123</div>
2878 !! html/php+tidy
2879 <pre>123</pre><p>
2880 &lt;div </p><div>123</div>
2881 !! html/parsoid
2882 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"&lt;pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
2883
2884 &lt;div </p><div>123</div>
2885 !! end
2886
2887 !! test
2888 Parsoid: handle pre with space after attribute
2889 !! options
2890 parsoid=wt2html
2891 !! wikitext
2892 <pre style="width:50%;" >{{echo|foo}}</pre>
2893 !! html/php
2894 <pre style="width:50%;">{{echo|foo}}</pre>
2895
2896 !! html/parsoid
2897 <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>
2898 !! end
2899
2900 !! test
2901 Self-closed pre
2902 !! wikitext
2903 <pre />
2904 !! html/php
2905 <pre></pre>
2906
2907 !! html/parsoid
2908 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
2909 !! end
2910
2911 !! test
2912 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2913 !! options
2914 parsoid=wt2html
2915 !! wikitext
2916 {|
2917 <td>
2918 <td>
2919 </td>
2920
2921
2922
2923 |}
2924 !! html
2925 <table>
2926
2927 <tbody>
2928 <tr>
2929 <td></td>
2930
2931 <td>
2932 </td></tr>
2933
2934
2935
2936 </tbody></table>
2937 !! end
2938
2939
2940 #--------------------------------------------------------------------
2941 # Transclusion parameter whitespace stripping tests
2942 # Behavior is different for positional and named parameters
2943 #--------------------------------------------------------------------
2944 !! test
2945 Templates: Strip leading and trailing whitespace from named-param values
2946 !! wikitext
2947 {{echo|1= a }}
2948
2949 {{echo|1= {{echo|b}} }}
2950
2951 {{echo| 1 =
2952 c }}
2953
2954 {{echo| 1 =
2955 * d
2956 }}
2957 !! html
2958 <p>a
2959 </p><p>b
2960 </p><p>c
2961 </p>
2962 <ul><li>d</li></ul>
2963
2964 !! end
2965
2966 !! test
2967 Templates: Don't strip whitespace from positional-param values
2968 !! wikitext
2969 {{echo|a }}
2970
2971 {{echo|{{echo|b}} }}
2972
2973 {{echo| c
2974 }}
2975
2976 {{echo| {{echo|d}}
2977 }}
2978
2979 {{echo|
2980 e}}
2981
2982 {{echo|
2983 *f}}
2984
2985 {{echo|
2986 }}g
2987 !! html
2988 <p>a
2989 </p><p>b
2990 </p>
2991 <pre>c
2992 </pre>
2993 <p><br />
2994 </p>
2995 <pre>d
2996 </pre>
2997 <p><br />
2998 </p>
2999 <pre>e
3000 </pre>
3001 <p><br />
3002 </p>
3003 <ul><li>f</li></ul>
3004 <p><br />
3005 </p>
3006 <pre>g
3007 </pre>
3008 !! end
3009
3010 !! test
3011 Templates: Don't recognize targets split by newlines
3012 !! options
3013 parsoid=wt2html
3014 !! wikitext
3015 {{ech
3016 o|foo}}
3017 !! html/php
3018 <p>{{ech
3019 o|foo}}
3020 </p>
3021 !! html/parsoid
3022 <p>{{ech
3023 o|foo}}</p>
3024 !! end
3025
3026 !! test
3027 Templates: Recognize targets when newlines and comments don't split the target
3028 !! options
3029 parsoid=wt2html
3030 !! wikitext
3031 {{
3032 <!--X--> ech<!--X-->o<!--X-->
3033 <!--X--> <!--X-->
3034
3035 |foo}}
3036 !! html/php
3037 <p>foo
3038 </p>
3039 !! html/parsoid
3040 <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>
3041 !! end
3042
3043 !! test
3044 Templates: Handle empty comment-and-ws-only lines correctly
3045 !! wikitext
3046 {{echo|foo
3047 <!--should be ignored-->
3048 <!--should be ignored as well-->
3049 bar}}
3050 !! html/php
3051 <p>foo
3052 bar
3053 </p>
3054 !! html/parsoid
3055 <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>
3056 !! end
3057
3058 !! test
3059 Templates: Handle comments in the target
3060 !! wikitext
3061 {{echo
3062 <!-- should be ignored -->
3063 |foo}}
3064
3065 {{echo
3066 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3067 |foo}}
3068
3069 {{echo<!-- should be ignored -->
3070 |foo}}
3071
3072 {{echo<!-- should be ignored -->|foo}}
3073
3074 {{<!-- should be ignored -->echo|foo}}
3075 !! html/php
3076 <p>foo
3077 </p><p>foo
3078 </p><p>foo
3079 </p><p>foo
3080 </p><p>foo
3081 </p>
3082 !! html/parsoid
3083 <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>
3084
3085 <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>
3086
3087 <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>
3088
3089 <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>
3090
3091 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3092 !! end
3093
3094 !! test
3095 Templates: Handle comments in parameter names (T69657)
3096 !! wikitext
3097 {{echo|1
3098 <!-- should be ignored -->
3099 =foo}}
3100
3101 {{echo|
3102 <!-- should be ignored -->
3103 1 = foo}}
3104
3105 {{echo|1<!-- should be ignored -->=foo}}
3106
3107 {{echo|<!-- should be ignored -->1=foo}}
3108 !! html/php
3109 <p>foo
3110 </p><p>foo
3111 </p><p>foo
3112 </p><p>foo
3113 </p>
3114 !! html/parsoid
3115 <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>
3116
3117 <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>
3118
3119 <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>
3120
3121 <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>
3122 !! end
3123
3124 !! test
3125 Templates: Other wikitext in parameter names (T69657)
3126 !! wikitext
3127 {{echo|''1''=foo}}
3128 !! html/php
3129 <p>{{{1}}}
3130 </p>
3131 !! html/parsoid
3132 <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>
3133 !! end
3134
3135 !! test
3136 Templates: With colons
3137 !! wikitext
3138 {{With: Colon}}
3139 !! html/php
3140 <p>Template with colon
3141 </p>
3142 !! html/parsoid
3143 <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>
3144 !! end
3145
3146 #--------------------------------------------------------------------
3147 # Transclusion parameter escaping tests
3148 #--------------------------------------------------------------------
3149
3150 !! test
3151 Templates: Parsoid parameter escaping test 1
3152 !! wikitext
3153 {{echo|[foo]|{{echo|[bar]}}}}
3154 !! html/php+tidy
3155 <p>[foo]
3156 </p>
3157 !! html/parsoid
3158 <p about="#mwt1" typeof="mw:Transclusion"
3159 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3160 !! end
3161
3162 !! test
3163 Parsoid: Pipes in external links in template parameter
3164 !! wikitext
3165 {{echo|[{{echo|http://example.com}} link]}}
3166 !! html/php+tidy
3167 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3168 </p>
3169 !! html/parsoid
3170 <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>
3171 !! end
3172
3173 !! test
3174 Parsoid: pipe in transclusion parameter
3175 !! wikitext
3176 {{echo|http://foo.com/a&#124;b}}
3177 !! html/php+tidy
3178 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3179 </p>
3180 !! html/parsoid
3181 <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>
3182 !! end
3183
3184 !! test
3185 Parsoid: Pipe in external link target and content in template parameter
3186 !! options
3187 parsoid=html2wt,wt2wt
3188 !! wikitext
3189 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3190 !! html/php+tidy
3191 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3192 </p>
3193 !! html/parsoid
3194 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3195 typeof="mw:Transclusion"
3196 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3197 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3198 !! end
3199
3200 !! test
3201 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3202 !! options
3203 parsoid
3204 !! wikitext
3205 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3206 !! html
3207 <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>
3208 !! end
3209
3210 !! test
3211 Templates: Don't escape already nowiki-escaped text in template parameters
3212 !! options
3213 parsoid=html2wt,wt2wt
3214 !! wikitext
3215 {{echo|foo<nowiki>|</nowiki>bar}}
3216 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3217 {{echo|<nowiki></nowiki>}}
3218 !! html/php+tidy
3219 <p>foo|bar
3220 &lt;div&gt;
3221
3222 </p>
3223 !! html/parsoid
3224 <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>
3225 <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>
3226 <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>
3227 </p>
3228 !! end
3229
3230 ## T54824
3231 !! test
3232 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3233 !! options
3234 parsoid=html2wt,wt2wt
3235 !! wikitext
3236 {{echo|{{echo|1=bar}}}}
3237 !! html/php+tidy
3238 <p>bar
3239 </p>
3240 !! html/parsoid
3241 <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>
3242 !! end
3243
3244 ## T58733
3245 !! test
3246 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3247 !! wikitext
3248 {{echo|a : b}}
3249 !! html/php+tidy
3250 <p>a&#160;: b
3251 </p>
3252 !! html/parsoid
3253 <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>
3254 !! end
3255
3256 ## T73412
3257 !! test
3258 Templates: Preserve blank parameter names
3259 !! wikitext
3260 {{echo|=foo}}
3261 !! html/php+tidy
3262 <p>{{{1}}}
3263 </p>
3264 !! html/parsoid
3265 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3266 !! end
3267
3268 !! test
3269 Templates: Preserve blank parameter names in other positions
3270 !! wikitext
3271 {{blank_param|bar|=foo}}
3272 !! html/php+tidy
3273 <p>bar
3274 foo
3275 </p>
3276 !! html/parsoid
3277 <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
3278 foo</p>
3279 !! end
3280
3281 ###
3282 ### Parsoid-centric tests for testing RT edge cases for pre
3283 ###
3284
3285 !!test
3286 1a. Indent-Pre and Comments
3287 !! wikitext
3288 a
3289 <!--a-->
3290 c
3291 !! html
3292 <pre>a
3293 </pre>
3294 <p>c
3295 </p>
3296 !!end
3297
3298 !!test
3299 1b. Indent-Pre and Comments
3300 !! wikitext
3301 a
3302 <!--a-->
3303 c
3304 !! html
3305 <pre>a
3306 </pre>
3307 <p>c
3308 </p>
3309 !!end
3310
3311 !!test
3312 1c. Indent-Pre and Comments
3313 !! wikitext
3314 <!--a--> a
3315
3316 <!--a--> a
3317 !! html
3318 <pre> a
3319 </pre>
3320 <pre> a
3321 </pre>
3322 !!end
3323
3324 !!test
3325 1d. Indent-Pre and Comments
3326 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3327 !! wikitext
3328 <!--a--> a
3329
3330 <!--b-->b
3331 !! html
3332 <pre>a
3333 </pre>
3334 <pre>b
3335 </pre>
3336 !!end
3337
3338 !!test
3339 2a. Indent-Pre and tables
3340 !! wikitext
3341 {|
3342 |-
3343 !h1!!h2
3344 |foo||bar
3345 |}
3346 !! html
3347 <table>
3348
3349 <tr>
3350 <th>h1</th>
3351 <th>h2
3352 </th>
3353 <td>foo</td>
3354 <td>bar
3355 </td></tr></table>
3356
3357 !!end
3358
3359 !!test
3360 2b. Indent-Pre and tables
3361 !! wikitext
3362 {|
3363 |-
3364 |foo
3365 |}
3366 !! html
3367 <table>
3368
3369 <tr>
3370 <td>foo
3371 </td></tr></table>
3372
3373 !!end
3374
3375 !!test
3376 2c. Indent-Pre and tables (T44252)
3377 !! wikitext
3378 {|
3379 |+foo
3380 ! |bar
3381 |}
3382 !! html
3383 <table>
3384 <caption>foo
3385 </caption>
3386 <tr>
3387 <th>bar
3388 </th></tr></table>
3389
3390 !!end
3391
3392 !!test
3393 2d. Indent-Pre and tables
3394 !! wikitext
3395 a
3396 {|
3397 |b
3398 |}
3399 !! html/php
3400 <pre>a
3401 </pre>
3402 <table>
3403 <tr>
3404 <td>b
3405 </td></tr></table>
3406
3407 !! html/parsoid
3408 <pre>a</pre>
3409 <table>
3410 <tbody><tr><td> b</td></tr>
3411 </tbody></table>
3412 !!end
3413
3414 !!test
3415 2e. Indent-Pre and table-line syntax
3416 !! wikitext
3417 a
3418 | b
3419 | c
3420 !! html/php
3421 <pre>a
3422 | b
3423 | c
3424 </pre>
3425 !!end
3426
3427 !!test
3428 2f. Indent-pre started by table-line syntax
3429 !! wikitext
3430 a
3431 | b
3432 | c
3433 !! html/php
3434 <p>a
3435 </p>
3436 <pre>| b
3437 | c
3438 </pre>
3439 !! html/parsoid
3440 <p>a</p>
3441 <pre>
3442 | b
3443 | c</pre>
3444 !!end
3445
3446 !! test
3447 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3448 !! wikitext
3449 <table>
3450 <tr>
3451 <td>
3452 Text that should be rendered preformatted
3453 </td>
3454 </tr>
3455 </table>
3456 !! html
3457 <table>
3458 <tr>
3459 <td>
3460 <pre>Text that should be rendered preformatted
3461 </pre>
3462 </td>
3463 </tr>
3464 </table>
3465
3466 !! end
3467
3468 !! test
3469 2h. Indent pre in tables
3470 !! options
3471 parsoid=wt2html,html2html
3472 !! wikitext
3473 {|
3474 !
3475 foo
3476 !
3477 bar
3478 |-
3479 |
3480 baz
3481 {{!}}
3482 bam
3483 |}
3484 !! html/php
3485 <table>
3486 <tr>
3487 <th>
3488 <pre>foo
3489 </pre>
3490 </th>
3491 <th>
3492 <pre>bar
3493 </pre>
3494 </th></tr>
3495 <tr>
3496 <td>
3497 <pre>baz
3498 </pre>
3499 </td>
3500 <td>
3501 <pre>bam
3502 </pre>
3503 </td></tr></table>
3504
3505 !! html/parsoid
3506 <table>
3507 <tbody><tr><th>
3508 <pre>foo</pre>
3509 </th><th>
3510 <pre>bar</pre>
3511 </th></tr><tr>
3512 <td>
3513 <pre>baz</pre>
3514 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3515 <pre>bam</pre>
3516 </td></tr></tbody></table>
3517 !! end
3518
3519 !! test
3520 3a. Indent-Pre and block tags (single-line html)
3521 !! wikitext
3522 a <p> foo </p>
3523 b <div> foo </div>
3524 c <blockquote> foo </blockquote>
3525 <span> foo </span>
3526 !! html
3527 a <p> foo </p>
3528 b <div> foo </div>
3529 c <blockquote> foo </blockquote>
3530 <pre><span> foo </span>
3531 </pre>
3532 !! html/php+tidy
3533 <p> a </p><p> foo </p><p>
3534 b </p><div> foo </div><p>
3535 c </p><blockquote><p> foo </p></blockquote>
3536 <pre><span> foo </span>
3537 </pre>
3538 !! html/parsoid
3539 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3540 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3541 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3542 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3543 !! end
3544
3545 !! test
3546 3b. Indent-Pre and block tags (multi-line html)
3547 !! wikitext
3548 a <span>foo</span>
3549 <!-- comment --> b <div> foo </div>
3550 !! html/php
3551 <pre>a <span>foo</span>
3552 </pre>
3553 b <div> foo </div>
3554
3555 !! html/parsoid
3556 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3557 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3558 !! html/php+tidy
3559 <pre>a <span>foo</span>
3560 </pre><p>
3561 b </p><div> foo </div>
3562 !! end
3563
3564 !!test
3565 3c. Indent-Pre and block tags (pre-content on separate line)
3566 !! wikitext
3567 <p>
3568 foo
3569 </p>
3570
3571 <div>
3572 foo
3573 </div>
3574
3575 <center>
3576 foo
3577 </center>
3578
3579 <blockquote>
3580 foo
3581 </blockquote>
3582
3583 <blockquote>
3584 <pre>
3585 foo
3586 </pre>
3587 </blockquote>
3588
3589 <table><tr><td>
3590 foo
3591 </td></tr></table>
3592
3593 <ul><li>
3594 foo
3595 </li></ul>
3596
3597 !! html
3598 <p>
3599 foo
3600 </p>
3601 <div>
3602 <pre>foo
3603 </pre>
3604 </div>
3605 <center>
3606 <pre>foo
3607 </pre>
3608 </center>
3609 <blockquote>
3610 <p> foo
3611 </p>
3612 </blockquote>
3613 <blockquote>
3614 <pre>
3615 foo
3616 </pre>
3617 </blockquote>
3618 <table><tr><td>
3619 <pre>foo
3620 </pre>
3621 </td></tr></table>
3622 <ul><li>
3623 foo
3624 </li></ul>
3625
3626 !!end
3627
3628 !! test
3629 4. Indent-Pre and extension tags
3630 !! options
3631 parsoid=wt2html,html2html
3632 !! wikitext
3633 a <tag />
3634 !! html/php+tidy
3635 <p> a </p><pre>NULL
3636 array (
3637 )
3638 </pre>
3639 !! html/parsoid
3640 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3641 !! end
3642
3643 !! test
3644 5. Indent-Pre and html pre
3645 !! wikitext
3646 <pre class="123">hi</pre>
3647 !! html/php
3648 <pre class="123">hi</pre>
3649
3650 !! html/parsoid
3651 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3652 !! end
3653
3654 !!test
3655 Render paragraphs when indent-pre is suppressed in blocklevels
3656 !! wikitext
3657 <blockquote>
3658 foo
3659
3660 bar
3661 </blockquote>
3662 !! html
3663 <blockquote>
3664 <p> foo
3665 </p><p> bar
3666 </p>
3667 </blockquote>
3668
3669 !!end
3670
3671 !!test
3672 4. Multiple spaces at start-of-line
3673 !! wikitext
3674 <p> foo </p>
3675 foo
3676 {|
3677 |foo
3678 |}
3679 !! html
3680 <p> foo </p>
3681 <pre> foo
3682 </pre>
3683 <table>
3684 <tr>
3685 <td>foo
3686 </td></tr></table>
3687
3688 !!end
3689
3690 ## NOTE: the leading white-space chars on empty line are significant
3691 !! test
3692 5a. White-space in indent-pre
3693 !! wikitext
3694 a<br />
3695
3696 b
3697 !! html
3698 <pre>a<br />
3699
3700 b
3701 </pre>
3702 !! end
3703
3704 ## NOTE: the leading white-space chars on empty line are significant
3705 !! test
3706 5b. White-space in indent-pre
3707 !! wikitext
3708 a
3709
3710 b
3711
3712
3713 c
3714 !! html
3715 <pre>a
3716
3717 b
3718
3719
3720 c
3721 </pre>
3722 !! end
3723
3724 !! test
3725 5c. White-space in indent-pre
3726 !! wikitext
3727 ''a''
3728 ''b''
3729 ''c''
3730 !! html
3731 <pre><i>a</i>
3732 <i>b</i>
3733 <i>c</i>
3734 </pre>
3735 !! end
3736
3737 !! test
3738 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3739 !! wikitext
3740 a
3741
3742 <!-- continue -->
3743 b
3744
3745 c
3746
3747 d
3748 !! html
3749 <pre>a
3750
3751 b
3752 </pre>
3753 <pre>c
3754
3755 </pre>
3756 <p>d
3757 </p>
3758 !! end
3759
3760 !! test
3761 7a. Indent-pre and category links
3762 !! options
3763 parsoid=wt2html,wt2wt
3764 !! wikitext
3765 [[Category:foo]] <!-- No pre-wrapping -->
3766 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3767 !! html/php+tidy
3768 !! html/parsoid
3769 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3770 <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 -->
3771 !! end
3772
3773 ## We used to, but no longer wt2wt this test since the default serializer
3774 ## will normalize all categories to serialize on their own line.
3775 ## This wikitext usage is going to be fairly uncommon in production and
3776 ## selser will take care of preserving formatting in those scenarios.
3777 !! test
3778 7b. Indent-pre and category links
3779 !! options
3780 parsoid=wt2html
3781 !! wikitext
3782 [[Category:foo]] a
3783 [[Category:foo]] {{echo|b}}
3784 !! html/parsoid
3785 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3786 <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>
3787 !! end
3788
3789 !! test
3790 Indent-Pre: Newlines in comments shouldn't affect sol state
3791 !! wikitext
3792 a <!--
3793 foo
3794 --> b
3795 !! html/php+tidy
3796 <p>a b
3797 </p>
3798 !! html/parsoid
3799 <p>a <!--
3800 foo
3801 --> b</p>
3802 !! end
3803
3804 ###
3805 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3806 ###
3807
3808 !!test
3809 HTML-pre: 1. embedded newlines
3810 !! wikitext
3811 <pre>foo</pre>
3812
3813 <pre>
3814 foo
3815 </pre>
3816
3817 <pre>
3818
3819 foo
3820 </pre>
3821
3822 <pre>
3823
3824
3825 foo
3826 </pre>
3827 !! html/php+tidy
3828 <pre>foo</pre>
3829 <pre>foo
3830 </pre>
3831 <pre>
3832
3833 foo
3834 </pre>
3835 <pre>
3836
3837
3838 foo
3839 </pre>
3840 !! html/parsoid
3841 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3842
3843 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3844 </pre>
3845
3846 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3847
3848 foo
3849 </pre>
3850
3851 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3852
3853
3854 foo
3855 </pre>
3856 !!end
3857
3858 !! test
3859 HTML-pre: big spaces
3860 !! wikitext
3861 <pre>
3862
3863
3864
3865
3866 haha
3867
3868
3869
3870
3871 haha
3872
3873
3874
3875
3876 </pre>
3877 !! html/php+tidy
3878 <pre>
3879
3880
3881
3882
3883 haha
3884
3885
3886
3887
3888 haha
3889
3890
3891
3892
3893 </pre>
3894 !! html/parsoid
3895 <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"}}'>
3896
3897
3898
3899
3900 haha
3901
3902
3903
3904
3905 haha
3906
3907
3908
3909
3910 </pre>
3911 !! end
3912
3913 !!test
3914 HTML-pre: 2: indented text
3915 !! wikitext
3916 <pre>
3917 foo
3918 </pre>
3919 !! html
3920 <pre>
3921 foo
3922 </pre>
3923
3924 !!end
3925
3926 !!test
3927 HTML-pre: 3: other wikitext
3928 !! wikitext
3929 <pre>
3930 * foo
3931 # bar
3932 = no-h =
3933 '' no-italic ''
3934 [[ NoLink ]]
3935 </pre>
3936 !! html/php
3937 <pre>
3938 * foo
3939 # bar
3940 = no-h =
3941 '' no-italic ''
3942 [[ NoLink ]]
3943 </pre>
3944
3945 !! html/parsoid
3946 <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
3947 # bar
3948 = no-h =
3949 '' no-italic ''
3950 [[ NoLink ]]
3951 </pre>
3952 !!end
3953
3954 ###
3955 ### Definition lists
3956 ###
3957 !! test
3958 Simple definition
3959 !! wikitext
3960 ;name :Definition
3961 !! html
3962 <dl><dt>name</dt>
3963 <dd>Definition</dd></dl>
3964
3965 !! end
3966
3967 !! test
3968 Definition list for indentation only
3969 !! wikitext
3970 :Indented text
3971 !! html
3972 <dl><dd>Indented text</dd></dl>
3973
3974 !! end
3975
3976 !! test
3977 Definition list with no space
3978 !! wikitext
3979 ;name:Definition
3980 !! html
3981 <dl><dt>name</dt>
3982 <dd>Definition</dd></dl>
3983
3984 !!end
3985
3986 !! test
3987 Definition list with URL link
3988 !! wikitext
3989 ;http://example.com/ :definition
3990 !! html
3991 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
3992 <dd>definition</dd></dl>
3993
3994 !! end
3995
3996 !! test
3997 Definition list with bracketed URL link
3998 !! wikitext
3999 ;[http://www.example.com/ Example]:Something about it
4000 !! html
4001 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4002 <dd>Something about it</dd></dl>
4003
4004 !! end
4005
4006 !! test
4007 Definition list with wikilink containing colon
4008 !! wikitext
4009 ;[[Help:FAQ]]:The least-read page on Wikipedia
4010 !! html
4011 <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>
4012 <dd>The least-read page on Wikipedia</dd></dl>
4013
4014 !! end
4015
4016 # At Brion's and JeLuF's insistence... :)
4017 !! test
4018 Definition list with news link containing colon
4019 !! wikitext
4020 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4021 !! html/php
4022 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4023 <dd>This isn't even a real newsgroup!</dd></dl>
4024
4025 !! html/parsoid
4026 <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>
4027 !! end
4028
4029 !! test
4030 Malformed definition list with colon
4031 !! wikitext
4032 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4033 !! html
4034 <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>
4035
4036 !! end
4037
4038 !! test
4039 Definition lists: colon in external link text
4040 !! wikitext
4041 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4042 !! html
4043 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4044 <dd>OK, I made that up</dd></dl>
4045
4046 !! end
4047
4048 !! test
4049 Definition lists: colon in HTML attribute
4050 !! wikitext
4051 ;<b style="display: inline">bold</b>
4052 !! html
4053 <dl><dt><b style="display: inline">bold</b></dt></dl>
4054
4055 !! end
4056
4057 !! test
4058 Definition lists: self-closed tag
4059 !! wikitext
4060 ;one<br/>two :two-line fun
4061 !! html
4062 <dl><dt>one<br />two</dt>
4063 <dd>two-line fun</dd></dl>
4064
4065 !! end
4066
4067 !! test
4068 Definition lists: ignore colons inside tags
4069 !! wikitext
4070 ;one <b>two : tag <i>fun:</i>:</b>:def
4071 !! html
4072 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4073 <dd>def</dd></dl>
4074
4075 !! end
4076
4077 !! test
4078 Definition lists: excess closed tags
4079 !! wikitext
4080 ;one</b>two :bad tag fun
4081 !! html/php+tidy
4082 <dl><dt>onetwo</dt>
4083 <dd>bad tag fun</dd></dl>
4084 !! html/parsoid
4085 <dl>
4086 <dt>onetwo</dt>
4087 <dd>bad tag fun</dd>
4088 </dl>
4089 !! end
4090
4091 !! test
4092 T13748: Literal closing tags
4093 !! wikitext
4094 <dl>
4095 <dt>test 1</dt>
4096 <dd>test test test test test</dd>
4097 <dt>test 2</dt>
4098 <dd>test test test test test</dd>
4099 </dl>
4100 !! html
4101 <dl>
4102 <dt>test 1</dt>
4103 <dd>test test test test test</dd>
4104 <dt>test 2</dt>
4105 <dd>test test test test test</dd>
4106 </dl>
4107
4108 !! end
4109
4110 !! test
4111 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4112 !! wikitext
4113 <ul><li>
4114 ;term :description
4115 *unordered
4116 </li></ul>
4117 !! html
4118 <ul><li>
4119 <dl><dt>term</dt>
4120 <dd>description</dd></dl>
4121 <ul><li>unordered</li></ul>
4122 </li></ul>
4123
4124 !! end
4125
4126 !! test
4127 Definition list with empty definition and following paragraph
4128 !! wikitext
4129 ;term:
4130
4131 Paragraph text
4132 !! html
4133 <dl><dt>term</dt>
4134 <dd></dd></dl>
4135 <p>Paragraph text
4136 </p>
4137 !! end
4138
4139 !! test
4140 Nested definition lists using html syntax
4141 !! wikitext
4142 <dl><dt>x</dt>
4143 <dd>a</dd>
4144 <dd>b</dd></dl>
4145 !! html
4146 <dl><dt>x</dt>
4147 <dd>a</dd>
4148 <dd>b</dd></dl>
4149
4150 !! end
4151
4152 !! test
4153 Definition Lists: No nesting: Multiple dd's
4154 !! wikitext
4155 ;x
4156 :a
4157 :b
4158 !! html
4159 <dl><dt>x</dt>
4160 <dd>a</dd>
4161 <dd>b</dd></dl>
4162
4163 !! end
4164
4165 !! test
4166 Definition Lists: Indentation: Regular
4167 !! wikitext
4168 :i1
4169 ::i2
4170 :::i3
4171 !! html
4172 <dl><dd>i1
4173 <dl><dd>i2
4174 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4175
4176 !! end
4177
4178 !! test
4179 Definition Lists: Indentation: Missing 1st level
4180 !! wikitext
4181 ::i2
4182 :::i3
4183 !! html
4184 <dl><dd><dl><dd>i2
4185 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4186
4187 !! end
4188
4189 !! test
4190 Definition Lists: Indentation: Multi-level indent
4191 !! wikitext
4192 :::i3
4193 !! html
4194 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4195
4196 !! end
4197
4198 !! test
4199 Definition Lists: Hacky use to indent tables
4200 !! wikitext
4201 ::{|
4202 |foo
4203 |bar
4204 |}
4205 this text
4206 should be left alone
4207 !! html
4208 <dl><dd><dl><dd><table>
4209 <tr>
4210 <td>foo
4211 </td>
4212 <td>bar
4213 </td></tr></table></dd></dl></dd></dl>
4214 <p>this text
4215 should be left alone
4216 </p>
4217 !! end
4218
4219 !! test
4220 Definition Lists: Hacky use to indent tables (with content following table)
4221 !! wikitext
4222 :{|
4223 |foo
4224 |bar
4225 |} <!--c1--> this text should be part of the dl
4226 !! html/php+tidy
4227 <dl><dd><table>
4228 <tbody><tr>
4229 <td>foo
4230 </td>
4231 <td>bar
4232 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4233 !! html/parsoid
4234 <dl><dd><table>
4235 <tbody><tr>
4236 <td>foo
4237 </td>
4238 <td>bar
4239 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4240 !! end
4241
4242 !! test
4243 Definition Lists: Hacky use to indent tables, with comments (T65979)
4244 !! wikitext
4245 <!-- foo -->
4246 ::{|
4247 |foo
4248 |bar
4249 |}<!-- bar -->
4250 this text
4251 should be left alone
4252 !! html/parsoid
4253 <!-- foo -->
4254 <dl><dd><dl><dd><table><tr>
4255 <td>foo</td>
4256 <td>bar</td>
4257 </tr></table><!-- bar --></dd></dl></dd></dl>
4258 <p>this text
4259 should be left alone</p>
4260 !! end
4261
4262 !! test
4263 Definition Lists: Hacky use to indent tables, with comment before table
4264 !!options
4265 parsoid=wt2html
4266 !! wikitext
4267 ::<!-- foo -->{|
4268 |foo
4269 |}
4270 !! html/parsoid
4271 <dl><dd><dl><dd><!-- foo --><table><tr>
4272 <td>foo</td>
4273 </tr></table></dd></dl></dd></dl>
4274 !! end
4275
4276 # The trailing whitespace in this test is to catch a regression in
4277 # Parsoid after T54473.
4278 !! test
4279 Definition Lists: Hacky use to indent tables (WS-insensitive)
4280 !! wikitext
4281 :{|
4282 |a
4283 |}
4284 !! html/php
4285 <dl><dd><table>
4286 <tr>
4287 <td>a
4288 </td></tr></table></dd></dl>
4289
4290 !! html/parsoid
4291 <dl><dd><table>
4292 <tbody><tr><td>a</td></tr>
4293 </tbody></table></dd></dl>
4294 !! end
4295
4296 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4297 ## as an empty dt item. It also ignores all but the last ";" when followed
4298 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4299 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4300 ## ";"s.
4301 ##
4302 ## Ex: ";;t2 ::d2" is transformed into:
4303 ##
4304 ## <dl>
4305 ## <dt>t2 </dt>
4306 ## <dd>
4307 ## <dl>
4308 ## <dt></dt>
4309 ## <dd>d2</dd>
4310 ## </dl>
4311 ## </dd>
4312 ## </dl>
4313 ##
4314 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4315 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4316 ##
4317 ## <dl>
4318 ## <dt>
4319 ## <dl>
4320 ## <dt>t2 </dt>
4321 ## <dd>:d2</dd>
4322 ## </dl>
4323 ## </dt>
4324 ## </dl>
4325 ##
4326 ## All Parsoid only definition list tests have this difference.
4327 ##
4328 ## See also: https://phabricator.wikimedia.org/T8569
4329 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4330
4331 !! test
4332 Table / list interaction: indented table with lists in table contents
4333 !! wikitext
4334 :{|
4335 |-
4336 |a
4337
4338 *b
4339 |-
4340 |c
4341
4342 *d
4343 |}
4344 !! html
4345 <dl><dd><table>
4346
4347 <tr>
4348 <td>a
4349 <ul><li>b</li></ul>
4350 </td></tr>
4351 <tr>
4352 <td>c
4353 <ul><li>d</li></ul>
4354 </td></tr></table></dd></dl>
4355
4356 !! end
4357
4358 !!test
4359 Table / list interaction: lists nested in tables nested in indented lists
4360 !! wikitext
4361 :{|
4362 |
4363 :a
4364 :b
4365 |
4366 *c
4367 *d
4368 |}
4369
4370 *e
4371 *f
4372 !! html
4373 <dl><dd><table>
4374 <tr>
4375 <td>
4376 <dl><dd>a</dd>
4377 <dd>b</dd></dl>
4378 </td>
4379 <td>
4380 <ul><li>c</li>
4381 <li>d</li></ul>
4382 </td></tr></table></dd></dl>
4383 <ul><li>e</li>
4384 <li>f</li></ul>
4385
4386 !!end
4387
4388 !! test
4389 Definition Lists: Nesting: Multi-level (Parsoid only)
4390 !! wikitext
4391 ;t1 :d1
4392 ;;t2 ::d2
4393 ;;;t3 :::d3
4394 !! html/parsoid
4395 <dl>
4396 <dt>t1 </dt>
4397 <dd>d1</dd>
4398 <dt>
4399 <dl>
4400 <dt>t2 </dt>
4401 <dd>:d2</dd>
4402 <dt>
4403 <dl>
4404 <dt>t3 </dt>
4405 <dd>::d3</dd>
4406 </dl>
4407 </dt>
4408 </dl>
4409 </dt>
4410 </dl>
4411
4412
4413 !! end
4414
4415
4416 !! test
4417 Definition Lists: Nesting: Test 2
4418 !! wikitext
4419 ;t1
4420 ::d2
4421 !! html+tidy
4422 <dl><dt>t1</dt>
4423 <dd>
4424 <dl><dd>d2</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 !! test
4429 Definition Lists: Nesting: Test 3
4430 !! wikitext
4431 :;t1
4432 ::::d2
4433 !! html+tidy
4434 <dl><dd><dl><dt>t1</dt>
4435 <dd>
4436 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4437 !! end
4438
4439
4440 !! test
4441 Definition Lists: Nesting: Test 4
4442 !! wikitext
4443 ::;t3
4444 :::d3
4445 !! html
4446 <dl><dd><dl><dd><dl><dt>t3</dt>
4447 <dd>d3</dd></dl></dd></dl></dd></dl>
4448
4449 !! end
4450
4451
4452 ## The Parsoid team believes the following three test exposes a
4453 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4454 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4455 ## It also exposes a "misfeature" in tidy, which doesn't like
4456 ## <dl> tags with a single <dt> child; it converts the <dt> into
4457 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4458 !! test
4459 Definition Lists: Mixed Lists: Test 1
4460 !! wikitext
4461 :;*foo
4462 ::*bar
4463 :;baz
4464 !! html/php
4465 <dl><dd><dl><dt><ul><li>foo</li>
4466 <li>bar</li></ul></dt></dl>
4467 <dl><dt>baz</dt></dl></dd></dl>
4468
4469 !! html/php+tidy
4470 <dl><dd><dl><dt><ul><li>foo</li>
4471 <li>bar</li></ul></dt></dl>
4472 <dl><dt>baz</dt></dl></dd></dl>
4473 !! html/parsoid
4474 <dl>
4475 <dd><dl>
4476 <dt><ul>
4477 <li>foo
4478 </li>
4479 </ul></dt>
4480 <dd><ul>
4481 <li>bar
4482 </li>
4483 </ul></dd>
4484 <dt>baz</dt>
4485 </dl></dd>
4486 </dl>
4487 !! end
4488
4489 !! test
4490 Definition Lists: Mixed Lists: Test 2
4491 !! wikitext
4492 *:d1
4493 *:d2
4494 !! html
4495 <ul><li><dl><dd>d1</dd>
4496 <dd>d2</dd></dl></li></ul>
4497
4498 !! end
4499
4500
4501 !! test
4502 Definition Lists: Mixed Lists: Test 3
4503 !! wikitext
4504 *:::d1
4505 *:::d2
4506 !! html
4507 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4508 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4509
4510 !! end
4511
4512
4513 !! test
4514 Definition Lists: Mixed Lists: Test 4
4515 !! wikitext
4516 *;d1 :d2
4517 *;d3 :d4
4518 !! html
4519 <ul><li><dl><dt>d1</dt>
4520 <dd>d2</dd>
4521 <dt>d3</dt>
4522 <dd>d4</dd></dl></li></ul>
4523
4524 !! end
4525
4526
4527 !! test
4528 Definition Lists: Mixed Lists: Test 5
4529 !! wikitext
4530 *:d1
4531 *::d2
4532 !! html
4533 <ul><li><dl><dd>d1
4534 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4535
4536 !! end
4537
4538
4539 !! test
4540 Definition Lists: Mixed Lists: Test 6
4541 !! wikitext
4542 #*:d1
4543 #*:::d3
4544 !! html
4545 <ol><li><ul><li><dl><dd>d1
4546 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4547
4548 !! end
4549
4550
4551 !! test
4552 Definition Lists: Mixed Lists: Test 7
4553 !! wikitext
4554 :*d1
4555 :*d2
4556 !! html
4557 <dl><dd><ul><li>d1</li>
4558 <li>d2</li></ul></dd></dl>
4559
4560 !! end
4561
4562
4563 !! test
4564 Definition Lists: Mixed Lists: Test 8
4565 !! wikitext
4566 :*d1
4567 ::*d2
4568 !! html
4569 <dl><dd><ul><li>d1</li></ul>
4570 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4571
4572 !! end
4573
4574
4575 !! test
4576 Definition Lists: Mixed Lists: Test 9
4577 !! wikitext
4578 *;foo :bar
4579 !! html
4580 <ul><li><dl><dt>foo</dt>
4581 <dd>bar</dd></dl></li></ul>
4582
4583 !! end
4584
4585
4586 !! test
4587 Definition Lists: Mixed Lists: Test 10
4588 !! wikitext
4589 *#;foo :bar
4590 !! html
4591 <ul><li><ol><li><dl><dt>foo</dt>
4592 <dd>bar</dd></dl></li></ol></li></ul>
4593
4594 !! end
4595
4596 # The Parsoid team disagrees with the PHP parser's seemingly-random
4597 # rules regarding dd/dt on the next few tests. Parsoid is more
4598 # consistent, and recognizes the shared nesting and keeps the
4599 # still-open tags around until the nesting is complete.
4600
4601 # This is a regression test for T175099
4602 !! test
4603 Definition Lists: Mixed Lists: Test 11
4604 !! wikitext
4605 ;a
4606 :*b
4607 !! html/php
4608 <dl><dt>a</dt>
4609 <dd>
4610 <ul><li>b</li></ul></dd></dl>
4611
4612 !! html/parsoid
4613 <dl><dt>a
4614 <dd><ul><li>b</li></ul></dd></dl>
4615 !! end
4616
4617 # FIXME: Maybe get rid of this test?
4618 !! test
4619 Definition Lists: Mixed Lists: Test 12
4620 !! wikitext
4621 *#*#;*;;foo :bar
4622 *#*#;boo :baz
4623 !! html/php
4624 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4625 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4626 <dl><dt>boo</dt>
4627 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4628
4629 !! html/php+tidy
4630 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4631 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4632 <dl><dt>boo</dt>
4633 <dd>baz</dd></dl></li></ol></li></ul>
4634 !! html/parsoid
4635 <ul>
4636 <li>
4637 <ol>
4638 <li>
4639 <ul>
4640 <li>
4641 <ol>
4642 <li>
4643 <dl>
4644 <dt>
4645 <ul>
4646 <li>
4647 <dl>
4648 <dt>
4649 <dl>
4650 <dt>foo</dt>
4651 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4652 </dl></dt>
4653 </dl></li>
4654 </ul></dt>
4655 <dt>boo</dt>
4656 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4657 </dl></li>
4658 </ol></li>
4659 </ul></li>
4660 </ol></li>
4661 </ul>
4662 !! end
4663
4664 !! test
4665 Definition Lists: Mixed Lists: Test 13
4666 !! wikitext
4667 *#*#;*;;foo : bar
4668 *#*#;boo : baz
4669 !! html+tidy
4670 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4671 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4672 <dl><dt>boo&#160;</dt>
4673 <dd>baz</dd></dl></li></ol></li></ul>
4674 !! end
4675
4676 # FIXME: Maybe get rid of this test?
4677 # From whitelist:
4678 # * The test is wrong, there are two colons where there should be :;
4679 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4680 !! test
4681 Definition Lists: Weird Ones: Test 1
4682 !! wikitext
4683 *#;*::;;foo :bar (who uses this?)
4684 !! html/php+tidy
4685 <ul><li><ol><li><dl><dt>foo</dt>
4686 <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>
4687 !! html/parsoid
4688 <ul>
4689 <li>
4690 <ol>
4691 <li>
4692 <dl>
4693 <dt>
4694 <ul>
4695 <li>
4696 <dl>
4697 <dd>
4698 <dl>
4699 <dd>
4700 <dl>
4701 <dt>
4702 <dl>
4703 <dt>foo</dt>
4704 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4705 </dl></dt>
4706 </dl></dd>
4707 </dl></dd>
4708 </dl></li>
4709 </ul></dt>
4710 </dl></li>
4711 </ol></li>
4712 </ul>
4713 !! end
4714
4715 !! test
4716 Definition Lists: colons occurring in tags
4717 !! wikitext
4718 ;a:b
4719 ;'''a:b'''
4720 ;<i>a:b</i>
4721 ;<span>a:b</span>
4722 ;<div>a:b</div>
4723 ;<div>a
4724 :b</div>
4725 ;{{echo|a:b}}
4726 ;{{echo|''a:b''}}
4727 ;;;''a:b''
4728 !! html+tidy
4729 <dl><dt>a</dt>
4730 <dd>b</dd>
4731 <dt><b>a:b</b></dt>
4732 <dt><i>a:b</i></dt>
4733 <dt><span>a:b</span></dt>
4734 <dt><div>a:b</div></dt>
4735 <dt><div>a</div></dt>
4736 <dd>b</dd>
4737 <dt>a</dt>
4738 <dd>b</dd>
4739 <dt><i>a:b</i></dt></dl>
4740 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4741 !! html/parsoid
4742 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4743 <dt><b>a:b</b></dt>
4744 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4745 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4746 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4747 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4748 <dd>b</dd>
4749 <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>
4750 <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>
4751 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4752 !! end
4753
4754 # Parsoid's output differs here again because it shares
4755 # nesting between the two lists unlike the PHP parser.
4756 # Unsure which is more desirable.
4757 !! test
4758 Definition Lists: colons and tables 1
4759 !! wikitext
4760 :{|
4761 |x
4762 |}
4763 :{|
4764 |y
4765 |}
4766 !! html/php
4767 <dl><dd><table>
4768 <tr>
4769 <td>x
4770 </td></tr></table></dd></dl>
4771 <dl><dd><table>
4772 <tr>
4773 <td>y
4774 </td></tr></table></dd></dl>
4775
4776 !! html/parsoid
4777 <dl><dd><table>
4778 <tr>
4779 <td>x
4780 </td></tr></table></dd>
4781 <dd><table>
4782 <tr>
4783 <td>y
4784 </td></tr></table></dd></dl>
4785 !! end
4786
4787 # FIXME: Does this need a html/php section?
4788 !! test
4789 Definition Lists: template interaction
4790 !! wikitext
4791 ::{{definition_list}}
4792
4793 :one
4794 ::{{definition_list}}
4795 :::two
4796 :::three
4797 ::four
4798 !! html/parsoid
4799 <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">
4800 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4801
4802 <dl><dd data-parsoid='{}'>one
4803 <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">
4804 </span><dd about="#mwt2">two
4805 <dl><dd>two</dd>
4806 <dd>three</dd></dl></dd>
4807 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4808 !! end
4809
4810
4811 ###
4812 ### External links
4813 ###
4814 !! test
4815 External links: non-bracketed
4816 !! wikitext
4817 Non-bracketed: http://example.com
4818 !! html
4819 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4820 </p>
4821 !! end
4822
4823 # parsoid doesn't explicitly mark autonumbered links, see T55505
4824 !! test
4825 External links: numbered
4826 !! wikitext
4827 Numbered: [http://example.com]
4828 Numbered: [http://example.net]
4829 Numbered: [http://example.com]
4830 !! html/php
4831 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4832 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4833 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4834 </p>
4835 !! html/parsoid
4836 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4837 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4838 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4839 !!end
4840
4841 !! test
4842 External links: specified text
4843 !! wikitext
4844 Specified text: [http://example.com link]
4845 !! html
4846 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4847 </p>
4848 !!end
4849
4850 !! test
4851 External links: trail
4852 !! wikitext
4853 Linktrails should not work for external links: [http://example.com link]s
4854 !! html
4855 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: dollar sign in URL
4861 !! wikitext
4862 http://example.com/1$2345
4863 !! html
4864 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4865 </p>
4866 !! end
4867
4868 # parsoid doesn't explicitly mark autonumbered links, see T55505
4869 !! test
4870 External links: dollar sign in URL (autonumber)
4871 !! wikitext
4872 [http://example.com/1$2345]
4873 !! html/php
4874 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4875 </p>
4876 !! html/parsoid
4877 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4878 !!end
4879
4880 !! test
4881 External links: open square bracket forbidden in URL (T6377)
4882 !! options
4883 parsoid=wt2html,wt2wt,html2html
4884 !! wikitext
4885 http://example.com/1[2345
4886 !! html/php
4887 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4888 </p>
4889 !! html/parsoid
4890 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4891 !! end
4892
4893 !! test
4894 External links: open square bracket forbidden in URL (named) (T6377)
4895 !! options
4896 parsoid=wt2html,html2html
4897 !! wikitext
4898 [http://example.com/1[2345]
4899 !! html/php
4900 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4901 </p>
4902 !! html/parsoid
4903 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4904 !!end
4905
4906 # parsoid adds a space before the link name
4907 !! test
4908 External links: open square bracket forbidden in URL (named) (T6377)
4909 Parsoid variant.
4910 !! wikitext
4911 [http://example.com/1 [2345]
4912 !! html
4913 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4914 </p>
4915 !!end
4916
4917 !! test
4918 External links: nowiki in URL link text (T8230)
4919 !! wikitext
4920 [http://example.com/ <nowiki>''example site''</nowiki>]
4921 !! html
4922 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4923 </p>
4924 !! end
4925
4926 !! test
4927 External links: newline forbidden in text (T8230 regression check)
4928 !! wikitext
4929 [http://example.com/ first
4930 second]
4931 !! html
4932 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4933 second]
4934 </p>
4935 !!end
4936
4937 !! test
4938 External links: Pipe char between url and text
4939 !! wikitext
4940 [http://example.com | link]
4941 !! html
4942 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4943 </p>
4944 !!end
4945
4946 !! test
4947 External links: protocol-relative URL in brackets
4948 !! wikitext
4949 [//example.com/ Test]
4950 !! html
4951 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4952 </p>
4953 !! end
4954
4955 # parsoid doesn't explicitly mark autonumbered links, see T55505
4956 !! test
4957 External links: protocol-relative URL in brackets without text
4958 !! wikitext
4959 [//example.com]
4960 !! html/php
4961 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4962 </p>
4963 !! html/parsoid
4964 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4965 !! end
4966
4967 !! test
4968 External links: protocol-relative URL in free text is left alone
4969 !! wikitext
4970 //example.com/Foo
4971 !! html
4972 <p>//example.com/Foo
4973 </p>
4974 !!end
4975
4976 !! test
4977 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4978 !! wikitext
4979 foo//example.com/Foo
4980 !! html
4981 <p>foo//example.com/Foo
4982 </p>
4983 !! end
4984
4985 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4986 !! test
4987 External links: with no contents
4988 !! options
4989 parsoid=wt2html,wt2wt
4990 !! wikitext
4991 [http://en.wikipedia.org/wiki/Foo]
4992
4993 [[wikipedia:Foo|Bar]]
4994
4995 [[wikipedia:Foo|<span>Bar</span>]]
4996 !! html/php
4997 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4998 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4999 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5000 </p>
5001 !! html/parsoid
5002 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5003 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5004 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5005 !! end
5006
5007 !! test
5008 External links: Free with trailing punctuation
5009 !! wikitext
5010 http://example.com,
5011 http://example.com;
5012 http://example.com\
5013 http://example.com.
5014 http://example.com:
5015 http://example.com!
5016 http://example.com?
5017 http://example.com)
5018 http://example.com/url_with_(brackets)
5019 (http://example.com/url_without_brackets)
5020 http://example.com/url_with_entity&amp;
5021 http://example.com/url_with_entity&#x26;
5022 http://example.com/url_with_entity&#038;
5023 http://example.com/url_with_entity&nbsp;
5024 http://example.com/url_with_entity&#xA0;
5025 http://example.com/url_with_entity&#160;
5026 http://example.com/url_with_entity&lt;
5027 http://example.com/url_with_entity&#x3C;
5028 http://example.com/url_with_entity&#60;
5029 !! html/php
5030 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5031 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5032 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5033 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5034 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5035 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5036 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5037 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5038 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5039 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5040 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5041 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5042 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5043 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5044 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5045 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5046 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5047 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5048 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5049 </p>
5050 !! html/parsoid
5051 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5052 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5053 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5054 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5055 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5056 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5057 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5058 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5060 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5061 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5062 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5063 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5064 <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>
5065 <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>
5066 <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>
5067 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
5068 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5069 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5070 !! end
5071
5072 !! test
5073 External links: tricky Parsoid html2html case
5074 !! options
5075 parsoid=wt2html,wt2wt,html2html
5076 !! wikitext
5077 http://example.com/url_with_entity&amp;amp;
5078 !! html/php
5079 <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>;
5080 </p>
5081 !! html/parsoid
5082 <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>
5083 !! end
5084
5085 !! test
5086 External links: Free with trailing quotes (T113666)
5087 !! wikitext
5088 '''News:''' Stuff here
5089
5090 news:'a'b''c''d e
5091 !! html/php
5092 <p><b>News:</b> Stuff here
5093 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5094 </p>
5095 !! html/parsoid
5096 <p><b>News:</b> Stuff here</p>
5097 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5098 !! end
5099
5100 !! test
5101 External links: with entity
5102 !! wikitext
5103 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5104 !! html/php
5105 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5106 </p>
5107 !! html/parsoid
5108 <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>
5109 !! end
5110
5111 !! test
5112 External links: Lone protocols are never linked (T105697)
5113 !! wikitext
5114 http://
5115 http://;
5116 (http://)
5117 bitcoin:
5118 bitcoin:;
5119 (bitcoin:)
5120 !! html
5121 <p>http://
5122 http://;
5123 (http://)
5124 bitcoin:
5125 bitcoin:;
5126 (bitcoin:)
5127 </p>
5128 !! end
5129
5130 !! test
5131 External links: No preceding word characters allowed (T67278)
5132 !! wikitext
5133 NOPEhttp://example.com
5134 N0http://example.com
5135 ok:http://example.com
5136 ok-http://example.com
5137 !! html
5138 <p>NOPEhttp://example.com
5139 N0http://example.com
5140 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5141 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5142 </p>
5143 !! end
5144
5145 !! test
5146 External links: nofollow domain exception
5147 !! wikitext
5148 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5149 !! html
5150 <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>.
5151 </p>
5152 !!end
5153
5154 !! test
5155 External image
5156 !! wikitext
5157 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5158 !! html
5159 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5160 </p>
5161 !! end
5162
5163 !! test
5164 External image from https
5165 !! wikitext
5166 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5167 !! html
5168 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5169 </p>
5170 !! end
5171
5172 !! test
5173 External image (when not allowed)
5174 !! options
5175 wgAllowExternalImages=0
5176 !! wikitext
5177 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5178 !! html
5179 <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>
5180 </p>
5181 !! end
5182
5183 !! test
5184 Link to non-http image, no img tag
5185 !! wikitext
5186 Link to non-http image, no img tag: ftp://example.com/test.jpg
5187 !! html
5188 <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>
5189 </p>
5190 !! end
5191
5192 !! test
5193 External links: terminating separator
5194 !! wikitext
5195 Terminating separator: http://example.com/thing,
5196 !! html
5197 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5198 </p>
5199 !! end
5200
5201 !! test
5202 External links: intervening separator
5203 !! wikitext
5204 Intervening separator: http://example.com/1,2,3
5205 !! html
5206 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5207 </p>
5208 !! end
5209
5210 !! test
5211 External links: old bug with URL in query
5212 !! wikitext
5213 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5214 !! html
5215 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5216 </p>
5217 !! end
5218
5219 !! test
5220 External links: old URL-in-URL bug, mixed protocols
5221 !! wikitext
5222 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5223 !! html
5224 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5225 </p>
5226 !!end
5227
5228 # Since Parsoid is starting to emit canonical wikitext for links,
5229 # [http://example.com http://example.com] will not RT back to that
5230 # form anymore.
5231 !! test
5232 External links: URL in text
5233 !! options
5234 parsoid=wt2html
5235 !! wikitext
5236 URL in text: [http://example.com http://example.com]
5237 !! html/php
5238 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5239 </p>
5240 !! html/parsoid
5241 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5242 !! end
5243
5244 !! test
5245 External links: Clickable images
5246 !! wikitext
5247 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5248 !! html/php
5249 <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>
5250 </p>
5251 !! html/parsoid
5252 <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>
5253 !! end
5254
5255 !! test
5256 External links: raw ampersand
5257 !! wikitext
5258 Old &amp; use: http://x&y
5259 !! html
5260 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5261 </p>
5262 !! end
5263
5264 !! test
5265 External links: encoded ampersand
5266 !! wikitext
5267 Old &amp; use: http://x&amp;y
5268 !! html/php
5269 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5270 </p>
5271 !! html/parsoid
5272 <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>
5273 !! end
5274
5275 !! test
5276 External links: encoded equals (T8102)
5277 !! wikitext
5278 http://example.com/?foo&#61;bar
5279 !! html/php
5280 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5281 </p>
5282 !! html/parsoid
5283 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5284 !! end
5285
5286 ##
5287 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5288 ## does it number them. As discussed in T55505, we can identify
5289 ## autonumbered links via CSS.
5290 ##
5291
5292 !! test
5293 External links: [raw ampersand]
5294 !! wikitext
5295 Old &amp; use: [http://x&y]
5296 !! html/php
5297 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5298 </p>
5299 !! html/parsoid
5300 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5301 !! end
5302
5303 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5304 # mode will return the [raw ampersand] wikitext
5305 !! test
5306 External links: [encoded ampersand]
5307 !! options
5308 parsoid=wt2html,wt2wt,html2html
5309 !! wikitext
5310 Old &amp; use: [http://x&amp;y]
5311 !! html/php
5312 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5313 </p>
5314 !! html/parsoid
5315 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5316 !! end
5317
5318 !! test
5319 External links: [raw equals]
5320 !! wikitext
5321 [http://example.com/?foo=bar]
5322 !! html/php
5323 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5327 !! end
5328
5329 # note that parsoid html is identical to [raw equals] case; so html2wt
5330 # mode will return the [raw equals] wikitext
5331 !! test
5332 External links: [encoded equals] (T8102)
5333 !! options
5334 parsoid=wt2html,wt2wt,html2html
5335 !! wikitext
5336 [http://example.com/?foo&#61;bar]
5337 !! html/php
5338 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5342 !! end
5343
5344 # xxx parsoid strips the IDN character, so the round-trip tests will
5345 # obviously fail and are disabled. --cscott
5346 !! test
5347 External links: [IDN ignored character reference in hostname; strip it right off]
5348 !! options
5349 parsoid=wt2html,wt2wt,html2html
5350 !! wikitext
5351 [http://e&zwnj;xample.com/]
5352 !! html/php
5353 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5354 </p>
5355 !! html/parsoid
5356 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5357 !! end
5358
5359 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5360 # Where an external link could easily circumvent the sanitization of the text of
5361 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5362 # test demands a higher standard. That's a bit strange.
5363 #
5364 # Example:
5365 #
5366 # http://e‌xample.com -> [http://example.com|http://example.com]
5367 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5368 #
5369 # The first example is sanitized, but the second is not. Any security benefits
5370 # from this production are trivial to circumvent. Either remove this test and
5371 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5372 # the test accordingly.
5373 #
5374 # All our love,
5375 # The Parsoid team.
5376 # xxx parsoid strips the IDN character, so the round-trip tests will
5377 # obviously fail and are disabled. --cscott
5378 !! test
5379 External links: IDN ignored character reference in hostname; strip it right off
5380 !! options
5381 parsoid=wt2html,html2html
5382 !! wikitext
5383 http://e&zwnj;xample.com/
5384 !! html/php
5385 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5386 </p>
5387 !! html/parsoid
5388 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5389 !! end
5390
5391 !! test
5392 External links: www.jpeg.org (T2554)
5393 !! wikitext
5394 http://www.jpeg.org
5395 !! html
5396 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5397 </p>
5398 !! end
5399
5400 # parsoid doesn't explicitly mark autonumbered links, see T55505
5401 !! test
5402 External links: URL within URL (T2002)
5403 !! wikitext
5404 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5405 !! html/php
5406 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5407 </p>
5408 !! html/parsoid
5409 <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>
5410 !! end
5411
5412 !! test
5413 T2361: URL inside bracketed URL
5414 !! wikitext
5415 [http://www.example.com/foo http://www.example.com/bar]
5416 !! html
5417 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5418 </p>
5419 !! end
5420
5421 !! test
5422 T2361: URL within URL, not bracketed
5423 !! wikitext
5424 http://www.example.com/foo?=http://www.example.com/bar
5425 !! html
5426 <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>
5427 </p>
5428 !! end
5429
5430 !! test
5431 T2289: ">"-token in URL-tail
5432 !! wikitext
5433 http://www.example.com/<hello>
5434 !! html
5435 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5436 </p>
5437 !!end
5438
5439 !! test
5440 T2289: literal ">"-token in URL-tail
5441 !! wikitext
5442 http://www.example.com/<b>html</b>
5443 !! html/php
5444 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5445 </p>
5446 !! html/parsoid
5447 <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>
5448 !! end
5449
5450 !! test
5451 T2289: ">"-token in bracketed URL
5452 !! wikitext
5453 [http://www.example.com/<hello> stuff]
5454 !! html
5455 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5456 </p>
5457 !!end
5458
5459 !! test
5460 T2289: literal ">"-token in bracketed URL
5461 !! wikitext
5462 [http://www.example.com/<b>html</b> stuff]
5463 !! html
5464 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5465 </p>
5466 !!end
5467
5468 !! test
5469 T2289: literal double quote at end of URL
5470 !! wikitext
5471 http://www.example.com/"hello"
5472 !! html
5473 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5474 </p>
5475 !!end
5476
5477 !! test
5478 T2289: literal double quote in bracketed URL
5479 !! wikitext
5480 [http://www.example.com/"hello" stuff]
5481 !! html
5482 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5483 </p>
5484 !!end
5485
5486 !! test
5487 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5488 !! wikitext
5489 [http://www.example.com test]
5490 !! html
5491 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5492 </p>
5493 !! end
5494
5495 !! test
5496 External links: link text with spaces
5497 !! wikitext
5498 [http://www.example.com a b c]
5499 [http://www.example.com ''a'' ''b'']
5500 !! html
5501 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5502 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5503 </p>
5504 !! end
5505
5506 # Note edge case difference between PHP and Parsoid here.
5507 !! test
5508 External links: wiki links within external link (T5695)
5509 !! options
5510 parsoid=wt2html,html2html
5511 !! wikitext
5512 [http://example.com [[wikilink]] embedded in ext link]
5513
5514 [http://example.com test [[wikilink]] embedded in ext link]
5515 !! html/php
5516 <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>
5517 </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>
5518 </p>
5519 !! html/parsoid
5520 <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>
5521 <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>
5522 !! end
5523
5524 !! test
5525 T2787: Links with one slash after the url protocol are invalid
5526 !! wikitext
5527 http:/example.com
5528
5529 [http:/example.com title]
5530 !! html
5531 <p>http:/example.com
5532 </p><p>[http:/example.com title]
5533 </p>
5534 !! end
5535
5536 !! test
5537 Bracketed external links with template-generated invalid target
5538 !! wikitext
5539 [{{echo|http:/example.com}} title]
5540 !! html
5541 <p>[http:/example.com title]
5542 </p>
5543 !! end
5544
5545 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5546 !! test
5547 Broken wikilinks (but not external links) prevent templates from closing
5548 !! options
5549 parsoid=wt2html
5550 !! wikitext
5551 [http://example.com x
5552
5553 {{echo|[http://example.com x}}
5554
5555 [[Foo
5556
5557 {{echo|[[Foo}}
5558 !! html/php
5559 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5560 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5561 </p><p>[[Foo
5562 </p><p>{{echo|[[Foo}}
5563 </p>
5564 !! html/parsoid
5565 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5566 <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>
5567 <p>[[Foo</p>
5568 <p>{{echo|[[Foo}}</p>
5569 !! end
5570
5571 !! test
5572 Wikilinks with embedded newlines are not broken
5573 !! wikitext
5574 {{echo|[[ Foo
5575 B
5576 C]]}}
5577 !! html/php
5578 <p>[[ Foo
5579 B
5580 C]]
5581 </p>
5582 !! html/parsoid
5583 <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>
5584 !! end
5585
5586 !! test
5587 Broken templates
5588 !! options
5589 parsoid=wt2html
5590 !! wikitext
5591 {{echo|[[Foo|}}]]
5592
5593 [[Foo|{{echo|]]}}
5594 !! html/php
5595 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5596 </p><p>[[Foo|]]
5597 </p>
5598 !! html/parsoid
5599 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5600 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5601 !! end
5602
5603 !! test
5604 T4702: Mismatched <i>, <b> and <a> tags are invalid
5605 !! wikitext
5606 ''[http://example.com text'']
5607 [http://example.com '''text]'''
5608 ''Something [http://example.com in italic'']
5609 ''Something [http://example.com mixed''''', even bold]'''
5610 '''''Now [http://example.com both''''']
5611 !! html
5612 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5613 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5614 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5615 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5616 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5617 </p>
5618 !! end
5619
5620
5621 !! test
5622 T6781: %26 in URL
5623 !! wikitext
5624 http://www.example.com/?title=AT%26T
5625 !! html/php
5626 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5627 </p>
5628 !! html/parsoid
5629 <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>
5630 !! end
5631
5632 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5633 # % is actually legal in HTML5. Any change in output would need testing though.
5634 !! test
5635 T6781, T7267: %25 in URL
5636 !! wikitext
5637 http://www.example.com/?title=100%25_Bran
5638 !! html/php
5639 <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>
5640 </p>
5641 !! html/parsoid
5642 <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>
5643 !! end
5644
5645 !! test
5646 T6781, T7267: %28, %29 in URL
5647 !! wikitext
5648 http://www.example.com/?title=Ben-Hur_%281959_film%29
5649 !! html/php
5650 <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>
5651 </p>
5652 !! html/parsoid
5653 <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>
5654 !! end
5655
5656
5657 !! test
5658 T6781: %26 in autonumber URL
5659 !! wikitext
5660 [http://www.example.com/?title=AT%26T]
5661 !! html/php
5662 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5663 </p>
5664 !! html/parsoid
5665 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5666 !! end
5667
5668 !! test
5669 T6781, T7267: %26 in autonumber URL
5670 !! wikitext
5671 [http://www.example.com/?title=100%25_Bran]
5672 !! html/php
5673 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5674 </p>
5675 !! html/parsoid
5676 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5677 !! end
5678
5679 !! test
5680 T6781, T7267: %28, %29 in autonumber URL
5681 !! wikitext
5682 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5683 !! html/php
5684 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5685 </p>
5686 !! html/parsoid
5687 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5688 !! end
5689
5690
5691 !! test
5692 T6781: %26 in bracketed URL
5693 !! wikitext
5694 [http://www.example.com/?title=AT%26T link]
5695 !! html/php
5696 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5697 </p>
5698 !! html/parsoid
5699 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5700 !! end
5701
5702 !! test
5703 T6781, T7267: %25 in bracketed URL
5704 !! wikitext
5705 [http://www.example.com/?title=100%25_Bran link]
5706 !! html
5707 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5708 </p>
5709 !! end
5710
5711 !! test
5712 T6781, T7267: %28, %29 in bracketed URL
5713 !! wikitext
5714 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5715 !! html/php
5716 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5717 </p>
5718 !! html/parsoid
5719 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5720 !! end
5721
5722 !! test
5723 External link containing a period in the anchor. (T65947)
5724 !! wikitext
5725 [//foo.org/bar#baz. bang]
5726
5727 [//foo.org/bar. bang]
5728 !! html/php
5729 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5730 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5731 </p>
5732 !! html/parsoid
5733 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5734 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5735 !! end
5736
5737 !! test
5738 External link containing a single quote. (T65947)
5739 !! wikitext
5740 [//foo.org/bar'baz]
5741
5742 [//foo.org/bar'baz bang]
5743 !! html/php
5744 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5745 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5746 </p>
5747 !! html/parsoid
5748 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5749 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5750 !! end
5751
5752 !! test
5753 External link containing double-single-quotes in text '' (T6598 sanity check)
5754 !! wikitext
5755 Some [http://example.com/ pretty ''italics'' and stuff]!
5756 !! html
5757 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5758 </p>
5759 !! end
5760
5761 !! test
5762 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5763 !! wikitext
5764 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5765 !! html
5766 <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>
5767 </p>
5768 !! end
5769
5770 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5771 !! test
5772 External link containing double-single-quotes with no space separating the url from text in italics
5773 !! wikitext
5774 [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]].]
5775 !! html/php+tidy
5776 <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>.
5777 </p>
5778 !! html/parsoid
5779 <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>
5780 !! end
5781
5782 !! test
5783 External link with comments in link text
5784 !! wikitext
5785 [http://www.google.com Google <!-- comment -->]
5786 !! html/php
5787 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5788 </p>
5789 !! html/parsoid
5790 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5791 !! end
5792
5793 !! test
5794 External link to bare IPv4 address
5795 !! wikitext
5796 [http://192.168.0.1 Link]
5797 !! html/php
5798 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5799 </p>
5800 !! html/parsoid
5801 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5802 !! end
5803
5804 !! test
5805 URL-encoding in URL functions (single parameter)
5806 !! wikitext
5807 {{localurl:Some page|amp=&}}
5808 !! html
5809 <p>/index.php?title=Some_page&amp;amp=&amp;
5810 </p>
5811 !! end
5812
5813 !! test
5814 URL-encoding in URL functions (multiple parameters)
5815 !! wikitext
5816 {{localurl:Some page|q=?&amp=&}}
5817 !! html
5818 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5819 </p>
5820 !! end
5821
5822 !! test
5823 Brackets in urls
5824 !! wikitext
5825 http://example.com/index.php?foozoid%5B%5D=bar
5826
5827 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5828 !! html/php
5829 <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>
5830 </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>
5831 </p>
5832 !! html/parsoid
5833 <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>
5834
5835 <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>
5836 !! end
5837
5838 !! test
5839 IPv6 urls, autolink format (T23261)
5840 !! wikitext
5841 http://[2404:130:0:1000::187:2]/index.php
5842
5843 Examples from RFC 2373, section 2.2:
5844
5845 *http://[1080::8:800:200C:417A]/unicast
5846 *http://[FF01::101]/multicast
5847 *http://[::1]/loopback
5848 *http://[::]/unspecified
5849 *http://[::13.1.68.3]/ipv4compat
5850 *http://[::FFFF:129.144.52.38]/ipv4compat
5851
5852 Examples from RFC 2732, section 2:
5853
5854 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5855 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5856 *http://[3ffe:2a00:100:7031::1]
5857 *http://[1080::8:800:200C:417A]/foo
5858 *http://[::192.9.5.5]/ipng
5859 *http://[::FFFF:129.144.52.38]:80/index.html
5860 *http://[2010:836B:4179::836B:4179]
5861 !! html/php
5862 <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>
5863 </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:
5864 </p>
5865 <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>
5866 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5867 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5868 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5869 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5870 <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>
5871 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5872 </p>
5873 <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>
5874 <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>
5875 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5876 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5877 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5878 <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>
5879 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5880
5881 !! html/parsoid
5882 <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>
5883
5884 <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>
5885 <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>
5886 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5887 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5888 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5889 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5890 <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>
5891
5892 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5893 <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>
5894 <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>
5895 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5896 <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>
5897 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5898 <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>
5899 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5900 !! end
5901
5902 !! test
5903 IPv6 urls, bracketed format (T23261)
5904 !! wikitext
5905 [http://[2404:130:0:1000::187:2]/index.php test]
5906
5907 Examples from RFC 2373, section 2.2:
5908
5909 *[http://[1080::8:800:200C:417A] unicast]
5910 *[http://[FF01::101] multicast]
5911 *[http://[::1]/ loopback]
5912 *[http://[::] unspecified]
5913 *[http://[::13.1.68.3] ipv4compat]
5914 *[http://[::FFFF:129.144.52.38] ipv4compat]
5915
5916 Examples from RFC 2732, section 2:
5917
5918 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5919 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5920 *[http://[3ffe:2a00:100:7031::1] 3]
5921 *[http://[1080::8:800:200C:417A]/foo 4]
5922 *[http://[::192.9.5.5]/ipng 5]
5923 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5924 *[http://[2010:836B:4179::836B:4179] 7]
5925 !! html/php
5926 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5927 </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:
5928 </p>
5929 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5930 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5931 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5932 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5933 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5934 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5935 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5936 </p>
5937 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5938 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5939 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5940 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5941 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5942 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5943 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5944
5945 !! html/parsoid
5946 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5947
5948 <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>
5949 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5950 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5951 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5952 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5953 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5954 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5955
5956 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5957 <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>
5958 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5959 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5960 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5961 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5962 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5963 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5964 !! end
5965
5966 !! test
5967 Non-extlinks in brackets
5968 !! wikitext
5969 [foo]
5970 [foo bar]
5971 [foo ''bar'']
5972 [fool's] errand
5973 [fool's errand]
5974 [{{echo|foo}}]
5975 [{{echo|foo}} bar]
5976 [{{echo|foo}} ''bar'']
5977 [{{echo|foo}}l's] errand
5978 [{{echo|foo}}l's errand]
5979 [url={{echo|foo}}]
5980 [url=http://example.com]
5981 [http:// bare protocols don't count]
5982 !! html/php
5983 <p>[foo]
5984 [foo bar]
5985 [foo <i>bar</i>]
5986 [fool's] errand
5987 [fool's errand]
5988 [foo]
5989 [foo bar]
5990 [foo <i>bar</i>]
5991 [fool's] errand
5992 [fool's errand]
5993 [url=foo]
5994 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5995 [http:// bare protocols don't count]
5996 </p>
5997 !! html/parsoid
5998 <p>[foo]
5999 [foo bar]
6000 [foo <i>bar</i>]
6001 [fool's] errand
6002 [fool's errand]
6003 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6004 [<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]
6005 [<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>]
6006 [<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
6007 [<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]
6008 [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>]
6009 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6010 [http:// bare protocols don't count]</p>
6011 !! end
6012
6013 !! test
6014 Percent encoding in external links
6015 !! wikitext
6016 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6017 !! html/php
6018 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6019 </p>
6020 !! html/parsoid
6021 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6022 !! end
6023
6024 !! test
6025 Use url link syntax for links where the content is equal the link target
6026 !! wikitext
6027 http://example.com
6028 !! html/php
6029 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6030 </p>
6031 !! html/parsoid
6032 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6033 !! end
6034
6035 !! test
6036 Parenthesis in external links, especially URL links
6037 !! wikitext
6038 http://example.com)
6039
6040 http://example.com/test)
6041
6042 http://example.com/(test)
6043
6044 http://example.com/((test)
6045
6046 (http://example.com/(test))
6047
6048 (http://example.com/(test)))))
6049
6050 http://example.com/a)b
6051
6052 [http://example.com) foo]
6053 !! html/php
6054 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6055 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6056 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6057 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6058 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6059 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6060 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6061 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6062 </p>
6063 !! html/parsoid
6064 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6065 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6066 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6067 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6068 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6069 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6070 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6071 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6072 !! end
6073
6074 !! test
6075 Parenthesis in external links, w/ transclusion or comment
6076 !! wikitext
6077 (http://example.com/{{echo|hi}})
6078
6079 (http://example.com<!-- hi -->)
6080 !! html/php
6081 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6082 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6083 </p>
6084 !! html/parsoid
6085 <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>
6086
6087 <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>
6088 !! end
6089
6090 !! test
6091 Serialize <a> tags with invalid link targets as plain text
6092 !! options
6093 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6094 !! html/parsoid
6095 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6096 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6097 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6098 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6099 !! wikitext
6100 text
6101 <nowiki>*</nowiki>text
6102 <nowiki>[[foo]]</nowiki>
6103 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6104 !! end
6105
6106 !! test
6107 mw:ExtLink -vs- mw:WikiLink (T94723)
6108 !! options
6109 parsoid=html2wt
6110 !! html/parsoid
6111 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6112 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6113 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6114 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6115 <p>
6116 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6117 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6118 </p>
6119 !! wikitext
6120 [[Foo|Bar]]
6121 [[Foo|Bar]]
6122 [[:en:Foo|Bar]]
6123 [[:en:Foo|Bar]]
6124
6125 [[:en:European_Robin|European Robin]]
6126 [[:en:European_Robin|European Robin]]
6127 !! end
6128
6129 !! test
6130 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6131 !! options
6132 parsoid=wt2wt
6133 !! wikitext
6134 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6135 !! html/parsoid
6136 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6137 !! end
6138
6139
6140 ###
6141 ### Quotes
6142 ###
6143
6144 !! test
6145 Quotes
6146 !! wikitext
6147 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6148
6149 Normal text. '''''Bold italic text.''''' Normal text.
6150 !! html
6151 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6152 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6153 </p>
6154 !! end
6155
6156 !! test
6157 Quotes wrapping HTML table
6158 !! wikitext
6159 '''<table><tr><td>hi</td></tr></table>'''
6160 !! html/php+tidy
6161 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6162 !! html/parsoid
6163 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6164 !! end
6165
6166 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6167 # parser strips. The wikitext contains just the first half of the bold
6168 # quote pair.
6169 !! test
6170 Unclosed and unmatched quotes
6171 !! wikitext
6172 '''''Bold italic text '''with bold deactivated''' in between.'''''
6173
6174 '''''Bold italic text ''with italic deactivated'' in between.'''''
6175
6176 '''Bold text..
6177
6178 ..spanning two paragraphs (should not work).'''
6179
6180 '''Bold tag left open
6181
6182 ''Italic tag left open
6183
6184 Normal text.
6185
6186 <!-- Unmatching number of opening, closing tags: -->
6187 '''This year''''s election ''should'' beat '''last year''''s.
6188
6189 ''Tom'''s car is bigger than ''Susan'''s.
6190
6191 Plain ''italic'''s plain
6192 !! html/php
6193 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6194 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6195 </p><p><b>Bold text..</b>
6196 </p><p>..spanning two paragraphs (should not work).
6197 </p><p><b>Bold tag left open</b>
6198 </p><p><i>Italic tag left open</i>
6199 </p><p>Normal text.
6200 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6201 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6202 </p><p>Plain <i>italic'</i>s plain
6203 </p>
6204 !! html/parsoid
6205 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6206 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6207 </p><p><b>Bold text..</b>
6208 </p><p>..spanning two paragraphs (should not work).<b></b>
6209 </p><p><b>Bold tag left open</b>
6210 </p><p><i>Italic tag left open</i>
6211 </p><p>Normal text.
6212 </p>
6213 <!-- Unmatching number of opening, closing tags: -->
6214 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6215 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6216 </p><p>Plain <i>italic'</i>s plain
6217 </p>
6218 !! end
6219
6220 ###
6221 ### Tables
6222 ###
6223 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6224 ###
6225
6226 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6227 # is the bare minimum required by the spec, see:
6228 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6229 # Parsoid team replies: empty table tags are legal in HTML5
6230 !! test
6231 A table with no data.
6232 !! options
6233 parsoid=wt2html
6234 !! wikitext
6235 {||}
6236 !! html/php
6237
6238 !! html/parsoid
6239 <table></table>
6240
6241 !! end
6242
6243 !! test
6244 A table with stray table end tags on start tag line (wt2html)
6245 !! options
6246 parsoid=wt2html
6247 !! wikitext
6248 {|style="color: red;"|}
6249
6250 {|style="color: red;" |}
6251 |foo
6252 |}
6253
6254 {|style="color: red;"|} id="foo"
6255 |foo
6256 |}
6257
6258 {|style="color: red;" |} id="foo"
6259 |foo
6260 |}
6261 !! html
6262 <table style="color: red;"></table>
6263
6264 <table style="color: red;">
6265 <tbody><tr>
6266 <td>foo</td>
6267 </tr></tbody>
6268 </table>
6269
6270 <table style="color: red;" id="foo">
6271 <tbody><tr>
6272 <td>foo</td>
6273 </tr></tbody>
6274 </table>
6275
6276 <table style="color: red;" id="foo">
6277 <tbody><tr>
6278 <td>foo</td>
6279 </tr></tbody>
6280 </table>
6281
6282 !! end
6283
6284 !! test
6285 A table with no data (take 2)
6286 !! wikitext
6287 {|
6288 |}
6289 !! html/parsoid
6290 <table></table>
6291 !! end
6292
6293 # A table with nothing but a caption is invalid XHTML, we might want to render
6294 # this as <p>caption</p>
6295 # Parsoid team replies: table with only a caption is legal in HTML5
6296 !! test
6297 A table with nothing but a caption
6298 !! wikitext
6299 {|
6300 |+caption
6301 |}
6302 !! html/php
6303 <table>
6304 <caption>caption
6305 </caption><tr><td></td></tr></table>
6306
6307 !! html/parsoid
6308 <table><caption>caption</caption></table>
6309 !! end
6310
6311 !! test
6312 A table with caption with default-spaced attributes and a table row
6313 !! wikitext
6314 {|
6315 |+ style="color: red;" |caption1
6316 |-
6317 |foo
6318 |}
6319 !! html
6320 <table>
6321 <caption style="color: red;">caption1
6322 </caption>
6323 <tr>
6324 <td>foo
6325 </td></tr></table>
6326
6327 !! end
6328
6329 !! test
6330 A table with captions with non-default spaced attributes and a table row
6331 !! wikitext
6332 {|
6333 |+style="color: red;"|caption2
6334 |+ style="color: red;"|caption3
6335 |-
6336 |foo
6337 |}
6338 !! html
6339 <table>
6340 <caption style="color: red;">caption2
6341 </caption>
6342 <caption style="color: red;">caption3
6343 </caption>
6344 <tr>
6345 <td>foo
6346 </td></tr></table>
6347
6348 !! end
6349
6350 !! test
6351 Table td-cell syntax variations
6352 !! wikitext
6353 {|
6354 |foo bar foo|baz
6355 |foo bar foo||baz
6356 |style='color:red;'|baz
6357 |style='color:red;'||baz
6358 |}
6359 !! html
6360 <table>
6361 <tr>
6362 <td>baz
6363 </td>
6364 <td>foo bar foo</td>
6365 <td>baz
6366 </td>
6367 <td style="color:red;">baz
6368 </td>
6369 <td>style='color:red;'</td>
6370 <td>baz
6371 </td></tr></table>
6372
6373 !! end
6374
6375 !! test
6376 Simple table
6377 !! wikitext
6378 {|
6379 |1||2
6380 |-
6381 |3||4
6382 |}
6383 !! html
6384 <table>
6385 <tr>
6386 <td>1</td>
6387 <td>2
6388 </td></tr>
6389 <tr>
6390 <td>3</td>
6391 <td>4
6392 </td></tr></table>
6393
6394 !! end
6395
6396 !! test
6397 Simple table but with multiple dashes for row wikitext
6398 !! wikitext
6399 {|
6400 |foo
6401 |-----
6402 |bar
6403 |}
6404 !! html
6405 <table>
6406 <tr>
6407 <td>foo
6408 </td></tr>
6409 <tr>
6410 <td>bar
6411 </td></tr></table>
6412
6413 !! end
6414
6415 !! test
6416 Multiplication table
6417 !! wikitext
6418 {| border="1" cellpadding="2"
6419 |+Multiplication table
6420 |-
6421 !&times;!!1!!2!!3
6422 |-
6423 !1
6424 |1||2||3
6425 |-
6426 !2
6427 |2||4||6
6428 |-
6429 !3
6430 |3||6||9
6431 |-
6432 !4
6433 |4||8||12
6434 |-
6435 !5
6436 |5||10||15
6437 |}
6438 !! html
6439 <table border="1" cellpadding="2">
6440 <caption>Multiplication table
6441 </caption>
6442 <tr>
6443 <th>&#215;</th>
6444 <th>1</th>
6445 <th>2</th>
6446 <th>3
6447 </th></tr>
6448 <tr>
6449 <th>1
6450 </th>
6451 <td>1</td>
6452 <td>2</td>
6453 <td>3
6454 </td></tr>
6455 <tr>
6456 <th>2
6457 </th>
6458 <td>2</td>
6459 <td>4</td>
6460 <td>6
6461 </td></tr>
6462 <tr>
6463 <th>3
6464 </th>
6465 <td>3</td>
6466 <td>6</td>
6467 <td>9
6468 </td></tr>
6469 <tr>
6470 <th>4
6471 </th>
6472 <td>4</td>
6473 <td>8</td>
6474 <td>12
6475 </td></tr>
6476 <tr>
6477 <th>5
6478 </th>
6479 <td>5</td>
6480 <td>10</td>
6481 <td>15
6482 </td></tr></table>
6483
6484 !! end
6485
6486 !! test
6487 Accept "||" in table headings
6488 !! wikitext
6489 {|
6490 !h1||h2
6491 |}
6492 !! html
6493 <table>
6494 <tr>
6495 <th>h1</th>
6496 <th>h2
6497 </th></tr></table>
6498
6499 !! end
6500
6501 !! test
6502 Accept "!!" in table data
6503 !! wikitext
6504 {|
6505 |Foo!!||
6506 |}
6507 !! html
6508 <table>
6509 <tr>
6510 <td>Foo!!</td>
6511 <td>
6512 </td></tr></table>
6513
6514 !! html/parsoid
6515 <table>
6516 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6517 </tbody></table>
6518 !! end
6519
6520 !! test
6521 Accept "||" in indented table headings
6522 !! wikitext
6523 :{|
6524 !h1||h2
6525 |}
6526 !! html
6527 <dl><dd><table>
6528 <tr>
6529 <th>h1</th>
6530 <th>h2
6531 </th></tr></table></dd></dl>
6532
6533 !! end
6534
6535 !! test
6536 Accept "!!" in templates
6537 !! wikitext
6538 {|
6539 !a {{echo|b!!c}}
6540 |}
6541 !! html/php
6542 <table>
6543 <tr>
6544 <th>a b</th>
6545 <th>c
6546 </th></tr></table>
6547
6548 !! html/parsoid
6549 <table>
6550 <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>
6551 !! end
6552
6553 !! test
6554 Accept "!!" in table headings after newline
6555 !! wikitext
6556 {|
6557 !a
6558 b!!c
6559 |}
6560 !! html/php
6561 <table>
6562 <tr>
6563 <th>a
6564 <p>b!!c
6565 </p>
6566 </th></tr></table>
6567
6568 !! html/parsoid
6569 <table>
6570 <tbody><tr><th>a
6571 <p>b!!c</p></th></tr>
6572 </tbody></table>
6573 !! end
6574
6575 !! test
6576 Accept "!!" in table data of mixed wikitext / html syntax
6577 !! wikitext
6578 {|
6579 !a
6580 <tr><td>b!!c</td></tr>
6581 |}
6582 !! html/php+tidy
6583 <table>
6584 <tbody><tr>
6585 <th>a
6586 </th></tr><tr><td>b!!c</td></tr>
6587 </tbody></table>
6588 !! html/parsoid
6589 <table>
6590 <tbody><tr><th>a</th></tr>
6591 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6592 </tbody></table>
6593 !! end
6594
6595 !! test
6596 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6597 !! wikitext
6598 {|
6599 !|h1
6600 ||a
6601 |}
6602 !! html
6603 <table>
6604 <tr>
6605 <th>h1
6606 </th>
6607 <td>a
6608 </td></tr></table>
6609
6610 !! end
6611
6612 !!test
6613 Accept "| !" at start of line in tables (ignore !-attribute)
6614 !! wikitext
6615 {|
6616 |-
6617 |!style="color:red"|bar
6618 |}
6619 !! html
6620 <table>
6621
6622 <tr>
6623 <td>bar
6624 </td></tr></table>
6625
6626 !!end
6627
6628 !!test
6629 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 +/-
6630 !! wikitext
6631 {|
6632 |-
6633 |style='color:red;'|+1
6634 |style='color:blue;'|-1
6635 |-
6636 |1||2||3
6637 |1||+2||-3
6638 |-
6639 | +1
6640 | -1
6641 |}
6642 !! html
6643 <table>
6644
6645 <tr>
6646 <td style="color:red;">+1
6647 </td>
6648 <td style="color:blue;">-1
6649 </td></tr>
6650 <tr>
6651 <td>1</td>
6652 <td>2</td>
6653 <td>3
6654 </td>
6655 <td>1</td>
6656 <td>+2</td>
6657 <td>-3
6658 </td></tr>
6659 <tr>
6660 <td>+1
6661 </td>
6662 <td>-1
6663 </td></tr></table>
6664
6665 !!end
6666
6667 !! test
6668 Table rowspan
6669 !! wikitext
6670 {| border=1
6671 |Cell 1, row 1
6672 |rowspan=2|Cell 2, row 1 (and 2)
6673 |Cell 3, row 1
6674 |-
6675 |Cell 1, row 2
6676 |Cell 3, row 2
6677 |}
6678 !! html
6679 <table border="1">
6680 <tr>
6681 <td>Cell 1, row 1
6682 </td>
6683 <td rowspan="2">Cell 2, row 1 (and 2)
6684 </td>
6685 <td>Cell 3, row 1
6686 </td></tr>
6687 <tr>
6688 <td>Cell 1, row 2
6689 </td>
6690 <td>Cell 3, row 2
6691 </td></tr></table>
6692
6693 !! end
6694
6695 !! test
6696 Nested table
6697 !! wikitext
6698 {| border=1
6699 | &alpha;
6700 |
6701 {| bgcolor=#ABCDEF border=2
6702 |nested
6703 |-
6704 |table
6705 |}
6706 |the original table again
6707 |}
6708 !! html
6709 <table border="1">
6710 <tr>
6711 <td>&#945;
6712 </td>
6713 <td>
6714 <table bgcolor="#ABCDEF" border="2">
6715 <tr>
6716 <td>nested
6717 </td></tr>
6718 <tr>
6719 <td>table
6720 </td></tr></table>
6721 </td>
6722 <td>the original table again
6723 </td></tr></table>
6724
6725 !! end
6726
6727 !! test
6728 Invalid attributes in table cell (T3830)
6729 !! wikitext
6730 {|
6731 |Cell:|broken
6732 |}
6733 !! html
6734 <table>
6735 <tr>
6736 <td>broken
6737 </td></tr></table>
6738
6739 !! end
6740
6741 !! test
6742 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6743 !! wikitext
6744 {|
6745 |title="foo" |bar
6746 |title="foo<nowiki>|</nowiki>" |bar
6747 |title="foo<nowiki>|</nowiki>" bar
6748 |}
6749 !! html/php
6750 <table>
6751 <tr>
6752 <td title="foo">bar
6753 </td>
6754 <td title="foo&#124;">bar
6755 </td>
6756 <td>title="foo|" bar
6757 </td></tr></table>
6758
6759 !! html/parsoid
6760 <table>
6761 <tbody><tr><td title="foo">bar</td>
6762 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6763 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6764 </tbody></table>
6765 !! end
6766
6767 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6768 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6769 # *2wt modes will fail.
6770 !! test
6771 Table security: embedded pipes
6772 !! options
6773 parsoid=wt2html,html2html
6774 !! wikitext
6775 {|
6776 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6777 !! html/php
6778 <table>
6779 <tr>
6780 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6781 <td>]" onmouseover="alert(document.cookie)"&gt;test
6782 </td>
6783 </tr>
6784 </table>
6785
6786 !! html/parsoid
6787 <table><tbody>
6788 <tr>
6789 <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>
6790 !! end
6791
6792 !! test
6793 Element attributes with double ! should not be broken up by <th>
6794 !! wikitext
6795 {|
6796 !hi <div class="!!">ha</div> ho
6797 |}
6798 !! html/php
6799 <table>
6800 <tr>
6801 <th>hi <div class="!!">ha</div> ho
6802 </th></tr></table>
6803
6804 !! html/parsoid
6805 <table>
6806 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6807 </tbody></table>
6808 !! end
6809
6810 !! test
6811 ! and || in element attributes should not be parsed as <th>/<td>
6812 !! wikitext
6813 {|
6814 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6815 |}
6816 !! html/php
6817 <table>
6818 <tr>
6819 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6820 </td></tr></table>
6821
6822 !! html/parsoid
6823 <table>
6824 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6825 </tbody></table>
6826 !! end
6827
6828 # FIXME: The output seems broken. Filed as T110268.
6829 !! test
6830 ! and || in td attributes should not be parsed as <th>/<td>
6831 !! options
6832 parsoid=wt2html
6833 !! wikitext
6834 {|
6835 |style="color: red !important;" data-contrived="put this here ||"|foo
6836 |}
6837 !! html/php
6838 <table>
6839 <tr>
6840 <td>style="color: red !important;" data-contrived="put this here</td>
6841 <td>foo
6842 </td></tr></table>
6843
6844 !! html/parsoid
6845 <table>
6846 <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>
6847 </tbody></table>
6848 !! end
6849
6850 !! test
6851 Break on | in element attribute in template
6852 !! options
6853 parsoid=wt2html,html2html
6854 !! wikitext
6855 {{echo|1=<div class="hi|ho">ha</div>}}
6856 !! html/php
6857 <p>ho"&gt;ha&lt;/div&gt;
6858 </p>
6859 !! html/parsoid
6860 <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>
6861 !! end
6862
6863 !! test
6864 Break on | in element attribute name in template
6865 !! wikitext
6866 {{echo|<div cla|ss="hiho">ha</div>}}
6867 !! html/parsoid
6868 <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>
6869 !! end
6870
6871 !! test
6872 Don't break on | in extension attribute in template
6873 !! wikitext
6874 {{echo|<ref name="hi|ho">ha</ref>}}
6875
6876 <references />
6877 !! html/parsoid
6878 <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>
6879
6880 <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>
6881 !! end
6882
6883 ## We don't support roundtripping of these attributes in Parsoid.
6884 ## Selective serialization takes care of preventing dirty diffs.
6885 ## But, on edits, we dirty-diff the invalid attribute text.
6886 !! test
6887 Invalid text in table attributes should be discarded
6888 !! options
6889 parsoid=wt2html
6890 !! wikitext
6891 {| <span>boo</span> style='border:1px solid black'
6892 | <span>boo</span> style='color:blue' |1
6893 |<span>boo</span> style='color:blue'|2
6894 |}
6895 !! html/php
6896 <table style="border:1px solid black">
6897 <tr>
6898 <td style="color:blue">1
6899 </td>
6900 <td style="color:blue">2
6901 </td></tr></table>
6902
6903 !! html/parsoid
6904 <table style="border:1px solid black">
6905 <tr>
6906 <td style="color:blue">1</td>
6907 <td style="color:blue">2</td>
6908 </tr>
6909 </table>
6910 !! end
6911
6912 !! test
6913 Invalid text in table attributes should be preserved by selective serializer
6914 !! options
6915 parsoid={
6916 "modes": ["selser"],
6917 "changes": [
6918 ["td:first-child", "text", "abc"],
6919 ["td + td", "text", "xyz"]
6920 ]
6921 }
6922 !! wikitext
6923 {| <span>boo</span> style='border:1px solid black'
6924 | <span>boo</span> style='color:blue' | 1
6925 |<span>boo</span> style='color:blue'| 2
6926 |}
6927 !! wikitext/edited
6928 {| <span>boo</span> style='border:1px solid black'
6929 | <span>boo</span> style='color:blue' | abc
6930 |<span>boo</span> style='color:blue'| xyz
6931 |}
6932 !! end
6933
6934 !! test
6935 1. Template-generated table cell attributes and cell content
6936 !! wikitext
6937 {|
6938 |{{table_attribs}}
6939 | {{table_attribs}}
6940 || {{table_attribs_5}}
6941 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6942 |align=center {{table_attribs}}
6943 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6944 |}
6945 !! html
6946 <table>
6947 <tr>
6948 <td style="color:red;">Foo
6949 </td>
6950 <td style="color:red;">Foo
6951 </td>
6952 <td>style="color:red;"</td>
6953 <td>Bar
6954 </td>
6955 <td style="color:red;">Foo
6956 </td>
6957 <td align="center" style="color:red;">Foo
6958 </td>
6959 <td align="center" style="color:red;">Foo
6960 </td></tr></table>
6961
6962 !! end
6963
6964 !! test
6965 2. Template-generated table cell attributes and cell content
6966 !! wikitext
6967 {|
6968 |{{table_attribs_2}}
6969 |}
6970 !! html/php
6971 <table>
6972 <tr>
6973 <td style="color:red;">Foo
6974 </td>
6975 <td>Bar</td>
6976 <td>Baz
6977 </td></tr></table>
6978
6979 !! html/parsoid
6980 <table>
6981 <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>
6982 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6983 </tbody></table>
6984 !! end
6985
6986 !! test
6987 3. Template-generated table cell attributes and cell content
6988 !! wikitext
6989 {|
6990 !align=center {{table_header_cells}}
6991 |-
6992 |align=center {{table_cells}}
6993 |}
6994 !! html/php
6995 <table>
6996 <tr>
6997 <th align="center" style="color:red;">Foo</th>
6998 <th style="color:red;"><i>Bar</i></th>
6999 <th style="color:brown;"><i>Foo</i> and Baz
7000 </th></tr>
7001 <tr>
7002 <td align="center" style="color:red;">Foo</td>
7003 <td style="color:red;"><i>Bar</i></td>
7004 <td style="color:brown;"><i>Foo</i> and Baz
7005 </td></tr></table>
7006
7007 !! html/parsoid
7008 <table>
7009 <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>
7010 <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>
7011 </tbody></table>
7012 !! end
7013
7014 !! test
7015 4. Template-generated table cell attributes and cell content inside a templated table
7016 !! wikitext
7017 {{tbl-start}}
7018 !align=center {{table_header_cells}}
7019 |-
7020 |align=center {{table_cells}}
7021 {{tbl-end}}
7022 !! html/php
7023 <table>
7024 <tr>
7025 <th align="center" style="color:red;">Foo</th>
7026 <th style="color:red;"><i>Bar</i></th>
7027 <th style="color:brown;"><i>Foo</i> and Baz
7028 </th></tr>
7029 <tr>
7030 <td align="center" style="color:red;">Foo</td>
7031 <td style="color:red;"><i>Bar</i></td>
7032 <td style="color:brown;"><i>Foo</i> and Baz
7033 </td></tr></table>
7034
7035 !! html/parsoid
7036 <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}}]}'>
7037 <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>
7038 <tr>
7039 <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>
7040 </tbody></table>
7041 !! end
7042
7043 ## Edge case fix to prevent future regressions
7044 !! test
7045 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7046 !! wikitext
7047 {|
7048 |{{table_attribs_7}}
7049 |}
7050 <references />
7051 !! html/parsoid
7052 <table>
7053 <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","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7054 </tbody></table>
7055 <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>
7056 !! end
7057
7058 !! test
7059 Table with row followed by newlines and table heading
7060 !! options
7061 parsoid=wt2html,html2html
7062 !! wikitext
7063 {|
7064 |-
7065
7066 !foo
7067 |}
7068 !! html/*
7069 <table>
7070
7071
7072 <tr>
7073 <th>foo
7074 </th></tr></table>
7075
7076 !! end
7077
7078 !! test
7079 Table with empty line following the start tag
7080 !! options
7081 parsoid=wt2html,html2html
7082 !! wikitext
7083 {|
7084
7085 |-
7086 |foo
7087 |}
7088 !! html/*
7089 <table>
7090
7091
7092 <tr>
7093 <td>foo
7094 </td></tr></table>
7095
7096 !! end
7097
7098 !! test
7099 Table attributes with empty value
7100 !! options
7101 parsoid=wt2html,html2html
7102 !! wikitext
7103 {|
7104 | style=|hello
7105 |}
7106 !! html/php
7107 <table>
7108 <tr>
7109 <td style="">hello
7110 </td></tr></table>
7111
7112 !! html/parsoid
7113 <table>
7114 <tbody><tr><td style="">hello</td></tr>
7115 </tbody></table>
7116 !! end
7117
7118 !! test
7119 Wikitext table with a lot of comments
7120 !! wikitext
7121 {|
7122 <!-- c0 -->
7123 |foo
7124 <!-- c1 -->
7125 |-<!-- c2 -->
7126 <!-- c3 -->
7127 |<!-- c4 -->
7128 <!-- c5 -->
7129 |}
7130 !! html
7131 <table>
7132 <tr>
7133 <td>foo
7134 </td></tr>
7135 <tr>
7136 <td>
7137 </td></tr></table>
7138
7139 !! end
7140
7141 !! test
7142 Wikitext table comments represented in parsoid dom
7143 !! wikitext
7144 {|<!--c1--><!--c2-->
7145 |-<!--c3-->
7146 |x
7147 |}
7148 !! html/php+tidy
7149 <table>
7150
7151 <tbody><tr>
7152 <td>x
7153 </td></tr></tbody></table>
7154 !! html/parsoid
7155 <table><!--c1--><!--c2-->
7156 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7157 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7158 </tbody></table>
7159 !! end
7160
7161 !! test
7162 Wikitext table with double-line table cell
7163 !! wikitext
7164 {|
7165 |a
7166 b
7167 |}
7168 !! html
7169 <table>
7170 <tr>
7171 <td>a
7172 <p>b
7173 </p>
7174 </td></tr></table>
7175
7176 !! end
7177
7178 !! test
7179 Table cell with a single comment
7180 !! wikitext
7181 {|
7182 |<!-- c1 -->
7183 |a
7184 |}
7185 !! html
7186 <table>
7187 <tr>
7188 <td>
7189 </td>
7190 <td>a
7191 </td></tr></table>
7192
7193 !! end
7194
7195 !! test
7196 Table-cell after a comment-only-empty-line
7197 !! wikitext
7198 {|
7199 |a
7200 <!--c1-->
7201 <!--c2-->|b
7202 |}
7203 !! html
7204 <table>
7205 <tr>
7206 <td>a
7207 </td>
7208 <td>b
7209 </td></tr></table>
7210
7211 !! html/parsoid
7212 <table>
7213 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7214 <!--c1-->
7215 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7216 </tbody></table>
7217
7218 !! end
7219
7220 !! test
7221 Build table with {{!}}
7222 !! wikitext
7223 {{{!}} class="wikitable"
7224 !header
7225 !second header
7226 {{!}}- style="color:red;"
7227 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7228 {{!}}}
7229 !! html
7230 <table class="wikitable">
7231 <tr>
7232 <th>header
7233 </th>
7234 <th>second header
7235 </th></tr>
7236 <tr style="color:red;">
7237 <td>data</td>
7238 <td style="color:red;">second data
7239 </td></tr></table>
7240
7241 !! end
7242
7243 !! test
7244 Build table with pipe as data
7245 !! wikitext
7246 {| class="wikitable"
7247 !header
7248 !second header
7249 |- style="color:red;"
7250 |data|| style="color:red;" |second data
7251 |-
7252 | style="color:red;" |data with | || style="color:red;" | second data with |
7253 |-
7254 ||data with | |||second data with |
7255 |}
7256 !! html
7257 <table class="wikitable">
7258 <tr>
7259 <th>header
7260 </th>
7261 <th>second header
7262 </th></tr>
7263 <tr style="color:red;">
7264 <td>data</td>
7265 <td style="color:red;">second data
7266 </td></tr>
7267 <tr>
7268 <td style="color:red;">data with |</td>
7269 <td style="color:red;">second data with |
7270 </td></tr>
7271 <tr>
7272 <td>data with |</td>
7273 <td>second data with |
7274 </td></tr></table>
7275
7276 !! end
7277
7278 !! test
7279 Build table with wikilink
7280 !! wikitext
7281 {| class="wikitable"
7282 !header||second header
7283 |- style="color:red;"
7284 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7285 |-
7286 |data||second data [[Main Page|link|text with pipe]]
7287 |}
7288 !! html
7289 <table class="wikitable">
7290 <tr>
7291 <th>header</th>
7292 <th>second header
7293 </th></tr>
7294 <tr style="color:red;">
7295 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7296 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7297 </td></tr>
7298 <tr>
7299 <td>data</td>
7300 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7301 </td></tr></table>
7302
7303 !! end
7304
7305 # The expected HTML structure in this test is debatable. The PHP parser does
7306 # not parse this kind of table at all. The main focus for Parsoid is on
7307 # round-tripping, so this output is ok for now. TODO: revisit!
7308 !! test
7309 Wikitext table with html-syntax row
7310 !! wikitext
7311 {|
7312 |-
7313 <td>foo</td>
7314 |}
7315 !! html/parsoid
7316 <table>
7317 <tbody>
7318 <tr>
7319 <td>foo</td></tr></tbody></table>
7320 !! end
7321
7322 ## Remex doesn't account for fostered content.
7323 !! test
7324 Fostered content in tables: Plain text
7325 !! options
7326 parsoid=wt2html
7327 !! wikitext
7328 {|
7329 |-
7330 a
7331 |}
7332 !! html/php
7333 <table>
7334
7335 a
7336 </table>
7337
7338 !! html/php+tidy
7339
7340
7341 a
7342 <table></table>
7343 !! html/parsoid
7344 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7345 a</p>
7346 <table>
7347 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7348 !! end
7349
7350 !! test
7351 Fostered content in tables: Lists
7352 !! options
7353 parsoid=wt2html,html2html
7354 !! wikitext
7355 {|
7356 |-
7357 *a
7358 |}
7359 !! html/php
7360 <table>
7361
7362 <ul><li>a</li></ul>
7363 </table>
7364
7365 !! html/php+tidy
7366 <ul><li>a</li></ul><table>
7367
7368
7369 </table>
7370 !! html/parsoid
7371 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7372 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7373
7374 </tr></tbody></table>
7375 !! end
7376
7377 !! test
7378 Template generated table cell with attributes
7379 !! wikitext
7380 {|
7381 |-
7382 {{table_attribs_4}} ||a||b
7383 |}
7384 !! html/php+tidy
7385 <table>
7386
7387 <tbody><tr>
7388 <td style="background-color:#DC241f;" width="10px"></td>
7389 <td>a</td>
7390 <td>b
7391 </td></tr></tbody></table>
7392 !! html/parsoid
7393 <table>
7394 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7395 <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>
7396 !! end
7397
7398 !! test
7399 Parsoid: Round-trip tables directly followed by content (T53219)
7400 !! options
7401 parsoid=wt2html,wt2wt
7402 !! wikitext
7403 {|
7404 |foo
7405 |} bar
7406
7407 {|
7408 |baz
7409 |}<b>quux</b>
7410 !! html+tidy
7411 <table>
7412 <tbody><tr>
7413 <td>foo
7414 </td></tr></tbody></table><p> bar
7415 </p><table>
7416 <tbody><tr>
7417 <td>baz
7418 </td></tr></tbody></table><p><b>quux</b>
7419 </p>
7420 !! end
7421
7422 !! test
7423 Parsoid: Default to a newline after tables in new content (T53219)
7424 !! options
7425 parsoid=html2wt
7426 !! html/parsoid
7427 <table><tbody>
7428 <tr><td>foo</td></tr></tbody></table> bar
7429 <table><tbody>
7430 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7431 !! wikitext
7432 {|
7433 |foo
7434 |}
7435 <nowiki> </nowiki>bar
7436 {|
7437 |baz
7438 |}
7439 '''quux'''
7440 !! end
7441
7442 !! test
7443 Parsoid: Row-syntax table headings followed by comment & table cells
7444 !! options
7445 parsoid=wt2html,wt2wt
7446 !! wikitext
7447 {|
7448 !foo||bar
7449 <!-- foo --> ||baz||quux
7450 |}
7451 !! html/php
7452 <table>
7453 <tr>
7454 <th>foo</th>
7455 <th>bar
7456 </th>
7457 <td>baz</td>
7458 <td>quux
7459 </td></tr></table>
7460
7461 !! html/parsoid
7462 <table>
7463 <tbody><tr><th>foo</th><th>bar
7464 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7465 </tbody></table>
7466 !! end
7467
7468 !!test
7469 Parsoid: Recover better from broken table attributes
7470 !!options
7471 parsoid=wt2html
7472 !!wikitext
7473 {| class="foo
7474 | class="bar" |
7475 foo
7476 |}
7477 !!html/php+tidy
7478 <table class="foo">
7479 <tbody><tr>
7480 <td class="bar">
7481 <p>foo
7482 </p>
7483 </td></tr></tbody></table>
7484 !!html/parsoid
7485 <table class="foo">
7486 <tr>
7487 <td class="bar">
7488 <p>foo</p></td></tr>
7489 </tbody></table>
7490 !!end
7491
7492 !! test
7493 Tables: Digest broken attributes on table and tr tag
7494 !! options
7495 parsoid=wt2html
7496 !! wikitext
7497 {| || |} ++
7498 |- || || ++ --
7499 |- > [
7500 |}
7501 !! html
7502 <table>
7503 <tbody>
7504 <tr class='mw-empty-elt'></tr>
7505 <tr class='mw-empty-elt'></tr>
7506 </tbody></table>
7507 !! end
7508
7509 !! test
7510 Table with missing opening <tr> tag
7511 !! options
7512 parsoid=wt2html,wt2wt
7513 !! wikitext
7514 <table>
7515 <td>foo</td>
7516 </tr>
7517 </table>
7518 !! html+tidy
7519 <table>
7520 <tbody><tr><td>foo</td>
7521 </tr>
7522 </tbody></table>
7523 !! end
7524
7525 # T137406: Whitespace in the HTML
7526 !! test
7527 1. Generate correct wikitext for tables with thead/tbody/tfoot
7528 !! options
7529 parsoid=html2wt
7530 !! html/parsoid
7531 <table>
7532 <caption>Test</caption>
7533 <thead>
7534 <tr>
7535 <th>Month</th>
7536 <th>Savings</th>
7537 </tr>
7538 </thead>
7539 <tbody>
7540 <tr>
7541 <td>January</td>
7542 <td>$100</td>
7543 </tr>
7544 <tr>
7545 <td>February</td>
7546 <td>$80</td>
7547 </tr>
7548 </tbody>
7549 <tfoot>
7550 <tr>
7551 <td>Sum</td>
7552 <td>$180</td>
7553 </tr>
7554 </tfoot>
7555 </table>
7556 !! wikitext
7557 {|
7558 |+Test
7559 !Month
7560 !Savings
7561 |-
7562 |January
7563 |$100
7564 |-
7565 |February
7566 |$80
7567 |-
7568 |Sum
7569 |$180
7570 |}
7571 !! html/php+tidy
7572 <table>
7573 <caption>Test
7574 </caption>
7575 <tbody><tr>
7576 <th>Month
7577 </th>
7578 <th>Savings
7579 </th></tr>
7580 <tr>
7581 <td>January
7582 </td>
7583 <td>$100
7584 </td></tr>
7585 <tr>
7586 <td>February
7587 </td>
7588 <td>$80
7589 </td></tr>
7590 <tr>
7591 <td>Sum
7592 </td>
7593 <td>$180
7594 </td></tr></tbody></table>
7595 !! end
7596
7597 # T137406: No whitespace in the HTML
7598 !! test
7599 2. Generate correct wikitext for tables with thead/tbody/tfoot
7600 !! options
7601 parsoid=html2wt
7602 !! html/parsoid
7603 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7604 !! wikitext
7605 {|
7606 !heading
7607 |-
7608 |foo
7609 |}
7610 !! end
7611
7612 !! test
7613 Wikitext tables can be nested inside HTML tables
7614 !! options
7615 parsoid=html2wt
7616 !! html
7617 <table data-parsoid='{"stx":"html"}'>
7618 <tr><td>
7619 <table>
7620 <tr><td>foo</td></tr>
7621 </table>
7622 </td></tr>
7623 </table>
7624 !! wikitext
7625 <table>
7626 <tr><td>
7627 {|
7628 |foo
7629 |}
7630 </td></tr>
7631 </table>
7632 !! end
7633
7634 ###
7635 ### Internal links
7636 ###
7637 !! test
7638 Plain link, capitalized
7639 !! wikitext
7640 [[Main Page]]
7641 !! html
7642 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7643 </p>
7644 !! end
7645
7646 !! test
7647 Plain link, uncapitalized
7648 !! wikitext
7649 [[main Page]]
7650 !! html
7651 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link
7657 !! wikitext
7658 [[Main Page|The Main Page]]
7659 !! html
7660 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7661 </p>
7662 !! end
7663
7664 !! test
7665 Piped link with comment in link text
7666 !! wikitext
7667 [[Main Page|The Main<!--front--> Page]]
7668 !! html
7669 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7670 </p>
7671 !! end
7672
7673 !! test
7674 Piped link with multiple pipe characters in link text
7675 !! wikitext
7676 [[Main Page||The|Main|Page|]]
7677 !! html/php
7678 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7679 </p>
7680 !! html/parsoid
7681 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7682 !! end
7683
7684 !! test
7685 Piped link with no link text
7686 !! wikitext
7687 [[Thomas Bek (bishop of St David's)|]]
7688 !! html/php
7689 <p>[[Thomas Bek (bishop of St David's)|]]
7690 </p>
7691 !! html/parsoid
7692 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7693 !! end
7694
7695 !! test
7696 Piped link with empty link text
7697 !! wikitext
7698 [[Main Page|<nowiki/>]] - empty nowiki
7699 [[Main Page| ]] - empty space
7700 [[Main Page|&nbsp;]] - empty non breaking space
7701 !! html/php
7702 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7703 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7704 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7705 </p>
7706 !! html/parsoid
7707 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7708 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7709 <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>
7710 !! end
7711
7712 !! test
7713 Broken link
7714 !! wikitext
7715 [[Zigzagzogzagzig]]
7716 !! html
7717 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7718 </p>
7719 !! end
7720
7721 !! test
7722 Broken link with fragment
7723 !! wikitext
7724 [[Zigzagzogzagzig#zug]]
7725 !! html
7726 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7727 </p>
7728 !! end
7729
7730 !! test
7731 Special page link with fragment
7732 !! wikitext
7733 [[Special:Version#anchor]]
7734 !! html
7735 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7736 </p>
7737 !! end
7738
7739 !! test
7740 Nonexistent special page link with fragment
7741 !! wikitext
7742 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7743 !! html
7744 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7745 </p>
7746 !! end
7747
7748 !! test
7749 Link with prefix
7750 !! wikitext
7751 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7752 !! html
7753 <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>
7754 </p>
7755 !! end
7756
7757 !! test
7758 Link with suffix
7759 !! wikitext
7760 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7761 !! html
7762 <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>!!!
7763 </p>
7764 !! end
7765
7766 !! article
7767 prefixed article
7768 !! text
7769 Some text
7770 !! endarticle
7771
7772 !! test
7773 T45661: Piped links with identical prefixes
7774 !! wikitext
7775 [[prefixed article|prefixed articles with spaces]]
7776
7777 [[prefixed article|prefixed articlesaoeu]]
7778
7779 [[Main Page|Main Page test]]
7780 !! html
7781 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7782 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7783 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7784 </p>
7785 !! end
7786
7787
7788 !! test
7789 Link with HTML entity in suffix / tail
7790 !! wikitext
7791 [[Main Page]]&quot;, [[Main Page]]&#97;
7792 !! html/php
7793 <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;
7794 </p>
7795 !! html/parsoid
7796 <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>
7797 !! end
7798
7799 !! test
7800 Link with 3 brackets
7801 !! wikitext
7802 [[[Main Page]]]
7803 Foo [[[Main Page]]]
7804 !! html
7805 <p>[[[Main Page]]]
7806 Foo [[[Main Page]]]
7807 </p>
7808 !! end
7809
7810 !! test
7811 Link with 4 brackets
7812 !! wikitext
7813 [[[[Main Page]]]]
7814 !! html
7815 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7816 </p>
7817 !! end
7818
7819 !! test
7820 Piped link with 3 brackets
7821 !! wikitext
7822 [[[main page|the main page]]]
7823 !! html
7824 <p>[[[main page|the main page]]]
7825 </p>
7826 !! end
7827
7828 !! test
7829 Piped link with extlink-like text
7830 !! wikitext
7831 [[Main Page|[bar]]]
7832 [[Main Page|This is a [bar]]]
7833 [[Main Page|[bar]]
7834 !! html/php
7835 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7836 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7837 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7838 </p>
7839 !! html/parsoid
7840 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7841 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7842 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7843 !! end
7844
7845 !! test
7846 Link with multiple pipes
7847 !! wikitext
7848 [[Main Page|The|Main|Page]]
7849 !! html
7850 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7851 </p>
7852 !! end
7853
7854 !! test
7855 Anchor containing a #. (T65430)
7856 !! config
7857 wgFragmentMode=[ 'html5', 'legacy' ]
7858 !! wikitext
7859 [[Main Page#And#Link]]
7860 !! html/php
7861 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7862 </p>
7863 !! html/parsoid
7864 <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>
7865 !! end
7866
7867 !! test
7868 Link to namespaces
7869 !! wikitext
7870 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7871 !! html
7872 <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>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Link with space in namespace
7878 !! wikitext
7879 [[User talk:Foo bar]]
7880 !! html
7881 <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>
7882 </p>
7883 !! end
7884
7885 !! article
7886 MemoryAlpha:AlphaTest
7887 !! text
7888 This is an article in the MemoryAlpha namespace
7889 (which shadows the memoryalpha interwiki link).
7890 !! endarticle
7891
7892 !! test
7893 Namespace takes precedence over interwiki link (T53680)
7894 !! wikitext
7895 [[MemoryAlpha:AlphaTest]]
7896 !! html
7897 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7898 </p>
7899 !! end
7900
7901 # The previous test doesn't work correctly in html2*, due to not recognizing the
7902 # link as an internal one. This one checks for the correct behavior.
7903 !! test
7904 Link to namespace preferred over interwiki with correct rel attribute
7905 !! options
7906 parsoid=html2wt,html2html
7907 !! html/parsoid
7908 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7909 !! wikitext
7910 [[MemoryAlpha:AlphaTest]]
7911 !! end
7912
7913 !! test
7914 Piped link to namespace
7915 !! wikitext
7916 [[Meta:Disclaimers|The disclaimers]]
7917 !! html
7918 <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>
7919 </p>
7920 !! end
7921
7922 !! test
7923 Link containing }
7924 !! wikitext
7925 [[Usually caused by a typo (oops}]]
7926 !! html
7927 <p>[[Usually caused by a typo (oops}]]
7928 </p>
7929 !! end
7930
7931 !! article
7932 7% Solution
7933 !! text
7934 Just a test of an article title containing a percent.
7935 !! endarticle
7936
7937 !! test
7938 Link containing % (not as a hex sequence)
7939 !! wikitext
7940 [[7% Solution]]
7941 [[7% Solution|7%25 Solution]]
7942 !! html/php
7943 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7944 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7948 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7949 !! end
7950
7951 # note that the parsoid HTML is identical to the previous test output,
7952 # so the previous test ensures that the html2wt mode will generate the
7953 # "not as a hex sequence" wikitext.
7954 !! test
7955 Link containing % as a single hex sequence interpreted to char
7956 !! options
7957 parsoid=wt2wt,wt2html,html2html
7958 !! wikitext
7959 [[7%25 Solution]]
7960 [[7%25 Solution|7%25 Solution]]
7961 !! html/php
7962 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7963 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7964 </p>
7965 !! html/parsoid
7966 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7967 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7968 !!end
7969
7970 !! test
7971 Link containing % as a double hex sequence interpreted to hex sequence
7972 !! wikitext
7973 [[7%2525 Solution]]
7974 !! html
7975 <p>[[7%2525 Solution]]
7976 </p>
7977 !!end
7978
7979 ## Example for such a section: == < ==
7980 !! test
7981 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7982 !! config
7983 wgFragmentMode=[ 'html5', 'legacy' ]
7984 !! wikitext
7985 [[%23%3c]][[%23%3e]]
7986 !! html/php
7987 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7988 </p>
7989 !! html/parsoid
7990 <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>
7991 !! end
7992
7993 ## Example for such a section: == < ==
7994 !! test
7995 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7996 !! config
7997 wgFragmentMode=[ 'legacy' ]
7998 !! wikitext
7999 [[%23%3c]][[%23%3e]]
8000 !! html/php
8001 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8002 </p>
8003 !! end
8004
8005 !! test
8006 Link containing "<#" and ">#" as a hex sequences
8007 !! wikitext
8008 [[%3c%23]][[%3e%23]]
8009 !! html
8010 <p>[[%3c%23]][[%3e%23]]
8011 </p>
8012 !! end
8013
8014 !! test
8015 Link containing an equals sign
8016 !! wikitext
8017 [[Special:BookSources/isbn=4-00-026157-6]]
8018 !! html/php
8019 <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>
8020 </p>
8021 !! html/parsoid
8022 <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>
8023 !! end
8024
8025 !! article
8026 Foo~bar
8027 !! text
8028 Just a test of an article title containing a tilde.
8029 !! endarticle
8030
8031 # note that links containing signatures, like [[Foo~~~~]], are
8032 # massaged by the pre-save transform (PST) and so the tildes are never
8033 # seen by the parser.
8034 !! test
8035 Link containing a tilde
8036 !! wikitext
8037 [[Foo~bar]]
8038 !! html/php
8039 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8040 </p>
8041 !! html/parsoid
8042 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8043 !! end
8044
8045 !! test
8046 Link containing double-single-quotes '' (T6598)
8047 !! wikitext
8048 [[Lista d''e paise d''o munno]]
8049 !! html/php
8050 <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>
8051 </p>
8052 !! html/parsoid
8053 <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>
8054 !! end
8055
8056 !! test
8057 Link containing double quotes and spaces
8058 !! wikitext
8059 [[Cool "Gator"]]
8060 !! html/php
8061 <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>
8062 </p>
8063 !! html/parsoid
8064 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8065 !! end
8066
8067 !! test
8068 File containing double quotes and spaces
8069 !! wikitext
8070 [[File:Cool "Gator".png]]
8071 !! html/parsoid
8072 <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>
8073 !! end
8074
8075 !! test
8076 Redirect containing double quotes and spaces
8077 !! wikitext
8078 #REDIRECT [[Cool "Gator"]]
8079 !! html/parsoid
8080 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8081 !! end
8082
8083 !! test
8084 Link containing double-single-quotes '' in text (T6598 sanity check)
8085 !! wikitext
8086 Some [[Link|pretty ''italics'' and stuff]]!
8087 !! html/php
8088 <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>!
8089 </p>
8090 !! html/parsoid
8091 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8092 !! end
8093
8094 !! test
8095 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8096 !! wikitext
8097 ''Some [[Link|pretty ''italics'' and stuff]]!''
8098 !! html
8099 <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>
8100 </p>
8101 !! end
8102
8103 !! test
8104 Link with double quotes in title part (literal) and alternate part (interpreted)
8105 !! wikitext
8106 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8107
8108 [[''Pentecoste'']]
8109
8110 [[''Pentecoste''|Pentecoste]]
8111
8112 [[''Pentecoste''|''Pentecoste'']]
8113 !! html/php
8114 <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>
8115 </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>
8116 </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>
8117 </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>
8118 </p>
8119 !! html/parsoid
8120 <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>
8121 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8122 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8123 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8124 !! end
8125
8126 !! test
8127 Broken image links with HTML captions (T41700)
8128 !! wikitext
8129 [[File:Nonexistent|<script></script>]]
8130 [[File:Nonexistent|100x100px|<script></script>]]
8131 [[File:Nonexistent|&lt;]]
8132 [[File:Nonexistent|a<i>b</i>c]]
8133 !! html/php
8134 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8135 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8136 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8137 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8138 </p>
8139 !! html/parsoid
8140 <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>
8141 <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>
8142 <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>
8143 <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>
8144 !! end
8145
8146 !! test
8147 Plain link to URL
8148 !! wikitext
8149 [[http://www.example.com]]
8150 !! html/php
8151 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8152 </p>
8153 !! html/parsoid
8154 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8155 !! end
8156
8157 !! test
8158 Plain link to URL with link text
8159 !! wikitext
8160 [[http://www.example.com Link text]]
8161 !! html
8162 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8163 </p>
8164 !! end
8165
8166 !! test
8167 Plain link to protocol-relative URL
8168 !! wikitext
8169 [[//www.example.com]]
8170 !! html/php
8171 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8172 </p>
8173 !! html/parsoid
8174 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8175 !! end
8176
8177 !! test
8178 Plain link to protocol-relative URL with link text
8179 !! wikitext
8180 [[//www.example.com Link text]]
8181 !! html
8182 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8183 </p>
8184 !! end
8185
8186 !! test
8187 Plain link to page with question mark in title
8188 !! wikitext
8189 [[A?b]]
8190
8191 [[A?b|Baz]]
8192 !! html
8193 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8194 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8195 </p>
8196 !! end
8197
8198 # I'm fairly sure the expected result here is wrong.
8199 # We want these to be URL links, not pseudo-pages with URLs for titles....
8200 # However the current output is also pretty screwy.
8201 #
8202 # ----
8203 # I'm changing it to match the current output--it arguably makes more
8204 # sense in the light of the test above. Old expected result was:
8205 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8206 #</p>
8207 # But I think this test is bordering on "garbage in, garbage out" anyway.
8208 # -- wtm
8209 !! test
8210 Piped link to URL
8211 !! wikitext
8212 Piped link to URL: [[http://www.example.com|an example URL]]
8213 !! html/php
8214 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8215 </p>
8216 !! html/parsoid
8217 <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>
8218 !! end
8219
8220 !! test
8221 Plain link in template argument
8222 !! options
8223 parsoid=wt2html
8224 !! wikitext
8225 {{echo|[http://www.example.com |123]}}
8226
8227 {{echo|[[http://www.example.com |123]]}}
8228
8229 {{echo|[[http://www.example.com |123]}}
8230
8231 {{echo|[http://www.example.com |123]]}}
8232 !! html/php
8233 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8234 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8235 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8236 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8237 </p>
8238 !! html/parsoid
8239 <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>
8240
8241 <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>
8242
8243 <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>
8244
8245 <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>
8246 !! end
8247
8248 !! test
8249 T2002: [[page|http://url/]] should link to page, not http://url/
8250 !! wikitext
8251 [[Main Page|http://url/]]
8252 !! html/php
8253 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8254 </p>
8255 !! html/parsoid
8256 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8257 !! end
8258
8259 # Parsoid does not mark self-links, by design.
8260 !! test
8261 T2337: Escaped self-links should be bold
8262 !! options
8263 title=[[Bug462]]
8264 !! wikitext
8265 [[Bu&#103;462]] [[Bug462]]
8266 !! html/php+tidy
8267 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8268 </p>
8269 !! html/parsoid
8270 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8271 !! end
8272
8273 !! test
8274 Self-link to section should not be bold
8275 !! options
8276 title=[[Main Page]]
8277 !! wikitext
8278 [[Main Page#section]]
8279 !! html
8280 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8281 </p>
8282 !! end
8283
8284 !! article
8285 00
8286 !! text
8287 This is 00.
8288 !! endarticle
8289
8290 !!test
8291 Self-link to numeric title
8292 !!options
8293 title=[[0]]
8294 !! wikitext
8295 [[0]]
8296 !! html
8297 <p><a class="mw-selflink selflink">0</a>
8298 </p>
8299 !!end
8300
8301 !!test
8302 Link to numeric-equivalent title
8303 !!options
8304 title=[[0]]
8305 !! wikitext
8306 [[00]]
8307 !! html
8308 <p><a href="/wiki/00" title="00">00</a>
8309 </p>
8310 !!end
8311
8312 !! test
8313 <nowiki> inside a link
8314 !! wikitext
8315 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8316 !! html
8317 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8318 </p>
8319 !! end
8320
8321 !! test
8322 Non-breaking spaces in title
8323 !! wikitext
8324 [[&nbsp; Main &nbsp; Page &nbsp;]]
8325 !! html
8326 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8327 </p>
8328 !!end
8329
8330 # Add new article for the test below so that it doesn't red-link
8331 !! article
8332 Foo bar baz
8333 !! text
8334 boo
8335 !! endarticle
8336
8337 !! test
8338 Multiple spaces in titles should normalize to a single underscore
8339 !! options
8340 parsoid=wt2html,wt2wt
8341 !! wikitext
8342 [[Foo bar baz|x]]
8343 [[Foo bar baz|x]]
8344 [[Foo bar baz|x]]
8345 !! html/php
8346 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8347 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8348 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8349 </p>
8350 !! html/parsoid
8351 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8352 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8353 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8354 </p>
8355 !! end
8356
8357 !! test
8358 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8359 !! options
8360 language=ca
8361 !! wikitext
8362 '''[[Main Page]]'''
8363 !! html
8364 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8370 !! options
8371 language=ca
8372 !! wikitext
8373 ''[[Main Page]]''
8374 !! html
8375 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8376 </p>
8377 !! end
8378
8379 !! test
8380 Internal link with en linktrail: no apostrophes (T29473)
8381 !! options
8382 language=en
8383 !! wikitext
8384 [[Something]]'nice
8385 !! html
8386 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8387 </p>
8388 !! end
8389
8390 !! test
8391 Internal link with ca linktrail with apostrophes (T29473)
8392 !! options
8393 language=ca
8394 !! wikitext
8395 [[Something]]'nice
8396 !! html
8397 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8398 </p>
8399 !! end
8400
8401 !! test
8402 Internal link with kaa linktrail with apostrophes (T29473)
8403 !! options
8404 language=kaa
8405 !! wikitext
8406 [[Something]]'nice
8407 !! html
8408 <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>
8409 </p>
8410 !! end
8411
8412 !! test
8413 Link with multiple ":" in a subpage-supporting namespace (T65636)
8414 !! wikitext
8415 [[User:Foo/Test/63636:Bar|Test]]
8416 !! html/php
8417 <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>
8418 </p>
8419 !! html/parsoid
8420 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8421 !! end
8422
8423 ## Mainly a sanity check for Parsoid
8424 !! test
8425 Handle title parsing for subpages
8426 !! options
8427 title=[[/123123]]
8428 subpage
8429 !! wikitext
8430 123
8431 !! html/php
8432 <p>123
8433 </p>
8434 !! html/parsoid
8435 <p>123</p>
8436 !! end
8437
8438 !! article
8439 User:Test/123
8440 !! text
8441 test 123
8442 !! endarticle
8443
8444 !! test
8445 Link to a subpage from a namespace other than main
8446 !! options
8447 title=[[User:Test]]
8448 subpage
8449 !! wikitext
8450 [[/123]]
8451 !! html/php
8452 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8453 </p>
8454 !! html/parsoid
8455 <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>
8456 !! end
8457
8458 !! test
8459 Ensure that transclusion titles are not url-decoded
8460 !! options
8461 subpage title=[[Test]]
8462 parsoid=wt2html
8463 !! wikitext
8464 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8465 !! html/php
8466 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8467 </p>
8468 !! html/parsoid
8469 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8470 !! end
8471
8472 !! test
8473 Purely hash wikilink
8474 !! options
8475 title=[[User:Test/123]]
8476 subpage
8477 !! wikitext
8478 [[#a|b]]
8479 !! html/php
8480 <p><a href="#a">b</a>
8481 </p>
8482 !! html/parsoid
8483 <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>
8484 !! end
8485
8486 !! test
8487 Serialization of purely hash wikilink
8488 !! options
8489 title=[[User:Test/123]]
8490 subpage
8491 parsoid=html2wt
8492 !! html/parsoid
8493 <p><a href="#a">[[</a></p>
8494 !! wikitext
8495 [[#a|<nowiki>[[</nowiki>]]
8496 !! html/php
8497 <p><a href="#a">[[</a>
8498 </p>
8499 !! end
8500
8501 !! test
8502 1. Interaction of linktrail and template encapsulation
8503 !! wikitext
8504 {{echo|[[Foo]]}}l
8505 !! html/parsoid
8506 <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>
8507 !! end
8508
8509 !! test
8510 2. Interaction of linktrail and template encapsulation
8511 !! options
8512 parsoid
8513 !! wikitext
8514 {{echo|Some [[Fool]]}}s
8515 !! html
8516 <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>
8517 !! end
8518
8519 !! test
8520 3. Interaction of linktrail and template encapsulation
8521 !! options
8522 parsoid
8523 !! wikitext
8524 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8525 !! html
8526 <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>
8527 !! end
8528
8529 !! article
8530 Söfnuður
8531 !! text
8532 Test.
8533 !! endarticle
8534
8535 !! test
8536 Internal link with is link prefix
8537 !! options
8538 language=is
8539 !! wikitext
8540 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8541 !! html
8542 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8543 </p>
8544 !! end
8545
8546 !! article
8547 Mótmælendatrú
8548 !! text
8549 Test.
8550 !! endarticle
8551
8552 !! test
8553 Internal link with is link trail and link prefix
8554 !! options
8555 language=is
8556 !! wikitext
8557 [[mótmælendatrú|xxx]]ar
8558 [[mótmælendatrú]]ar
8559 mótmælenda[[söfnuður]]
8560 mótmælenda[[söfnuður|söfnuðir]]
8561 mótmælenda[[söfnuður|söfnuðir]]xxx
8562 !! html
8563 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8564 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8565 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8566 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8567 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8568 </p>
8569 !! end
8570
8571 !! test
8572 Parsoid link trail escaping
8573 !! options
8574 parsoid=html2wt,html2html
8575 !! html/parsoid
8576 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8577 !! wikitext
8578 [[apple]]<nowiki/>s
8579 !! end
8580
8581 !! test
8582 Parsoid link prefix escaping
8583 !! options
8584 language=is
8585 parsoid=html2wt,html2html
8586 !! html/parsoid
8587 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8588 !! wikitext
8589 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8590 !! end
8591
8592 !! test
8593 Parsoid link bracket escaping
8594 !! options
8595 parsoid=html2wt,html2html
8596 !! html/parsoid
8597 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8598 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8599 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8600 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8601 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8602 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8603 !! wikitext
8604 [[Test]]
8605
8606 [<nowiki/>[[Test]]]
8607
8608 [[[[Test]]]]
8609
8610 [[[<nowiki/>[[Test]]]]]
8611
8612 [[[[[[Test]]]]]]
8613
8614 [[[[[<nowiki/>[[Test]]]]]]]
8615 !! end
8616
8617 !! test
8618 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8619 !! wikitext
8620 [[Foo| bar]]
8621
8622 [[Foo| ''bar'']]
8623
8624 [http://wp.org foo]
8625
8626 [http://wp.org ''foo'']
8627 !! html
8628 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8629 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8630 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8631 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8632 </p>
8633 !! end
8634
8635 !! test
8636 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8637 !! wikitext
8638 [[Foo|{{echo|a}} b {{echo|c}}]]
8639 !! html/parsoid
8640 <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>
8641 !! end
8642
8643 !! test
8644 Link with angle bracket after anchor
8645 !! config
8646 wgFragmentMode=[ 'html5', 'legacy' ]
8647 !! wikitext
8648 [[Foo#<bar>]]
8649 !! html/php
8650 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8651 </p>
8652 !! html/parsoid
8653 <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>
8654 !! end
8655
8656 !! test
8657 Link with angle bracket after anchor (legacy)
8658 !! config
8659 wgFragmentMode=[ 'legacy' ]
8660 !! wikitext
8661 [[Foo#<bar>]]
8662 !! html/php
8663 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8664 </p>
8665 !! end
8666
8667 ###
8668 ### Interwiki links (see maintenance/interwiki.sql)
8669 ###
8670
8671 !! test
8672 Inline interwiki link
8673 !! options
8674 parsoid=wt2html,wt2wt,html2html
8675 !! wikitext
8676 [[MeatBall:SoftSecurity]]
8677 !! html/php
8678 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8679 </p>
8680 !! html/parsoid
8681 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8682 !! end
8683
8684 !! test
8685 Inline interwiki link with empty title (T4372)
8686 !! options
8687 parsoid=wt2html,wt2wt,html2html
8688 !! wikitext
8689 [[MeatBall:]]
8690 !! html/php
8691 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8692 </p>
8693 !! html/parsoid
8694 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8695 !! end
8696
8697 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8698 !! test
8699 Interwiki link encoding conversion (T3636)
8700 !! options
8701 parsoid=wt2html,wt2wt
8702 !! wikitext
8703 *[[Wikipedia:ro:Olteni&#0355;a]]
8704 *[[Wikipedia:ro:Olteni&#355;a]]
8705 !! html
8706 <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>
8707 <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>
8708
8709 !! html/php+tidy
8710 <ul>
8711 <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>
8712 <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>
8713 </ul>
8714 !! html/parsoid
8715 <ul>
8716 <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>
8717 <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>
8718 </ul>
8719 !! end
8720
8721 !! test
8722 Interwiki link with fragment (T4130)
8723 !! wikitext
8724 [[MeatBall:SoftSecurity#foo]]
8725 !! html
8726 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8727 </p>
8728 !! end
8729
8730 !! test
8731 Link scenarios with escaped fragments
8732 !! config
8733 wgFragmentMode=[ 'html5', 'legacy' ]
8734 !! wikitext
8735 [[#Is this great?]]
8736 [[Foo#Is this great?]]
8737 [[meatball:Foo#Is this great?]]
8738 !! html/php
8739 <p><a href="#Is_this_great?">#Is this great?</a>
8740 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8741 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8742 </p>
8743 !! html/parsoid
8744 <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>
8745 <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>
8746 <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>
8747 !! end
8748
8749 !! test
8750 Link scenarios with escaped fragments (legacy)
8751 !! config
8752 wgFragmentMode=[ 'legacy' ]
8753 !! wikitext
8754 [[#Is this great?]]
8755 [[Foo#Is this great?]]
8756 [[meatball:Foo#Is this great?]]
8757 !! html/php
8758 <p><a href="#Is_this_great.3F">#Is this great?</a>
8759 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8760 <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>
8761 </p>
8762 !! end
8763
8764 # Ideally the wikipedia: prefix here should be proto-relative too
8765 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8766 # define the 'en' prefix, and originally the test used 'wikipedia',
8767 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8768 # article.
8769 !! test
8770 Different interwiki prefixes mapping to the same URL
8771 !! wikitext
8772 [[:en:Foo]]
8773
8774 [[:en:Foo|Foo]]
8775
8776 [[wikipedia:Foo]]
8777
8778 [[:wikipedia:Foo|Foo]]
8779
8780 [[wikipedia:en:Foo]]
8781
8782 [[:wikipedia:en:Foo]]
8783
8784 [[ wikiPEdia :Foo]]
8785 !! html/parsoid
8786 <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>
8787
8788 <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>
8789
8790 <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>
8791
8792 <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>
8793
8794 <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>
8795
8796 <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>
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 !! end
8800
8801 !! test
8802 Interwiki links that cannot be represented in wiki syntax
8803 !! wikitext
8804 [[meatball:ok]]
8805 [[meatball:ok#foo|ok with fragment]]
8806 [[meatball:ok_as_well?|ok ending with ? mark]]
8807 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8808 [http://de.wikipedia.org/wiki/#foo is just fragment]
8809
8810 !! html/php
8811 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8812 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8813 <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>
8814 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8815 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8816 </p>
8817 !! html/parsoid
8818 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8819 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8820 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" title="meatball:ok as well?">ok ending with ? mark</a>
8821 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8822 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8823 !! end
8824
8825 !! test
8826 Interwiki links: trail
8827 !! wikitext
8828 [[wikipedia:Foo|Ba]]r
8829 !! html/php
8830 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8831 </p>
8832 !! html/parsoid
8833 <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>
8834 !! end
8835
8836 !! test
8837 Local interwiki link
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 [[local:Template:Foo]]
8842 !! html/php
8843 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8844 </p>
8845 !! html/parsoid
8846 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8847 !! end
8848
8849 # Parsoid does not mark self-links, by design.
8850 !! test
8851 Local interwiki link: self-link to current page
8852 !! options
8853 title=[[Main Page]]
8854 parsoid=wt2html,wt2wt,html2html
8855 !! wikitext
8856 [[local:Main Page]]
8857 !! html/php
8858 <p><a class="mw-selflink selflink">local:Main Page</a>
8859 </p>
8860 !! html/parsoid
8861 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8862 !! end
8863
8864 !! test
8865 Local interwiki link: prefix only (T66167)
8866 !! options
8867 parsoid=wt2html,wt2wt,html2html
8868 !! wikitext
8869 [[local:]]
8870 !! html/php
8871 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8872 </p>
8873 !! html/parsoid
8874 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8875 !! end
8876
8877 !! test
8878 Local interwiki link: with additional interwiki prefix (T63357)
8879 !! options
8880 parsoid=wt2html,wt2wt,html2html
8881 !! wikitext
8882 [[local:meatball:Hello]]
8883 !! html/php
8884 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8885 </p>
8886 !! html/parsoid
8887 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8888 !! end
8889
8890 !! test
8891 Multiple local interwiki link prefixes
8892 !! wikitext
8893 [[local:local:local:local:mi:local:Foo]]
8894 !! options
8895 parsoid=wt2html,wt2wt,html2html
8896 !! html/php
8897 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8898 </p>
8899 !! html/parsoid
8900 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8901 !! end
8902
8903 !! test
8904 Interwiki link with percent encoded target
8905 !! wikitext
8906 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8907 !! html/php
8908 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8909 </p>
8910 !! html/parsoid
8911 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa" title="es:Nueva Guipúzcoa" data-parsoid='{"stx":"piped","a":{"href":"http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa"},"sa":{"href":":es:Nueva Guip%C3%BAzcoa"},"isIW":true}'>Nueva Guipúzcoa</a></p>
8912 !! end
8913
8914 ###
8915 ### Interlanguage links
8916 ### Language links (so that searching for '### language' matches..)
8917 ###
8918
8919 !! test
8920 Interlanguage link
8921 !! wikitext
8922 Blah blah blah
8923 [[zh:Chinese]]
8924 !! html/php
8925 <p>Blah blah blah
8926 </p>
8927 !! html/parsoid
8928 <p>Blah blah blah</p>
8929 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8930 !! end
8931
8932 ## parsoid html2wt will lose the space variations
8933 !! test
8934 Interlanguage link with spacing
8935 !! options
8936 parsoid=wt2html,wt2wt,html2html
8937 !! wikitext
8938 Blah blah blah
8939 [[ zh : Chinese ]]
8940 !! html/php
8941 <p>Blah blah blah
8942 </p>
8943 !! html/parsoid
8944 <p>Blah blah blah</p>
8945 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8946 !! end
8947
8948 !! test
8949 Double interlanguage link
8950 !! wikitext
8951 Blah blah blah
8952 [[es:Spanish]]
8953 [[zh:Chinese]]
8954 !! html/php
8955 <p>Blah blah blah
8956 </p>
8957 !! html/parsoid
8958 <p>Blah blah blah</p>
8959 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8960 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8961 !! end
8962
8963 ## parsoid html2wt will lose the space variations
8964 !! test
8965 Interlanguage link variations
8966 !! options
8967 parsoid=wt2html,wt2wt,html2html
8968 !! wikitext
8969 Blah blah blah
8970 [[ es :Spanish]]
8971 [[ ZH :Chinese]]
8972 [[es:Foo_bar]]
8973 !! html/php
8974 <p>Blah blah blah
8975 </p>
8976 !! html/parsoid
8977 <p>Blah blah blah</p>
8978 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8979 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8980 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8981 !! end
8982
8983 !! test
8984 Escaping of interlanguage links (T129218, T156308)
8985 !! wikitext
8986 Blah blah blah
8987 [[:es:Spanish]]
8988 [[ : zh : Chinese ]]
8989 !! html/php
8990 <p>Blah blah blah
8991 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8992 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8993 </p>
8994 !! html/parsoid
8995 <p>Blah blah blah
8996 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8997 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8998 !! end
8999
9000 !! test
9001 Multiple colons escaping interlanguage links
9002 !! options
9003 parsoid=wt2html
9004 !! wikitext
9005 [[:es:Spanish]]
9006 [[::es:Spanish]]
9007 [[:::es:Spanish]]
9008 !! html/php
9009 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9010 [[::es:Spanish]]
9011 [[:::es:Spanish]]
9012 </p>
9013 !! html/parsoid
9014 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9015 [[::es:Spanish]]
9016 [[:::es:Spanish]]</p>
9017 !! end
9018
9019 ## parsoid html2wt will normalize the space to _
9020 !! test
9021 Space and question mark encoding in interlanguage links (T95473)
9022 !! options
9023 parsoid=wt2html,wt2wt,html2html
9024 !! wikitext
9025 Blah blah blah
9026 [[es:Foo bar?]]
9027 !! html/php
9028 <p>Blah blah blah
9029 </p>
9030 !! html/parsoid
9031 <p>Blah blah blah</p>
9032 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9033 !! end
9034
9035 !! test
9036 Interlanguage link, with prefix links
9037 !! options
9038 language=ln
9039 !! wikitext
9040 Blah blah blah
9041 [[zh:Chinese]]
9042 !! html/php
9043 <p>Blah blah blah
9044 </p>
9045 !! html/parsoid
9046 <p>Blah blah blah</p>
9047 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9048 !! end
9049
9050 !! test
9051 Double interlanguage link, with prefix links (T10897)
9052 !! options
9053 language=ln
9054 !! wikitext
9055 Blah blah blah
9056 [[es:Spanish]]
9057 [[zh:Chinese]]
9058 !! html/php
9059 <p>Blah blah blah
9060 </p>
9061 !! html/parsoid
9062 <p>Blah blah blah</p>
9063 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9064 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9065 !! end
9066
9067 !! test
9068 "Extra" interlanguage links (T34189 / gerrit 111390)
9069 !! wikitext
9070 Blah blah blah
9071 [[mul:Article]]
9072 !! html/php
9073 <p>Blah blah blah
9074 </p>
9075 !! html/parsoid
9076 <p>Blah blah blah</p>
9077 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9078 !! end
9079
9080 ## PHP parser tests script needs an update
9081 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9082 !! test
9083 Language links render as inline links if $wgInterwikiMagic=false
9084 !! options
9085 wgInterwikiMagic=false
9086 parsoid=wt2html,wt2wt,html2html
9087 !! wikitext
9088 Blah blah blah
9089 [[zh:Chinese]]
9090 !! html/parsoid
9091 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9092 !! end
9093
9094 ## PHP parser tests script needs an update
9095 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9096 !! test
9097 Language links render as inline links in the Talk namespace
9098 !! options
9099 title=Talk:Foo
9100 parsoid=wt2html,wt2wt,html2html
9101 !! wikitext
9102 Blah blah blah
9103 [[zh:Chinese]]
9104 !! html/parsoid
9105 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9106 !! end
9107
9108 !! test
9109 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9110 !! options
9111 language=ln
9112 !! wikitext
9113 [[WW&nbsp;II]]
9114 !! html
9115 <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>
9116 </p>
9117 !! end
9118
9119 !! test
9120 Parsoid T55221: Wikilinks should be properly entity-escaped
9121 !! options
9122 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9123 !! html/parsoid
9124 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9125 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9126 !! wikitext
9127 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9128
9129 He&amp;nbsp;llo He&amp;nbsp;llo
9130 !! html/php
9131 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9132 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9133 </p>
9134 !! end
9135
9136 # html2wt will fail because of title normalization without data-parsoid
9137 !! test
9138 Parsoid: handle constructor well
9139 !! options
9140 parsoid=wt2html,wt2wt
9141 !! wikitext
9142 [[constructor]]
9143
9144 [[constructor:foo]]
9145 !! html/php
9146 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9147 </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>
9148 </p>
9149 !! html/parsoid
9150 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9151
9152 <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>
9153 !! end
9154
9155 !! test
9156 Template parameter named "constructor"
9157 !! wikitext
9158 {{echo| constructor = |hi}}
9159 !! html/parsoid
9160 <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>
9161 !! end
9162
9163 !! article
9164 ko:
9165 !! text
9166 Test.
9167 !! endarticle
9168
9169 # Note that `ko` isn't a known interlanguage prefix
9170 !! test
9171 Parsoid: recognize interlanguage links without a target page
9172 !! options
9173 ill
9174 !! wikitext
9175 [[es:]]
9176
9177 [[ko:]]
9178 !! html/php
9179 es:
9180 !! html/parsoid
9181 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9182
9183 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9184 !! end
9185
9186 # Note that `ko` isn't a known interwiki prefix
9187 !! test
9188 Parsoid: recognize interwiki links without a target page
9189 !! options
9190 parsoid=wt2html,wt2wt,html2html
9191 !! wikitext
9192 [[:es:]]
9193
9194 [[:ko:]]
9195 !! html/php
9196 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9197 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9198 </p>
9199 !! html/parsoid
9200 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9201 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9202 !! end
9203
9204 !! test
9205 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9206 !! wikitext
9207 [[mi:Foo]]
9208 !! html/php
9209 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9210 </p>
9211 !! html/parsoid
9212 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9213 !! end
9214
9215 !! test
9216 Interlanguage link with preceding local interwiki link (T70085)
9217 !! options
9218 parsoid=wt2html,wt2wt,html2html
9219 !! wikitext
9220 Blah blah blah
9221 [[local:es:Spanish]]
9222 !! html/php
9223 <p>Blah blah blah
9224 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9225 </p>
9226 !! html/parsoid
9227 <p>Blah blah blah
9228 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9229 !! end
9230
9231 !! test
9232 Looks like an interlanguage link, but is actually a local interwiki
9233 !! options
9234 parsoid=wt2html,wt2wt,html2html
9235 !! wikitext
9236 Blah blah blah
9237 [[mi:Template:Foo]]
9238 !! html/php
9239 <p>Blah blah blah
9240 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9241 </p>
9242 !! html/parsoid
9243 <p>Blah blah blah
9244 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9245 !! end
9246
9247 ###
9248 ### Redirects, Parsoid-only
9249 ###
9250
9251 !! test
9252 1. Simple redirect to page
9253 !! wikitext
9254 #REDIRECT [[Main Page]]
9255 !! html/parsoid
9256 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9257 !! end
9258
9259 !! test
9260 2. Other redirect variants
9261 !! wikitext
9262 #REDIRECT [[Main_Page]]
9263 !! html/parsoid
9264 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9265 !! end
9266
9267 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9268 # This tests the Parsoid bail-out code.
9269 !! test
9270 3. Other redirect variants
9271 !! options
9272 parsoid=wt2html
9273 !! wikitext
9274 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9275 !! html/parsoid
9276 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9277 !! end
9278
9279 !! test
9280 4. Redirect to a templated destination
9281 !! wikitext
9282 #REDIRECT [[{{echo|Foo}}bar]]
9283 !! html/parsoid
9284 <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"}]]}'/>
9285 !! end
9286
9287 !! test
9288 Empty redirect
9289 !! options
9290 parsoid=wt2html,wt2wt
9291 !! wikitext
9292 #REDIRECT [[]]
9293 !! html/parsoid
9294 <ol>
9295 <li>REDIRECT [[]]</li></ol>
9296 !! end
9297
9298 !! test
9299 Optional colon in #REDIRECT
9300 !! options
9301 # the colon is archaic syntax. we support it for wt2html, but we
9302 # don't care that it roundtrips back to the modern syntax.
9303 parsoid=wt2html,html2html
9304 !! wikitext
9305 #REDIRECT:[[Main Page]]
9306 !! html/parsoid
9307 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9308 !! end
9309
9310 !! test
9311 Whitespace in #REDIRECT with optional colon
9312 !! options
9313 # the colon and gratuitous whitespace is archaic syntax. we support
9314 # it for wt2html, but we don't care that it roundtrips back to the
9315 # modern syntax (without extra whitespace)
9316 parsoid=wt2html,html2html
9317 !! wikitext
9318
9319 #REDIRECT
9320 :
9321 [[Main Page]]
9322 !! html/parsoid
9323 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9324 !! end
9325
9326 !! test
9327 Piped link in #REDIRECT
9328 !! options
9329 # content after piped link is ignored. we support this syntax,
9330 # but don't care that the piped link is lost when we roundtrip this.
9331 parsoid=wt2html
9332 !! wikitext
9333 #REDIRECT [[Main Page|bar]]
9334 !! html/parsoid
9335 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9336 !! end
9337
9338 !! test
9339 Redirect to category (T104502)
9340 !! options
9341 parsoid=wt2html,wt2wt
9342 !! wikitext
9343 #REDIRECT [[Category:Foo]]
9344 !! html/parsoid
9345 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9346 !! end
9347
9348 !! test
9349 Redirect to category with URL encoding (T104502)
9350 !! options
9351 parsoid=wt2html
9352 !! wikitext
9353 #REDIRECT [[Category%3AFoo]]
9354 !! html/parsoid
9355 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9356 !! end
9357
9358 !! test
9359 Redirect to category page
9360 !! wikitext
9361 #REDIRECT [[:Category:Foo]]
9362 !! html/parsoid
9363 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9364 !! end
9365
9366 !! test
9367 Redirect to image page (1)
9368 !! wikitext
9369 #REDIRECT [[File:Wiki.png]]
9370 !! html/parsoid
9371 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9372 !! end
9373
9374 !! test
9375 Redirect to image page (2)
9376 !! wikitext
9377 #REDIRECT [[Image:Wiki.png]]
9378 !! html/parsoid
9379 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9380 !! end
9381
9382 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9383 # Next test confirms this.
9384 !! test
9385 Redirect to language (1) (T104918)
9386 !! options
9387 parsoid=wt2html,wt2wt,html2html
9388 !! wikitext
9389 #REDIRECT [[en:File:Wiki.png]]
9390 !! html/parsoid
9391 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9392 !! end
9393
9394 !! test
9395 Redirect to language (2) (T104918)
9396 !! wikitext
9397 #REDIRECT [[:en:File:Wiki.png]]
9398 !! html/parsoid
9399 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9400 !! end
9401
9402 !! test
9403 Redirect to interwiki (T104918)
9404 !! wikitext
9405 #REDIRECT [[meatball:File:Wiki.png]]
9406 !! html/parsoid
9407 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9408 !! end
9409
9410 !! test
9411 Non-English #REDIRECT
9412 !! options
9413 language=is
9414 !! wikitext
9415 #TILVÍSUN [[Main Page]]
9416 !! html/parsoid
9417 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9418 !! end
9419
9420 !! test
9421 Redirect syntax under text isn't considered a redirect
9422 !! wikitext
9423 some text
9424
9425 #redirect [[Main Page]]
9426 !! html/parsoid
9427 <p>some text</p>
9428 <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>
9429 !! end
9430
9431 !! test
9432 New redirect
9433 !! options
9434 parsoid=html2wt
9435 !! html/parsoid
9436 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9437 !! wikitext
9438 #REDIRECT [[Foo]]
9439 Foo
9440 !! end
9441
9442 !! test
9443 Redirect followed by block on the same line
9444 !! options
9445 parsoid=wt2html
9446 !! wikitext
9447 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9448 !! html/parsoid
9449 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9450 !! end
9451
9452 !! test
9453 Redirect followed by a newline
9454 !! wikitext
9455 #REDIRECT [[Main Page]]
9456 A newline
9457 !! html/parsoid
9458 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9459 <p>A newline</p>
9460 !! end
9461
9462 !! test
9463 Redirect followed by multiple newlines
9464 !! wikitext
9465 #REDIRECT [[Main Page]]
9466
9467
9468 A newline
9469 !! html/parsoid
9470 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9471
9472 <p><br/>
9473 A newline</p>
9474 !! end
9475
9476 !! test
9477 Drop duplicate redirects
9478 !! options
9479 parsoid=html2wt
9480 !! html/parsoid
9481 <link rel="mw:PageProp/redirect" href="./Foo"/>
9482 <link rel="mw:PageProp/redirect" href="./Bar"/>
9483 <link rel="mw:PageProp/redirect" href="./Baz"/>
9484 !! wikitext
9485 #REDIRECT [[Foo]]
9486 !! end
9487
9488 ##
9489 ## XHTML tidiness
9490 ###
9491
9492 !! test
9493 <br> to <br />
9494 !! wikitext
9495 1<br>2<br />3
9496 !! html
9497 <p>1<br />2<br />3
9498 </p>
9499 !! end
9500
9501 !! test
9502 Broken br tag sanitization
9503 !! wikitext
9504 </br>
9505 !! html/php
9506 <p>&lt;/br&gt;
9507 </p>
9508 !! end
9509
9510 # TODO: Fix html2html mode (T53055)!
9511 !! test
9512 Parsoid: Broken br tag recognition
9513 !! options
9514 parsoid=wt2html
9515 !! wikitext
9516 </br>
9517
9518 <br/ >
9519 !! html+tidy
9520 <p><br />
9521 </p><p><br />
9522 </p>
9523 !! end
9524
9525 !! test
9526 Incorrecly removing closing slashes from correctly formed XHTML
9527 !! wikitext
9528 <br style="clear:both;" />
9529 !! html
9530 <p><br style="clear:both;" />
9531 </p>
9532 !! end
9533
9534 !! test
9535 Failing to transform badly formed HTML into correct XHTML
9536 !! wikitext
9537 <br style="clear: left;">
9538 <br style="clear: right;">
9539 <br style="clear: both;">
9540 !! html
9541 <p><br style="clear: left;" />
9542 <br style="clear: right;" />
9543 <br style="clear: both;" />
9544 </p>
9545 !!end
9546
9547 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9548 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9549 !! test
9550 Handling html with a div self-closing tag
9551 !! wikitext
9552 <div title />
9553 <div title/>
9554 <div title/ >
9555 <div title=bar />
9556 <div title=bar/>
9557 <div title=bar/ >
9558 !! html/php
9559 <p>&lt;div title /&gt;
9560 &lt;div title/&gt;
9561 </p>
9562 <div>
9563 <p>&lt;div title=bar /&gt;
9564 &lt;div title=bar/&gt;
9565 </p>
9566 <div title="bar/"></div>
9567 </div>
9568
9569 !! html/parsoid
9570 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9571 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9572 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9573 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9574 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9575 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9576 !! end
9577
9578 !! test
9579 Elements with solidus in various attribute positions
9580 !! options
9581 parsoid=wt2html,html2html
9582 !! wikitext
9583 <div cla/ss="123">ha</div>
9584
9585 <div / class="123">ha</div>
9586
9587 <div class= / "123">ha</div>
9588 !! html/php+tidy
9589 <div>ha</div>
9590 <div class="123">ha</div>
9591 <div class="/">ha</div>
9592 !! html/parsoid
9593 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9594
9595 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9596
9597 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9598 !! end
9599
9600 !! test
9601 Handling html with a br self-closing tag
9602 !! wikitext
9603 <br title />
9604 <br title/>
9605 <br title/ >
9606 <br title=bar />
9607 <br title=bar/>
9608 <br title=bar/ >
9609 !! html/php
9610 <p><br title="" />
9611 <br title="" />
9612 <br />
9613 <br title="bar" />
9614 <br title="bar" />
9615 <br title="bar/" />
9616 </p>
9617 !! html/parsoid
9618 <p><br title="" />
9619 <br title="" />
9620 <br title="" />
9621 <br title="bar" />
9622 <br title="bar" />
9623 <br title="bar/" />
9624 </p>
9625 !! end
9626
9627 !! test
9628 Horizontal ruler (should it add that extra space?)
9629 !! wikitext
9630 <hr>
9631 <hr >
9632 foo <hr
9633 > bar
9634 !! html+tidy
9635 <hr />
9636 <hr /><p>
9637 foo </p><hr /><p> bar
9638 </p>
9639 !! end
9640
9641 !! test
9642 Horizontal ruler -- 4+ dashes render hr
9643 !! wikitext
9644 ----
9645 !! html
9646 <hr />
9647
9648 !! end
9649
9650 !! test
9651 Horizontal ruler -- eats additional dashes on the same line
9652 !! wikitext
9653 ---------
9654 !! html
9655 <hr />
9656
9657 !! end
9658
9659 !! test
9660 Horizontal ruler -- does not collapse dashes on consecutive lines
9661 !! wikitext
9662 ----
9663 ----
9664 !! html
9665 <hr />
9666 <hr />
9667
9668 !! end
9669
9670 !! test
9671 Horizontal ruler -- <4 dashes render as plain text
9672 !! wikitext
9673 ---
9674 !! html
9675 <p>---
9676 </p>
9677 !! end
9678
9679 !! test
9680 Horizontal ruler -- Supports content following dashes on same line
9681 !! wikitext
9682 ---- Foo
9683 !! html
9684 <hr /> Foo
9685
9686 !! html+tidy
9687 <hr /><p> Foo
9688 </p>
9689 !! end
9690
9691 ###
9692 ### Block-level elements
9693 ###
9694 !! test
9695 Common list
9696 !! wikitext
9697 *Common list
9698 *item 2
9699 *item 3
9700 !! html
9701 <ul><li>Common list</li>
9702 <li>item 2</li>
9703 <li>item 3</li></ul>
9704
9705 !! end
9706
9707 !! test
9708 Numbered list
9709 !! wikitext
9710 #Numbered list
9711 #item 2
9712 #item 3
9713 !! html
9714 <ol><li>Numbered list</li>
9715 <li>item 2</li>
9716 <li>item 3</li></ol>
9717
9718 !! end
9719
9720 # the switch from level 3 to ordered should not introduce a newline between
9721 !! test
9722 Mixed list
9723 !! wikitext
9724 *Mixed list
9725 *#with numbers
9726 **and bullets
9727 *#and numbers
9728 *bullets again
9729 **bullet level 2
9730 ***bullet level 3
9731 ***#Number on level 4
9732 **bullet level 2
9733 **#Number on level 3
9734 **#Number on level 3
9735 *#number level 2
9736 *Level 1
9737 ***Level 3
9738 #**Level 3, but ordered
9739 !! html
9740 <ul><li>Mixed list
9741 <ol><li>with numbers</li></ol>
9742 <ul><li>and bullets</li></ul>
9743 <ol><li>and numbers</li></ol></li>
9744 <li>bullets again
9745 <ul><li>bullet level 2
9746 <ul><li>bullet level 3
9747 <ol><li>Number on level 4</li></ol></li></ul></li>
9748 <li>bullet level 2
9749 <ol><li>Number on level 3</li>
9750 <li>Number on level 3</li></ol></li></ul>
9751 <ol><li>number level 2</li></ol></li>
9752 <li>Level 1
9753 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9754 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9755
9756 !! end
9757
9758 !! test
9759 1. Nested mixed wikitext and html list
9760 !! wikitext
9761 *hi
9762 *<ul><li>ho</li></ul>
9763 *hi
9764 **ho
9765 !! html/php
9766 <ul><li>hi</li>
9767 <li><ul><li>ho</li></ul></li>
9768 <li>hi
9769 <ul><li>ho</li></ul></li></ul>
9770
9771 !! html/parsoid
9772 <ul><li>hi</li>
9773 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9774 <li>hi
9775 <ul><li>ho</li></ul></li></ul>
9776 !! end
9777
9778 !! test
9779 2. Nested mixed wikitext and html list (incompatible)
9780 !! wikitext
9781 ;hi
9782 :{{echo|<li>ho</li>}}
9783 !! html/php
9784 <dl><dt>hi</dt>
9785 <dd><li>ho</li></dd></dl>
9786
9787 !! html/parsoid
9788 <dl><dt>hi</dt>
9789 <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>
9790 !! end
9791
9792 !! test
9793 Nested lists 1
9794 !! wikitext
9795 *foo
9796 **bar
9797 !! html
9798 <ul><li>foo
9799 <ul><li>bar</li></ul></li></ul>
9800
9801 !! end
9802
9803 !! test
9804 Nested lists 2
9805 !! wikitext
9806 **foo
9807 *bar
9808 !! html
9809 <ul><li><ul><li>foo</li></ul></li>
9810 <li>bar</li></ul>
9811
9812 !! end
9813
9814 !! test
9815 Nested lists 3 (first element empty)
9816 !! wikitext
9817 *
9818 **bar
9819 !! html
9820 <ul><li>
9821 <ul><li>bar</li></ul></li></ul>
9822
9823 !! end
9824
9825 !! test
9826 Nested lists 4 (first element empty)
9827 !! wikitext
9828 **
9829 *bar
9830 !! html
9831 <ul><li><ul><li></li></ul></li>
9832 <li>bar</li></ul>
9833
9834 !! end
9835
9836 !! test
9837 Nested lists 5 (both elements empty)
9838 !! wikitext
9839 **
9840 *
9841 !! html
9842 <ul><li><ul><li></li></ul></li>
9843 <li></li></ul>
9844
9845 !! end
9846
9847 !! test
9848 Nested lists 6 (both elements empty)
9849 !! wikitext
9850 *
9851 **
9852 !! html
9853 <ul><li>
9854 <ul><li></li></ul></li></ul>
9855
9856 !! end
9857
9858 !! test
9859 Nested lists 7 (skip initial nesting levels)
9860 !! wikitext
9861 ***foo
9862 !! html
9863 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9864
9865 !! end
9866
9867 !! test
9868 Nested lists 8 (multiple nesting transitions)
9869 !! wikitext
9870 *foo
9871 ***bar
9872 **baz
9873 *boo
9874 !! html
9875 <ul><li>foo
9876 <ul><li><ul><li>bar</li></ul></li>
9877 <li>baz</li></ul></li>
9878 <li>boo</li></ul>
9879
9880 !! end
9881
9882 !! test
9883 Nested lists 9 (extension interaction)
9884 !! options
9885 parsoid
9886 !! wikitext
9887 *<references />
9888 !! html/parsoid
9889 <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>
9890 !! end
9891
9892 !! test
9893 1. Lists with start-of-line-transparent tokens before bullets: Comments
9894 !! wikitext
9895 *foo
9896 *<!--cmt-->bar
9897 <!--cmt-->*baz
9898 !! html
9899 <ul><li>foo</li>
9900 <li>bar</li>
9901 <li>baz</li></ul>
9902
9903 !! end
9904
9905 !! test
9906 Nested lists 10 (list and span siblings: wt2wt regression)
9907 !! wikitext
9908 *a <span>x</span>
9909 **b <span>y</span>
9910 !! html/parsoid
9911 <ul><li>a <span>x</span>
9912 <ul><li>b <span>y</span></li></ul></li></ul>
9913 !! end
9914
9915 !! test
9916 2. Lists with start-of-line-transparent tokens before bullets: Template close
9917 !! wikitext
9918 *foo {{echo|bar
9919 }}*baz
9920 !! html
9921 <ul><li>foo bar</li>
9922 <li>baz</li></ul>
9923
9924 !! end
9925
9926 !! test
9927 List items are not parsed correctly following a <pre> block (T2785)
9928 !! wikitext
9929 *<pre>foo</pre>
9930 *<pre>bar</pre>
9931 *zar
9932 !! html/php
9933 <ul><li><pre>foo</pre></li>
9934 <li><pre>bar</pre></li>
9935 <li>zar</li></ul>
9936
9937 !! html/parsoid
9938 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9939 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9940 <li>zar</li></ul>
9941 !! end
9942
9943 # FIXME: Might benefit from a html/parsoid since this has a template
9944 !! test
9945 List items from template
9946 !! wikitext
9947
9948 {{inner list}}
9949 *item 2
9950
9951 *item 0
9952 {{inner list}}
9953 *item 2
9954
9955 *item 0
9956 *notSOL{{inner list}}
9957 *item 2
9958 !! html
9959 <ul><li>item 1</li>
9960 <li>item 2</li></ul>
9961 <ul><li>item 0</li>
9962 <li>item 1</li>
9963 <li>item 2</li></ul>
9964 <ul><li>item 0</li>
9965 <li>notSOL</li>
9966 <li>item 1</li>
9967 <li>item 2</li></ul>
9968
9969 !! end
9970
9971 !! test
9972 List interrupted by empty line or heading
9973 !! wikitext
9974 *foo
9975
9976 **bar
9977 ==A heading==
9978 *Another list item
9979 !! html
9980 <ul><li>foo</li></ul>
9981 <ul><li><ul><li>bar</li></ul></li></ul>
9982 <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>
9983 <ul><li>Another list item</li></ul>
9984
9985 !!end
9986
9987 !! test
9988 Multiple list tags generated by templates
9989 !! wikitext
9990 {{echo|<li>}}a
9991 {{echo|<li>}}b
9992 {{echo|<li>}}c
9993 !! html
9994 <li>a
9995 <li>b
9996 <li>c</li>
9997 </li>
9998 </li>
9999
10000
10001 !! html+tidy
10002 <li>a
10003 </li><li>b
10004 </li><li>c
10005 </li>
10006 !! html/parsoid
10007 <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>"}},"i":0}},"a"]}'>a</li>
10008 <li about="#mwt2" 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>"}},"i":0}},"b"]}'>b</li>
10009 <li about="#mwt3" 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>"}},"i":0}},"c"]}'>c</li>
10010 !! end
10011
10012 !! test
10013 Multiple newlines in between HTML list items don't induce paragraph wrapping
10014 !! wikitext
10015 <ul>
10016 <li>hi</li>
10017
10018
10019
10020
10021 <li>ho</li>
10022 </ul>
10023
10024 <dl>
10025 <dt>hi</dt>
10026 <dd>ho<div>123</div>
10027 </dd>
10028
10029
10030 </dl>
10031 !! html/php+tidy
10032 <ul>
10033 <li>hi</li>
10034
10035
10036
10037
10038 <li>ho</li>
10039 </ul>
10040 <dl>
10041 <dt>hi</dt>
10042 <dd>ho<div>123</div>
10043 </dd>
10044
10045
10046 </dl>
10047 !! end
10048
10049 !!test
10050 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10051 !! wikitext
10052 *a
10053 <!--This line will NOT split the list-->
10054 *b
10055 <!--This line will NOT split the list either-->
10056 *c
10057 <!--foo--> <!----> <!--This line NOT split the list either-->
10058 *d
10059 !! html
10060 <ul><li>a</li>
10061 <li>b</li>
10062 <li>c</li>
10063 <li>d</li></ul>
10064
10065 !!end
10066
10067 !!test
10068 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10069 !! wikitext
10070 *a
10071 <!--This line will NOT split the list-->
10072 *b
10073 <!--This line will NOT split the list either-->
10074 *c
10075 <!--foo--> <!----> <!--This line NOT split the list
10076 either-->
10077 *d
10078 !! html
10079 <ul><li>a</li>
10080 <li>b</li>
10081 <li>c</li>
10082 <li>d</li></ul>
10083
10084 !!end
10085
10086 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10087 # That pass could possibly be removed.
10088 !!test
10089 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10090 !!options
10091 parsoid=wt2html,wt2wt
10092 !! wikitext
10093 *foo
10094 *<li>li-hack
10095 *{{echo|<li>templated li-hack}}
10096 *<!--foo--><li> unsupported li-hack with preceding comments
10097
10098 <ul>
10099 <li><li>not a li-hack
10100 </li>
10101 </ul>
10102 !! html+tidy
10103 <ul><li>foo</li>
10104 <li class="mw-empty-elt"></li><li>li-hack</li>
10105 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10106 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10107 <ul>
10108 <li class="mw-empty-elt"></li><li>not a li-hack
10109 </li>
10110 </ul>
10111 !! html/parsoid
10112 <ul><li> foo</li>
10113 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10114 <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>
10115 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10116
10117 <ul data-parsoid='{"stx":"html"}'>
10118 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10119 </li>
10120 </ul>
10121
10122 !!end
10123
10124 !! test
10125 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10126 !! options
10127 parsoid
10128 !! wikitext
10129 #foo
10130 ##bar
10131
10132 *foo
10133 **bar
10134
10135 :foo
10136 ::bar
10137 !! html
10138 <ol>
10139 <li>foo<ol>
10140 <li>bar</li>
10141 </ol></li>
10142 </ol><ul>
10143 <li>foo<ul>
10144 <li>bar</li>
10145 </ul></li>
10146 </ul><dl>
10147 <dd>foo<dl>
10148 <dd>bar</dd>
10149 </dl></dd>
10150 </dl>
10151 !! end
10152
10153 !! test
10154 Parsoid: Test of whitespace serialization with Templated bullets
10155 !! options
10156 parsoid=wt2html
10157 !! wikitext
10158 * {{bullet}}
10159 !! html/parsoid
10160 <ul>
10161 <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>
10162 </ul>
10163 !! end
10164
10165 # ------------------------------------------------------------------------
10166 # The next set of tests are about Parsoid's ability to handle badly nested
10167 # tags (parse, minimize scope of fixup, and roundtrip back)
10168 # ------------------------------------------------------------------------
10169
10170 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10171 # Parsoid's list handling is more aware of block structure.
10172 !! test
10173 Unbalanced closing block tags break a list
10174 !! wikitext
10175 <div>
10176 *a</div><div>
10177 *b</div>
10178 !! html+tidy
10179 <div>
10180 <ul><li>a</li></ul></div><div>
10181 <li>b</li></div>
10182 !! html/parsoid
10183 <div><ul>
10184 <li>a</li>
10185 </ul></div>
10186 <div><ul>
10187 <li>b</li>
10188 </ul></div>
10189 !! end
10190
10191 !! test
10192 Unbalanced closing non-block tags don't break a list
10193 !! options
10194 parsoid=wt2html,html2html
10195 !! wikitext
10196 <span>
10197 *a</span><span>
10198 *b</span>
10199 !! html/php+tidy
10200 <p><span>
10201 </span></p>
10202 <ul><li>a<span></span></li>
10203 <li>b</li></ul>
10204 !! html/parsoid
10205 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10206 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10207 <li>b</li></ul>
10208 !! end
10209
10210 # Parsoid does some post-dom-building cleanup
10211 # which is why its output differs from Remex.
10212 !! test
10213 Unclosed formatting tags that straddle lists are closed and reopened
10214 !! options
10215 parsoid=wt2html,wt2wt,html2html
10216 !! wikitext
10217 #<s> a
10218 #b </s>
10219 !! html/php+tidy
10220 <ol><li><s> a</s></li><s>
10221 </s><li><s>b </s></li></ol>
10222 !! html/parsoid
10223 <ol><li><s> a</s></li>
10224 <li><s>b </s></li></ol>
10225 !! end
10226
10227 # Output is ugly because of all the misnested tag fixups.
10228 !! test
10229 1. List embedded in a formatting tag
10230 !! wikitext
10231 <small>
10232 *foo
10233 </small>
10234 !! html/php+tidy
10235 <p><small>
10236 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10237 </p>
10238 !! html/parsoid
10239 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10240 <ul><li data-parsoid='{}'>foo</li></ul></small>
10241 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10242 !! end
10243
10244 # Output is ugly because of all the misnested tag fixups.
10245 !! test
10246 2. List embedded in a formatting tag in a misnested way
10247 !! wikitext
10248 <small>
10249 *a
10250 *b</small>
10251 !! html/php+tidy
10252 <p><small>
10253 </small></p><small></small><ul><small><li>a</li>
10254 </small><li><small>b</small></li></ul>
10255 !! html/parsoid
10256 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10257 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10258 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10259 !! end
10260
10261 # Output is ugly because of all the misnested tag fixups.
10262 !! test
10263 3. List embedded in a formatting tag in a misnested way
10264 !! wikitext
10265 <small>
10266
10267 ** 123</small>
10268 !! html/php+tidy
10269 <p><small>
10270 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10271 !! html/parsoid
10272 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10273
10274 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10275 !! end
10276
10277 ###
10278 ### Magic Words
10279 ###
10280
10281 # Note that the current date is hard-coded as
10282 # 1970-01-01T00:02:03Z (a Thursday)
10283 # when running parser tests. The timezone is also fixed to GMT, so
10284 # local date will be identical to current date.
10285
10286 !! test
10287 Magic Word: {{CURRENTDAY}}
10288 !! wikitext
10289 {{CURRENTDAY}}
10290 !! html
10291 <p>1
10292 </p>
10293 !! end
10294
10295 !! test
10296 Magic Word: {{CURRENTDAY2}}
10297 !! wikitext
10298 {{CURRENTDAY2}}
10299 !! html
10300 <p>01
10301 </p>
10302 !! end
10303
10304 !! test
10305 Magic Word: {{CURRENTDAYNAME}}
10306 !! wikitext
10307 {{CURRENTDAYNAME}}
10308 !! html
10309 <p>Thursday
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{CURRENTDOW}}
10315 !! wikitext
10316 {{CURRENTDOW}}
10317 !! html
10318 <p>4
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{CURRENTMONTH}}
10324 !! wikitext
10325 {{CURRENTMONTH}}
10326 !! html
10327 <p>01
10328 </p>
10329 !! end
10330
10331 !! test
10332 Magic Word: {{CURRENTMONTH1}}
10333 !! wikitext
10334 {{CURRENTMONTH1}}
10335 !! html
10336 <p>1
10337 </p>
10338 !! end
10339
10340 !! test
10341 Magic Word: {{CURRENTMONTHABBREV}}
10342 !! wikitext
10343 {{CURRENTMONTHABBREV}}
10344 !! html
10345 <p>Jan
10346 </p>
10347 !! end
10348
10349 !! test
10350 Magic Word: {{CURRENTMONTHNAME}}
10351 !! wikitext
10352 {{CURRENTMONTHNAME}}
10353 !! html
10354 <p>January
10355 </p>
10356 !! end
10357
10358 !! test
10359 Magic Word: {{CURRENTMONTHNAMEGEN}}
10360 !! wikitext
10361 {{CURRENTMONTHNAMEGEN}}
10362 !! html
10363 <p>January
10364 </p>
10365 !! end
10366
10367 !! test
10368 Magic Word: {{CURRENTTIME}}
10369 !! wikitext
10370 {{CURRENTTIME}}
10371 !! html
10372 <p>00:02
10373 </p>
10374 !! end
10375
10376 !! test
10377 Magic Word: {{CURRENTHOUR}}
10378 !! wikitext
10379 {{CURRENTHOUR}}
10380 !! html
10381 <p>00
10382 </p>
10383 !! end
10384
10385 !! test
10386 Magic Word: {{CURRENTWEEK}} (T6594)
10387 !! wikitext
10388 {{CURRENTWEEK}}
10389 !! html
10390 <p>1
10391 </p>
10392 !! end
10393
10394 !! test
10395 Magic Word: {{CURRENTYEAR}}
10396 !! wikitext
10397 {{CURRENTYEAR}}
10398 !! html
10399 <p>1970
10400 </p>
10401 !! end
10402
10403 !! test
10404 Magic Word: {{CURRENTTIMESTAMP}}
10405 !! wikitext
10406 {{CURRENTTIMESTAMP}}
10407 !! html
10408 <p>19700101000203
10409 </p>
10410 !! end
10411
10412 !! test
10413 Magic Words LOCAL (UTC)
10414 !! wikitext
10415 *{{LOCALMONTH}}
10416 *{{LOCALMONTH1}}
10417 *{{LOCALMONTHNAME}}
10418 *{{LOCALMONTHNAMEGEN}}
10419 *{{LOCALMONTHABBREV}}
10420 *{{LOCALDAY}}
10421 *{{LOCALDAY2}}
10422 *{{LOCALDAYNAME}}
10423 *{{LOCALYEAR}}
10424 *{{LOCALTIME}}
10425 *{{LOCALHOUR}}
10426 *{{LOCALWEEK}}
10427 *{{LOCALDOW}}
10428 *{{LOCALTIMESTAMP}}
10429 !! html
10430 <ul><li>01</li>
10431 <li>1</li>
10432 <li>January</li>
10433 <li>January</li>
10434 <li>Jan</li>
10435 <li>1</li>
10436 <li>01</li>
10437 <li>Thursday</li>
10438 <li>1970</li>
10439 <li>00:02</li>
10440 <li>00</li>
10441 <li>1</li>
10442 <li>4</li>
10443 <li>19700101000203</li></ul>
10444
10445 !! end
10446
10447 !! test
10448 Magic Word: {{FULLPAGENAME}}
10449 !! options
10450 title=[[User:Ævar Arnfjörð Bjarmason]]
10451 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10452 !! wikitext
10453 {{FULLPAGENAME}}
10454 !! html/*
10455 <p>User:Ævar Arnfjörð Bjarmason
10456 </p>
10457 !! end
10458
10459 !! test
10460 Magic Word: {{FULLPAGENAMEE}}
10461 !! options
10462 title=[[User:Ævar Arnfjörð Bjarmason]]
10463 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10464 !! wikitext
10465 {{FULLPAGENAMEE}}
10466 !! html/*
10467 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10468 </p>
10469 !! end
10470
10471 !! test
10472 Magic Word: {{TALKSPACE}}
10473 !! options
10474 title=[[User:Ævar Arnfjörð Bjarmason]]
10475 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10476 !! wikitext
10477 {{TALKSPACE}}
10478 !! html/*
10479 <p>User talk
10480 </p>
10481 !! end
10482
10483 !! test
10484 Magic Word: {{TALKSPACE}}, same namespace
10485 !! options
10486 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10487 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10488 !! wikitext
10489 {{TALKSPACE}}
10490 !! html/*
10491 <p>User talk
10492 </p>
10493 !! end
10494
10495 !! test
10496 Magic Word: {{TALKSPACE}}, main namespace
10497 !! options
10498 title=[[Parser Test]]
10499 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10500 !! wikitext
10501 {{TALKSPACE}}
10502 !! html/*
10503 <p>Talk
10504 </p>
10505 !! end
10506
10507 !! test
10508 Magic Word: {{TALKSPACEE}}
10509 !! options
10510 title=[[User:Ævar Arnfjörð Bjarmason]]
10511 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10512 !! wikitext
10513 {{TALKSPACEE}}
10514 !! html/*
10515 <p>User_talk
10516 </p>
10517 !! end
10518
10519 !! test
10520 Magic Word: {{SUBJECTSPACE}}
10521 !! options
10522 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10523 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10524 !! wikitext
10525 {{SUBJECTSPACE}}
10526 !! html/*
10527 <p>User
10528 </p>
10529 !! end
10530
10531 !! test
10532 Magic Word: {{SUBJECTSPACE}}, same namespace
10533 !! options
10534 title=[[User:Ævar Arnfjörð Bjarmason]]
10535 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10536 !! wikitext
10537 {{SUBJECTSPACE}}
10538 !! html/*
10539 <p>User
10540 </p>
10541 !! end
10542
10543 !! test
10544 Magic Word: {{SUBJECTSPACE}}, main namespace
10545 !! options
10546 title=[[Parser Test]]
10547 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10548 !! wikitext
10549 {{SUBJECTSPACE}}
10550 !! html/*
10551
10552 !! end
10553
10554 !! test
10555 Magic Word: {{SUBJECTSPACEE}}
10556 !! options
10557 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SUBJECTSPACEE}}
10561 !! html/*
10562 <p>User
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{NAMESPACE}}
10568 !! options
10569 title=[[User:Ævar Arnfjörð Bjarmason]]
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{NAMESPACE}}
10573 !! html/*
10574 <p>User
10575 </p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{NAMESPACEE}}
10580 !! options
10581 title=[[User:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{NAMESPACEE}}
10585 !! html/*
10586 <p>User
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{NAMESPACENUMBER}}
10592 !! options
10593 title=[[User:Ævar Arnfjörð Bjarmason]]
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{NAMESPACENUMBER}}
10597 !! html/*
10598 <p>2
10599 </p>
10600 !! end
10601
10602 !! test
10603 Magic Word: {{SUBPAGENAME}}
10604 !! options
10605 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10606 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10607 !! wikitext
10608 {{SUBPAGENAME}}
10609 !! html/*
10610 <p>sub ö
10611 </p>
10612 !! end
10613
10614 !! test
10615 Magic Word: {{SUBPAGENAMEE}}
10616 !! options
10617 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10618 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10619 !! wikitext
10620 {{SUBPAGENAMEE}}
10621 !! html/*
10622 <p>sub_%C3%B6
10623 </p>
10624 !! end
10625
10626 !! test
10627 Magic Word: {{ROOTPAGENAME}}
10628 !! options
10629 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10630 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10631 !! wikitext
10632 {{ROOTPAGENAME}}
10633 !! html/*
10634 <p>Ævar Arnfjörð Bjarmason
10635 </p>
10636 !! end
10637
10638 !! test
10639 Magic Word: {{ROOTPAGENAMEE}}
10640 !! options
10641 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10642 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10643 !! wikitext
10644 {{ROOTPAGENAMEE}}
10645 !! html/*
10646 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10647 </p>
10648 !! end
10649
10650 !! test
10651 Magic Word: {{BASEPAGENAME}}
10652 !! options
10653 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10654 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10655 !! wikitext
10656 {{BASEPAGENAME}}
10657 !! html/*
10658 <p>Ævar Arnfjörð Bjarmason
10659 </p>
10660 !! end
10661
10662 !! test
10663 Magic Word: {{BASEPAGENAMEE}}
10664 !! options
10665 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10666 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10667 !! wikitext
10668 {{BASEPAGENAMEE}}
10669 !! html/*
10670 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10671 </p>
10672 !! end
10673
10674 !! test
10675 Magic Word: {{TALKPAGENAME}}
10676 !! options
10677 title=[[User:Ævar Arnfjörð Bjarmason]]
10678 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10679 !! wikitext
10680 {{TALKPAGENAME}}
10681 !! html/*
10682 <p>User talk:Ævar Arnfjörð Bjarmason
10683 </p>
10684 !! end
10685
10686 !! test
10687 Magic Word: {{TALKPAGENAMEE}}
10688 !! options
10689 title=[[User:Ævar Arnfjörð Bjarmason]]
10690 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10691 !! wikitext
10692 {{TALKPAGENAMEE}}
10693 !! html/*
10694 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10695 </p>
10696 !! end
10697
10698 !! test
10699 Magic Word: {{SUBJECTPAGENAME}}
10700 !! options
10701 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10702 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10703 !! wikitext
10704 {{SUBJECTPAGENAME}}
10705 !! html/*
10706 <p>User:Ævar Arnfjörð Bjarmason
10707 </p>
10708 !! end
10709
10710 !! test
10711 Magic Word: {{SUBJECTPAGENAMEE}}
10712 !! options
10713 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10714 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10715 !! wikitext
10716 {{SUBJECTPAGENAMEE}}
10717 !! html/*
10718 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10719 </p>
10720 !! end
10721
10722 !! test
10723 Magic Word: {{NUMBEROFFILES}}
10724 !! options
10725 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10726 !! wikitext
10727 {{NUMBEROFFILES}}
10728 !! html/*
10729 <p>7
10730 </p>
10731 !! end
10732
10733 !! test
10734 Magic Word: {{PAGENAME}}
10735 !! options
10736 title=[[User:Ævar Arnfjörð Bjarmason]]
10737 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10738 !! wikitext
10739 {{PAGENAME}}
10740 !! html/*
10741 <p>Ævar Arnfjörð Bjarmason
10742 </p>
10743 !! end
10744
10745 !! test
10746 Magic Word: {{PAGENAME}} with metacharacters
10747 !! options
10748 title=[['foo & bar = baz']]
10749 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10750 !! wikitext
10751 ''{{PAGENAME}}''
10752 !! html+tidy
10753 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10754 </p>
10755 !! end
10756
10757 !! test
10758 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10759 !! options
10760 title=[[*RFC 1234 http://example.com/]]
10761 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10762 !! wikitext
10763 {{PAGENAME}}
10764 !! html+tidy
10765 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10766 </p>
10767 !! end
10768
10769 !! test
10770 Magic Word: {{PAGENAMEE}}
10771 !! options
10772 title=[[User:Ævar Arnfjörð Bjarmason]]
10773 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10774 !! wikitext
10775 {{PAGENAMEE}}
10776 !! html/*
10777 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10778 </p>
10779 !! end
10780
10781 !! test
10782 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10783 !! options
10784 title=[[*RFC 1234 http://example.com/]]
10785 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10786 !! wikitext
10787 {{PAGENAMEE}}
10788 !! html+tidy
10789 <p>&#42;RFC_1234_http&#58;//example.com/
10790 </p>
10791 !! end
10792
10793 !! test
10794 Magic Word: {{REVISIONID}}
10795 !! options
10796 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10797 showflags
10798 !! wikitext
10799 {{REVISIONID}}
10800 !! html/*
10801 <p>1337
10802 </p>
10803 flags=vary-revision-id
10804 !! end
10805
10806 !! test
10807 Magic Word: {{SCRIPTPATH}}
10808 !! options
10809 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10810 !! wikitext
10811 {{SCRIPTPATH}}
10812 !! html/*
10813
10814 !! end
10815
10816 !! test
10817 Magic Word: {{STYLEPATH}}
10818 !! options
10819 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10820 !! wikitext
10821 {{STYLEPATH}}
10822 !! html/*
10823 <p>/skins
10824 </p>
10825 !! end
10826
10827 !! test
10828 Magic Word: {{SERVER}}
10829 !! options
10830 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10831 !! wikitext
10832 {{SERVER}}
10833 !! html/*
10834 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10835 </p>
10836 !! end
10837
10838 !! test
10839 Magic Word: {{SERVERNAME}}
10840 !! options
10841 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10842 !! wikitext
10843 {{SERVERNAME}}
10844 !! html/*
10845 <p>example.org
10846 </p>
10847 !! end
10848
10849 !! test
10850 Magic Word: {{SITENAME}}
10851 !! options
10852 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10853 !! wikitext
10854 {{SITENAME}}
10855 !! html/*
10856 <p>MediaWiki
10857 </p>
10858 !! end
10859
10860 !! test
10861 Magic Word: {{PAGELANGUAGE}}
10862 !! options
10863 language=fr
10864 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10865 !! wikitext
10866 {{PAGELANGUAGE}}
10867 !! html/*
10868 <p>fr
10869 </p>
10870 !! end
10871
10872 !! test
10873 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10874 !! options
10875 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10876 !! wikitext
10877 {{PAGELANGUAGE}}
10878 !! html/*
10879 <p>en
10880 </p>
10881 !! end
10882
10883 !! test
10884 Case-sensitive magic words, when cased differently, should just be template transclusions
10885 !! wikitext
10886 {{CurrentMonth}}
10887 {{currentday}}
10888 {{cURreNTweEK}}
10889 {{currentHour}}
10890 !! html
10891 <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>
10892 <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>
10893 <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>
10894 <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>
10895 </p>
10896 !! end
10897
10898 !! test
10899 Case-insensitive magic words should still work with weird casing.
10900 !! wikitext
10901 {{sErVeRNaMe}}
10902 {{LCFirst:AOEU}}
10903 {{ucFIRST:aoeu}}
10904 {{SERver}}
10905 !! html
10906 <p>example.org
10907 aOEU
10908 Aoeu
10909 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10910 </p>
10911 !! end
10912
10913 # From plwiki:PLOS_ONE
10914 !! test
10915 Parsoid: Page property magic word with magic word contents
10916 !! wikitext
10917 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10918 !! html/parsoid
10919 <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>"}]]}'/>
10920 !! end
10921
10922 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10923 # But, this is a limitation of our representation and is documented in
10924 # TemplateHandler.js in processSpecialMagicWord
10925 !! test
10926 Parsoid: Template-generated DISPLAYTITLE
10927 !! wikitext
10928 {{{{echo|DISPLAYTITLE}}:Foo}}
10929 !! options
10930 showtitle
10931 !! config
10932 wgAllowDisplayTitle=true
10933 wgRestrictDisplayTitle=false
10934 !! html/php
10935 Foo
10936
10937 !! html/parsoid
10938 <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"}]]}'/>
10939 !! end
10940
10941 !! test
10942 Namespace 1 {{ns:1}}
10943 !! wikitext
10944 {{ns:1}}
10945 !! html
10946 <p>Talk
10947 </p>
10948 !! end
10949
10950 !! test
10951 Namespace 1 {{ns:01}}
10952 !! wikitext
10953 {{ns:01}}
10954 !! html
10955 <p>Talk
10956 </p>
10957 !! end
10958
10959 !! test
10960 Namespace 0 {{ns:0}} (T6783)
10961 !! wikitext
10962 {{ns:0}}
10963 !! html
10964
10965 !! end
10966
10967 !! test
10968 Namespace 0 {{ns:00}} (T6783)
10969 !! wikitext
10970 {{ns:00}}
10971 !! html
10972
10973 !! end
10974
10975 !! test
10976 Namespace -1 {{ns:-1}}
10977 !! wikitext
10978 {{ns:-1}}
10979 !! html
10980 <p>Special
10981 </p>
10982 !! end
10983
10984 !! test
10985 Namespace User {{ns:User}}
10986 !! wikitext
10987 {{ns:User}}
10988 !! html
10989 <p>User
10990 </p>
10991 !! end
10992
10993 !! test
10994 Namespace User talk {{ns:User_talk}}
10995 !! wikitext
10996 {{ns:User_talk}}
10997 !! html
10998 <p>User talk
10999 </p>
11000 !! end
11001
11002 !! test
11003 Namespace User talk {{ns:uSeR tAlK}}
11004 !! wikitext
11005 {{ns:uSeR tAlK}}
11006 !! html
11007 <p>User talk
11008 </p>
11009 !! end
11010
11011 !! test
11012 Namespace File {{ns:File}}
11013 !! wikitext
11014 {{ns:File}}
11015 !! html
11016 <p>File
11017 </p>
11018 !! end
11019
11020 !! test
11021 Namespace File {{ns:Image}}
11022 !! wikitext
11023 {{ns:Image}}
11024 !! html
11025 <p>File
11026 </p>
11027 !! end
11028
11029 !! test
11030 Namespace (lang=de) Benutzer {{ns:User}}
11031 !! options
11032 language=de
11033 !! wikitext
11034 {{ns:User}}
11035 !! html
11036 <p>Benutzer
11037 </p>
11038 !! end
11039
11040 !! test
11041 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11042 !! options
11043 language=de
11044 !! wikitext
11045 {{ns:3}}
11046 !! html
11047 <p>Benutzer Diskussion
11048 </p>
11049 !! end
11050
11051 !! test
11052 Urlencode
11053 !! wikitext
11054 {{urlencode:hi world?!}}
11055 {{urlencode:hi world?!|WIKI}}
11056 {{urlencode:hi world?!|PATH}}
11057 {{urlencode:hi world?!|QUERY}}
11058 !! html/php
11059 <p>hi+world%3F%21
11060 hi_world%3F!
11061 hi%20world%3F%21
11062 hi+world%3F%21
11063 </p>
11064 !! end
11065
11066 !! test
11067 Magic Word: prioritize type info over data-parsoid
11068 !! options
11069 parsoid=html2wt
11070 !! html/parsoid
11071 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11072 !! wikitext
11073 __FORCETOC__
11074 !! end
11075
11076 !! test
11077 Magic Word: serialize on separate line (parsoid)
11078 !! options
11079 parsoid=wt2wt,html2wt
11080 !! wikitext
11081 foo
11082 __NOTOC__
11083 bar
11084 !! html/parsoid
11085 foo<meta property="mw:PageProp/notoc"/>bar
11086 !! end
11087
11088 !! test
11089 Magic Word: rt non-english wikis
11090 !! options
11091 parsoid=wt2wt
11092 language=de
11093 !! wikitext
11094 __NOEDITSECTION__
11095 !! html/parsoid
11096 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11097 !! end
11098
11099 !!test
11100 __proto__ is treated as normal wikitext (T105997)
11101 !!wikitext
11102 __proto__
11103 !!html
11104 <p>__proto__
11105 </p>
11106 !!end
11107
11108 ###
11109 ### Magic links
11110 ###
11111 !! test
11112 Magic links: internal link to RFC (T2479)
11113 !! wikitext
11114 [[RFC 123]]
11115 !! html/php
11116 <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>
11117 </p>
11118 !! html/parsoid
11119 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11120 !! end
11121
11122 !! test
11123 Magic links: RFC (T2479)
11124 !! wikitext
11125 RFC 822
11126 !! html/php
11127 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11128 </p>
11129 !! html/parsoid
11130 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11131 !! end
11132
11133 !! test
11134 Magic links: RFC (T67278)
11135 !! wikitext
11136 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11137 !! html/php
11138 <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.
11139 </p>
11140 !! html/parsoid
11141 <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>
11142 !! end
11143
11144 !! test
11145 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11146 !! wikitext
11147 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11148 RFC
11149 822
11150 !! html/php
11151 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11152 RFC
11153 822
11154 </p>
11155 !! html/parsoid
11156 <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>
11157 RFC
11158 822</p>
11159 !! end
11160
11161 !! test
11162 Magic links: ISBN (T3937)
11163 !! wikitext
11164 ISBN 0-306-40615-2
11165 !! html/php
11166 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11167 </p>
11168 !! html/parsoid
11169 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11170 !! end
11171
11172 !! test
11173 Magic links: ISBN (T67278)
11174 !! wikitext
11175 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11176 !! html/php
11177 <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.
11178 </p>
11179 !! html/parsoid
11180 <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>
11181 !! end
11182
11183 !! test
11184 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11185 !! wikitext
11186 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11187 ISBN
11188 9780316098113
11189 ISBN 978
11190 0316098113
11191 !! html/php
11192 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11193 ISBN
11194 9780316098113
11195 ISBN 978
11196 0316098113
11197 </p>
11198 !! html/parsoid
11199 <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>
11200 ISBN
11201 9780316098113
11202 ISBN 978
11203 0316098113</p>
11204 !! end
11205
11206 !! test
11207 Magic links: PMID incorrectly converts space to underscore
11208 !! wikitext
11209 PMID 1234
11210 !! html/php
11211 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11212 </p>
11213 !! html/parsoid
11214 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11215 !! end
11216
11217 !! test
11218 Magic links: PMID (T67278)
11219 !! wikitext
11220 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11221 !! html/php
11222 <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.
11223 </p>
11224 !! html/parsoid
11225 <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>
11226 !! end
11227
11228 !! test
11229 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11230 !! wikitext
11231 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11232 PMID
11233 1234
11234 !! html/php
11235 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11236 PMID
11237 1234
11238 </p>
11239 !! html/parsoid
11240 <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>
11241 PMID
11242 1234</p>
11243 !! end
11244
11245 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11246 # since these are ExtLinkText, not MagicLinkText
11247 !! test
11248 Magic links: use appropriate serialization for "almost" magic links.
11249 !! wikitext
11250 X[[Special:BookSources/0978739256|foo]]
11251
11252 X[https://tools.ietf.org/html/rfc1234 foo]
11253 !! html/php
11254 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11255 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11256 </p>
11257 !! html/parsoid
11258 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11259 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11260 !! end
11261
11262 !! test
11263 Magic links: All disabled (T47942)
11264 !! options
11265 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11266 !! wikitext
11267 ISBN 0-306-40615-2
11268 PMID 1234
11269 RFC 4321
11270 !! html/php
11271 <p>ISBN 0-306-40615-2
11272 PMID 1234
11273 RFC 4321
11274 </p>
11275 !! end
11276
11277 ###
11278 ### Templates
11279 ####
11280
11281 !! test
11282 Nonexistent template
11283 !! wikitext
11284 {{thistemplatedoesnotexist}}
11285 !! html
11286 <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>
11287 </p>
11288 !! end
11289
11290 !! test
11291 Template with invalid target containing tags
11292 !! wikitext
11293 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11294 !! html
11295 <p>{{a<b>b</b>|foo|a=b|a = b}}
11296 </p>
11297 !! end
11298
11299 !! test
11300 Template with invalid target containing unclosed tag
11301 !! wikitext
11302 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11303 !! html
11304 <p>{{a<b>|foo|a=b|a = b}}</b>
11305 </p>
11306 !! end
11307
11308 !! test
11309 Template with invalid target containing wikilink
11310 !! wikitext
11311 {{[[Main Page]]}}
11312 !! html/php
11313 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11314 </p>
11315 !! html/parsoid
11316 <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>
11317 !! end
11318
11319 !! test
11320 Template with just whitespace in it, T70421
11321 !! wikitext
11322 {{echo|{{ }}}}
11323 !! html/parsoid
11324 <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>
11325 !! end
11326
11327 !! article
11328 Template:test
11329 !! text
11330 This is a test template
11331 !! endarticle
11332
11333 !! test
11334 Simple template
11335 !! wikitext
11336 {{test}}
11337 !! html
11338 <p>This is a test template
11339 </p>
11340 !! end
11341
11342 !! test
11343 Template with explicit namespace
11344 !! wikitext
11345 {{Template:test}}
11346 !! html
11347 <p>This is a test template
11348 </p>
11349 !! end
11350
11351
11352 !! article
11353 Template:paramtest
11354 !! text
11355 This is a test template with parameter {{{param}}}
11356 !! endarticle
11357
11358 !! test
11359 Template parameter
11360 !! wikitext
11361 {{paramtest|param=foo}}
11362 !! html
11363 <p>This is a test template with parameter foo
11364 </p>
11365 !! end
11366
11367 !! article
11368 Template:paramtestnum
11369 !! text
11370 [[{{{1}}}|{{{2}}}]]
11371 !! endarticle
11372
11373 !! test
11374 Template unnamed parameter
11375 !! wikitext
11376 {{paramtestnum|Main Page|the main page}}
11377 !! html
11378 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11379 </p>
11380 !! end
11381
11382 !! article
11383 Template:templatesimple
11384 !! text
11385 (test)
11386 !! endarticle
11387
11388 !! article
11389 Template:templateredirect
11390 !! text
11391 #redirect [[Template:templatesimple]]
11392 !! endarticle
11393
11394 !! article
11395 Template:templateasargtestnum
11396 !! text
11397 {{{{{1}}}}}
11398 !! endarticle
11399
11400 !! article
11401 Template:templateasargtest
11402 !! text
11403 {{template{{{templ}}}}}
11404 !! endarticle
11405
11406 !! article
11407 Template:templateasargtest2
11408 !! text
11409 {{{{{templ}}}}}
11410 !! endarticle
11411
11412 !! test
11413 Template with template name as unnamed argument
11414 !! wikitext
11415 {{templateasargtestnum|templatesimple}}
11416 !! html
11417 <p>(test)
11418 </p>
11419 !! end
11420
11421 !! test
11422 Template with template name as argument
11423 !! wikitext
11424 {{templateasargtest|templ=simple}}
11425 !! html
11426 <p>(test)
11427 </p>
11428 !! end
11429
11430 !! test
11431 Template with template name as argument (2)
11432 !! wikitext
11433 {{templateasargtest2|templ=templatesimple}}
11434 !! html
11435 <p>(test)
11436 </p>
11437 !! end
11438
11439 !! article
11440 Template:templateasargtestdefault
11441 !! text
11442 {{{{{templ|templatesimple}}}}}
11443 !! endarticle
11444
11445 !! article
11446 Template:templa
11447 !! text
11448 '''templ'''
11449 !! endarticle
11450
11451 !! test
11452 Template with default value
11453 !! wikitext
11454 {{templateasargtestdefault}}
11455 !! html
11456 <p>(test)
11457 </p>
11458 !! end
11459
11460 !! test
11461 Template with default value (value set)
11462 !! wikitext
11463 {{templateasargtestdefault|templ=templa}}
11464 !! html
11465 <p><b>templ</b>
11466 </p>
11467 !! end
11468
11469 !! test
11470 Template redirect
11471 !! wikitext
11472 {{templateredirect}}
11473 !! html/php
11474 <p>(test)
11475 </p>
11476 !! html/parsoid
11477 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11478 !! end
11479
11480 !! test
11481 Template with argument in separate line
11482 !! wikitext
11483 {{ templateasargtest |
11484 templ = simple }}
11485 !! html
11486 <p>(test)
11487 </p>
11488 !! end
11489
11490 !! test
11491 Template with complex template as argument
11492 !! wikitext
11493 {{paramtest|
11494 param ={{ templateasargtest |
11495 templ = simple }}}}
11496 !! html
11497 <p>This is a test template with parameter (test)
11498 </p>
11499 !! end
11500
11501 !! test
11502 Templates with templated name
11503 !! wikitext
11504 {{{{echo|echo}}|foo}}
11505 {{{{echo|inner list}} }}
11506 !! html
11507 <p>foo
11508 </p>
11509 <ul><li>item 1</li></ul>
11510
11511 !! html/parsoid
11512 <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>
11513 <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>
11514 !! end
11515
11516 ## Regression test; the output here isn't really that interesting.
11517 !! test
11518 Templates with templated name and top level template args
11519 !! wikitext
11520 {{1{{2{{{3}}}|4=5}}}}
11521 !! html/parsoid
11522 <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>
11523 !! end
11524
11525 # Parsoid markup is deliberate "broken". This is an edge case.
11526 # See long comment in TemplateHandler.js:convertAttribsToString.
11527 !! test
11528 Templates with invalid templated targets
11529 !! wikitext
11530 {{echo
11531 {{echo|foo}}
11532 }}
11533 !! html/php
11534 <p>{{echo
11535 foo
11536 }}
11537 </p>
11538 !! html/parsoid
11539 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11540 foo }}</p>
11541 !! end
11542
11543 !! test
11544 Template with thumb image (with link in description)
11545 !! wikitext
11546 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11547 !! html/php
11548 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>
11549
11550 !! html+tidy
11551 <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>
11552 !! html/parsoid
11553 <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>
11554 !! end
11555
11556 !! article
11557 Template:complextemplate
11558 !! text
11559 {{{1}}} {{paramtest|
11560 param ={{{param}}}}}
11561 !! endarticle
11562
11563 !! test
11564 Template with complex arguments
11565 !! wikitext
11566 {{complextemplate|
11567 param ={{ templateasargtest |
11568 templ = simple }}|[[Template:complextemplate|link]]}}
11569 !! html
11570 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11571 </p>
11572 !! end
11573
11574 !! test
11575 T2553: link with two variables in a piped link
11576 !! wikitext
11577 {|
11578 |[[{{{1}}}|{{{2}}}]]
11579 |}
11580 !! html/php
11581 <table>
11582 <tr>
11583 <td>[[{{{1}}}|{{{2}}}]]
11584 </td></tr></table>
11585
11586 !! html/parsoid
11587 <table>
11588 <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>
11589 </tbody></table>
11590 !! end
11591
11592 # See: T2553
11593 !! test
11594 Abort table cell attribute parsing on wikilink
11595 !! wikitext
11596 {|
11597 |testing [[one|two]] |three||four
11598 |testing one two |three||four
11599 |testing="[[one|two]]" |three||four
11600 |}
11601 !! html/php
11602 <table>
11603 <tr>
11604 <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>
11605 <td>four
11606 </td>
11607 <td>three</td>
11608 <td>four
11609 </td>
11610 <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>
11611 <td>four
11612 </td></tr></table>
11613
11614 !! html/parsoid
11615 <table>
11616 <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>
11617 <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>
11618 <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>
11619 </tbody></table>
11620 !! end
11621
11622 !! test
11623 Don't abort table cell attribute parsing if wikilink is found in template arg
11624 !! wikitext
11625 {|
11626 |Test {{#tag:ref|One two "[[three]]" four}}
11627 |}
11628 !! html/parsoid
11629 <table>
11630 <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>
11631 </tbody></table>
11632 !! end
11633
11634 !! test
11635 Magic variable as template parameter
11636 !! wikitext
11637 {{paramtest|param={{SITENAME}}}}
11638 !! html
11639 <p>This is a test template with parameter MediaWiki
11640 </p>
11641 !! end
11642
11643 !! article
11644 Template:linktest
11645 !! text
11646 [[{{{param}}}|link]]
11647 !! endarticle
11648
11649 !! test
11650 Template parameter as link source
11651 !! wikitext
11652 {{linktest|param=Main Page}}
11653 !! html
11654 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11655 </p>
11656 !! end
11657
11658 !!article
11659 Template:paramtest2
11660 !! text
11661 including another template, {{paramtest|param={{{arg}}}}}
11662 !! endarticle
11663
11664 !! test
11665 Template passing argument to another template
11666 !! wikitext
11667 {{paramtest2|arg='hmm'}}
11668 !! html
11669 <p>including another template, This is a test template with parameter 'hmm'
11670 </p>
11671 !! end
11672
11673 !! article
11674 Template:Linktest2
11675 !! text
11676 Main Page
11677 !! endarticle
11678
11679 !! test
11680 Template as link source
11681 !! wikitext
11682 [[{{linktest2}}]]
11683
11684 [[{{linktest2}}|Main Page]]
11685
11686 [[{{linktest2}}]]Page
11687 !! html
11688 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11689 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11690 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11691 </p>
11692 !! end
11693
11694
11695 !! article
11696 Template:loop1
11697 !! text
11698 {{loop2}}
11699 !! endarticle
11700
11701 !! article
11702 Template:loop2
11703 !! text
11704 {{loop1}}
11705 !! endarticle
11706
11707 !! test
11708 Template infinite loop
11709 !! wikitext
11710 {{loop1}}
11711 !! html
11712 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11713 </p>
11714 !! end
11715
11716 !! test
11717 Template from main namespace
11718 !! wikitext
11719 {{:Main Page}}
11720 !! html
11721 <p>blah blah
11722 </p>
11723 !! end
11724
11725 !! test
11726 Template from non-includable namespace
11727 !! options
11728 wgNonincludableNamespaces=10
11729 !! wikitext
11730 {{echo|uh oh!}}
11731 !! html
11732 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11733 </p>
11734 !! end
11735
11736 !! article
11737 Template:table
11738 !! text
11739 {|
11740 | 1 || 2
11741 |-
11742 | 3 || 4
11743 |}
11744 !! endarticle
11745
11746 !! test
11747 T2529: Template with table, not included at beginning of line
11748 !! wikitext
11749 foo {{table}}
11750 !! html
11751 <p>foo
11752 </p>
11753 <table>
11754 <tr>
11755 <td>1</td>
11756 <td>2
11757 </td></tr>
11758 <tr>
11759 <td>3</td>
11760 <td>4
11761 </td></tr></table>
11762
11763 !! end
11764
11765 !! test
11766 T2523: Template shouldn't eat newline (or add an extra one before table)
11767 !! wikitext
11768 foo
11769 {{table}}
11770 !! html
11771 <p>foo
11772 </p>
11773 <table>
11774 <tr>
11775 <td>1</td>
11776 <td>2
11777 </td></tr>
11778 <tr>
11779 <td>3</td>
11780 <td>4
11781 </td></tr></table>
11782
11783 !! end
11784
11785 !! test
11786 T2041: Template parameters shown as broken links
11787 !! wikitext
11788 {{{parameter}}}
11789 !! html
11790 <p>{{{parameter}}}
11791 </p>
11792 !! end
11793
11794 !! test
11795 Template with targets containing wikilinks
11796 !! options
11797 parsoid=wt2html
11798 !! wikitext
11799 {{[[foo]]}}
11800
11801 {{[[{{echo|foo}}]]}}
11802
11803 {{{{echo|[[foo}}]]}}
11804 !! html/php
11805 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11806 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11807 </p><p>{{[[foo}}]]
11808 </p>
11809 !! html/parsoid
11810 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11811 <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>
11812 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11813 !! end
11814
11815 !! article
11816 Template:''
11817 !! text
11818 bar
11819 !! endarticle
11820
11821 !! test
11822 Templates: Double quotes as template target
11823 !! wikitext
11824 foo {{''}} baz
11825 !! html/php
11826 <p>foo bar baz
11827 </p>
11828 !! html/parsoid
11829 <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
11830 </p>
11831 !! end
11832
11833 ## This test is about making sure Parsoid's data-mw is well formed in the
11834 ## face of multiple templates with intersecting and overlapping ranges. The
11835 ## wikitext itself is wretched.
11836 !! test
11837 Templates with intersecting and overlapping ranges
11838 !! wikitext
11839 {|{{echo|
11840 <p>ha</p>}}
11841 {|{{echo|
11842 <p>ho</p>}}
11843 {{echo|{{!}}hi}}
11844 |}
11845 !! html/php+tidy
11846 <p>ha</p><table>
11847
11848 </table><p>ho</p><table>
11849
11850 <tbody><tr>
11851 <td>hi
11852 </td></tr></tbody></table>
11853 !! html/parsoid
11854 <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":""}]]}'>
11855
11856 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11857
11858 <tbody><tr><td>hi</td></tr>
11859 </tbody></table>
11860 !! end
11861
11862 !! article
11863 Template:MSGNW test
11864 !! text
11865 ''None'' of '''this''' should be
11866 * interpreted
11867 but rather passed unmodified
11868 {{test}}
11869 <gallery>
11870 File:Foobar.jpg
11871 </gallery>
11872 <!-- comment -->
11873 !! endarticle
11874
11875 # hmm, fix this or just deprecate msgnw and document its behavior?
11876 !! test
11877 msgnw keyword
11878 !! wikitext
11879 {{msgnw:MSGNW test}}
11880 !! html/php
11881 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11882 &#42; interpreted
11883 &#32;but rather passed unmodified
11884 &#123;&#123;test&#125;&#125;
11885 &#60;gallery&#62;
11886 File:Foobar.jpg
11887 &#60;/gallery&#62;
11888 &#60;!-- comment --&#62;
11889 </p>
11890 !! end
11891
11892 !! test
11893 int keyword
11894 !! wikitext
11895 {{int:youhavenewmessages|lots of money|not!}}
11896 !! html
11897 <p>You have lots of money (not!).
11898 </p>
11899 !! end
11900
11901 !! test
11902 int keyword - non-existing message
11903 !! wikitext
11904 {{int:var}}
11905 !! html
11906 <p>⧼var⧽
11907 </p>
11908 !! end
11909
11910 !! article
11911 Template:Includes
11912 !! text
11913 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11914 !! endarticle
11915
11916 !! test
11917 <includeonly> and <noinclude> being included
11918 !! wikitext
11919 {{Includes}}
11920 !! html
11921 <p>Foobar
11922 </p>
11923 !! end
11924
11925 !! article
11926 Template:Includes2
11927 !! text
11928 <onlyinclude>Foo</onlyinclude>bar
11929 !! endarticle
11930
11931 !! test
11932 <onlyinclude> being included
11933 !! wikitext
11934 {{Includes2}}
11935 !! html
11936 <p>Foo
11937 </p>
11938 !! end
11939
11940
11941 !! article
11942 Template:Includes3
11943 !! text
11944 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11945 !! endarticle
11946
11947 !! test
11948 <onlyinclude> and <includeonly> being included
11949 !! wikitext
11950 {{Includes3}}
11951 !! html
11952 <p>Foo
11953 </p>
11954 !! end
11955
11956 !! test
11957 <includeonly> and <noinclude> on a page
11958 !! wikitext
11959 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11960 !! html
11961 <p>Foozar
11962 </p>
11963 !! end
11964
11965 !! test
11966 Un-closed <noinclude>
11967 !! wikitext
11968 <noinclude>
11969 !! html
11970 !! end
11971
11972 !! test
11973 <onlyinclude> on a page
11974 !! wikitext
11975 <onlyinclude>Foo</onlyinclude>bar
11976 !! html
11977 <p>Foobar
11978 </p>
11979 !! end
11980
11981 !! test
11982 Un-closed <onlyinclude>
11983 !! wikitext
11984 <onlyinclude>
11985 !! html
11986 !! end
11987
11988 !!test
11989 Self-closed noinclude, includeonly, onlyinclude tags
11990 !! wikitext
11991 <noinclude />
11992 <includeonly />
11993 <onlyinclude />
11994 !! html
11995 <p><br />
11996 </p>
11997 !!end
11998
11999 !!test
12000 Unbalanced includeonly and noinclude tags
12001 !! wikitext
12002 {|
12003 |a</noinclude>
12004 |b</noinclude></noinclude>
12005 |c</noinclude></includeonly>
12006 |d</includeonly></includeonly>
12007 |}
12008 !! html
12009 <table>
12010 <tr>
12011 <td>a
12012 </td>
12013 <td>b
12014 </td>
12015 <td>c&lt;/includeonly&gt;
12016 </td>
12017 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12018 </td></tr></table>
12019
12020 !!end
12021
12022 !! article
12023 Template:Includeonly section
12024 !! text
12025 <includeonly>
12026 ==Includeonly section==
12027 </includeonly>
12028 ==Section T-1==
12029 !!endarticle
12030
12031 !! test
12032 T8563: Edit link generation for section shown by <includeonly>
12033 !! wikitext
12034 {{includeonly section}}
12035 !! html
12036 <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>
12037 <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>
12038
12039 !! end
12040
12041 # Uses same input as the contents of [[Template:Includeonly section]]
12042 !! test
12043 T8563: Section extraction for section shown by <includeonly>
12044 !! options
12045 section=T-2
12046 !! wikitext
12047 <includeonly>
12048 ==Includeonly section==
12049 </includeonly>
12050 ==Section T-2==
12051 !! html
12052 ==Section T-2==
12053 !! end
12054
12055 !! test
12056 T8563: Edit link generation for section suppressed by <includeonly>
12057 !! wikitext
12058 <includeonly>
12059 ==Includeonly section==
12060 </includeonly>
12061 ==Section 1==
12062 !! html
12063 <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>
12064
12065 !! end
12066
12067 !! test
12068 T8563: Section extraction for section suppressed by <includeonly>
12069 !! options
12070 section=1
12071 !! wikitext
12072 <includeonly>
12073 ==Includeonly section==
12074 </includeonly>
12075 ==Section 1==
12076 !! html
12077 ==Section 1==
12078 !! end
12079
12080 !! test
12081 Un-closed <includeonly>
12082 !! wikitext
12083 <includeonly>
12084 !! html/php
12085 !! html/parsoid
12086 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12087 !! end
12088
12089 ## We used to, but no longer wt2wt this test since the default serializer
12090 ## will normalize the include directives to serialize on their own line.
12091 ## Selser will take care of preserving formatting in scenarios where they
12092 ## intermingled with other wikitext.
12093 !! test
12094 Includes and comments at SOL
12095 !! options
12096 parsoid=wt2html,html2html
12097 !! wikitext
12098 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12099
12100 <noinclude>
12101 some
12102 </noinclude>*stuff
12103 *here
12104
12105 <noinclude>
12106 some</noinclude>* stuff
12107 * here
12108
12109 <includeonly>can have stuff</includeonly>===here===
12110
12111 !! html/php
12112 <h2><span class="mw-headline" id="hu">hu</span></h2>
12113 <p>some
12114 </p>
12115 <ul><li>stuff</li>
12116 <li>here</li></ul>
12117 <p><br />
12118 some* stuff
12119 </p>
12120 <ul><li>here</li></ul>
12121 <h3><span class="mw-headline" id="here">here</span></h3>
12122
12123 !! html/parsoid
12124 <!-- 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>
12125
12126 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12127 <p>some</p>
12128 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12129 <li>here</li></ul>
12130
12131 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12132 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12133 <ul><li>here</li></ul>
12134
12135 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
12136
12137 !! end
12138
12139 # TODO: test with DOM fragment reuse!
12140 !! test
12141 Parsoid: DOM fragment reuse
12142 !! options
12143 parsoid=wt2wt,wt2html
12144 !! wikitext
12145 a{{echo|b<table></table>c}}d
12146
12147 a{{echo|b
12148 <table></table>
12149 c}}d
12150
12151 {{echo|a
12152
12153 <table></table>
12154
12155 b}}
12156 !! html
12157 <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>
12158
12159 <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">
12160 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12161 </span><p about="#mwt2">cd</p>
12162
12163 <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">
12164
12165 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12166
12167 </span><p about="#mwt3">b</p>
12168 !! end
12169
12170 !! test
12171 Parsoid: Merge double tds (T52603)
12172 !! options
12173 parsoid
12174 !! wikitext
12175 {|
12176 |{{echo|{{!}} foo}}
12177 |}
12178 !! html
12179 <table><tbody>
12180 <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>
12181 </tbody></table>
12182 !! end
12183
12184 !! test
12185 Parsoid: Merge double tds in nested transclusion content (T52603)
12186 !! options
12187 parsoid
12188 !! wikitext
12189 {{echo|<div>}}
12190 {|
12191 |{{echo|{{!}} foo}}
12192 |}
12193 {{echo|</div>}}
12194 !! html
12195 <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}}]}'>
12196 <table><tbody>
12197 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12198 </tbody></table>
12199 </div>
12200 !! end
12201
12202 ###
12203 ### <includeonly> and <noinclude> in attributes
12204 ###
12205 !!test
12206 0. includeonly around the entire attribute
12207 !! wikitext
12208 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12209 !! html
12210 <p><span id="v2">bar</span>
12211 </p>
12212 !!end
12213
12214 !!test
12215 1. includeonly in html attr key
12216 !! wikitext
12217 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12218 !! html
12219 <p><span id="foo">bar</span>
12220 </p>
12221 !!end
12222
12223 !!test
12224 2. includeonly in html attr value
12225 !! wikitext
12226 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12227 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12228 !! html
12229 <p><span id="v1">bar</span>
12230 <span id="v1">bar</span>
12231 </p>
12232 !!end
12233
12234 !!test
12235 3. includeonly in part of an attr value
12236 !! wikitext
12237 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12238 !! html
12239 <p><span style="color:red;">bar</span>
12240 </p>
12241 !!end
12242
12243 !!test
12244 4. includeonly in table attributes
12245 !! wikitext
12246 {|
12247 |- <noinclude>
12248 |-
12249 |a
12250 </noinclude>
12251 |- <includeonly>
12252 |-
12253 |b
12254 </includeonly>
12255 |}
12256 !! html
12257 <table>
12258
12259
12260 <tr>
12261 <td>a
12262 </td></tr>
12263 </table>
12264
12265 !!end
12266
12267 ###
12268 ### Preprocessor precedence tests
12269 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12270 ###
12271 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12272 !! test
12273 Preprocessor precedence 1: link is rightmost opening
12274 !! options
12275 parsoid=wt2html
12276 !! wikitext
12277 {{[[Foo|bar}}]]
12278
12279 But close-brace is not a valid character in a link title:
12280 {{[[Foo}}|bar]]
12281
12282 However, we can still tell this was handled as a link in the preprocessor:
12283 {{echo|[[Foo}}|bar]]|bat}}
12284 !! html/php
12285 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12286 </p><p>But close-brace is not a valid character in a link title:
12287 {{[[Foo}}|bar]]
12288 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12289 [[Foo}}|bar]]
12290 </p>
12291 !! html/parsoid
12292 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12293 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12294 <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>
12295 !! end
12296
12297 !! test
12298 Preprocessor precedence 2: template is rightmost opening
12299 !! options
12300 language=zh
12301 !! wikitext
12302 -{{echo|foo}-}}-
12303 !! html/php
12304 <p>-foo}--
12305 </p>
12306 !! html/parsoid
12307 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12308 !! end
12309
12310 !! test
12311 Preprocessor precedence 3: language converter is rightmost opening
12312 !! options
12313 language=zh
12314 parsoid=wt2html
12315 !! wikitext
12316 {{echo|hi}}
12317
12318 {{-{R|echo|hi}}}-
12319
12320 [[-{R|raw]]}-
12321 !! html/php
12322 <p>hi
12323 </p><p>{{echo|hi}}
12324 </p><p>[[raw]]
12325 </p>
12326 !! html/parsoid
12327 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12328 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12329 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12330 !! end
12331
12332 !! test
12333 Preprocessor precedence 4: left-most angle bracket
12334 !! options
12335 language=zh
12336 !! wikitext
12337 <!--{raw}-->
12338 !! html/php
12339 !! html/parsoid
12340 <!--{raw}-->
12341 !! end
12342
12343 !! article
12344 Template:Precedence5
12345 !! text
12346 {{{{{1}}}}}
12347 !! endarticle
12348
12349 !! test
12350 Preprocessor precedence 5: tplarg takes precedence over template
12351 !! wikitext
12352 {{Precedence5|Bullet}}
12353 !! html/php
12354 <ul><li>Bar</li></ul>
12355
12356 !! html/parsoid
12357 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12358 !! end
12359
12360 !! test
12361 Preprocessor precedence 6: broken link is rightmost opening
12362 !! options
12363 parsoid=wt2html
12364 !! wikitext
12365 {{echo|[[Foo}}
12366
12367 {{echo|[[Foo|bar|bat=baz}}
12368 !! html/php
12369 <p>{{echo|[[Foo}}
12370 </p><p>{{echo|[[Foo|bar|bat=baz}}
12371 </p>
12372 !! html/parsoid
12373 <p>{{echo|[[Foo}}</p>
12374 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12375 !! end
12376
12377 # This next test exposes a difference between PHP and Parsoid:
12378 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12379 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12380 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12381 # outer `[[Foo` extends until the `y]]`
12382 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12383 # intermediate result (after template expansion), and link processing
12384 # happens on this intermediate result, which moves the wikilink
12385 # boundary leftward to `[[Foo|Bar]]`
12386 # 2b) Parsoid works in a single step, so it's going to keep the
12387 # wikilink as extending to the `y]]`
12388 # 3a) Then PHP does linktrail processing which slurps up the trailing
12389 # `xy` inside the link.
12390 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12391 # `z` inside the link.
12392 # This is "correct" behavior. Parsoid's basic worldview is that the
12393 # `]]` inside the template shouldn't be allowed to leak out to affect
12394 # the surrounding wikilink. PHP may match Parsoid (in the future)
12395 # if you use {{#balance}} (T114445).
12396
12397 !! test
12398 Preprocessor precedence 7: broken template is rightmost opening
12399 !! options
12400 parsoid=wt2html
12401 !! wikitext
12402 [[Foo|{{echo|Bar]]
12403
12404 [[Foo|{{echo|Bar]]-x}}-y]]-z
12405
12406 Careful: linktrails can move the end of the wikilink:
12407 [[Foo|{{echo|y']]a}}l]]l
12408 !! html/php
12409 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12410 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12411 </p><p>Careful: linktrails can move the end of the wikilink:
12412 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12413 </p>
12414 !! html/parsoid
12415 <p>[[Foo|{{echo|Bar]]</p>
12416 <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>
12417 <p>Careful: linktrails can move the end of the wikilink:
12418 <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>
12419 !! end
12420
12421 !! test
12422 Preprocessor precedence 8: broken language converter is rightmost opening
12423 !! options
12424 language=zh
12425 !! wikitext
12426 [[Foo-{R|raw]]
12427 !! html
12428 <p>[[Foo-{R|raw]]
12429 </p>
12430 !! end
12431
12432 !! article
12433 Template:Preprocessor_precedence_9
12434 !! text
12435 ;4: {{{{1}}}}
12436 ;5: {{{{{2}}}}}
12437 ;6: {{{{{{3}}}}}}
12438 ;7: {{{{{{{4}}}}}}}
12439 !! endarticle
12440
12441 !! test
12442 Preprocessor precedence 9: groups of braces
12443 !! wikitext
12444 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12445 !! html/php
12446 <dl><dt>4</dt>
12447 <dd>{Four}</dd>
12448 <dt>5</dt>
12449 <dd></dd></dl>
12450 <ul><li>Bar</li></ul>
12451 <dl><dt>6</dt>
12452 <dd>Four</dd>
12453 <dt>7</dt>
12454 <dd>{Bullet}</dd></dl>
12455
12456 !! html/parsoid
12457 <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}}]}'>
12458 <dt>4</dt>
12459 <dd>{Four}</dd>
12460 <dt>5</dt>
12461 <dd></dd>
12462 </dl><ul about="#mwt1">
12463 <li>Bar</li>
12464 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12465 <dt>6</dt>
12466 <dd>Four</dd>
12467 <dt>7</dt>
12468 <dd>{Bullet}</dd>
12469 </dl>
12470 !! end
12471
12472 !! article
12473 Template:Preprocessor_precedence_10
12474 !! text
12475 ;1: -{R|raw}-
12476 ;2: -{{Bullet}}-
12477 ;3: -{{{1}}}-
12478 ;4: -{{{{2}}}}-
12479 ;5: -{{{{{3}}}}}-
12480 ;6: -{{{{{{4}}}}}}-
12481 ;7: -{{{{{{{5}}}}}}}-
12482 !! endarticle
12483
12484 !! test
12485 Preprocessor precedence 10: groups of braces with leading dash
12486 !! options
12487 language=zh
12488 !! wikitext
12489 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12490 !! html/php
12491 <dl><dt>1</dt>
12492 <dd>raw</dd>
12493 <dt>2</dt>
12494 <dd>-</dd></dl>
12495 <ul><li>Bar-</li></ul>
12496 <dl><dt>3</dt>
12497 <dd>-Three-</dd>
12498 <dt>4</dt>
12499 <dd>raw2</dd>
12500 <dt>5</dt>
12501 <dd>-</dd></dl>
12502 <ul><li>Bar-</li></ul>
12503 <dl><dt>6</dt>
12504 <dd>-Three-</dd>
12505 <dt>7</dt>
12506 <dd>raw2</dd></dl>
12507
12508 !! html/parsoid
12509 <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}}]}'>
12510 <dt>1</dt>
12511 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12512 <dt>2</dt>
12513 <dd>-</dd>
12514 </dl><ul about="#mwt1">
12515 <li>Bar-</li>
12516 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12517 <dt>3</dt>
12518 <dd>-Three-</dd>
12519 <dt>4</dt>
12520 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12521 <dt>5</dt>
12522 <dd>-</dd>
12523 </dl><ul about="#mwt1">
12524 <li>Bar-</li>
12525 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12526 <dt>6</dt>
12527 <dd>-Three-</dd>
12528 <dt>7</dt>
12529 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12530 </dl>
12531 !! end
12532
12533 !! test
12534 Preprocessor precedence 11: found during visual diff testing
12535 !! wikitext
12536 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12537
12538 {{echo|-{{echo|-{{echo|x}}}}}}
12539
12540 {{echo|-{{echo|x}}}}
12541 !! html/php
12542 <p><span>-<span>-x</span></span>
12543 </p><p>--x
12544 </p><p>-x
12545 </p>
12546 !! html/parsoid
12547 <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>
12548
12549 <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>
12550
12551 <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>
12552 !! end
12553
12554 !! test
12555 Preprocessor precedence 12: broken language converter closed by brace.
12556 !! options
12557 parsoid=wt2html
12558 !! wikitext
12559 This form breaks the template, which is unfortunate:
12560 *{{echo|foo-{bar}bat}}
12561
12562 But if the broken language converter markup is inside an extension
12563 tag, nothing bad happens:
12564 *<nowiki>foo-{bar}bat</nowiki>
12565 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12566 *<pre>foo-{bar}bat</pre>
12567 *{{echo|<pre>foo-{bar}bat</pre>}}
12568
12569 <tag>foo-{bar}bat</tag>
12570 {{echo|<tag>foo-{bar}bat</tag>}}
12571
12572 !! html/php+tidy
12573 <p>This form breaks the template, which is unfortunate:
12574 </p>
12575 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12576 <p>But if the broken language converter markup is inside an extension
12577 tag, nothing bad happens:
12578 </p>
12579 <ul><li>foo-&#123;bar}bat</li>
12580 <li>foo-&#123;bar}bat</li>
12581 <li><pre>foo-{bar}bat</pre></li>
12582 <li><pre>foo-{bar}bat</pre></li></ul>
12583 <pre>'foo-{bar}bat'
12584 array (
12585 )
12586 </pre>
12587 <pre>'foo-{bar}bat'
12588 array (
12589 )
12590 </pre>
12591 !! html/parsoid
12592 <p>This form breaks the template, which is unfortunate:</p>
12593 <ul>
12594 <li>{{echo|foo-{bar}bat}}</li>
12595 </ul>
12596 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12597 <ul>
12598 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12599 <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>
12600 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12601 <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>
12602 </ul>
12603 <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>
12604 !! end
12605
12606 !! test
12607 Preprocessor precedence 13: broken language converter in external link
12608 !! options
12609 parsoid=wt2html
12610 !! wikitext
12611 *[http://example.com/-{foo Example in URL]
12612 *[http://example.com Example in -{link} description]
12613 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12614 !! html/php+tidy
12615 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12616 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12617 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12618 !! html/parsoid
12619 <ul>
12620 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12621 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12622 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12623 </ul>
12624 !! end
12625
12626 !! test
12627 Preprocessor precedence 14: broken language converter in comment
12628 !! wikitext
12629 *<!--{{foo}}-->...should be ok
12630 *<!---{{foo}}-->...extra dashes
12631 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12632 !! html/php+tidy
12633 <ul><li>...should be ok</li>
12634 <li>...extra dashes</li>
12635 <li>foobat...should be ok</li></ul>
12636 !! html/parsoid
12637 <ul>
12638 <li><!--{{foo}}-->...should be ok</li>
12639 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12640 <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>
12641 </ul>
12642 !! end
12643
12644 !! test
12645 Preprocessor precedence 15: broken brace markup in headings
12646 !! config
12647 wgFragmentMode=[ 'html5', 'legacy' ]
12648 !! options
12649 parsoid=wt2html
12650 !! wikitext
12651 __NOTOC__ __NOEDITSECTION__
12652 ===1 foo[bar 1===
12653 1
12654 ===2 foo[[bar 2===
12655 2
12656 ===3 foo{bar 3===
12657 3
12658 ===4 foo{{bar 4===
12659 4
12660 ===5 foo{{{bar 5===
12661 5
12662 ===6 foo-{bar 6===
12663 6
12664 !! html/php+tidy
12665 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12666 <p>1
12667 </p>
12668 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12669 <p>2
12670 </p>
12671 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12672 <p>3
12673 </p>
12674 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12675 <p>4
12676 </p>
12677 <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>
12678 <p>5
12679 </p>
12680 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12681 <p>6
12682 </p>
12683 !! html/parsoid
12684 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12685 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12686 <p>1</p>
12687 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12688 <p>2</p>
12689 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12690 <p>3</p>
12691 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12692 <p>4</p>
12693 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12694 <p>5</p>
12695 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12696 <p>6</p>
12697 !! end
12698
12699 !! test
12700 Preprocessor precedence 16: matching closing braces to opening braces
12701 !! options
12702 language=zh
12703 parsoid=wt2html
12704 !! wikitext
12705 -{{{echo|foo}}bar}-
12706 !! html/php
12707 <p>foobar
12708 </p>
12709 !! html/parsoid
12710 <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>
12711 !! end
12712
12713 !! test
12714 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12715 !! options
12716 parsoid=wt2html
12717 !! wikitext
12718 {{echo|hi {{}}}}
12719 !! html/php
12720 <p>hi {{}}
12721 </p>
12722 !! html/parsoid
12723 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12724 !! end
12725
12726 # Ensure we're using a language without variants for this test; even
12727 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12728 !! test
12729 Preprocessor precedence 18: another rightmost wins scenario
12730 !! options
12731 parsoid=wt2html
12732 language=de
12733 !! wikitext
12734 {{ -{{{{1|tplarg}}} }} }-
12735 !! html/php
12736 <p>{{ -{tplarg }} }-
12737 </p>
12738 !! html/parsoid
12739 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12740 !! end
12741
12742 !! test
12743 Preprocessor precedence 19: break syntax
12744 !! options
12745 parsoid=wt2html
12746 !! wikitext
12747 -{{
12748 !! html/php
12749 <p>-{{
12750 </p>
12751 !! html/parsoid
12752 <p>-{{</p>
12753 !! end
12754
12755 ###
12756 ### Token Stream Patcher tests
12757 ###
12758 ### These tests won't always pass wt2wt and other modes because
12759 ### on serialization, the table will be output on a new line.
12760 ### For now, we are blacklisting them, and using this to test selser.
12761 ###
12762
12763 !!test
12764 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12765 !!options
12766 parsoid=wt2html,wt2wt
12767 !!wikitext
12768 {{echo|}}{| width = '100%'
12769 |foo
12770 |}
12771 !!html/parsoid
12772 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12773 <tbody><tr><td>foo</td></tr>
12774 </tbody></table>
12775 !!end
12776
12777 ## We used to, but no longer wt2wt this test since the default serializer
12778 ## will normalize the include directives to serialize on their own line.
12779 ## Selser will take care of preserving formatting in scenarios where they
12780 ## intermingled with other wikitext.
12781 !!test
12782 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12783 !!options
12784 parsoid=wt2html
12785 !!wikitext
12786 <includeonly>a</includeonly>{| {{{b}}}
12787 |c
12788 |}
12789 !!html/parsoid
12790 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}' data-mw='{"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":""}]]}'>
12791 <tbody><tr><td>c</td></tr>
12792 </tbody></table>
12793 !!end
12794
12795 !! test
12796 Table wikitext syntax outside wiki-tables
12797 !! wikitext
12798 a
12799 |+ not a caption
12800 ! not a table heading
12801 |- not a table row
12802 | not a table cell
12803 | class="foo bar" | baz
12804 b
12805 |}
12806 |-
12807 c
12808 !! html
12809 <p>a
12810 |+ not a caption
12811 ! not a table heading
12812 |- not a table row
12813 | not a table cell
12814 | class="foo bar" | baz
12815 b
12816 |}
12817 |-
12818 c
12819 </p>
12820 !! end
12821
12822 ###
12823 ### Testing parsing of templates where a template arg
12824 ### has the same name as the template itself.
12825 ###
12826
12827 !! article
12828 Template:quote
12829 !! text
12830 {{{quote|{{{1}}}}}}
12831 !! endarticle
12832
12833 !!test
12834 Templates: Template Name/Arg clash: 1. Use of positional param
12835 !! wikitext
12836 {{quote|foo}}
12837 !! html
12838 <p>foo
12839 </p>
12840 !!end
12841
12842 !!test
12843 Templates: Template Name/Arg clash: 2. Use of named param
12844 !! wikitext
12845 {{quote|quote=foo}}
12846 !! html
12847 <p>foo
12848 </p>
12849 !!end
12850
12851 !!test
12852 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12853 !! wikitext
12854 {{quote|quote}}
12855 !! html
12856 <p>quote
12857 </p>
12858 !!end
12859
12860 ###
12861 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12862 ###
12863
12864 !!test
12865 Templates: 1. Simple use
12866 !! wikitext
12867 {{echo|Foo}}
12868 !! html
12869 <p>Foo
12870 </p>
12871 !!end
12872
12873 !!test
12874 Templates: 2. Inside a block tag
12875 !! wikitext
12876 <div>{{echo|Foo}}</div>
12877 <blockquote>{{echo|Foo}}</blockquote>
12878 !! html
12879 <div>Foo</div>
12880 <blockquote>Foo</blockquote>
12881
12882 !! html+tidy
12883 <div>Foo</div>
12884 <blockquote><p>Foo</p></blockquote>
12885 !!end
12886
12887 !!test
12888 Templates: P-wrapping: 1a. Templates on consecutive lines
12889 !! wikitext
12890 {{echo|Foo}}
12891 {{echo|bar}}
12892 !! html
12893 <p>Foo
12894 bar
12895 </p>
12896 !!end
12897
12898 !!test
12899 Templates: P-wrapping: 1b. Templates on consecutive lines
12900 !! wikitext
12901 Foo
12902
12903 {{echo|bar}}
12904 {{echo|baz}}
12905 !! html
12906 <p>Foo
12907 </p><p>bar
12908 baz
12909 </p>
12910 !!end
12911
12912 !!test
12913 Templates: P-wrapping: 1c. Templates on consecutive lines
12914 !! wikitext
12915 {{echo|Foo}}
12916 {{echo|bar}} <div>baz</div>
12917 !! html
12918 <p>Foo
12919 </p>
12920 bar <div>baz</div>
12921
12922 !! html+tidy
12923 <p>Foo
12924 </p><p>
12925 bar </p><div>baz</div>
12926 !! end
12927
12928 !!test
12929 Templates: P-wrapping: 1d. Template preceded by comment-only line
12930 !!options
12931 parsoid
12932 !! wikitext
12933 <!-- foo -->
12934 {{echo|Bar}}
12935 !! html
12936 <!-- foo -->
12937
12938 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12939 !!end
12940
12941 !! test
12942 Templates: Scopes should not be expanded unnecessarily
12943 !! options
12944 parsoid=wt2html,wt2wt
12945 !! wikitext
12946 {{echo|<div>a</div>}}b{{echo|
12947 <div>c</div>}}
12948 !! html
12949 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>a&lt;/div>"}},"i":0}}]}'>a</div><p>b</p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;div>c&lt;/div>"}},"i":0}}]}'>
12950 </span><div about="#mwt2">c</div>
12951 !! end
12952
12953 !!test
12954 Templates: Inline Text: 1. Multiple template uses
12955 !! wikitext
12956 {{echo|Foo}}bar{{echo|baz}}
12957 !! html
12958 <p>Foobarbaz
12959 </p>
12960 !!end
12961
12962 !!test
12963 Templates: Inline Text: 2. Back-to-back template uses
12964 !! wikitext
12965 {{echo|Foo}}{{echo|bar}}
12966 !! html
12967 <p>Foobar
12968 </p>
12969 !!end
12970
12971 !!test
12972 Templates: Block Tags: 1. Multiple template uses
12973 !! wikitext
12974 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12975 !! html
12976 <div>Foo</div><div>bar</div><div>baz</div>
12977
12978 !!end
12979
12980 !!test
12981 Templates: Block Tags: 2. Back-to-back template uses
12982 !! wikitext
12983 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12984 !! html
12985 <div>Foo</div><div>bar</div>
12986
12987 !!end
12988
12989 ## Parsoid drops empty elements in templates.
12990 !! test
12991 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12992 !! wikitext
12993 {{echo|a
12994 b</p>}}
12995 !! html/php+tidy
12996 <p>a
12997 </p><p>
12998 b</p><p class="mw-empty-elt"></p>
12999 !! html/parsoid
13000 <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">
13001 </span><p about="#mwt1">b</p>
13002 !! end
13003
13004 !!test
13005 Templates: Links: 1. Simple example
13006 !! wikitext
13007 {{echo|[[Foo|bar]]}}
13008 !! html
13009 <p><a href="/wiki/Foo" title="Foo">bar</a>
13010 </p>
13011 !!end
13012
13013 !!test
13014 Templates: Links: 2. Generation of link href
13015 !! wikitext
13016 [[{{echo|Foo}}|bar]]
13017 !! html
13018 <p><a href="/wiki/Foo" title="Foo">bar</a>
13019 </p>
13020 !!end
13021
13022 !!test
13023 Templates: Links: 3. Generation of part of a link href
13024 !! wikitext
13025 [[Fo{{echo|o}}|bar]]
13026
13027 [[Foo{{echo|bar}}]]
13028
13029 [[Foo{{echo|bar}}baz]]
13030
13031 [[Foo{{echo|bar}}|bar]]
13032
13033 [[:Foo{{echo|bar}}]]
13034
13035 [[:Foo{{echo|bar}}|bar]]
13036 !! html
13037 <p><a href="/wiki/Foo" title="Foo">bar</a>
13038 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13039 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13040 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13041 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13042 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13043 </p>
13044 !!end
13045
13046 !!test
13047 Templates: Links: 4. Multiple templates generating link href
13048 !! wikitext
13049 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13050 !! html
13051 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13052 </p>
13053 !!end
13054
13055 !!test
13056 Templates: Links: 5. Generation of link text
13057 !! wikitext
13058 [[Foo|{{echo|bar}}]]
13059 !! html
13060 <p><a href="/wiki/Foo" title="Foo">bar</a>
13061 </p>
13062 !!end
13063
13064 !!test
13065 Templates: Links: 5. Nested templates (only outermost template should be marked)
13066 !! wikitext
13067 {{echo|[[{{echo|Foo}}|bar]]}}
13068 !! html
13069 <p><a href="/wiki/Foo" title="Foo">bar</a>
13070 </p>
13071 !!end
13072
13073 !!test
13074 Templates: HTML Tag: 1. Generation of HTML attr. key
13075 !! wikitext
13076 <div {{echo|style}}="color:red;">foo</div>
13077 !! html
13078 <div style="color:red;">foo</div>
13079
13080 !!end
13081
13082 !!test
13083 Templates: HTML Tag: 2. Generation of HTML attr. value
13084 !! wikitext
13085 <div style={{echo|'color:red;'}}>foo</div>
13086 !! html
13087 <div style="color:red;">foo</div>
13088
13089 !!end
13090
13091 !!test
13092 Templates: HTML Tag: 3. Generation of HTML attr key and value
13093 !! wikitext
13094 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13095 !! html
13096 <div style="color:red;">foo</div>
13097
13098 !!end
13099
13100 !!test
13101 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13102 !! wikitext
13103 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13104 !! html
13105 <div title="This is a long title with just one piece templated">foo</div>
13106
13107 !!end
13108
13109 !!test
13110 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13111 !! wikitext
13112 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13113 !! html
13114 <div title="This is a long title with just one piece templated">foo</div>
13115
13116 !!end
13117
13118 !!test
13119 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13120 !! wikitext
13121 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13122 !! html
13123 <div title="This is a long title with just one piece templated">foo</div>
13124
13125 !!end
13126
13127 # SSS FIXME: While it is great we added support for all this,
13128 # do we want to make this part of the spec? Maybe we want to
13129 # deprecate this kind of usage in the future?
13130 !!test
13131 Templates: HTML Tag: 7. Generation of partial attribute key string
13132 !! wikitext
13133 <div st{{echo|yle}}="color:red;">foo</div>
13134 !! html
13135 <div style="color:red;">foo</div>
13136
13137 !!end
13138
13139 !! test
13140 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13141 !! wikitext
13142 <div {{echo|1=id="v1"}}>bar</div>
13143 !! html
13144 <div id="v1">bar</div>
13145
13146 !!end
13147
13148 !! test
13149 Templates: HTML Tag: 9. Multiple template-generated attributes
13150 !! wikitext
13151 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13152 !! html
13153 <div id="v1" title="foo">bar</div>
13154
13155 !!end
13156
13157 !! test
13158 Templates: Support for templates generating attributes and content
13159 !! wikitext
13160 {| {{mixed_attr_content_template}}
13161 |-
13162 |bar
13163 |}
13164 !! html/php
13165 <table style="color:red;" title="T48811">
13166
13167 <tr>
13168 <td>foo
13169 </td></tr>
13170 <tr>
13171 <td>bar
13172 </td></tr></table>
13173
13174 !! html/parsoid
13175 <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|}"]}'>
13176 <tbody><tr>
13177 <td>foo</td></tr>
13178 <tr>
13179 <td>bar</td></tr>
13180 </tbody></table>
13181 !!end
13182
13183 !! article
13184 Template:attribute_from_template
13185 !! text
13186 class="123"
13187 !! endarticle
13188
13189 !! test
13190 Table cell with attribute before expanded attribute
13191 !! wikitext
13192 {|
13193 | align="center" {{attribute_from_template}} |456
13194 |}
13195 !! html/parsoid
13196 <table>
13197 <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>
13198 </tbody></table>
13199 !! end
13200
13201 !! test
13202 1. Entities and nowikis inside templated attributes should be handled correctly
13203 !! wikitext
13204 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13205 !! html/php
13206 <div style="background:#f9f9f9;">foo</div>
13207
13208 !! html/parsoid
13209 <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>
13210 !! end
13211
13212 !! test
13213 2. Entities and nowikis inside templated attributes should be handled correctly
13214 !! wikitext
13215 {|
13216 |{{table_attribs_3}}
13217 |}
13218 !! html/php
13219 <table>
13220 <tr>
13221 <td style="background:#f9f9f9;">Foo
13222 </td></tr></table>
13223
13224 !! html/parsoid
13225 <table>
13226 <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>
13227 </tbody></table>
13228 !! end
13229
13230 !! test
13231 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13232 !! wikitext
13233 {{tbl-start}}
13234 |{{table_attribs_3}}
13235 {{tbl-end}}
13236 !! html/php
13237 <table>
13238 <tr>
13239 <td style="background:#f9f9f9;">Foo
13240 </td></tr></table>
13241
13242 !! html/parsoid
13243 <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}}]}'>
13244 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13245 </tbody></table>
13246 !! end
13247
13248 # T107622
13249 !! test
13250 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13251 !! wikitext
13252 {|
13253 |{{table_attribs_6}} hi
13254 |}
13255 !! html/php
13256 <table>
13257 <tr>
13258 <td style="background: red;">hi
13259 </td></tr></table>
13260
13261 !! html/parsoid
13262 <table>
13263 <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>
13264 </tbody></table>
13265 !! end
13266
13267 !!test
13268 Templates: HTML Tables: 1. Generating start of a HTML table
13269 !! wikitext
13270 {{echo|<table><tr><td>foo</td>}}</tr></table>
13271 !! html
13272 <table><tr><td>foo</td></tr></table>
13273
13274 !!end
13275
13276 !!test
13277 Templates: HTML Tables: 2a. Generating middle of a HTML table
13278 !! wikitext
13279 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13280 !! html
13281 <table><tr><td>foo</td></tr></table>
13282
13283 !!end
13284
13285 !!test
13286 Templates: HTML Tables: 2b. Generating middle of a HTML table
13287 !! wikitext
13288 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13289 !! html
13290 <table><tr><td>foo</td></tr></table>
13291
13292 !!end
13293
13294 !!test
13295 Templates: HTML Tables: 3. Generating end of a HTML table
13296 !! wikitext
13297 <table><tr>{{echo|<td>foo</td></tr></table>}}
13298 !! html
13299 <table><tr><td>foo</td></tr></table>
13300
13301 !!end
13302
13303 !!test
13304 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13305 !! wikitext
13306 {{echo|<table>}}<tr><td>foo</td></tr></table>
13307 !! html
13308 <table><tr><td>foo</td></tr></table>
13309
13310 !!end
13311
13312 !!test
13313 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13314 !! wikitext
13315 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13316 !! html
13317 <table><tr><td>foo</td></tr></table>
13318
13319 !!end
13320
13321 !!test
13322 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13323 !! wikitext
13324 <table><tr>{{echo|<td>}}foo</td></tr></table>
13325 !! html
13326 <table><tr><td>foo</td></tr></table>
13327
13328 !!end
13329
13330 !!test
13331 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13332 !! wikitext
13333 <table><tr><td>foo{{echo|</td>}}</tr></table>
13334 !! html
13335 <table><tr><td>foo</td></tr></table>
13336
13337 !!end
13338
13339 !!test
13340 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13341 !! wikitext
13342 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13343 !! html
13344 <table><tr><td>foo</td></tr></table>
13345
13346 !!end
13347
13348 !!test
13349 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13350 !! wikitext
13351 <table><tr><td>foo</td></tr>{{echo|</table>}}
13352 !! html
13353 <table><tr><td>foo</td></tr></table>
13354
13355 !!end
13356
13357 !!test
13358 Templates: HTML Tables: 5. Proper fostering of categories from inside
13359 !!options
13360 parsoid=wt2html,wt2wt
13361 !! wikitext
13362 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13363 <!--Two categories (T52330)-->
13364 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13365 !! html
13366 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13367 <!--Two categories (T52330)-->
13368 <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>
13369 !!end
13370
13371 ## Remex doesn't account for fostered content.
13372 !! test
13373 Templates: Wiki Tables: 1a. Fostering of entire template content
13374 !! wikitext
13375 {|
13376 {{echo|a}}
13377 |}
13378 !! html/php
13379 <table>
13380 a
13381 <tr><td></td></tr></table>
13382
13383 !! html/php+tidy
13384
13385 a
13386 <table><tbody><tr><td></td></tr></tbody></table>
13387 !! html/parsoid
13388 <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">
13389
13390 </table>
13391 !! end
13392
13393 !!test
13394 Templates: Wiki Tables: 1b. Fostering of entire template content
13395 !! wikitext
13396 {|
13397 {{echo|<div>}}
13398 foo
13399 {{echo|</div>}}
13400 |}
13401 !! html
13402 <table>
13403 <div>
13404 <p>foo
13405 </p>
13406 </div>
13407 <tr><td></td></tr></table>
13408
13409 !! html/php+tidy
13410 <div>
13411 <p>foo
13412 </p>
13413 </div><table>
13414
13415 <tbody><tr><td></td></tr></tbody></table>
13416 !! html/parsoid
13417 <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|}"]}'>
13418 <p>foo</p>
13419 </div><table about="#mwt3">
13420
13421 </table>
13422 !! end
13423
13424 ## Remex doesn't account for fostered content.
13425 !! test
13426 Templates: Wiki Tables: 2. Fostering of partial template content
13427 !! wikitext
13428 {|
13429 {{echo|a
13430 <div>b</div>}}
13431 |}
13432 !! html/php
13433 <table>
13434 a
13435 <div>b</div>
13436 <tr><td></td></tr></table>
13437
13438 !! html/php+tidy
13439
13440 a
13441 <div>b</div><table>
13442 <tbody><tr><td></td></tr></tbody></table>
13443 !! html/parsoid
13444 <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">
13445
13446
13447 </table>
13448 !! end
13449
13450 !!test
13451 Templates: Wiki Tables: 3. td-content via multiple templates
13452 !! wikitext
13453 {|
13454 {{echo|{{pipe}}a}}{{echo|b}}
13455 |}
13456 !! html
13457 <table>
13458 <tr>
13459 <td>ab
13460 </td></tr></table>
13461
13462 !!end
13463
13464 !!test
13465 Templates: Wiki Tables: 4. Templated tags, no content
13466 !! wikitext
13467 {{tbl-start}}
13468 {{tbl-end}}
13469 !! html
13470 <table>
13471 <tr><td></td></tr></table>
13472
13473 !!end
13474
13475 !!test
13476 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13477 !! wikitext
13478 {{tbl-start}}
13479 |foo
13480 {{tbl-end}}
13481 !! html
13482 <table>
13483 <tr>
13484 <td>foo
13485 </td></tr></table>
13486
13487 !!end
13488
13489 !!test
13490 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13491 !! wikitext
13492 {{tbl-start}}
13493 {{!}}foo
13494 {{tbl-end}}
13495 !! html
13496 <table>
13497 <tr>
13498 <td>foo
13499 </td></tr></table>
13500
13501 !!end
13502
13503 ## This test case is very specific to Parsoid's internals
13504 ## and is hence only tested for Parsoid's code. Parsoid uses
13505 ## a <meta> marker tag for <ref> tags and they are expanded
13506 ## much later. We are verifying that this <meta> tag usage
13507 ## doesn't prevent foster parenting.
13508 !! test
13509 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13510 !! wikitext
13511 {{PartialTable}}<ref>foo</ref>
13512 |}
13513
13514 <references />
13515 !! html/parsoid
13516 <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","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><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">
13517 <tbody>
13518 </tbody></table>
13519
13520 <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>
13521 !! end
13522
13523 !! test
13524 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13525 !! wikitext
13526 {{echo|
13527 {{{!}}
13528 {{!}}-}}
13529 <onlyinclude>
13530 |foo
13531 </onlyinclude>
13532 {{!}}}
13533 !! html/parsoid
13534 <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{{!}}}"]}'>
13535 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13536 <tbody><tr>
13537
13538 <td>foo
13539 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13540 </tbody></table>
13541 !! end
13542
13543 !!test
13544 Templates: Lists: Multi-line list-items via templates
13545 !! wikitext
13546 *{{echo|a {{nonexistent|
13547 unused}}}}
13548 *{{echo|b {{nonexistent|
13549 unused}}}}
13550 !! html
13551 <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>
13552 <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>
13553
13554 !!end
13555
13556 !!test
13557 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13558 !! wikitext
13559 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13560 !! html
13561 <p><i>ab</i>c<i>d</i>e
13562 </p>
13563 !!end
13564
13565 !!test
13566 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13567 (PHP parser generates misnested html)
13568 !! wikitext
13569 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13570 !! html/parsoid
13571 <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>
13572 !!end
13573
13574 !!test
13575 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13576 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13577 !! options
13578 parsoid=wt2html,wt2wt
13579 !! wikitext
13580 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13581 !! html
13582 <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>
13583 <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>
13584 <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>
13585 !!end
13586
13587 !!test
13588 Templates: Ugly nesting: 4. Divs opened/closed across templates
13589 !! wikitext
13590 a<div>b{{echo|c</div>d}}e
13591 !! html
13592 a<div>bc</div>de
13593
13594 !! html+tidy
13595 <p>a</p><div>bc</div><p>de
13596 </p>
13597 !! end
13598
13599 !! test
13600 Templates: Ugly templates: 3. newline-only template parameter
13601 !! wikitext
13602 foo {{echo|
13603 }}
13604 !! html
13605 <p>foo
13606 </p>
13607 !! end
13608
13609 # This looks like a bug: a single newline triggers p/br for some reason.
13610 !! test
13611 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13612 !! wikitext
13613 {{echo|
13614 }}
13615 !! html
13616 <p><br />
13617 </p>
13618 !! end
13619
13620 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13621 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13622 !! test
13623 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13624 !! wikitext
13625 {{echo|<table>}}
13626 {{echo|<div>foo}}
13627 {{echo|</table>}}
13628 !! html/parsoid
13629 <div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' 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}}]}'>foo</div><span about="#mwt1">
13630 </span><table about="#mwt1">
13631 </table>
13632 !! end
13633
13634 # T66017 -- ugly wikitext with fostered content generates two template ranges
13635 # that are "identical" and generate nesting cycles in the algorithm
13636 !! test
13637 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13638 !! wikitext
13639 {{echo|<table><tr><td><table>}}
13640 {{echo|<div>}}
13641 {{echo|</div>}}
13642 !! html/parsoid
13643 <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"}'>
13644 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13645 </table></td></tr></tbody></table>
13646 !! end
13647
13648 !! test
13649 Templates: Parameters substituted at the top-level
13650 !! wikitext
13651 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13652
13653 {{{foo|bar|baz}}}
13654 !! html/php
13655 <p><i>who</i> me? <b>never!</b>
13656 </p><p>bar
13657 </p>
13658 !! html/parsoid
13659 <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>
13660
13661 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13662 !! end
13663
13664 !! test
13665 Templates: Param with empty arg in the final position
13666 !! wikitext
13667 {{{hi|}}}
13668 !! html/parsoid
13669 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13670 !! end
13671
13672 !!test
13673 Parser Functions: 1. Simple example
13674 !! wikitext
13675 {{uc:foo}}
13676 !! html
13677 <p>FOO
13678 </p>
13679 !!end
13680
13681 !!test
13682 Parser Functions: 2. Nested use (only outermost should be marked up)
13683 !! wikitext
13684 {{uc:{{lc:FOO}}}}
13685 !! html
13686 <p>FOO
13687 </p>
13688 !!end
13689
13690 ## Note that the templates inside the references are not wrapped
13691 !! test
13692 Template nested in extension tag in template
13693 !! options
13694 language=zh
13695 !! wikitext
13696 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13697 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13698 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13699 <references />
13700 !! html/parsoid
13701 <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","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Wikipedia:首页#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13702 <span about="#mwt8" 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="#mwt8" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Wikipedia:首页#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
13703 <span about="#mwt13" 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="#mwt13" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Wikipedia:首页#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
13704 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt17" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Wikipedia:首页#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">hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Wikipedia:首页#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 rel="mw:ExtLink" class="external autonumber" href="http://test.com?q=ho"></a></span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Wikipedia:首页#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["ho"],"t":"hi"}}'></span></span></li></ol>
13705 !! end
13706
13707 ###
13708 ### Pre-save transform tests
13709 ###
13710
13711 !! test
13712 pre-save transform: subst:
13713 !! options
13714 pst
13715 !! wikitext
13716 {{subst:test}}
13717 !! html/php
13718 This is a test template
13719 !! end
13720
13721 !! test
13722 pre-save transform: normal template
13723 !! options
13724 pst
13725 !! wikitext
13726 {{test}}
13727 !! html/php
13728 {{test}}
13729 !! end
13730
13731 !! test
13732 pre-save transform: nonexistent template
13733 !! options
13734 pst
13735 !! wikitext
13736 {{thistemplatedoesnotexist}}
13737 !! html/php
13738 {{thistemplatedoesnotexist}}
13739 !! end
13740
13741 !! test
13742 pre-save transform: subst magic variables
13743 !! options
13744 pst
13745 !! wikitext
13746 {{subst:SITENAME}}
13747 !! html/php
13748 MediaWiki
13749 !! end
13750
13751 # This is T2089, which I fixed. -- wtm
13752 !! test
13753 pre-save transform: subst: templates with parameters
13754 !! options
13755 pst
13756 !! wikitext
13757 {{subst:paramtest|param="something else"}}
13758 !! html/php
13759 This is a test template with parameter "something else"
13760 !! end
13761
13762 !! article
13763 Template:nowikitest
13764 !! text
13765 <nowiki>'''not wiki'''</nowiki>
13766 !! endarticle
13767
13768 !! test
13769 pre-save transform: nowiki in subst (T3188)
13770 !! options
13771 pst
13772 !! wikitext
13773 {{subst:nowikitest}}
13774 !! html/php
13775 <nowiki>'''not wiki'''</nowiki>
13776 !! end
13777
13778 !! article
13779 Template:commenttest
13780 !! text
13781 This template has <!-- a comment --> in it.
13782 !! endarticle
13783
13784 !! test
13785 pre-save transform: comment in subst (T3936)
13786 !! options
13787 pst
13788 !! wikitext
13789 {{subst:commenttest}}
13790 !! html/php
13791 This template has <!-- a comment --> in it.
13792 !! end
13793
13794 !! test
13795 pre-save transform: unclosed tag
13796 !! options
13797 pst
13798 !! wikitext
13799 <nowiki>'''not wiki'''
13800 !! html/php
13801 <nowiki>'''not wiki'''
13802 !! end
13803
13804 !! test
13805 pre-save transform: mixed tag case
13806 !! options
13807 pst
13808 !! wikitext
13809 <NOwiki>'''not wiki'''</noWIKI>
13810 !! html/php
13811 <NOwiki>'''not wiki'''</noWIKI>
13812 !! end
13813
13814 !! test
13815 pre-save transform: unclosed comment in <nowiki>
13816 !! options
13817 pst
13818 !! wikitext
13819 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13820 !! html/php
13821 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13822 !!end
13823
13824 # Leading @ in this template definition works around a limitation
13825 # in parsoid's parserTests which otherwise strips the <span> from the
13826 # result (confusing it for a template wrapper)
13827 !! article
13828 Template:dangerous
13829 !!text
13830 @<span onmouseover="alert('crap')">Oh no</span>
13831 !!endarticle
13832
13833 !!test
13834 (confirming safety of fix for subst T3936)
13835 !! wikitext
13836 {{Template:dangerous}}
13837 !! html
13838 <p>@<span>Oh no</span>
13839 </p>
13840 !! end
13841
13842 !! test
13843 pre-save transform: comment containing gallery (T7024)
13844 !! options
13845 pst
13846 !! wikitext
13847 <!-- <gallery>data</gallery> -->
13848 !! html/php
13849 <!-- <gallery>data</gallery> -->
13850 !!end
13851
13852 !! test
13853 pre-save transform: comment containing extension
13854 !! options
13855 pst
13856 !! wikitext
13857 <!-- <tag>data</tag> -->
13858 !! html/php
13859 <!-- <tag>data</tag> -->
13860 !!end
13861
13862 !! test
13863 pre-save transform: comment containing nowiki
13864 !! options
13865 pst
13866 !! wikitext
13867 <!-- <nowiki>data</nowiki> -->
13868 !! html/php
13869 <!-- <nowiki>data</nowiki> -->
13870 !!end
13871
13872 !! test
13873 pre-save transform: <noinclude> in subst (T5298)
13874 !! options
13875 pst
13876 !! wikitext
13877 {{subst:Includes}}
13878 !! html/php
13879 Foobar
13880 !! end
13881
13882 !! test
13883 pre-save transform: <onlyinclude> in subst (T5298)
13884 !! options
13885 pst
13886 !! wikitext
13887 {{subst:Includes2}}
13888 !! html/php
13889 Foo
13890 !! end
13891
13892 !! article
13893 Template:SubstTest
13894 !!text
13895 {{<includeonly>subst:</includeonly>Includes}}
13896 !! endarticle
13897
13898 !! article
13899 Template:SafeSubstTest
13900 !! text
13901 {{<includeonly>safesubst:</includeonly>Includes}}
13902 !! endarticle
13903
13904 !! test
13905 T24297: safesubst: works during PST
13906 !! options
13907 pst
13908 !! wikitext
13909 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13910 !! html/php
13911 FoobarFoobar
13912 !! end
13913
13914 !! test
13915 T24297: safesubst: works during normal parse
13916 !! wikitext
13917 {{SafeSubstTest}}
13918 !! html
13919 <p>Foobar
13920 </p>
13921 !! end
13922
13923 !! test
13924 subst: does not work during normal parse
13925 !! wikitext
13926 {{SubstTest}}
13927 !! html
13928 <p>{{subst:Includes}}
13929 </p>
13930 !! end
13931
13932 !! test
13933 pre-save transform: context links ("pipe trick")
13934 !! options
13935 pst
13936 !! wikitext
13937 [[Article (context)|]]
13938 [[Bar:Article|]]
13939 [[:Bar:Article|]]
13940 [[Bar:Article (context)|]]
13941 [[:Bar:Article (context)|]]
13942 [[|Article]]
13943 [[|Article (context)]]
13944 [[Bar:X (Y) Z|]]
13945 [[:Bar:X (Y) Z|]]
13946 !! html/php
13947 [[Article (context)|Article]]
13948 [[Bar:Article|Article]]
13949 [[:Bar:Article|Article]]
13950 [[Bar:Article (context)|Article]]
13951 [[:Bar:Article (context)|Article]]
13952 [[Article]]
13953 [[Article (context)]]
13954 [[Bar:X (Y) Z|X (Y) Z]]
13955 [[:Bar:X (Y) Z|X (Y) Z]]
13956 !! end
13957
13958 !! test
13959 pre-save transform: context links ("pipe trick") with interwiki prefix
13960 !! options
13961 pst
13962 !! wikitext
13963 [[interwiki:Article|]]
13964 [[:interwiki:Article|]]
13965 [[interwiki:Bar:Article|]]
13966 [[:interwiki:Bar:Article|]]
13967 !! html/php
13968 [[interwiki:Article|Article]]
13969 [[:interwiki:Article|Article]]
13970 [[interwiki:Bar:Article|Bar:Article]]
13971 [[:interwiki:Bar:Article|Bar:Article]]
13972 !! end
13973
13974 !! test
13975 pre-save transform: context links ("pipe trick") with parens in title
13976 !! options
13977 pst title=[[Somearticle (context)]]
13978 !! wikitext
13979 [[|Article]]
13980 !! html/php
13981 [[Article (context)|Article]]
13982 !! end
13983
13984 !! test
13985 pre-save transform: context links ("pipe trick") with comma in title
13986 !! options
13987 pst title=[[Someplace, Somewhere]]
13988 !! wikitext
13989 [[|Otherplace]]
13990 [[Otherplace, Elsewhere|]]
13991 [[Otherplace, Elsewhere, Anywhere|]]
13992 !! html/php
13993 [[Otherplace, Somewhere|Otherplace]]
13994 [[Otherplace, Elsewhere|Otherplace]]
13995 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13996 !! end
13997
13998 !! test
13999 pre-save transform: context links ("pipe trick") with parens and comma
14000 !! options
14001 pst title=[[Someplace (IGNORED), Somewhere]]
14002 !! wikitext
14003 [[|Otherplace]]
14004 [[Otherplace (place), Elsewhere|]]
14005 !! html/php
14006 [[Otherplace, Somewhere|Otherplace]]
14007 [[Otherplace (place), Elsewhere|Otherplace]]
14008 !! end
14009
14010 !! test
14011 pre-save transform: context links ("pipe trick") with comma and parens
14012 !! options
14013 pst title=[[Who, me? (context)]]
14014 !! wikitext
14015 [[|Yes, you.]]
14016 [[Me, Myself, and I (1937 song)|]]
14017 !! html/php
14018 [[Yes, you. (context)|Yes, you.]]
14019 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14020 !! end
14021
14022 !! test
14023 pre-save transform: context links ("pipe trick") with namespace
14024 !! options
14025 pst title=[[Ns:Somearticle]]
14026 !! wikitext
14027 [[|Article]]
14028 !! html/php
14029 [[Ns:Article|Article]]
14030 !! end
14031
14032 !! test
14033 pre-save transform: context links ("pipe trick") with namespace and parens
14034 !! options
14035 pst title=[[Ns:Somearticle (context)]]
14036 !! wikitext
14037 [[|Article]]
14038 !! html/php
14039 [[Ns:Article (context)|Article]]
14040 !! end
14041
14042 !! test
14043 pre-save transform: context links ("pipe trick") with namespace and comma
14044 !! options
14045 pst title=[[Ns:Somearticle, Context, Whatever]]
14046 !! wikitext
14047 [[|Article]]
14048 !! html/php
14049 [[Ns:Article, Context, Whatever|Article]]
14050 !! end
14051
14052 !! test
14053 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14054 !! options
14055 pst title=[[Ns:Somearticle, Context (context)]]
14056 !! wikitext
14057 [[|Article]]
14058 !! html/php
14059 [[Ns:Article (context)|Article]]
14060 !! end
14061
14062 !! test
14063 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14064 !! options
14065 pst title=[[Ns:Somearticle (IGNORED), Context]]
14066 !! wikitext
14067 [[|Article]]
14068 !! html/php
14069 [[Ns:Article, Context|Article]]
14070 !! end
14071
14072 !! test
14073 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14074 !! options
14075 pst
14076 !! wikitext
14077 [[Article(context)|]]
14078 [[Bar:Article(context)|]]
14079 [[:Bar:Article(context)|]]
14080 [[|Article(context)]]
14081 [[Bar:X(Y)Z|]]
14082 [[:Bar:X(Y)Z|]]
14083 !! html/php
14084 [[Article(context)|Article]]
14085 [[Bar:Article(context)|Article]]
14086 [[:Bar:Article(context)|Article]]
14087 [[Article(context)]]
14088 [[Bar:X(Y)Z|X(Y)Z]]
14089 [[:Bar:X(Y)Z|X(Y)Z]]
14090 !! end
14091
14092 !! test
14093 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14094 !! options
14095 pst
14096 !! wikitext
14097 [[Article (context)|]]
14098 [[Bar:Article (context)|]]
14099 [[:Bar:Article (context)|]]
14100 [[|Article (context)]]
14101 [[Bar:X (Y) Z|]]
14102 [[:Bar:X (Y) Z|]]
14103 !! html/php
14104 [[Article (context)|Article]]
14105 [[Bar:Article (context)|Article]]
14106 [[:Bar:Article (context)|Article]]
14107 [[Article (context)]]
14108 [[Bar:X (Y) Z|X (Y) Z]]
14109 [[:Bar:X (Y) Z|X (Y) Z]]
14110 !! end
14111
14112 !! test
14113 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14114 !! options
14115 pst
14116 !! wikitext
14117 [[Article(context)|]]
14118 [[Bar:Article(context)|]]
14119 [[:Bar:Article(context)|]]
14120 [[|Article(context)]]
14121 [[Bar:X(Y)Z|]]
14122 [[:Bar:X(Y)Z|]]
14123 !! html/php
14124 [[Article(context)|Article]]
14125 [[Bar:Article(context)|Article]]
14126 [[:Bar:Article(context)|Article]]
14127 [[Article(context)]]
14128 [[Bar:X(Y)Z|X(Y)Z]]
14129 [[:Bar:X(Y)Z|X(Y)Z]]
14130 !! end
14131
14132 !! test
14133 pre-save transform: context links ("pipe trick") with commas (T23660)
14134 !! options
14135 pst
14136 !! wikitext
14137 [[Article (context), context|]]
14138 [[Article (context),context|]]
14139 [[Bar:Article (context), context|]]
14140 [[Bar:Article (context),context|]]
14141 [[:Bar:Article (context), context|]]
14142 [[:Bar:Article (context),context|]]
14143 !! html/php
14144 [[Article (context), context|Article]]
14145 [[Article (context),context|Article]]
14146 [[Bar:Article (context), context|Article]]
14147 [[Bar:Article (context),context|Article]]
14148 [[:Bar:Article (context), context|Article]]
14149 [[:Bar:Article (context),context|Article]]
14150 !! end
14151
14152 !! test
14153 Parsoid: backwards pipe trick
14154 !! wikitext
14155 [[|'''bar''']]
14156 !! html/php
14157 <p>[[|<b>bar</b>]]
14158 </p>
14159 !! html/parsoid
14160 <p>[[|<b>bar</b>]]</p>
14161 !! end
14162
14163 !! test
14164 pre-save transform: trim trailing empty lines
14165 !! options
14166 pst
14167 !! wikitext
14168 Empty lines are trimmed
14169
14170
14171
14172
14173 !! html/php
14174 Empty lines are trimmed
14175 !! end
14176
14177 !! test
14178 pre-save transform: Signature expansion
14179 !! options
14180 pst
14181 !! wikitext
14182 * ~~~
14183 * ~~~~
14184 * ~~~~~
14185 * <noinclude>~~~</noinclude>
14186 * <includeonly>~~~</includeonly>
14187 * <onlyinclude>~~~</onlyinclude>
14188 !! html/php
14189 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14190 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14191 * 00:02, 1 January 1970 (UTC)
14192 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14193 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14194 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14195 !! end
14196
14197
14198 !! test
14199 ParserOutput flags from signature expansion (T84843)
14200 !! options
14201 pst
14202 showflags
14203 !! wikitext
14204 ~~~~
14205 !! html/php
14206 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14207 flags=user-signature
14208 !! end
14209
14210
14211 !! test
14212 pre-save transform: Signature expansion in nowiki tags (T2093)
14213 !! options
14214 pst disabled
14215 !! wikitext
14216 Shall not expand:
14217
14218 <nowiki>~~~~</nowiki>
14219
14220 <includeonly><nowiki>~~~~</nowiki></includeonly>
14221
14222 <noinclude><nowiki>~~~~</nowiki></noinclude>
14223
14224 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14225
14226 {{subst:Foo}} shall be converted to FOO
14227
14228 As well as inside noinclude/onlyinclude
14229 <noinclude>{{subst:Foo}}</noinclude>
14230 <onlyinclude>{{subst:Foo}}</onlyinclude>
14231
14232 But not inside includeonly
14233 <includeonly>{{subst:Foo}}</includeonly>
14234 !! html/php
14235 Shall not expand:
14236
14237 <nowiki>~~~~</nowiki>
14238
14239 <includeonly><nowiki>~~~~</nowiki></includeonly>
14240
14241 <noinclude><nowiki>~~~~</nowiki></noinclude>
14242
14243 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14244
14245 FOO shall be converted to FOO
14246
14247 As well as inside noinclude/onlyinclude
14248 <noinclude>FOO</noinclude>
14249 <onlyinclude>FOO</onlyinclude>
14250
14251 But not inside includeonly
14252 <includeonly>{{subst:Foo}}</includeonly>
14253 !! end
14254
14255 !! test
14256 Parsoid: Recognize nowiki with trailing space in tags
14257 !! options
14258 parsoid=wt2html
14259 !! wikitext
14260 <nowiki ><div>[[foo]]</nowiki >
14261
14262 a<nowiki / >b
14263
14264 c<nowiki />d
14265
14266 e<nowiki/ >f
14267 !! html/php+tidy
14268 <p>&lt;div&gt;[[foo]]
14269 </p><p>a&lt;nowiki / &gt;b
14270 </p><p>cd
14271 </p><p>e&lt;nowiki/ &gt;f
14272 </p>
14273 !! html/parsoid
14274 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14275
14276 <p>a&lt;nowiki / >b</p>
14277
14278 <p>c<span typeof="mw:Nowiki"></span>d</p>
14279
14280 <p>e&lt;nowiki/ >f</p>
14281 !! end
14282
14283 !! test
14284 Parsoid: Recognize nowiki with odd capitalization
14285 !! options
14286 parsoid=wt2html
14287 !! wikitext
14288 <noWikI ><div>[[foo]]</Nowiki >
14289 !! html
14290 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14291 !! end
14292
14293
14294 !! test
14295 Parsoid: Escape nowiki with trailing space in tags
14296 !! options
14297 parsoid=html2wt
14298 !! html/parsoid
14299 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14300 <p>a&lt;nowiki /&gt;b</p>
14301 <p>c&lt;nowiki/ &gt;d</p>
14302 !! wikitext
14303 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14304
14305 a&lt;nowiki /&gt;b
14306
14307 c&lt;nowiki/ &gt;d
14308 !! end
14309
14310 !! test
14311 Parsoid: Escape weird noWikI capitalizations
14312 !! options
14313 parsoid=html2wt
14314 !! html/parsoid
14315 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14316 !! wikitext
14317 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14318 !! end
14319
14320 ###
14321 ### Message transform tests
14322 ###
14323 !! test
14324 message transform: magic variables
14325 !! options
14326 msg
14327 !! wikitext
14328 {{SITENAME}}
14329 !! html
14330 MediaWiki
14331 !! end
14332
14333 !! test
14334 message transform: should not transform wiki markup
14335 !! options
14336 msg
14337 !! wikitext
14338 ''test''
14339 !! html
14340 ''test''
14341 !! end
14342
14343 !! test
14344 message transform: <noinclude> in transcluded template (T6926)
14345 !! options
14346 msg
14347 !! wikitext
14348 {{Includes}}
14349 !! html
14350 Foobar
14351 !! end
14352
14353 !! test
14354 message transform: <onlyinclude> in transcluded template (T6926)
14355 !! options
14356 msg
14357 !! wikitext
14358 {{Includes2}}
14359 !! html
14360 Foo
14361 !! end
14362
14363 !! test
14364 {{#special:}} page name, known
14365 !! options
14366 msg
14367 !! wikitext
14368 {{#special:Recentchanges}}
14369 !! html
14370 Special:RecentChanges
14371 !! end
14372
14373 !! test
14374 {{#special:}} page name with subpage, known
14375 !! options
14376 msg
14377 !! wikitext
14378 {{#special:Recentchanges/param}}
14379 !! html
14380 Special:RecentChanges/param
14381 !! end
14382
14383 !! test
14384 {{#special:}} page name, unknown
14385 !! options
14386 msg
14387 !! wikitext
14388 {{#special:foobar nonexistent}}
14389 !! html
14390 Special:Foobar nonexistent
14391 !! end
14392
14393 !! test
14394 {{#speciale:}} page name, known
14395 !! options
14396 msg
14397 !! wikitext
14398 {{#speciale:Recentchanges}}
14399 !! html
14400 Special:RecentChanges
14401 !! end
14402
14403 !! test
14404 {{#speciale:}} page name with subpage, known
14405 !! options
14406 msg
14407 !! wikitext
14408 {{#speciale:Recentchanges/param}}
14409 !! html
14410 Special:RecentChanges/param
14411 !! end
14412
14413 !! test
14414 {{#speciale:}} page name, unknown
14415 !! options
14416 msg
14417 !! wikitext
14418 {{#speciale:foobar nonexistent}}
14419 !! html
14420 Special:Foobar_nonexistent
14421 !! end
14422
14423 ###
14424 ### Images
14425 ###
14426 ### For Parsoid-specific tests, see
14427 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14428
14429 !! test
14430 Simple image
14431 !! options
14432 parsoid=wt2html,wt2wt,html2html
14433 !! wikitext
14434 [[Image:foobar.jpg]]
14435 !! html/php
14436 <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>
14437 </p>
14438 !! html/parsoid
14439 <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>
14440 !! end
14441
14442 !! test
14443 Serialize simple image with span wrapper
14444 !! options
14445 parsoid=html2wt
14446 !! html/parsoid
14447 <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>
14448 !! wikitext
14449 [[File:Foobar.jpg]]
14450 !! end
14451
14452 !! test
14453 Simple image (using File: namespace, now canonical)
14454 !! wikitext
14455 [[File:Foobar.jpg]]
14456 !! html/php
14457 <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>
14458 </p>
14459 !! html/parsoid
14460 <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>
14461 !! end
14462
14463 !! test
14464 Right-aligned image
14465 !! wikitext
14466 [[File:Foobar.jpg|right]]
14467 !! html/php
14468 <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>
14469
14470 !! html/parsoid
14471 <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>
14472 !! end
14473
14474 !! test
14475 Image with caption
14476 !! wikitext
14477 [[File:Foobar.jpg|right|Caption text]]
14478 !! html/php
14479 <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>
14480
14481 !! html/parsoid
14482 <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>
14483 !! end
14484
14485 !! test
14486 Image with caption, T55312 #1
14487 !! wikitext
14488 [[File:Foobar.jpg|right|Caption page stuff]]
14489 !! html/php
14490 <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>
14491
14492 !! html/parsoid
14493 <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>
14494 !! end
14495
14496 !! test
14497 Image with caption, T55312 #2
14498 !! wikitext
14499 [[File:Foobar.jpg|right|Caption page=]]
14500 !! html/php
14501 <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>
14502
14503 !! html/parsoid
14504 <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>
14505 !! end
14506
14507 !! test
14508 Image with caption, T55312 #3
14509 !! wikitext
14510 [[File:Foobar.jpg|right|Caption page=stuff]]
14511 !! html/php
14512 <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>
14513
14514 !! html/parsoid
14515 <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>
14516 !! end
14517
14518 !! test
14519 Image caption with pipe entity
14520 !! wikitext
14521 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14522 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14523 !! html/php
14524 <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>
14525 <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>
14526
14527 !! html/parsoid
14528 <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>
14529 <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>
14530 !! end
14531
14532 !! test
14533 Allow empty links in image captions (T62753)
14534 !! options
14535 thumbsize=220
14536 !! wikitext
14537 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14538 [[]]
14539 [[Link2]]
14540 ]]
14541 !! html/php
14542 <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>
14543
14544 !! html/parsoid
14545 <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>
14546 [[]]
14547 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14548 </figcaption></figure>
14549 !! end
14550
14551 !! test
14552 Titles in unlinked images (T23454)
14553 !! wikitext
14554 [[File:Foobar.jpg|link=|stuff]]
14555 !! html/php
14556 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14557 </p>
14558 !! html/parsoid
14559 <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>
14560 !! end
14561
14562 !! test
14563 Link with empty target
14564 !! wikitext
14565 [[]]
14566 !! html
14567 <p>[[]]
14568 </p>
14569 !! end
14570
14571 !! test
14572 Image with link trail
14573 !! wikitext
14574 Linktrails should not work for images: [[File:Foobar.jpg]]s
14575 !! html/php
14576 <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
14577 </p>
14578 !! html/parsoid
14579 <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>
14580 !! end
14581
14582 !! test
14583 Image with empty attribute
14584 !! options
14585 parsoid=wt2html,wt2wt,html2html
14586 !! wikitext
14587 [[File:Foobar.jpg|right||Caption text]]
14588 !! html/php
14589 <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>
14590
14591 !! html/parsoid
14592 <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>
14593 !! end
14594
14595 !! test
14596 1. Block image with individual attributes from templates
14597 !! wikitext
14598 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14599 !! html/php
14600 <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>
14601
14602 !! html/parsoid
14603 <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>
14604 !! end
14605
14606 !! test
14607 2. Block Image with individual attributes from templates
14608 !! wikitext
14609 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14610 !! html/php
14611 <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>
14612
14613 !! html/parsoid
14614 <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>
14615 !! end
14616
14617 !! test
14618 3. Inline image with individual attributes from templates
14619 !! wikitext
14620 [[File:Foobar.jpg|{{echo|50px}}]]
14621 !! html/php
14622 <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>
14623 </p>
14624 !! html/parsoid
14625 <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>
14626 !! end
14627
14628 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14629 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14630 !! test
14631 Image with multiple attributes from the same template
14632 !! wikitext
14633 [[File:Foobar.jpg|{{image_attribs}}]]
14634 !! html/php
14635 <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>
14636
14637 !! html/parsoid
14638 <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>
14639 !! end
14640
14641 !! test
14642 Image with link tails
14643 !! options
14644 thumbsize=220
14645 !! wikitext
14646 123[[File:Foobar.jpg]]456
14647 123[[File:Foobar.jpg|right]]456
14648 123[[File:Foobar.jpg|thumb]]456
14649 !! html/php
14650 <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
14651 </p>
14652 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
14653 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
14654
14655 !! html/php+tidy
14656 <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
14657 </p><p>
14658 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
14659 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
14660 </p>
14661 !! html/parsoid
14662 <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>
14663 <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
14664 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>
14665 !! end
14666
14667 !! test
14668 Image with multiple captions -- only last one is accepted
14669 !! wikitext
14670 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14671 !! html/php
14672 <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>
14673
14674 !! html/parsoid
14675 <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>
14676 !! end
14677
14678 !! test
14679 Image with multiple widths -- use last
14680 !! wikitext
14681 [[File:Foobar.jpg|200px|300px|caption]]
14682 !! html/php
14683 <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>
14684 </p>
14685 !! html/parsoid
14686 <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>
14687 !! end
14688
14689 !! test
14690 Image with multiple alignments -- use first (T50664)
14691 !! options
14692 thumbsize=220
14693 !! wikitext
14694 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14695
14696 [[File:Foobar.jpg|middle|text-top|caption]]
14697 !! html/php
14698 <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>
14699 <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>
14700 </p>
14701 !! html/parsoid
14702 <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>
14703 <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>
14704 !! end
14705
14706 !! test
14707 Image with width attribute at different positions
14708 !! wikitext
14709 [[File:Foobar.jpg|200px|right|Caption]]
14710 [[File:Foobar.jpg|right|200px|Caption]]
14711 [[File:Foobar.jpg|right|Caption|200px]]
14712 !! html/php
14713 <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>
14714 <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>
14715 <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>
14716
14717 !! html/parsoid
14718 <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>
14719 <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>
14720 <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>
14721 !! end
14722
14723 # a sad bit of backward-compatibility
14724 !! test
14725 Image with size specified with pxpx (T15500, T53628)
14726 !! options
14727 parsoid=wt2html,wt2wt,html2html
14728 !! wikitext
14729 [[File:Foobar.jpg|20pxpx]]
14730 [[File:Foobar.jpg|200x20pxpx]]
14731 !! html/php
14732 <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>
14733 <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>
14734 </p>
14735 !! html/parsoid
14736 <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>
14737 !! end
14738
14739 !! test
14740 Image with link parameter, wiki target
14741 !! wikitext
14742 [[File:Foobar.jpg|link=Main Page]]
14743 !! html/php
14744 <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>
14745 </p>
14746 !! html/parsoid
14747 <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>
14748 !! end
14749
14750 # parsoid T51293 (part 1)
14751 !! test
14752 Image with link parameter, URL target
14753 !! wikitext
14754 [[File:Foobar.jpg|link=http://example.com/]]
14755 !! html/php
14756 <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>
14757 </p>
14758 !! html/parsoid
14759 <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>
14760 !! end
14761
14762 # parsoid T51293 (part 2)
14763 !! test
14764 Image with link parameter, protocol-less URL target
14765 !! wikitext
14766 [[File:Foobar.jpg|link=//example.com/]]
14767 !! html/php
14768 <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>
14769 </p>
14770 !! html/parsoid
14771 <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>
14772 !! end
14773
14774 !! test
14775 Escaping non-block captions (T107435)
14776 !! options
14777 parsoid={
14778 "modes": ["wt2wt"],
14779 "changes": [
14780 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14781 ]
14782 }
14783 !! wikitext
14784 [[Image:Foobar.jpg|caption]]
14785 !! wikitext/edited
14786 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14787 !! end
14788
14789 # wgExternalLinkTarget not supported by Parsoid
14790 !! test
14791 Image with link parameter, wgExternalLinkTarget
14792 !! wikitext
14793 [[Image:foobar.jpg|link=http://example.com/]]
14794 !! config
14795 wgExternalLinkTarget='foobar'
14796 !! html/php
14797 <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>
14798 </p>
14799 !! end
14800
14801 !! test
14802 Image with link parameter, wgNoFollowLinks set to false
14803 !! wikitext
14804 [[Image:foobar.jpg|link=http://example.com/]]
14805 !! config
14806 wgNoFollowLinks=false
14807 !! html/php
14808 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14809 </p>
14810 !! end
14811
14812 !! test
14813 Image with link parameter, wgNoFollowDomainExceptions
14814 !! wikitext
14815 [[Image:foobar.jpg|link=http://example.com/]]
14816 !! config
14817 wgNoFollowDomainExceptions='example.com'
14818 !! html/php
14819 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14820 </p>
14821 !! end
14822
14823 # wgExternalLinkTarget not supported by Parsoid
14824 !! test
14825 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14826 !! wikitext
14827 [[Image:foobar.jpg|link=http://example.com/|Title]]
14828 !! config
14829 wgExternalLinkTarget='foobar'
14830 !! html/php
14831 <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>
14832 </p>
14833 !! end
14834
14835 !! test
14836 Image with empty link parameter
14837 !! wikitext
14838 [[File:Foobar.jpg|link=]]
14839 !! html/php
14840 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14841 </p>
14842 !! html/parsoid
14843 <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>
14844 !! end
14845
14846 !! test
14847 Image with link parameter (wiki target) and unnamed parameter
14848 !! wikitext
14849 [[File:Foobar.jpg|link=Main_Page|Title]]
14850 !! html/php
14851 <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>
14852 </p>
14853 !! html/parsoid
14854 <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>
14855 !! end
14856
14857 !! test
14858 Image with link parameter (URL target) and unnamed parameter
14859 !! wikitext
14860 [[File:Foobar.jpg|link=http://example.com/|Title]]
14861 !! html/php
14862 <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>
14863 </p>
14864 !! html/parsoid
14865 <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>
14866 !! end
14867
14868 !! test
14869 Thumbnail image with link parameter
14870 !! options
14871 thumbsize=220
14872 parsoid=wt2html,wt2wt,html2html
14873 !! wikitext
14874 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14875 !! html/php
14876 <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>
14877
14878 !! html/parsoid
14879 <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>
14880 !! end
14881
14882 !! test
14883 Manually-specified thumbnail image
14884 !! options
14885 thumbsize=220
14886 !! wikitext
14887 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14888 !! html/php
14889 <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>
14890
14891 !! html/parsoid
14892 <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>
14893 !! end
14894
14895 !! test
14896 Manually-specified thumbnail image with explicit link to wiki page
14897 !! options
14898 thumbsize=220
14899 parsoid=wt2html,wt2wt,html2html
14900 !! wikitext
14901 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14902 !! html/php
14903 <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>
14904
14905 !! html/parsoid
14906 <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>
14907 !! end
14908
14909 !! test
14910 Manually-specified thumbnail image with explicit link to url
14911 !! options
14912 thumbsize=220
14913 parsoid=wt2html,wt2wt,html2html
14914 !! wikitext
14915 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14916 !! html/php
14917 <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>
14918
14919 !! html/parsoid
14920 <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>
14921 !! end
14922
14923 !! test
14924 Manually-specified thumbnail image with explicit no link
14925 !! options
14926 thumbsize=220
14927 parsoid=wt2html,wt2wt,html2html
14928 !! wikitext
14929 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14930 !! html/php
14931 <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>
14932
14933 !! html/parsoid
14934 <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>
14935 !! end
14936
14937 !! test
14938 Manually-specified thumbnail image with explicit link and alt text
14939 !! options
14940 thumbsize=220
14941 parsoid=wt2html,wt2wt,html2html
14942 !! wikitext
14943 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14944 !! html/php
14945 <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>
14946
14947 !! html/parsoid
14948 <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>
14949 !! end
14950
14951 !! test
14952 Image with frame and link
14953 !! options
14954 parsoid=wt2html,wt2wt,html2html
14955 !! wikitext
14956 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14957 !! html/php
14958 <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>
14959
14960 !! html/parsoid
14961 <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>
14962 !! end
14963
14964 !! test
14965 Image with frame and link and explicit alt
14966 !! options
14967 parsoid=wt2html,wt2wt,html2html
14968 !! wikitext
14969 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14970 !! html/php
14971 <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>
14972
14973 !! html/parsoid
14974 <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>
14975 !! end
14976
14977 !! test
14978 Image with wiki markup in implicit alt
14979 !! wikitext
14980 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14981
14982 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14983 !! html/php
14984 <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>
14985 </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>
14986 </p>
14987 !! html/parsoid
14988 <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>
14989
14990 <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>
14991 !! end
14992
14993 !! test
14994 Alt image option should handle most kinds of wikitext without barfing
14995 !! wikitext
14996 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14997 !! html/php
14998 <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>
14999
15000 !! html/parsoid
15001 <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>
15002 !! end
15003
15004 !! test
15005 Image with table with attributes in caption
15006 !! options
15007 parsoid=wt2html,html2html
15008 !! wikitext
15009 [[File:Foobar.jpg|thumb|
15010 {| class="123" |
15011 |- class="456" |
15012 | ha
15013 |}
15014 ]]
15015 !! html/parsoid
15016 <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>
15017 <table class="123">
15018 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15019 <td> ha</td></tr>
15020 </tbody></table>
15021 </figcaption></figure>
15022 !! end
15023
15024 !! test
15025 Image with table with rows from templates in caption
15026 !! wikitext
15027 [[File:Foobar.jpg|thumb|
15028 {|
15029 {{echo|{{!}} hi}}
15030 |}
15031 ]]
15032 !! html/parsoid
15033 <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>
15034 <table>
15035 <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>
15036 </tbody></table>
15037 </figcaption></figure>
15038 !! end
15039
15040 !! test
15041 Image with nested tables in caption
15042 !! wikitext
15043 [[File:Foobar.jpg|thumb|Foo<br />
15044 {|
15045 |
15046 {|
15047 |z
15048 |}
15049 |}
15050 ]]
15051 !! html/parsoid
15052 <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}'/>
15053 <table>
15054 <tbody><tr><td>
15055 <table>
15056 <tbody><tr><td>z</td></tr>
15057 </tbody></table></td></tr>
15058 </tbody></table>
15059 </figcaption></figure>
15060 !! end
15061
15062 !! test
15063 Image with heading and horizontal rule in caption
15064 !! wikitext
15065 [[File:Foobar.jpg|thumb|
15066 ===Testing===
15067 123
15068 --------------
15069 ]]
15070 !! html/php
15071 <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>
15072
15073 !! html/parsoid
15074 <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>
15075 <h3 id="Testing">Testing</h3>
15076 123
15077 <hr data-parsoid='{"extra_dashes":10}'/>
15078 </figcaption></figure>
15079 !! end
15080
15081 ###################
15082 # Conflicting image format options.
15083 # First option specified should 'win'.
15084 # All three cases in each test should be identical.
15085
15086 !! test
15087 Image with 'frameless' first.
15088 !! options
15089 parsoid=wt2html,wt2wt,html2html
15090 !! wikitext
15091 [[File:Foobar.jpg|frameless|caption]]
15092
15093 [[File:Foobar.jpg|frameless|frame|caption]]
15094
15095 [[File:Foobar.jpg|frameless|thumb|caption]]
15096 !! html/php
15097 <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>
15098 </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>
15099 </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>
15100 </p>
15101 !! html/parsoid
15102 <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>
15103 <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>
15104 <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>
15105 !! end
15106
15107 !! test
15108 Image with 'frame' first.
15109 !! options
15110 parsoid=wt2html,wt2wt,html2html
15111 !! wikitext
15112 [[File:Foobar.jpg|frame|caption]]
15113 [[File:Foobar.jpg|frame|frameless|caption]]
15114 [[File:Foobar.jpg|frame|thumb|caption]]
15115 !! html/php
15116 <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>
15117 <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>
15118 <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>
15119
15120 !! html/parsoid
15121 <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>
15122 <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>
15123 <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>
15124 !! end
15125
15126 !! test
15127 Image with 'thumb' first.
15128 !! options
15129 parsoid=wt2html,wt2wt,html2html
15130 !! wikitext
15131 [[File:Foobar.jpg|thumb|caption]]
15132 [[File:Foobar.jpg|thumb|frameless|caption]]
15133 [[File:Foobar.jpg|thumb|frame|caption]]
15134 !! html/php
15135 <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>
15136 <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>
15137 <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>
15138
15139 !! html/parsoid
15140 <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>
15141 <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>
15142 <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>
15143 !! end
15144
15145 ###################
15146 # Image sizing.
15147 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15148 # and https://phabricator.wikimedia.org/T64258
15149 # Foobar has actual size of 1941x220
15150 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15151 # a scalable format.
15152 # 2. Framed images always ignore size options; always render at default size.
15153 # 3. "Unspecified format" and border are the only types which can be
15154 # enlarged.
15155
15156 !! test
15157 Image: unspecified format and border enlarge
15158 !! options
15159 parsoid=wt2html,wt2wt,html2html
15160 !! wikitext
15161 [[File:Foobar.jpg|2000px]]
15162
15163 [[File:Foobar.jpg|border|2000px]]
15164 !! html/php
15165 <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>
15166 </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>
15167 </p>
15168 !! html/parsoid
15169 <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>
15170 <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>
15171 !! end
15172
15173 !! test
15174 Image: "unspecified format" and border reduce
15175 !! options
15176 parsoid=wt2html,wt2wt,html2html
15177 !! wikitext
15178 [[File:Foobar.jpg|1000px]]
15179
15180 [[File:Foobar.jpg|border|1000px]]
15181 !! html/php
15182 <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>
15183 </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>
15184 </p>
15185 !! html/parsoid
15186 <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>
15187 <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>
15188 !! end
15189
15190 !! test
15191 Image: thumbs reduce
15192 !! options
15193 parsoid=wt2html,wt2wt,html2html
15194 !! wikitext
15195 [[File:Foobar.jpg|thumb|50px]]
15196 !! html/php
15197 <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>
15198
15199 !! html/parsoid
15200 <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>
15201 !! end
15202
15203 !! test
15204 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15205 !! options
15206 parsoid=wt2html,wt2wt,html2html
15207 !! wikitext
15208 [[File:Foobar.jpg|thumb|2000px]]
15209
15210 [[File:Foobar.svg|thumb|2000px]]
15211 !! html/php
15212 <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>
15213 <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>
15214
15215 !! html/parsoid
15216 <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>
15217 <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>
15218 !! end
15219
15220 !! test
15221 Image: frameless can reduce in size
15222 !! options
15223 parsoid=wt2html,wt2wt,html2html
15224 !! wikitext
15225 [[File:Foobar.jpg|frameless|50px]]
15226 !! html/php
15227 <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>
15228 </p>
15229 !! html/parsoid
15230 <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>
15231 !! end
15232
15233 !! test
15234 Image: bitmap frameless can't be enlarged past original size, but vector can
15235 !! options
15236 parsoid=wt2html,wt2wt,html2html
15237 !! wikitext
15238 [[File:Foobar.jpg|frameless|2000px]]
15239
15240 [[File:Foobar.svg|frameless|2000px]]
15241 !! html/php
15242 <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>
15243 </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>
15244 </p>
15245 !! html/parsoid
15246 <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>
15247 <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>
15248 !! end
15249
15250 !! test
15251 Image: framed images are always unscaled.
15252 !! options
15253 parsoid=wt2html,wt2wt,html2html
15254 !! wikitext
15255 [[File:Foobar.jpg|frame]]
15256
15257 [[File:Foobar.jpg|frame|50px]]
15258
15259 [[File:Foobar.jpg|frame|50x50px]]
15260
15261 [[File:Foobar.jpg|frame|2000px]]
15262 !! html/php
15263 <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>
15264 <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>
15265 <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>
15266 <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>
15267
15268 !! html/parsoid
15269 <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>
15270 <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>
15271 <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>
15272 <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>
15273 !! end
15274
15275 ###################
15276
15277 !! test
15278 Link to image page- image page normally doesn't exists, hence edit link
15279 Add test with existing image page
15280 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15281 !! wikitext
15282 [[:Image:test]]
15283 !! html
15284 <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>
15285 </p>
15286 !! end
15287
15288 !! test
15289 T20784 Link to non-existent image page with caption should use caption as link text
15290 !! wikitext
15291 [[:Image:test|caption]]
15292 !! html
15293 <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>
15294 </p>
15295 !! end
15296
15297 !! test
15298 Frameless image caption with a free URL
15299 !! wikitext
15300 [[File:Foobar.jpg|http://example.com]]
15301 !! html/php
15302 <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>
15303 </p>
15304 !! html/parsoid
15305 <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>
15306 !! end
15307
15308 !! test
15309 Thumbnail image caption with a free URL
15310 !! options
15311 thumbsize=220
15312 !! wikitext
15313 [[File:Foobar.jpg|thumb|http://example.com]]
15314 !! html/php
15315 <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>
15316
15317 !! html/parsoid
15318 <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>
15319 !! end
15320
15321 !! test
15322 Thumbnail image caption with a free URL and explicit alt
15323 !! options
15324 thumbsize=220
15325 parsoid=wt2html,wt2wt,html2html
15326 !! wikitext
15327 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15328 !! html/php
15329 <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>
15330
15331 !! html/parsoid
15332 <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>
15333 !! end
15334
15335 !! test
15336 SVG thumbnails with no language set
15337 !! options
15338 !! wikitext
15339 [[File:Foobar.svg|thumb|caption]]
15340 !! html/php
15341 <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>
15342
15343 !! html/parsoid
15344 <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>
15345 !! end
15346
15347 !! test
15348 SVG thumbnails with language de
15349 !! options
15350 parsoid=wt2html,wt2wt,html2html
15351 !! wikitext
15352 [[File:Foobar.svg|thumb|caption|lang=de]]
15353 !! html/php
15354 <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>
15355
15356 !! html/parsoid
15357 <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>
15358 !! end
15359
15360 !! test
15361 SVG thumbnails with invalid language code
15362 !! options
15363 parsoid=wt2html,wt2wt,html2html
15364 !! wikitext
15365 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15366 !! html/php
15367 <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>
15368
15369 !! html/parsoid
15370 <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>
15371 !! end
15372
15373 !! test
15374 T3887: A ISBN with a thumbnail
15375 !! wikitext
15376 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15377 !! html/php
15378 <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>
15379
15380 !! html/parsoid
15381 <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>
15382 !! end
15383
15384 !! test
15385 T3887: A RFC with a thumbnail
15386 !! wikitext
15387 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15388 !! html/php
15389 <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>
15390
15391 !! html/parsoid
15392 <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>
15393 !! end
15394
15395 !! test
15396 T3887: A mailto link with a thumbnail
15397 !! wikitext
15398 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15399 !! html/php
15400 <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>
15401
15402 !! html/parsoid
15403 <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>
15404 !! end
15405
15406 # Pending resolution to T2368
15407 !! test
15408 T2648: Frameless image caption with a link
15409 !! wikitext
15410 [[File:Foobar.jpg|text with a [[link]] in it]]
15411 !! html/php
15412 <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>
15413 </p>
15414 !! html/parsoid
15415 <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>
15416 !! end
15417
15418 !! test
15419 T2648: Frameless image caption with a link (suffix)
15420 !! wikitext
15421 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15422 !! html/php
15423 <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>
15424 </p>
15425 !! html/parsoid
15426 <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>
15427 !! end
15428
15429 !! test
15430 T2648: Frameless image caption with an interwiki link
15431 !! wikitext
15432 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15433 !! html/php
15434 <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>
15435 </p>
15436 !! html/parsoid
15437 <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>
15438 !! end
15439
15440 !! test
15441 T2648: Frameless image caption with a piped interwiki link
15442 !! wikitext
15443 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15444 !! html/php
15445 <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>
15446 </p>
15447 !! html/parsoid
15448 <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>
15449 !! end
15450
15451 !! test
15452 T107474: Frameless image caption with <nowiki>
15453 !! wikitext
15454 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15455 !! html/parsoid
15456 <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>
15457 !! end
15458
15459 !! test
15460 Escape HTML special chars in image alt text
15461 !! wikitext
15462 [[File:Foobar.jpg|& < > "]]
15463 !! html/php
15464 <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>
15465 </p>
15466 !! html/parsoid
15467 <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>
15468 !! end
15469
15470 !! test
15471 Escape HTML special chars in image alt text with LanguageConverter
15472 !! options
15473 language=zh
15474 !! wikitext
15475 [[File:Foobar.jpg|& < > "]]
15476 !! html/php
15477 <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>
15478 </p>
15479 !! html/parsoid
15480 <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>
15481 !! end
15482
15483 !! test
15484 Entities in file name and attributes
15485 !! wikitext
15486 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15487 !! html/php
15488 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15489 </p>
15490 !! html/parsoid
15491 <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>
15492 !! end
15493
15494 !! test
15495 T2499: Alt text should have &#1234;, not &amp;1234;
15496 !! wikitext
15497 [[File:Foobar.jpg|&#9792;]]
15498 !! html/php
15499 <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>
15500 </p>
15501 !! html/parsoid
15502 <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>
15503 !! end
15504
15505 !! test
15506 Broken image caption with link
15507 !! options
15508 parsoid=wt2html,wt2wt,html2html
15509 !! wikitext
15510 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15511 !! html/php
15512 <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.
15513 </p>
15514 !! html/parsoid
15515 <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>
15516 !! end
15517
15518 !! test
15519 Image caption containing another image
15520 !! wikitext
15521 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15522 !! html/php
15523 <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>
15524
15525 !! html/parsoid
15526 <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>
15527 !! end
15528
15529 !! test
15530 Image: caption containing a newline
15531 !! wikitext
15532 [[File:Foobar.jpg|This
15533 *is some text]]
15534 !! html/php
15535 <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>
15536 </p>
15537 !! html/parsoid
15538 <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>
15539 !!end
15540
15541 !!test
15542 Image: caption containing leading space
15543 (The leading space should not trigger nowiki escaping in wt2wt mode)
15544 !! wikitext
15545 [[File:Foobar.jpg|thumb| bar]]
15546 !! html/php
15547 <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>
15548
15549 !! html/parsoid
15550 <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>
15551 !!end
15552
15553 # html/php output not have newlines after table, td, th, etc. because
15554 # Linker::makeThumbLink2() replaces the newlines with spaces since
15555 # the table is inside a caption.
15556 # FIXME: Verify if that circa 2004 fix is still required.
15557 !! test
15558 Image: caption containing a table
15559 !! options
15560 parsoid=wt2html,wt2wt,html2html
15561 !! wikitext
15562 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15563 {|
15564 !Foo!!Bar
15565 |-
15566 |Foo1||Bar1
15567 |}
15568 and some more text.]]
15569 !! html/php
15570 <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>
15571
15572 !! html/parsoid
15573 <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
15574 <table>
15575 <tbody>
15576 <tr><th>Foo</th><th>Bar</th></tr>
15577 <tr>
15578 <td>Foo1</td>
15579 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15580 !! end
15581
15582 !! test
15583 T5090: External links other than http: in image captions
15584 !! wikitext
15585 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15586 !! html/php
15587 <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>
15588
15589 !! html/parsoid
15590 <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>
15591 !! end
15592
15593 !! test
15594 Custom class
15595 !! options
15596 parsoid=wt2html,wt2wt,html2html
15597 !! wikitext
15598 [[Image:foobar.jpg|a|class=b]]
15599 !! html/php
15600 <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>
15601 </p>
15602 !! html/parsoid
15603 <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>
15604 !! end
15605
15606 !! test
15607 Localized image handling (1).
15608 !! options
15609 parsoid=wt2html,wt2wt,html2html
15610 language=es
15611 !! wikitext
15612 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15613 !! html/php
15614 <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>
15615
15616 !! html/parsoid
15617 <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>
15618 !! end
15619
15620 !! test
15621 Localized image handling (2).
15622 !! options
15623 thumbsize=220
15624 parsoid=wt2html,wt2wt,html2html
15625 language=es
15626 !! wikitext
15627 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15628 !! html/php
15629 <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>
15630
15631 !! html/parsoid
15632 <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>
15633 !! end
15634
15635 !! test
15636 Localized image handling (3).
15637 !! options
15638 language=fa
15639 parsoid=html2wt
15640 !! html/parsoid
15641 <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>
15642 !! wikitext
15643 [[File:Foobar.jpg|بندانگشتی]]
15644 !! end
15645
15646 !! test
15647 "border", "frameless" and "class" attributes on an image.
15648 !! options
15649 thumbsize=220
15650 parsoid=wt2html,wt2wt,html2html
15651 !! wikitext
15652 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15653 !! html/php
15654 <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>
15655 </p>
15656 !! html/parsoid
15657 <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>
15658 !! end
15659
15660 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15661 !! test
15662 Invalid image attributes (T64500)
15663 !! options
15664 thumbsize=220
15665 parsoid=wt2html,wt2wt,html2html
15666 !! wikitext
15667 [[File:Foobar.jpg|thumb|float|left|caption]]
15668
15669 [[File:Foobar.jpg|thumb|righ|caption]]
15670
15671 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15672 !! html/php
15673 <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>
15674 <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>
15675 <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>
15676
15677 !! html/parsoid
15678 <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>
15679 <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>
15680 <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>
15681 !! end
15682
15683 !! article
15684 File:Barfoo.jpg
15685 !! text
15686 #REDIRECT [[File:Barfoo.jpg]]
15687 !! endarticle
15688
15689 # FIXME: Parsoid should run this test -- but we'd need to teach the
15690 # mockAPI about the redirected Barfoo.jpg image.
15691 !! test
15692 Redirected image
15693 !! wikitext
15694 [[Image:Barfoo.jpg]]
15695 !! html/php
15696 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15697 </p>
15698 !! end
15699
15700 !! test
15701 Missing image with uploads disabled
15702 !! options
15703 wgEnableUploads=0
15704 !! wikitext
15705 [[File:Foobaz.jpg]]
15706 !! html/php
15707 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15708 </p>
15709 !! html/parsoid
15710 <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>
15711 !! end
15712
15713 # Parsoid-specific testing for images
15714 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15715 # Currently imperfect due to a flaw in the Parsoid testrunner
15716 # Work in progress
15717 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15718 # image tests.
15719
15720 !! test
15721 Parsoid-specific image handling - simple image with size and middle alignment
15722 !! wikitext
15723 [[File:Foobar.jpg|middle|50px]]
15724 !! html/parsoid
15725 <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>
15726 !! end
15727
15728 !! test
15729 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15730 !! options
15731 parsoid=wt2wt,wt2html,html2html
15732 !! wikitext
15733 [[Image:Foobar.jpg|middle|50px]]
15734 !! html/parsoid
15735 <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>
15736 !! end
15737
15738 !! test
15739 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15740 !! wikitext
15741 [[File:Foobar.jpg|50px|middle]]
15742 !! html/parsoid
15743 <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>
15744 !! end
15745
15746 !! test
15747 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15748 !! options
15749 parsoid=wt2html,wt2wt,html2html
15750 !! wikitext
15751 [[Image:Foobar.jpg|50px|middle]]
15752 !! html/parsoid
15753 <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>
15754 !! end
15755
15756 !! test
15757 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15758 !! wikitext
15759 [[File:Foobar.jpg|500x10px|baseline|caption]]
15760 !! html/parsoid
15761 <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>
15762 !! end
15763
15764 !! test
15765 Parsoid-specific image handling - simple image with border and size spec
15766 !! wikitext
15767 [[File:Foobar.jpg|50px|border|caption]]
15768 !! html/parsoid
15769 <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>
15770 !! end
15771
15772 !! test
15773 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15774 !! options
15775 parsoid=wt2html,html2html
15776 !! wikitext
15777 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15778 !! html/parsoid
15779 <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>
15780 !! end
15781
15782 !! test
15783 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15784 !! options
15785 parsoid=wt2html,html2html
15786 !! wikitext
15787 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15788 !! html/parsoid
15789 <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>
15790 !! end
15791
15792 !! test
15793 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15794 !! options
15795 parsoid=wt2html,html2html
15796 !! wikitext
15797 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15798 !! html/parsoid
15799 <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>
15800 !! end
15801
15802 !! test
15803 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15804 !! options
15805 parsoid=wt2html,html2html
15806 !! wikitext
15807 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15808 !! html/parsoid
15809 <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>
15810 !! end
15811
15812 !! test
15813 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15814 !! options
15815 parsoid=wt2html,wt2wt,html2html
15816 !! wikitext
15817 [[File:Foobar.jpg|frame|500x50px|caption]]
15818 !! html/parsoid
15819 <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>
15820 !! end
15821
15822 !! test
15823 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15824 !! options
15825 parsoid=wt2html,html2html
15826 !! wikitext
15827 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15828 !! html/parsoid
15829 <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>
15830 !! end
15831
15832 !! test
15833 Parsoid-specific image handling - frameless image with specific size, border, and caption
15834 !! wikitext
15835 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15836 !! html/parsoid
15837 <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>
15838 !! end
15839
15840 !! test
15841 Parsoid-specific image handling - simple image with a formatted caption
15842 !! wikitext
15843 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15844 !! html/parsoid
15845 <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>
15846 !! end
15847
15848 !! test
15849 Parsoid-specific image handling - caption with a template in it
15850 !! wikitext
15851 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15852 !! html/parsoid
15853 <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>
15854 !! end
15855
15856 !! test
15857 Parsoid-specific image handling - caption with unbalanced tags in it
15858 !! options
15859 parsoid=wt2html,wt2wt,html2html
15860 !! wikitext
15861 foo
15862 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15863 bar
15864 !! html/parsoid
15865 <p>foo</p>
15866 <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>
15867 <p>bar</p>
15868 !! end
15869
15870 !! test
15871 Parsoid-specific image handling - empty caption (1)
15872 !! options
15873 parsoid=wt2html,wt2wt
15874 !! wikitext
15875 [[File:Foobar.jpg|thumb|]]
15876 !! html/parsoid
15877 <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>
15878 !! end
15879
15880 # empty captions don't get serialized unless we're in the "round trip" case
15881 !! test
15882 Parsoid-specific image handling - empty caption (2)
15883 !! options
15884 parsoid=html2wt
15885 !! html/parsoid
15886 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15887 <a href="./File:Foobar.jpg">
15888 <img resource="./File:Foobar.jpg"
15889 src="//example.com/images/3/3a/Foobar.jpg"
15890 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15891 height="25" width="220"/>
15892 </a>
15893 <figcaption></figcaption>
15894 </figure>
15895 !! wikitext
15896 [[File:Foobar.jpg|thumb]]
15897 !! end
15898
15899 !! test
15900 Parsoid-specific image handling - whitespace caption
15901 !! wikitext
15902 [[File:Foobar.jpg|thumb| ]]
15903 !! html/parsoid
15904 <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>
15905 !! end
15906
15907 !! test
15908 Parsoid-specific image handling - lang option
15909 !! wikitext
15910 foo
15911 [[File:Foobar.svg|lang=de|caption]]
15912 bar
15913 !! html/parsoid
15914 <p>foo
15915 <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>
15916 bar</p>
15917 !! end
15918
15919 ## Edge case bugs in Parsoid from T93580
15920 !! test
15921 T93580: 1. Templated <ref> inside block images
15922 !! wikitext
15923 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15924
15925 <references />
15926 !! html/parsoid
15927 <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>
15928
15929 <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>
15930 !! end
15931
15932 !! test
15933 T93580: 2. <ref> inside inline images
15934 !! wikitext
15935 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15936
15937 <references />
15938 !! html/parsoid
15939 <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\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}&#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>
15940
15941 <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>
15942 !! end
15943
15944 !! test
15945 T93580: 3. Templated <ref> inside inline images
15946 !! wikitext
15947 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15948
15949 <references />
15950 !! html/parsoid
15951 <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>
15952
15953 <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>
15954 !! end
15955
15956 ###
15957 ### Subpages
15958 ###
15959 !! article
15960 Subpage test/subpage
15961 !! text
15962 foo
15963 !! endarticle
15964
15965 !! test
15966 Subpage link
15967 !! options
15968 subpage title=[[Subpage test]]
15969 !! wikitext
15970 [[/subpage]]
15971 !! html
15972 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15973 </p>
15974 !! end
15975
15976 !! test
15977 Subpage noslash link
15978 !! options
15979 subpage title=[[Subpage test]]
15980 !! wikitext
15981 [[/subpage/]]
15982 !! html
15983 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15984 </p>
15985 !! end
15986
15987 !! article
15988 Subpage test/1/2/subpage
15989 !! text
15990 blah
15991 !! endarticle
15992
15993 !! test
15994 Relative subpage noslash link
15995 !! options
15996 parsoid=wt2wt,wt2html,html2html
15997 subpage title=[[Subpage test/1/2/3/4]]
15998 !! wikitext
15999 [[../../subpage/]]
16000
16001 [[../../subpage]]
16002 !! html/php
16003 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16004 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16005 </p>
16006 !! html/parsoid
16007 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16008 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16009 !! end
16010
16011 !! test
16012 Parsoid: dot-slash prefixed wikilinks
16013 !! wikitext
16014 [[./foo]]
16015
16016 [[././bar]]
16017
16018 [[././baz/]]
16019 !! html/php
16020 <p>[[./foo]]
16021 </p><p>[[././bar]]
16022 </p><p>[[././baz/]]
16023 </p>
16024 !! html/parsoid
16025 <p>[[./foo]]
16026 </p><p>[[././bar]]
16027 </p><p>[[././baz/]]
16028 </p>
16029 !! end
16030
16031 !! test
16032 Render invalid page names as plain text (T53090)
16033 !! wikitext
16034 [[./../foo|bar]]
16035 [[foo�|bar]]
16036 [[foo/.|bar]]
16037 [[foo/..|bar]]
16038 [[foo~~~bar]]
16039 [[foo>bar]]
16040 [[foo[bar]]
16041 [[.]]
16042 [[..]]
16043 [[foo././bar]]
16044 [[foo[http://example.com]xyz]]
16045
16046 [[{{echo|./../foo}}|bar]]
16047 [[{{echo|foo/.}}|bar]]
16048 [[{{echo|foo/..}}|bar]]
16049 [[{{echo|foo~~~~bar}}]]
16050 [[{{echo|foo>bar}}]]
16051 [[{{echo|foo././bar}}]]
16052 [[{{echo|foo{bar}}]]
16053 [[{{echo|foo}bar}}]]
16054 [[{{echo|foo[bar}}]]
16055 [[{{echo|foo]bar}}]]
16056 [[{{echo|foo<bar}}]]
16057 !!html/php
16058 <p>[[./../foo|bar]]
16059 [[foo�|bar]]
16060 [[foo/.|bar]]
16061 [[foo/..|bar]]
16062 [[foo~~~bar]]
16063 [[foo&gt;bar]]
16064 [[foo[bar]]
16065 [[.]]
16066 [[..]]
16067 [[foo././bar]]
16068 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16069 </p><p>[[./../foo|bar]]
16070 [[foo/.|bar]]
16071 [[foo/..|bar]]
16072 [[foo~~~~bar]]
16073 [[foo&gt;bar]]
16074 [[foo././bar]]
16075 [[foo{bar]]
16076 [[foo}bar]]
16077 [[foo[bar]]
16078 [[foo]bar]]
16079 [[foo&lt;bar]]
16080 </p>
16081 !!html/parsoid
16082 <p>[[./../foo|bar]]
16083 [[foo�|bar]]
16084 [[foo/.|bar]]
16085 [[foo/..|bar]]
16086 [[foo~~~bar]]
16087 [[foo>bar]]
16088 [[foo[bar]]
16089 [[.]]
16090 [[..]]
16091 [[foo././bar]]
16092 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16093
16094 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16095 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16096 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16097 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16098 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16099 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16100 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16101 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16102 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16103 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16104 [[<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>
16105 !!end
16106
16107 !! test
16108 Disabled subpages
16109 !! wikitext
16110 [[/subpage]]
16111 !! html
16112 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16113 </p>
16114 !! end
16115
16116 !! test
16117 T2561: {{/Subpage}}
16118 !! options
16119 subpage title=[[Page]]
16120 !! wikitext
16121 {{/Subpage}}
16122 !! html
16123 <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>
16124 </p>
16125 !! end
16126
16127 ###
16128 ### Categories
16129 ###
16130 !! article
16131 Category:MediaWiki User's Guide
16132 !! text
16133 blah
16134 !! endarticle
16135
16136 !! test
16137 Link to category
16138 !! wikitext
16139 [[:Category:MediaWiki User's Guide]]
16140 !! html
16141 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16142 </p>
16143 !! end
16144
16145 !! test
16146 Simple category
16147 !! options
16148 cat
16149 !! wikitext
16150 [[Category:MediaWiki User's Guide]]
16151 !! html/php
16152 cat=MediaWiki_User's_Guide sort=
16153 !! html/parsoid
16154 <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"}}'/>
16155 !! end
16156
16157 !! test
16158 PAGESINCATEGORY invalid title fatal (r33546 fix)
16159 !! wikitext
16160 {{PAGESINCATEGORY:<bogus>}}
16161 !! html
16162 <p>0
16163 </p>
16164 !! end
16165
16166 !! test
16167 Category with different sort key
16168 !! options
16169 cat
16170 !! wikitext
16171 [[Category:MediaWiki User's Guide|Foo]]
16172 !! html/php
16173 cat=MediaWiki_User's_Guide sort=Foo
16174 !! html/parsoid
16175 <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"}}'/>
16176 !! end
16177
16178 !! test
16179 Category with identical sort key
16180 !! options
16181 cat
16182 !! wikitext
16183 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16184 !! html/php
16185 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16186 !! html/parsoid
16187 <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"}}'/>
16188 !! end
16189
16190 !! test
16191 Category with empty sort key
16192 !! options
16193 cat
16194 pst
16195 !! wikitext
16196 [[Category:MediaWiki User's Guide|]]
16197 !! html/php
16198 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16199 !! end
16200
16201 !! test
16202 Category with empty sort key and parentheses
16203 !! options
16204 cat
16205 pst
16206 !! wikitext
16207 [[Category:Foo (bar)|]]
16208 !! html/php
16209 [[Category:Foo (bar)|Foo]]
16210 !! end
16211
16212 !! test
16213 Category with link tail
16214 !! options
16215 cat
16216 pst
16217 !! wikitext
16218 123[[Category:Foo]]456
16219 !! html/php
16220 123[[Category:Foo]]456
16221 !! end
16222
16223 !! test
16224 Category with template
16225 !! options
16226 cat
16227 pst
16228 !! wikitext
16229 [[Category:{{echo|Foo}}]]
16230 !! html/php
16231 [[Category:{{echo|Foo}}]]
16232 !! end
16233
16234 !! test
16235 Category with template in sort key
16236 !! options
16237 cat
16238 pst
16239 !! wikitext
16240 [[Category:Foo|{{echo|Bar}}]]
16241 !! html/php
16242 [[Category:Foo|{{echo|Bar}}]]
16243 !! end
16244
16245 !! test
16246 Category with template in sort key and title
16247 !! options
16248 cat
16249 pst
16250 !! wikitext
16251 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16252 !! html/php
16253 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16254 !! end
16255
16256 ## We used to, but no longer wt2wt this test since the default serializer
16257 ## will normalize all categories to serialize on their own line.
16258 ## This wikitext usage is going to be fairly uncommon in production and
16259 ## selser will take care of preserving formatting in those scenarios.
16260 !! test
16261 Category / paragraph interactions
16262 !! options
16263 parsoid=wt2html
16264 !! wikitext
16265 Foo [[Category:Baz]] Bar
16266
16267 Foo [[Category:Baz]]
16268 Bar
16269
16270 Foo
16271 [[Category:Baz]]
16272 Bar
16273
16274 Foo
16275 [[Category:Baz]] Bar
16276
16277 Foo
16278 [[Category:Baz]]
16279 [[Category:Baz]]
16280 [[Category:Baz]]
16281 Bar
16282
16283 [[Category:Baz]]
16284 [[Category:Baz]]
16285 [[Category:Baz]]
16286
16287 [[Category:Baz]]
16288 {{echo|[[Category:Baz]]}}
16289 [[Category:Baz]]
16290 !! html/php
16291 <p>Foo Bar
16292 </p><p>Foo
16293 Bar
16294 </p><p>Foo
16295 Bar
16296 </p><p>Foo Bar
16297 </p><p>Foo
16298 Bar
16299 </p>
16300 !! html/parsoid
16301 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16302 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16303 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16304 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16305 <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>
16306 <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}}]}'/>
16307 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16308 !! end
16309
16310 ## We used to, but no longer wt2wt this test since the default serializer
16311 ## will normalize all categories to serialize on their own line.
16312 ## This wikitext usage is going to be fairly uncommon in production and
16313 ## selser will take care of preserving formatting in those scenarios.
16314 ##
16315 ## The whitespace on the empty line is part of the test. Please do not delete
16316 !! test
16317 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16318 !! options
16319 parsoid=wt2html
16320 !! wikitext
16321 This
16322
16323 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16324
16325 {{echo|[[Category:Foo]] and so should this!}}
16326 !! html/php
16327 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16328 </p>
16329 !! html/parsoid
16330 <p>This
16331
16332 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16333
16334 <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>
16335 !! end
16336
16337 ## Parsoid will not try to wt2wt this while preserving newlines because
16338 ## it suppresses excess newlines within list items -- and we don't want to
16339 ## introduce a special case just for categories, which is, in reality somewhat
16340 ## odd behavior -- categories are unlikely to be used in list items like this
16341 ## in top-level pages and are only likely to show up in template-generated
16342 ## list items where this RT-ing is a non-issue.
16343 ##
16344 ## The whitespace on the empty line is part of the test. Please do not delete
16345 !! test
16346 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16347 !! options
16348 parsoid=wt2html
16349 !! wikitext
16350 * This
16351
16352 [[Category:Foo]] and this should be part of the same list item
16353 * So should this
16354
16355 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16356 !! html
16357 <ul><li>This and this should be part of the same list item</li>
16358 <li>So should this and this should be part of the same list item</li></ul>
16359 !! html/parsoid
16360 <ul>
16361 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16362 <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>
16363 </ul>
16364 !! end
16365
16366 ## Newlines and categories that follow the last item of a list
16367 ## are treated differently because this (list followed by categories)
16368 ## is an extremely common pattern on wikis.
16369 !! test
16370 3. Categories and newlines: newline suppression for last list item should RT properly
16371 !! wikitext
16372 *a
16373 *b
16374
16375 [[Category:Foo]]
16376
16377 [[Category:Bar]]
16378 [[Category:Baz]]
16379
16380 :c
16381
16382 [[Category:C]]
16383
16384 ;d
16385
16386 [[Category:D]]
16387 !! html/parsoid
16388 <ul><li>a</li>
16389 <li>b</li></ul>
16390
16391 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16392
16393 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16394 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16395
16396 <dl><dd>c</dd></dl>
16397
16398 <link rel="mw:PageProp/Category" href="./Category:C"/>
16399
16400 <dl><dt>d</dt></dl>
16401
16402 <link rel="mw:PageProp/Category" href="./Category:D"/>
16403 !! end
16404
16405 !! test
16406 4. Categories and newlines: newline suppression for last list item should RT properly
16407 !! wikitext
16408 *a
16409 ****b
16410
16411 [[Category:Foo]]
16412 !! html/parsoid
16413 <ul><li>a
16414 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16415
16416 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16417 !! end
16418
16419 ## only wt2html for this to make sure the algo only applies to the rightmost path
16420 !! test
16421 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16422 !! options
16423 parsoid=wt2html
16424 !! wikitext
16425 *a
16426 **b
16427 [[Category:Foo]]
16428 *c
16429 **d
16430 [[Category:Foo]]
16431 !! html/parsoid
16432 <ul><li>a
16433 <ul><li>b
16434 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16435 <li>c
16436 <ul><li>d</li></ul></li></ul>
16437 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16438 !! end
16439
16440 ## We used to, but no longer wt2wt this test since the default serializer
16441 ## will normalize all categories to serialize on their own line.
16442 ## This wikitext usage is going to be fairly uncommon in production and
16443 ## selser will take care of preserving formatting in those scenarios.
16444 !! test
16445 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16446 !! options
16447 parsoid=wt2html
16448 !! wikitext
16449 *a [[Category:Foo]]
16450 !! html/parsoid
16451 <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>
16452 !! end
16453
16454 # This test also demonstrates because of newline+category tunneling
16455 # through the list hander, template wrapping doesn't expand to the
16456 # containing list when the list item swallows the category.
16457 !! test
16458 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16459 !! wikitext
16460 *{{echo|a
16461 [[Category:Foo]]}}
16462 !! html/parsoid
16463 <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
16464 </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>
16465 !! end
16466
16467 !! test
16468 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16469 !! wikitext
16470 *a
16471
16472 {{echo|[[Category:Foo]]
16473 [[Category:Bar]]}}
16474 [[Category:Baz]]
16475 !! html/parsoid
16476 <ul><li>a</li></ul>
16477
16478 <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">
16479 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16480 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16481 !! end
16482
16483 !! test
16484 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16485 !! wikitext
16486 *a
16487
16488 [[Category:Bar]]<!--boo1--> <!--boo2-->
16489 [[Category:Baz]]<!--boo3--> <!--boo4-->
16490 !! html/parsoid
16491 <ul><li>a</li></ul>
16492
16493 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16494 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16495 !! end
16496
16497 !! test
16498 Categories and newlines: should behave properly with linkprefix (T87753)
16499 !! options
16500 language=ar
16501 !! wikitext
16502 foo bar
16503 foo bar
16504 [[تصنيف:Foo]]
16505 [[تصنيف:Bar]]
16506 !! html/php
16507 <p>foo bar
16508 foo bar
16509 </p>
16510 !! html/parsoid
16511 <p>foo bar
16512 foo bar</p>
16513 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16514 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16515 !! end
16516
16517 !! test
16518 No regressions on internal links following category (T174639)
16519 !! options
16520 parsoid=wt2html,html2html
16521 !! wikitext
16522 [[Category:Foo]]<div>a
16523
16524 [[Foo]]</div>
16525 !! html/php
16526 <div>a
16527 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16528
16529 !! html/parsoid
16530 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16531
16532 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16533 !! end
16534
16535 # Note that Parsoid differs slightly from PHP due to T175421
16536 !! test
16537 11. Special case where only newlines separate links (T175416)
16538 !! options
16539 parsoid=wt2html,html2html
16540 !! wikitext
16541 [[Category:Foo]]
16542
16543 [[Foo]][[es:Alimento]]
16544
16545 [[Foo]]
16546 !! html/php
16547 <p><br />
16548 <a href="/wiki/Foo" title="Foo">Foo</a>
16549 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16550 </p>
16551 !! html/parsoid
16552 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16553
16554 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16555
16556 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16557 !! end
16558
16559 !! test
16560 Category links with multiple namespaces
16561 !! wikitext
16562 [[Category:Project:Foo]]
16563 !! html/parsoid
16564 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16565 !! end
16566
16567 !! test
16568 Parsoid: Serialize link to category page with colon escape
16569 !! options
16570 parsoid
16571 !! wikitext
16572
16573 [[:Category:Foo]]
16574 [[:Category:Foo|Bar]]
16575 !! html
16576 <p>
16577 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16578 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16579 </p>
16580 !! end
16581
16582 # We used to, but no longer wt2wt this test since the default serializer
16583 # will normalize all categories to serialize on their own line.
16584 # This wikitext usage is going to be fairly uncommon in production and
16585 # selser will take care of preventing whitespace insertion if this
16586 # occurs in an article.
16587 #
16588 # html2html disabled for the same reason (whitespace insertion between
16589 # x and y).
16590 #
16591 # html2wt disabled because it localizes the "Category" namespace.
16592 !! test
16593 Link prefix/suffixes aren't applied to category links
16594 !! options
16595 parsoid=wt2html
16596 language=is
16597 !! wikitext
16598 x[[Category:Foo]]y
16599 !! html/php
16600 <p>xy
16601 </p>
16602 !! html/parsoid
16603 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16604 !! end
16605
16606 !! test
16607 Link prefix/suffixes aren't applied to language links
16608 !! options
16609 parsoid=wt2html
16610 language=is
16611 !! wikitext
16612 x[[es:Foo]]y
16613 !! html/php
16614 <p>xy
16615 </p>
16616 !! html/parsoid
16617 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16618 !! end
16619
16620 !! test
16621 Parsoid: Serialize link to file page with colon escape
16622 !! options
16623 parsoid
16624 !! wikitext
16625
16626 [[:File:Foo.png]]
16627 [[:File:Foo.png|Bar]]
16628 !! html
16629 <p>
16630 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16631 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16632 </p>
16633 !! end
16634
16635 !! test
16636 Parsoid: Serialize a genuine category link without colon escape
16637 !! options
16638 parsoid
16639 !! wikitext
16640 [[Category:Foo]]
16641 [[Category:Foo|Bar]]
16642 !! html
16643 <link rel="mw:PageProp/Category" href="./Category:Foo">
16644 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16645 !! end
16646
16647 !! test
16648 Normalize hrefs properly before testing for invalid link targets (T72894)
16649 !! options
16650 parsoid=html2wt
16651 !! html/parsoid
16652 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16653 !! wikitext
16654 [[Category:Toxine bactérienne]]
16655 !! end
16656
16657 !! test
16658 Parsoid: Defaultsort
16659 !! wikitext
16660 {{DEFAULTSORT:Foo}}
16661 !! html/parsoid
16662 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16663 !! end
16664
16665 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16666 # But, this is a limitation of our representation and is documented in
16667 # TemplateHandler.js in processSpecialMagicWord
16668 !! test
16669 Parsoid: Defaultsort (template-generated)
16670 !! wikitext
16671 {{{{echo|DEFAULTSORT}}:Foo}}
16672 !! html/parsoid
16673 <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"}]]}'/>
16674 !! end
16675
16676 ###
16677 ### Inter-language links
16678 ###
16679 !! test
16680 Interlanguage links
16681 !! options
16682 ill
16683 !! wikitext
16684 [[es:Alimento]]
16685 [[fr:Nourriture]]
16686 [[zh:食品]]
16687 !! html/php
16688 es:Alimento fr:Nourriture zh:食品
16689 !! html/parsoid
16690 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16691 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16692 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16693 !! end
16694
16695 !! test
16696 Duplicate interlanguage links (T26502)
16697 !! options
16698 ill
16699 !! wikitext
16700 [[es:1]]
16701 [[es:2]]
16702 [[fr:1]]
16703 [[fr:2]]
16704 !! html/php
16705 es:1 fr:1
16706 !! html/parsoid
16707 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16708 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16709 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16710 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16711 !! end
16712
16713 ###
16714 ### Sections
16715 ###
16716 !! test
16717 Basic section headings
16718 !! wikitext
16719 ==Headline 1==
16720 Some text
16721
16722 ==Headline 2==
16723 More
16724 ===Smaller headline===
16725 Blah blah
16726 !! html
16727 <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>
16728 <p>Some text
16729 </p>
16730 <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>
16731 <p>More
16732 </p>
16733 <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>
16734 <p>Blah blah
16735 </p>
16736 !! end
16737
16738 !! test
16739 Section headings with TOC
16740 !! wikitext
16741 ==Headline 1==
16742 ===Subheadline 1===
16743 =====Skipping a level=====
16744 ======Skipping a level======
16745
16746 ==Headline 2==
16747 Some text
16748 ===Another headline===
16749 !! html
16750 <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>
16751 <ul>
16752 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16753 <ul>
16754 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16755 <ul>
16756 <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>
16757 <ul>
16758 <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>
16759 </ul>
16760 </li>
16761 </ul>
16762 </li>
16763 </ul>
16764 </li>
16765 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16766 <ul>
16767 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16768 </ul>
16769 </li>
16770 </ul>
16771 </div>
16772
16773 <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>
16774 <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>
16775 <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>
16776 <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>
16777 <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>
16778 <p>Some text
16779 </p>
16780 <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>
16781
16782 !! end
16783
16784 !! test
16785 TOC anchors don't collide
16786 !! wikitext
16787 __FORCETOC__
16788 ==Headline 2==
16789 ==Headline==
16790 ==Headline 2==
16791 ==Headline==
16792 !! html/php
16793 <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>
16794 <ul>
16795 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16796 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16797 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16798 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16799 </ul>
16800 </div>
16801
16802 <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>
16803 <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>
16804 <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>
16805 <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>
16806
16807 !! end
16808
16809 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16810 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16811 !! test
16812 Handling of sections up to level 6 and beyond
16813 !! options
16814 parsoid=wt2html
16815 !! wikitext
16816 =Level 1 Heading=
16817 ==Level 2 Heading==
16818 ===Level 3 Heading===
16819 ====Level 4 Heading====
16820 =====Level 5 Heading=====
16821 ======Level 6 Heading======
16822 =======Level 7 Heading=======
16823 ========Level 8 Heading========
16824 =========Level 9 Heading=========
16825 ==========Level 10 Heading==========
16826 !! html/php
16827 <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>
16828 <ul>
16829 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16830 <ul>
16831 <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>
16832 <ul>
16833 <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>
16834 <ul>
16835 <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>
16836 <ul>
16837 <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>
16838 <ul>
16839 <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>
16840 <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>
16841 <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>
16842 <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>
16843 <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>
16844 </ul>
16845 </li>
16846 </ul>
16847 </li>
16848 </ul>
16849 </li>
16850 </ul>
16851 </li>
16852 </ul>
16853 </li>
16854 </ul>
16855 </div>
16856
16857 <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>
16858 <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>
16859 <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>
16860 <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>
16861 <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>
16862 <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>
16863 <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>
16864 <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>
16865 <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>
16866 <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>
16867
16868 !! html/parsoid
16869 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16870 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16871 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16872 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16873 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16874 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16875 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16876 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16877 <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>
16878 <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>
16879 !! end
16880
16881 !! test
16882 TOC regression (T11764)
16883 !! wikitext
16884 ==title 1==
16885 ===title 1.1===
16886 ====title 1.1.1====
16887 ===title 1.2===
16888 ==title 2==
16889 ===title 2.1===
16890 !! html
16891 <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>
16892 <ul>
16893 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16894 <ul>
16895 <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>
16896 <ul>
16897 <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>
16898 </ul>
16899 </li>
16900 <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>
16901 </ul>
16902 </li>
16903 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16904 <ul>
16905 <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>
16906 </ul>
16907 </li>
16908 </ul>
16909 </div>
16910
16911 <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>
16912 <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>
16913 <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>
16914 <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>
16915 <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>
16916 <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>
16917
16918 !! end
16919
16920 !! test
16921 TOC for heading containing <span id="..."></span> (T96153)
16922 !! wikitext
16923 __FORCETOC__
16924 ==<span id="old-anchor"></span>New title==
16925 !! html/php
16926 <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>
16927 <ul>
16928 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16929 </ul>
16930 </div>
16931
16932 <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>
16933
16934 !! end
16935
16936 !! test
16937 TOC with wgMaxTocLevel=3 (T8204)
16938 !! options
16939 wgMaxTocLevel=3
16940 !! wikitext
16941 ==title 1==
16942 ===title 1.1===
16943 ====title 1.1.1====
16944 ===title 1.2===
16945 ==title 2==
16946 ===title 2.1===
16947 !! html
16948 <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>
16949 <ul>
16950 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16951 <ul>
16952 <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>
16953 <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>
16954 </ul>
16955 </li>
16956 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16957 <ul>
16958 <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>
16959 </ul>
16960 </li>
16961 </ul>
16962 </div>
16963
16964 <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>
16965 <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>
16966 <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>
16967 <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>
16968 <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>
16969 <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>
16970
16971 !! end
16972
16973 !! test
16974 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16975 !! options
16976 wgMaxTocLevel=3
16977 !! wikitext
16978 ==Section 1==
16979 ===Section 1.1===
16980 ====Section 1.1.1====
16981 ====Section 1.1.1.1====
16982 ==Section 2==
16983 !! html
16984 <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>
16985 <ul>
16986 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16987 <ul>
16988 <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>
16989 </ul>
16990 </li>
16991 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16992 </ul>
16993 </div>
16994
16995 <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>
16996 <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>
16997 <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>
16998 <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>
16999 <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>
17000
17001 !! end
17002
17003
17004 !! test
17005 Resolving duplicate section names
17006 !! wikitext
17007 ==Foo bar==
17008 ==Foo bar==
17009 !! html
17010 <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>
17011 <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>
17012
17013 !! end
17014
17015 !! test
17016 Resolving duplicate section names with differing case (T12721)
17017 !! wikitext
17018 ==Foo bar==
17019 ==Foo Bar==
17020 !! html
17021 <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>
17022 <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>
17023
17024 !! end
17025
17026 !! article
17027 Template:sections
17028 !! text
17029 ===Section 1===
17030 ==Section 2==
17031 !! endarticle
17032
17033 !! test
17034 Template with sections, __NOTOC__
17035 !! wikitext
17036 __NOTOC__
17037 ==Section 0==
17038 {{sections}}
17039 ==Section 4==
17040 !! html
17041 <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>
17042 <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>
17043 <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>
17044 <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>
17045
17046 !! end
17047
17048 !! test
17049 __NOEDITSECTION__ keyword
17050 !! wikitext
17051 __NOEDITSECTION__
17052 ==Section 1==
17053 ==Section 2==
17054 !! html
17055 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17056 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17057
17058 !! end
17059
17060 !! test
17061 Link inside a section heading
17062 !! wikitext
17063 ==Section with a [[Main Page|link]] in it==
17064 !! html
17065 <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>
17066
17067 !! end
17068
17069 !! test
17070 TOC regression (T14077)
17071 !! wikitext
17072 __TOC__
17073 ==title 1==
17074 ===title 1.1===
17075 ==title 2==
17076 !! html
17077 <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>
17078 <ul>
17079 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17080 <ul>
17081 <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>
17082 </ul>
17083 </li>
17084 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17085 </ul>
17086 </div>
17087
17088 <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>
17089 <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>
17090 <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>
17091
17092 !! end
17093
17094 !! test
17095 T3219 URL next to image (good)
17096 !! wikitext
17097 http://example.com [[File:Foobar.jpg]]
17098 !! html/php
17099 <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>
17100 </p>
17101 !! html/parsoid
17102 <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>
17103 !!end
17104
17105 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17106 !! test
17107 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17108 !! options
17109 parsoid=wt2html,html2html
17110 !! wikitext
17111 ===
17112 The line above must have a trailing space!
17113 === <!--
17114 --> <!-- -->
17115 But just in case it doesn't...
17116 !! html/php
17117 <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>
17118 <p>The line above must have a trailing space!
17119 </p>
17120 <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>
17121 <p>But just in case it doesn't...
17122 </p>
17123 !! html/parsoid
17124 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17125 <p>The line above must have a trailing space!</p>
17126 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17127 --> <!-- -->
17128 <p>But just in case it doesn't...</p>
17129 !! end
17130
17131 !! test
17132 Header with special characters (T27462)
17133 !! wikitext
17134 The tooltips shall not show entities to the user (ie. be double escaped)
17135
17136 ==text > text==
17137 section 1
17138
17139 ==text < text==
17140 section 2
17141
17142 ==text & text==
17143 section 3
17144
17145 ==text ' text==
17146 section 4
17147
17148 ==text " text==
17149 section 5
17150 !! html/php
17151 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17152 </p>
17153 <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>
17154 <ul>
17155 <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>
17156 <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>
17157 <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>
17158 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17159 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17160 </ul>
17161 </div>
17162
17163 <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>
17164 <p>section 1
17165 </p>
17166 <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>
17167 <p>section 2
17168 </p>
17169 <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>
17170 <p>section 3
17171 </p>
17172 <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>
17173 <p>section 4
17174 </p>
17175 <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>
17176 <p>section 5
17177 </p>
17178 !! html/parsoid
17179 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17180
17181 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17182 <p>section 1</p>
17183
17184 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17185 <p>section 2</p>
17186
17187 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17188 <p>section 3</p>
17189
17190 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17191 <p>section 4</p>
17192
17193 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17194 <p>section 5</p>
17195 !! end
17196
17197 !! test
17198 Header with space, plus and underscore as entity
17199 !! wikitext
17200 Id should not contain + for spaces
17201
17202 ==Space between Text==
17203 section 1
17204
17205 ==Space-Entity&#32;between&#32;Text==
17206 section 2
17207
17208 ==Plus+between+Text==
17209 section 3
17210
17211 ==Plus-Entity&#43;between&#43;Text==
17212 section 4
17213
17214 ==Underscore_between_Text==
17215 section 5
17216
17217 ==Underscore-Entity&#95;between&#95;Text==
17218 section 6
17219
17220 [[#Space between Text]]
17221 [[#Space-Entity&#32;between&#32;Text]]
17222 [[#Plus+between+Text]]
17223 [[#Plus-Entity&#43;between&#43;Text]]
17224 [[#Underscore_between_Text]]
17225 [[#Underscore-Entity&#95;between&#95;Text]]
17226 !! html/php
17227 <p>Id should not contain + for spaces
17228 </p>
17229 <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>
17230 <ul>
17231 <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>
17232 <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>
17233 <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>
17234 <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>
17235 <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>
17236 <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>
17237 </ul>
17238 </div>
17239
17240 <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>
17241 <p>section 1
17242 </p>
17243 <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>
17244 <p>section 2
17245 </p>
17246 <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>
17247 <p>section 3
17248 </p>
17249 <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>
17250 <p>section 4
17251 </p>
17252 <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>
17253 <p>section 5
17254 </p>
17255 <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>
17256 <p>section 6
17257 </p><p><a href="#Space_between_Text">#Space between Text</a>
17258 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17259 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17260 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17261 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17262 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17263 </p>
17264 !! html/parsoid
17265 <p>Id should not contain + for spaces</p>
17266
17267 <h2 id="Space_between_Text">Space between Text</h2>
17268 <p>section 1</p>
17269
17270 <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>
17271 <p>section 2</p>
17272
17273 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17274 <p>section 3</p>
17275
17276 <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>
17277 <p>section 4</p>
17278
17279 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17280 <p>section 5</p>
17281
17282 <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>
17283 <p>section 6</p>
17284
17285 <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>
17286 <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>
17287 <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>
17288 <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>
17289 <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>
17290 <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>
17291 !! end
17292
17293 # Parsoid html2wt disabled because it adds padding spaces around =
17294 !! test
17295 Headers with excess '=' characters
17296 (Are similar tests necessary beyond the 1st level?)
17297 !! options
17298 parsoid=wt2html,wt2wt,html2html
17299 !! wikitext
17300 =foo==
17301 ==foo=
17302 =''italic'' heading==
17303 ==''italic'' heading=
17304 !! html/php
17305 <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>
17306 <ul>
17307 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17308 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17309 <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>
17310 <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>
17311 </ul>
17312 </div>
17313
17314 <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>
17315 <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>
17316 <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>
17317 <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>
17318
17319 !! html/parsoid
17320 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17321 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17322 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17323 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17324 !! end
17325
17326 !! test
17327 HTML headers vs TOC (T25393)
17328 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17329 !! wikitext
17330 <h1>Header 1</h1>
17331 ==Header 1.1==
17332 ==Header 1.2==
17333
17334 <h1>Header 2
17335 </h1>
17336 ==Header 2.1==
17337 ==Header 2.2==
17338 __NOEDITSECTION__
17339 !! html/php
17340 <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>
17341 <ul>
17342 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17343 <ul>
17344 <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>
17345 <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>
17346 </ul>
17347 </li>
17348 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17349 <ul>
17350 <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>
17351 <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>
17352 </ul>
17353 </li>
17354 </ul>
17355 </div>
17356
17357 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17358 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17359 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17360 <h1><span class="mw-headline" id="Header_2">Header 2
17361 </span></h1>
17362 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17363 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17364
17365 !! html/parsoid
17366 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17367 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17368 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17369
17370 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17371 </h1>
17372 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17373 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17374 <meta property="mw:PageProp/noeditsection"/>
17375 !! end
17376
17377 !! test
17378 Single-line or multiline-comments can follow headings
17379 !! options
17380 parsoid=wt2html,wt2wt
17381 !! wikitext
17382 ==foo==<!---->
17383 ==bar==<!--c1-->
17384 ==baz==<!--
17385 c2
17386 c3-->
17387 !! html/php
17388 <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>
17389 <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>
17390 <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>
17391
17392 !! html/parsoid
17393 <h2 id="foo">foo</h2><!---->
17394 <h2 id="bar">bar</h2><!--c1-->
17395 <h2 id="baz">baz</h2><!--
17396 c2
17397 c3-->
17398 !! end
17399
17400 !! test
17401 T3219 URL next to image (broken)
17402 !! wikitext
17403 http://example.com[[File:Foobar.jpg]]
17404 !! html/php
17405 <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>
17406 </p>
17407 !! html/parsoid
17408 <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>
17409 !!end
17410
17411 !! test
17412 T3186 news: in the middle of text
17413 !! wikitext
17414 http://en.wikinews.org/wiki/Wikinews:Workplace
17415 !! html
17416 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17417 </p>
17418 !!end
17419
17420
17421 !! test
17422 Namespaced link must have a title
17423 !! wikitext
17424 [[Project:]]
17425 !! html
17426 <p>[[Project:]]
17427 </p>
17428 !!end
17429
17430 !! test
17431 Namespaced link must have a title (bad fragment version)
17432 !! wikitext
17433 [[Project:#fragment]]
17434 !! html
17435 <p>[[Project:#fragment]]
17436 </p>
17437 !!end
17438
17439
17440 ###
17441 ### HTML tags and HTML attributes
17442 ###
17443
17444 !! test
17445 div with no attributes
17446 !! wikitext
17447 <div>HTML rocks</div>
17448 !! html
17449 <div>HTML rocks</div>
17450
17451 !! end
17452
17453 !! test
17454 div with double-quoted attribute
17455 !! wikitext
17456 <div id="rock">HTML rocks</div>
17457 !! html
17458 <div id="rock">HTML rocks</div>
17459
17460 !! end
17461
17462 !! test
17463 div with single-quoted attribute
17464 !! wikitext
17465 <div id='rock'>HTML rocks</div>
17466 !! html
17467 <div id="rock">HTML rocks</div>
17468
17469 !! end
17470
17471 !! test
17472 div with unquoted attribute
17473 !! wikitext
17474 <div id=rock>HTML rocks</div>
17475 !! html
17476 <div id="rock">HTML rocks</div>
17477
17478 !! end
17479
17480 !! test
17481 div with illegal double attributes
17482 !! wikitext
17483 <div id="a" id="b">HTML rocks</div>
17484 !! html
17485 <div id="b">HTML rocks</div>
17486
17487 !!end
17488
17489 !! test
17490 div with empty attribute value, space before equals
17491 !! options
17492 parsoid=wt2html,html2html
17493 !! wikitext
17494 <div class =>HTML rocks</div>
17495 !! html/php
17496 <div class="">HTML rocks</div>
17497
17498 !! html/parsoid
17499 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17500 !! end
17501
17502 !! test
17503 div with multiple empty attribute values
17504 !! config
17505 wgFragmentMode=[ 'html5', 'legacy' ]
17506 !! options
17507 parsoid=wt2html,html2html
17508 !! wikitext
17509 <div id= title=>HTML rocks</div>
17510 !! html/php
17511 <div id="title=">HTML rocks</div>
17512
17513 !! html/parsoid
17514 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17515 !! end
17516
17517 # FIXME Parsoid doesn't actually match PHP here.
17518 # Probably we should use the synthetic <foo /> or <indicator>
17519 # extensions for this test, which are enabled when running parser tests.
17520 !! test
17521 Extension tag in attribute value
17522 !! wikitext
17523 <span title="<translate>123</translate>">ok</span>
17524 !! html/php+disabled
17525 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17526 </p>
17527 !! html/parsoid
17528 <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>
17529 !! end
17530
17531 !! test
17532 table with multiple empty attribute values
17533 !! options
17534 parsoid=wt2html,html2html
17535 !! wikitext
17536 {| title= id=
17537 |hi
17538 |}
17539 !! html/php
17540 <table title="id=">
17541 <tr>
17542 <td>hi
17543 </td></tr></table>
17544
17545 !! html/parsoid
17546 <table title="id=">
17547 <tbody><tr><td>hi</td></tr>
17548 </tbody></table>
17549 !! end
17550
17551 !! test
17552 div with braces in attribute value
17553 !! wikitext
17554 <div title="{}">Foo</div>
17555 !! html/php
17556 <div title="&#123;&#125;">Foo</div>
17557
17558 !! html/parsoid
17559 <div title="{}">Foo</div>
17560 !! end
17561
17562 !! test
17563 div with empty attribute value, no space before equals
17564 !! options
17565 parsoid=wt2html,html2html
17566 !! wikitext
17567 <div class=>HTML rocks</div>
17568 !! html/php
17569 <div class="">HTML rocks</div>
17570
17571 !! html/parsoid
17572 <div class="">HTML rocks</div>
17573 !! end
17574
17575 !! test
17576 HTML multiple attributes correction
17577 !! wikitext
17578 <p class="error" class="awesome">Awesome!</p>
17579 !! html
17580 <p class="awesome">Awesome!</p>
17581
17582 !!end
17583
17584 !! test
17585 Table multiple attributes correction
17586 !! wikitext
17587 {|
17588 !+ class="error" class="awesome"|status
17589 |}
17590 !! html
17591 <table>
17592 <tr>
17593 <th class="awesome">status
17594 </th></tr></table>
17595
17596 !!end
17597
17598 !! test
17599 DIV IN UPPERCASE
17600 !! wikitext
17601 <DIV ID="x">HTML ROCKS</DIV>
17602 !! html
17603 <div id="x">HTML ROCKS</div>
17604
17605 !!end
17606
17607 !! test
17608 Non-ASCII pseudo-tags are rendered as text
17609 !! wikitext
17610 <khyô>
17611 !! html
17612 <p>&lt;khyô&gt;
17613 </p>
17614 !! end
17615
17616 !! test
17617 Pseudo-tag with URL 'name' renders as url link
17618 !! wikitext
17619 <http://example.com/>
17620 !! html
17621 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17622 </p>
17623 !! end
17624
17625 !! test
17626 text with amp in the middle of nowhere
17627 !! wikitext
17628 Remember AT&T?
17629 !! html
17630 <p>Remember AT&amp;T?
17631 </p>
17632 !! end
17633
17634 !! test
17635 text with character entity: eacute
17636 !! wikitext
17637 I always thought &eacute; was a cute letter.
17638 !! html+tidy
17639 <p>I always thought &#233; was a cute letter.
17640 </p>
17641 !! end
17642
17643 !! test
17644 text with entity-escaped character entity-like string: eacute
17645 !! wikitext
17646 I always thought &amp;eacute; was a cute letter.
17647 !! html
17648 <p>I always thought &amp;eacute; was a cute letter.
17649 </p>
17650 !! end
17651
17652 !! test
17653 text with undefined character entity: xacute
17654 !! wikitext
17655 I always thought &xacute; was a cute letter.
17656 !! html
17657 <p>I always thought &amp;xacute; was a cute letter.
17658 </p>
17659 !! end
17660
17661 !! test
17662 HTML5 tags
17663 !! wikitext
17664 <data value="5">five</data>
17665 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17666 <mark>This highlighted text</mark>
17667 !! html
17668 <p><data value="5">five</data>
17669 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17670 <mark>This highlighted text</mark>
17671 </p>
17672 !! end
17673
17674 !! test
17675 HTML tag with leading space is parsed as text
17676 !! wikitext
17677 < div>foo< /div>
17678 !! html
17679 <p>&lt; div&gt;foo&lt; /div&gt;
17680 </p>
17681 !! end
17682
17683 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17684 ## the HTML5 parsing spec.
17685 !! test
17686 Element with broken attribute syntax
17687 !! options
17688 parsoid=wt2html
17689 !! wikitext
17690 <div style=" style="123">hi</div>
17691 <div =>ho</div>
17692 !! html/php
17693 <div style="123">hi</div>
17694 <div>ho</div>
17695
17696 !! html/parsoid
17697 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17698 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17699 !! end
17700
17701 ###
17702 ### Nesting tests (see T43545, T52604, T53081)
17703 ###
17704
17705 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17706 # Note that html2wt is considerably more difficult if we use <b> in
17707 # the test case, instead of <small>
17708 !! test
17709 Ensure that HTML adoption agency algorithm is properly implemented.
17710 !! wikitext
17711 <small>X<small>Y</small>Z</small>
17712 !! html
17713 <p><small>X<small>Y</small>Z</small>
17714 </p>
17715 !! end
17716
17717 # This was T43545 in the PHP parser.
17718 !! test
17719 Nesting of <kbd>
17720 !! wikitext
17721 <kbd>X<kbd>Y</kbd>Z</kbd>
17722 !! html+tidy
17723 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17724 </p>
17725 !! end
17726
17727 # The following cases were T53081 in the PHP parser.
17728 # Note that there are some other nestable tags (b, i, etc) which are
17729 # not covered; see T53081 for discussion.
17730
17731 !! test
17732 Nesting of <em>
17733 !! wikitext
17734 <em>X<em>Y</em>Z</em>
17735 !! html+tidy
17736 <p><em>X<em>Y</em>Z</em>
17737 </p>
17738 !! end
17739
17740 !! test
17741 Nesting of <strong>
17742 !! wikitext
17743 <strong>X<strong>Y</strong>Z</strong>
17744 !! html+tidy
17745 <p><strong>X<strong>Y</strong>Z</strong>
17746 </p>
17747 !! end
17748
17749 !! test
17750 Nesting of <q>
17751 !! wikitext
17752 <q>X<q>Y</q>Z</q>
17753 !! html+tidy
17754 <p><q>X<q>Y</q>Z</q>
17755 </p>
17756 !! end
17757
17758 !! test
17759 Nesting of <ruby>
17760 !! wikitext
17761 <ruby>X<ruby>Y</ruby>Z</ruby>
17762 !! html
17763 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17764 </p>
17765 !! end
17766
17767 !! test
17768 Nesting of <bdo>
17769 !! wikitext
17770 <bdo>X<bdo>Y</bdo>Z</bdo>
17771 !! html
17772 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17773 </p>
17774 !! end
17775
17776
17777 ###
17778 ### Media links
17779 ###
17780
17781 !! test
17782 Media link
17783 !! wikitext
17784 [[Media:Foobar.jpg]]
17785 [[Media:Video.ogv]]
17786 [[:Media:Video.ogv]]
17787 !! html/php
17788 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17789 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17790 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17791 </p>
17792 !! html/parsoid
17793 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17794 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17795 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv" data-parsoid='{"a":{"resource":"./Media:Video.ogv"},"sa":{"resource":":Media:Video.ogv"}}'>Media:Video.ogv</a></p>
17796 !! end
17797
17798 !! test
17799 Media link with text
17800 !! wikitext
17801 [[Media:Foobar.jpg|A neat file to look at]]
17802 !! html/php
17803 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17804 </p>
17805 !! html/parsoid
17806 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17807 !! end
17808
17809 !! test
17810 Localized media link
17811 !! options
17812 language=is
17813 !! wikitext
17814 [[Miðill:Foobar.jpg]]
17815
17816 [[Miðill:Foobar.jpg|Icelandic]]
17817 !! html/php
17818 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
17819 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
17820 </p>
17821 !! html/parsoid
17822 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Miðill:Foobar.jpg</a></p>
17823 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
17824 !! end
17825
17826 # FIXME: this is still bad HTML tag nesting
17827 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17828 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17829 !! test
17830 Media link with nasty text
17831 !! options
17832 parsoid=wt2html,html2html
17833 !! wikitext
17834 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17835 !! html/php
17836 <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>
17837
17838 !! html/php+tidy
17839 <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>
17840 !! html/parsoid
17841 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Safe Link</a></p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg"><div style="display:none" data-parsoid='{"stx":"html"}'>" onmouseover="alert(document.cookie)" onfoo="</div></a>
17842 !! end
17843
17844 !! test
17845 Media link from missing resource (parsoid-only)
17846 !! options
17847 parsoid=html2wt
17848 !! html/parsoid
17849 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
17850 !! wikitext
17851 [[Media:Foobar.jpg|Bat!]]
17852 !! end
17853
17854 !! test
17855 Media link from missing resource, localized (parsoid-only)
17856 !! options
17857 parsoid=html2wt
17858 language=is
17859 !! html/parsoid
17860 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
17861 !! wikitext
17862 [[Miðill:Foobar.jpg|Bat!]]
17863 !! end
17864
17865 # This is a sanity test to ensure we don't crash or choke when given
17866 # old cached 1.7.0 HTML for media links; we don't require that the
17867 # result be "valid" because wt2wt was completely broken in 1.7.0
17868 !! test
17869 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
17870 !! options
17871 parsoid=html2wt
17872 !! html/parsoid
17873 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
17874 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17875 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
17876 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17877 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
17878 !! wikitext
17879 This is what Parsoid would emit (and we still handle this HTML fine):
17880
17881 [[Media:Foobar.jpg|A neat file to look at]]
17882
17883 But VisualEditor would mangle the rel attribute, and give us back this:
17884
17885 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
17886
17887 But at least we don't crash when trying to handle the mangled HTML!
17888 !! end
17889
17890 !! test
17891 Media link to nonexistent file (T3702)
17892 !! wikitext
17893 [[Media:No such.jpg]]
17894 [[Media:No_such file.jpg]]
17895 !! html/php
17896 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17897 <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>
17898 </p>
17899 !! html/parsoid
17900 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" resource="./Media: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":{"resource":"./Media:No_such.jpg"},"sa":{"resource":"Media:No such.jpg"}}'>Media:No such.jpg</a>
17901 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" resource="./Media: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":{"resource":"./Media:No_such_file.jpg"},"sa":{"resource":"Media:No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17902 !! end
17903
17904 !! test
17905 Image link to nonexistent file (T3850 - good)
17906 !! wikitext
17907 [[File:No_such.jpg]]
17908 !! html/php
17909 <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>
17910 </p>
17911 !! html/parsoid
17912 <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>
17913 !! end
17914
17915 !! test
17916 :Image link to nonexistent file (T3850 - bad)
17917 !! wikitext
17918 [[:Image:No such.jpg]]
17919 !! html/php
17920 <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>
17921 </p>
17922 !! html/parsoid
17923 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17924 !! end
17925
17926 !! test
17927 Character reference normalization in link text (T3938)
17928 !! wikitext
17929 [[Main Page|this&that]]
17930 !! html
17931 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17932 </p>
17933 !!end
17934
17935 !! article
17936 אַ
17937 !! text
17938 Test for unicode normalization
17939
17940 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17941 !! endarticle
17942
17943 !! test
17944 (T21451) Links should refer to the normalized form.
17945 !! wikitext
17946 [[&#xFB2E;]]
17947 [[&#x5d0;&#x5b7;]]
17948 [[&#x5d0;ַ]]
17949 [[א&#x5b7;]]
17950 [[אַ]]
17951 !! html
17952 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17953 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17954 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17955 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17956 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17957 </p>
17958 !! end
17959
17960 !! test
17961 Empty attribute crash test (T4067)
17962 !! wikitext
17963 <font color="">foo</font>
17964 !! html
17965 <p><font color="">foo</font>
17966 </p>
17967 !! end
17968
17969 !! test
17970 Empty attribute crash test single-quotes (T4067)
17971 !! wikitext
17972 <font color=''>foo</font>
17973 !! html
17974 <p><font color="">foo</font>
17975 </p>
17976 !! end
17977
17978 !! test
17979 Attribute test: equals, then nothing
17980 !! options
17981 parsoid=wt2html,html2html
17982 !! wikitext
17983 <font color=>foo</font>
17984 !! html/php
17985 <p><font color="">foo</font>
17986 </p>
17987 !! html/parsoid
17988 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17989 !! end
17990
17991 !! test
17992 Attribute test: unquoted value
17993 !! options
17994 parsoid=wt2html,html2html
17995 !! wikitext
17996 <font color=x>foo</font>
17997 !! html/php
17998 <p><font color="x">foo</font>
17999 </p>
18000 !! html/parsoid
18001 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18002 !! end
18003
18004 !! test
18005 Attribute test: unquoted but illegal value (hash)
18006 !! wikitext
18007 <font color=#x>foo</font>
18008 !! html
18009 <p><font color="#x">foo</font>
18010 </p>
18011 !! end
18012
18013 # Parsoid does not serialize to empty attribute syntax,
18014 # so wt2wt and html2wt cases are skipped
18015 !! test
18016 Attribute test: no value (T54330)
18017 !! options
18018 parsoid=wt2html,html2html
18019 !! wikitext
18020 <font color>foo</font>
18021 !! html/php
18022 <p><font color="">foo</font>
18023 </p>
18024 !! html/parsoid
18025 <p><font color="">foo</font></p>
18026 !! end
18027
18028 !! test
18029 T4095: link with three closing brackets
18030 !! wikitext
18031 [[Main Page]]]
18032 !! html/php
18033 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18034 </p>
18035 !! html/parsoid
18036 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18037 !! end
18038
18039 !! test
18040 T4095: link with pipe and three closing brackets
18041 !! wikitext
18042 [[Main Page|link]]]
18043 !! html/php
18044 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18045 </p>
18046 !! html/parsoid
18047 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18048 !! end
18049
18050 !! test
18051 T4095: link with pipe and three closing brackets, version 2
18052 !! wikitext
18053 [[Main Page|[http://example.com/]]]
18054 !! html/php
18055 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18056 </p>
18057 !! html/parsoid
18058 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18059 !! end
18060
18061
18062 ###
18063 ### Safety
18064 ###
18065
18066 !! article
18067 Template:Dangerous attribute
18068 !! text
18069 " onmouseover="alert(document.cookie)
18070 !! endarticle
18071
18072 !! article
18073 Template:Dangerous style attribute
18074 !! text
18075 border-size: expression(alert(document.cookie))
18076 !! endarticle
18077
18078 !! article
18079 Template:Div style
18080 !! text
18081 <div style="float: right; {{{1}}}">Magic div</div>
18082 !! endarticle
18083
18084 !! test
18085 T4304: HTML attribute safety (safe template; regression T4309)
18086 !! wikitext
18087 <div title="{{test}}"></div>
18088 !! html/php
18089 <div title="This is a test template"></div>
18090
18091 !! html/parsoid
18092 <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>
18093 !! end
18094
18095 # Parsoid has enough context to handle this case
18096 !! test
18097 T4304: HTML attribute safety (dangerous template; 2309)
18098 !! wikitext
18099 <div title="{{dangerous attribute}}"></div>
18100 !! html/php
18101 <div title=""></div>
18102
18103 !! html/parsoid
18104 <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>
18105 !! end
18106
18107 !! test
18108 T4304: HTML attribute safety (dangerous style template; 2309)
18109 !! wikitext
18110 <div style="{{dangerous style attribute}}"></div>
18111 !! html/php
18112 <div style="/* insecure input */"></div>
18113
18114 !! html/parsoid
18115 <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>
18116 !! end
18117
18118 !! test
18119 T4304: HTML attribute safety (safe parameter; 2309)
18120 !! wikitext
18121 {{div style|width: 200px}}
18122 !! html/php
18123 <div style="float: right; width: 200px">Magic div</div>
18124
18125 !! html/parsoid
18126 <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>
18127 !! end
18128
18129 !! test
18130 T4304: HTML attribute safety (unsafe parameter; 2309)
18131 !! wikitext
18132 {{div style|width: expression(alert(document.cookie))}}
18133 !! html/php
18134 <div style="/* insecure input */">Magic div</div>
18135
18136 !! html/parsoid
18137 <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>
18138 !! end
18139
18140 ## Parsoid output here differs; needs investigation.
18141 !! test
18142 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18143 !! wikitext
18144 {{div style|"><script>alert(document.cookie)</script>}}
18145 !! html
18146 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18147
18148 !! end
18149
18150 ## Parsoid output here differs; needs investigation.
18151 !! test
18152 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18153 !! wikitext
18154 {{div style|" ><script>alert(document.cookie)</script>}}
18155 !! html
18156 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18157
18158 !! end
18159
18160 !! test
18161 T4304: HTML attribute safety (link)
18162 !! wikitext
18163 <div title="[[Main Page]]"></div>
18164 !! html/php
18165 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18166
18167 !! html/parsoid
18168 <div title="[[Main Page]]"></div>
18169 !! end
18170
18171 !! test
18172 T4304: HTML attribute safety (italics)
18173 !! wikitext
18174 <div title="''foobar''"></div>
18175 !! html
18176 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18177
18178 !! end
18179
18180 !! test
18181 T4304: HTML attribute safety (bold)
18182 !! wikitext
18183 <div title="'''foobar'''"></div>
18184 !! html
18185 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18186
18187 !! end
18188
18189 !! test
18190 T4304: HTML attribute safety (ISBN)
18191 !! wikitext
18192 <div title="ISBN 1234567890"></div>
18193 !! html
18194 <div title="&#73;SBN 1234567890"></div>
18195
18196 !! end
18197
18198 !! test
18199 T4304: HTML attribute safety (RFC)
18200 !! wikitext
18201 <div title="RFC 1234"></div>
18202 !! html
18203 <div title="&#82;FC 1234"></div>
18204
18205 !! end
18206
18207 !! test
18208 T4304: HTML attribute safety (PMID)
18209 !! wikitext
18210 <div title="PMID 1234567890"></div>
18211 !! html
18212 <div title="&#80;MID 1234567890"></div>
18213
18214 !! end
18215
18216 !! test
18217 T4304: HTML attribute safety (web link)
18218 !! wikitext
18219 <div title="http://example.com/"></div>
18220 !! html
18221 <div title="http&#58;//example.com/"></div>
18222
18223 !! end
18224
18225 !! test
18226 T4304: HTML attribute safety (named web link)
18227 !! wikitext
18228 <div title="[http://example.com/ link]"></div>
18229 !! html/php
18230 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18231
18232 !! html/parsoid
18233 <div title="[http://example.com/ link]"></div>
18234 !! end
18235
18236 !! test
18237 T5244: HTML attribute safety (extension; safe)
18238 !! wikitext
18239 <div style="<nowiki>background:blue</nowiki>"></div>
18240 !! html/php
18241 <div style="background:blue"></div>
18242
18243 !! html/parsoid
18244 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18245 !! end
18246
18247 !! test
18248 T5244: HTML attribute safety (extension; unsafe)
18249 !! wikitext
18250 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18251 !! html/php
18252 <div style="/* insecure input */"></div>
18253
18254 !! html/parsoid
18255 <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>
18256 !! end
18257
18258 # More MSIE fun discovered by Tom Gilder
18259
18260 !! test
18261 MSIE CSS safety test: spurious slash
18262 !! wikitext
18263 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18264 !! html/php
18265 <div style="/* insecure input */">evil</div>
18266
18267 !! html/parsoid
18268 <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>
18269 !! end
18270
18271 !! test
18272 MSIE CSS safety test: hex code
18273 !! wikitext
18274 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18275 !! html/php
18276 <div style="/* insecure input */">evil</div>
18277
18278 !! html/parsoid
18279 <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>
18280 !! end
18281
18282 !! test
18283 MSIE CSS safety test: comment in url
18284 !! wikitext
18285 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18286 !! html/php
18287 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18288
18289 !! html/parsoid
18290 <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>
18291 !! end
18292
18293 !! test
18294 MSIE CSS safety test: comment in expression
18295 !! wikitext
18296 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18297 !! html/php
18298 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18299
18300 !! html/parsoid
18301 <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>
18302 !! end
18303
18304 !! test
18305 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18306 !! wikitext
18307 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18308 !! html/php
18309 <p style="/* invalid control char */">A</p>
18310
18311 !! html/parsoid
18312 <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>
18313 !! end
18314
18315 !! test
18316 MSIE 6 CSS safety test: Fullwidth (T57332)
18317 !! wikitext
18318 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18319 <div style="top:EXPRESSION(alert())">B</div>
18320 !! html/php
18321 <p style="/* insecure input */">A</p>
18322 <div style="/* insecure input */">B</div>
18323
18324 !! html/parsoid
18325 <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>
18326 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18327 !! end
18328
18329 !! test
18330 MSIE 6 CSS safety test: IPA extensions (T57332)
18331 !! wikitext
18332 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18333 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18334 !! html/php
18335 <div style="/* insecure input */">A</div>
18336 <p style="/* insecure input */">B</p>
18337
18338 !! html/parsoid
18339 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18340 <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>
18341 !! end
18342
18343 !! test
18344 MSIE 6 CSS safety test: sup/sub script (T57332)
18345 !! wikitext
18346 <div style="background-image:url⁽javascript:alert())">A</div>
18347 <div style="background-image:url₍javascript:alert())">B</div>
18348 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18349 !! html/php
18350 <div style="/* insecure input */">A</div>
18351 <div style="/* insecure input */">B</div>
18352 <p style="/* insecure input */">C</p>
18353
18354 !! html/parsoid
18355 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18356 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18357 <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>
18358 !! end
18359
18360 !! test
18361 Opera -o-link CSS
18362 !! options
18363 parsoid=wt2html,html2html
18364 !! wikitext
18365 <div
18366 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;"
18367 style="-o-link:attr(title);-o-link-source:current">X</div>
18368 !! html/php
18369 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18370
18371 !! html/parsoid
18372 <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>
18373 !! end
18374
18375 !! test
18376 MSIE 6 CSS safety test: Repetition markers (T57332)
18377 !! wikitext
18378 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18379 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18380 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18381 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18382 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18383 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18384 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18385 !! html/php
18386 <p style="/* insecure input */">A</p>
18387 <p style="/* insecure input */">B</p>
18388 <p style="/* insecure input */">C</p>
18389 <p style="/* insecure input */">D</p>
18390 <p style="/* insecure input */">E</p>
18391 <p style="/* insecure input */">F</p>
18392 <p style="/* insecure input */">G</p>
18393
18394 !! html/parsoid
18395 <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>
18396 <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>
18397 <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>
18398 <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>
18399 <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>
18400 <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>
18401 <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>
18402 !! end
18403
18404 !! test
18405 Table attribute legitimate extension
18406 !! wikitext
18407 {|
18408 !+ style="<nowiki>color:blue</nowiki>"|status
18409 |}
18410 !! html
18411 <table>
18412 <tr>
18413 <th style="color:blue">status
18414 </th></tr></table>
18415
18416 !!end
18417
18418 !! test
18419 Table attribute safety
18420 !! wikitext
18421 {|
18422 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18423 |}
18424 !! html
18425 <table>
18426 <tr>
18427 <th style="/* insecure input */">status
18428 </th></tr></table>
18429
18430 !! end
18431
18432 !! test
18433 CSS line continuation 1
18434 !! wikitext
18435 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18436 !! html
18437 <div style="/* insecure input */"></div>
18438
18439 !! end
18440
18441 !! test
18442 CSS line continuation 2
18443 !! wikitext
18444 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18445 !! html
18446 <div style="/* invalid control char */"></div>
18447
18448 !! end
18449
18450 !! article
18451 Template:Identity
18452 !! text
18453 {{{1}}}
18454 !! endarticle
18455
18456 !! test
18457 Expansion of multi-line templates in attribute values (T8255)
18458 !! wikitext
18459 <div style="background: {{identity|#00FF00}}">-</div>
18460 !! html
18461 <div style="background: #00FF00">-</div>
18462
18463 !! end
18464
18465 !! test
18466 Expansion of multi-line templates in attribute values (T8255 sanity check)
18467 !! wikitext
18468 <div style="background:
18469 #00FF00">-</div>
18470 !! html/php
18471 <div style="background: #00FF00">-</div>
18472
18473 !! html/parsoid
18474 <div style="background:
18475 #00FF00">-</div>
18476 !! end
18477
18478 !! test
18479 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18480 !! wikitext
18481 <div style="background: &#10;#00FF00">-</div>
18482 !! html
18483 <div style="background: &#10;#00FF00">-</div>
18484
18485 !! end
18486
18487 !! test
18488 Tags which are hidden from tidiers cannot pass through the Sanitizer
18489 !! wikitext
18490 <mw:toc><script>alert();</script></mw:toc>
18491 !! html+tidy
18492 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18493 </p>
18494 !! end
18495
18496 ###
18497 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18498 ###
18499
18500 !! test
18501 Parser hook: empty input
18502 !! wikitext
18503 <tag></tag>
18504 !! html/php
18505 <pre>
18506 ''
18507 array (
18508 )
18509 </pre>
18510
18511 !! html/parsoid
18512 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18513 !! end
18514
18515 ## Don't expect parsoid to rt this form.
18516 !! test
18517 Parser hook: empty input using terminated empty elements
18518 !! options
18519 parsoid=wt2html,html2html
18520 !! wikitext
18521 <tag/>
18522 !! html/php
18523 <pre>
18524 NULL
18525 array (
18526 )
18527 </pre>
18528
18529 !! html/parsoid
18530 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18531 !! end
18532
18533 !! test
18534 Parser hook: empty input using terminated empty elements (space before)
18535 !! wikitext
18536 <tag />
18537 !! html/php
18538 <pre>
18539 NULL
18540 array (
18541 )
18542 </pre>
18543
18544 !! html/parsoid
18545 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18546 !! end
18547
18548 !! test
18549 Parser hook: basic input
18550 !! wikitext
18551 <tag>input</tag>
18552 !! html/php
18553 <pre>
18554 'input'
18555 array (
18556 )
18557 </pre>
18558
18559 !! html/parsoid
18560 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18561 !! end
18562
18563 ## Don't expect parsoid to rt this form.
18564 !! test
18565 Parser hook: case insensitive
18566 !! options
18567 parsoid=wt2html,html2html
18568 !! wikitext
18569 <TAG>input</TAG>
18570 !! html/php
18571 <pre>
18572 'input'
18573 array (
18574 )
18575 </pre>
18576
18577 !! html/parsoid
18578 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18579 !! end
18580
18581 ## Don't expect parsoid to rt this form.
18582 !! test
18583 Parser hook: case insensitive, redux
18584 !! options
18585 parsoid=wt2html,html2html
18586 !! wikitext
18587 <TaG>input</TAg>
18588 !! html/php
18589 <pre>
18590 'input'
18591 array (
18592 )
18593 </pre>
18594
18595 !! html/parsoid
18596 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18597 !! end
18598
18599 !! test
18600 Parser hook: nested tags
18601 !! options
18602 parsoid=wt2html
18603 !! wikitext
18604 <tag><tag></tag></tag>
18605 !! html/php
18606 <pre>
18607 '<tag>'
18608 array (
18609 )
18610 </pre>&lt;/tag&gt;
18611
18612 !! html/php+tidy
18613 <pre>'<tag>'
18614 array (
18615 )
18616 </tag></pre><p>&lt;/tag&gt;
18617 </p>
18618 !! html/parsoid
18619 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18620 !! end
18621
18622 !! test
18623 Parser hook: basic arguments
18624 !! wikitext
18625 <tag width="200" height="100" depth="50" square=""></tag>
18626 !! html/php
18627 <pre>
18628 ''
18629 array (
18630 'width' => '200',
18631 'height' => '100',
18632 'depth' => '50',
18633 'square' => '',
18634 )
18635 </pre>
18636
18637 !! html/parsoid
18638 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18639 !! end
18640
18641 ## Don't expect parsoid to rt this form.
18642 !! test
18643 Parser hook: basic arguments, variations
18644 !! options
18645 parsoid=wt2html,html2html
18646 !! wikitext
18647 <tag width=200 height = "100" depth = '50' square></tag>
18648 !! html/php
18649 <pre>
18650 ''
18651 array (
18652 'width' => '200',
18653 'height' => '100',
18654 'depth' => '50',
18655 'square' => '',
18656 )
18657 </pre>
18658
18659 !! html/parsoid
18660 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18661 !! end
18662
18663 !! test
18664 Parser hook: argument containing a forward slash (T7344)
18665 !! wikitext
18666 <tag filename="/tmp/bla"></tag>
18667 !! html/php
18668 <pre>
18669 ''
18670 array (
18671 'filename' => '/tmp/bla',
18672 )
18673 </pre>
18674
18675 !! html/parsoid
18676 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18677 !! end
18678
18679 ## Don't expect parsoid to rt this form.
18680 !! test
18681 Parser hook: empty input using terminated empty elements (T4374)
18682 !! options
18683 parsoid=wt2html,html2html
18684 !! wikitext
18685 <tag foo=bar/>text
18686 !! html/php
18687 <pre>
18688 NULL
18689 array (
18690 'foo' => 'bar',
18691 )
18692 </pre>text
18693
18694 !! html/parsoid
18695 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
18696 !! end
18697
18698 ## </tag> should be output literally since there is no matching tag that begins it
18699 ## Don't expect parsoid to rt this form.
18700 !! test
18701 Parser hook: basic arguments using terminated empty elements (T4374)
18702 !! options
18703 parsoid=wt2html
18704 !! wikitext
18705 <tag width=200 height = "100" depth = '50' square/>
18706 other stuff
18707 </tag>
18708 !! html/php
18709 <pre>
18710 NULL
18711 array (
18712 'width' => '200',
18713 'height' => '100',
18714 'depth' => '50',
18715 'square' => '',
18716 )
18717 </pre>
18718 <p>other stuff
18719 &lt;/tag&gt;
18720 </p>
18721 !! html/parsoid
18722 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
18723 &lt;/tag></p>
18724 !! end
18725
18726 ## Don't expect parsoid to rt this form.
18727 !! test
18728 Parser hook: Don't allow unclosed extension tags
18729 !! options
18730 parsoid=wt2html
18731 !! wikitext
18732 test <tag>123
18733
18734 this is a '''test'''
18735 !! html/php
18736 <p>test &lt;tag&gt;123
18737 </p><p>this is a <b>test</b>
18738 </p>
18739 !! html/parsoid
18740 <p>test &lt;tag>123</p>
18741
18742 <p>this is a <b>test</b></p>
18743 !! end
18744
18745 !! test
18746 Parser hook: horizontal rule inside extension tag that outputs <pre>
18747 !! wikitext
18748 <tag>
18749 Hello
18750 <hr/>
18751 Goodbye
18752 </tag>
18753 !! html/php
18754 <pre>
18755 '
18756 Hello
18757 <hr/>
18758 Goodbye
18759 '
18760 array (
18761 )
18762 </pre>
18763
18764 !! end
18765
18766 ###
18767 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18768 ###
18769
18770 !! test
18771 Parser hook: static parser hook not inside a comment
18772 !! wikitext
18773 <statictag>hello, world</statictag>
18774
18775 <statictag action="flush" />
18776 !! html/php
18777 <p><br />
18778 hello, world
18779 </p>
18780 !! html/parsoid
18781 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18782 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about="#mwt4">hello, world</p>
18783 !! end
18784
18785 !! test
18786 Parser hook: static parser hook inside a comment
18787 !! wikitext
18788 <!-- <statictag>hello, world</statictag> -->
18789 <statictag action="flush" />
18790 !! html/php
18791 <p><br />
18792 </p>
18793 !! html/parsoid
18794 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18795 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></p>
18796 !! end
18797
18798 # Nested template calls; this case was broken by Parser.php rev 1.506,
18799 # since reverted.
18800
18801 !! article
18802 Template:One-parameter
18803 !! text
18804 (My parameter is: {{{1}}})
18805 !! endarticle
18806
18807 !! article
18808 Template:Map-one-parameter
18809 !! text
18810 {{{{{1}}}|{{{2}}}}}
18811 !! endarticle
18812
18813 !! test
18814 Nested template calls
18815 !! wikitext
18816 {{Map-one-parameter|One-parameter|param}}
18817 !! html
18818 <p>(My parameter is: param)
18819 </p>
18820 !! end
18821
18822
18823 ###
18824 ### Sanitizer
18825 ###
18826
18827 !! test
18828 Sanitizer: Closing of open tags
18829 !! wikitext
18830 <s></s><table></table>
18831 !! html/php+tidy
18832 <p><s></s></p><table></table>
18833 !! html/parsoid
18834 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
18835 !! end
18836
18837 !! test
18838 Sanitizer: Closing of open but not closed tags
18839 !! wikitext
18840 <s>foo
18841 !! html
18842 <p><s>foo</s>
18843 </p>
18844 !! end
18845
18846 !! test
18847 Sanitizer: Closing of closed but not open tags
18848 !! options
18849 parsoid=wt2html
18850 !! wikitext
18851 </s>
18852 !! html+tidy
18853 <p class="mw-empty-elt">
18854 </p>
18855 !! end
18856
18857 !! test
18858 Sanitizer: Closing of closed but not open table tags
18859 !! options
18860 parsoid=wt2html
18861 !! wikitext
18862 Table not started</td></tr></table>
18863 !! html+tidy
18864 <p>Table not started
18865 </p>
18866 !! end
18867
18868 !! test
18869 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18870 !! config
18871 wgFragmentMode=[ 'html5', 'legacy' ]
18872 !! wikitext
18873 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18874 !! html/php
18875 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18876 </p>
18877 !! html/parsoid
18878 <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>
18879 !! end
18880
18881 !! test
18882 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18883 !! config
18884 wgFragmentMode=[ 'legacy' ]
18885 !! wikitext
18886 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18887 !! html/php
18888 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18889 </p>
18890 !! end
18891
18892 # In HTML5, the restrictions are that id must contain at least one character,
18893 # and must not contain any space characters.
18894 !! test
18895 Sanitizer: Validating the contents of the id attribute (T6515)
18896 !! options
18897 disabled
18898 !! wikitext
18899 <br id="" /><br id="a space" />
18900 !! html
18901 Something ...
18902 !! end
18903
18904 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18905 !! test
18906 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18907 !! options
18908 disabled
18909 !! wikitext
18910 <br id="foo" /><br id="foo" />
18911 !! html
18912 Something need to be done. foo-2 ?
18913 !! end
18914
18915 !! test
18916 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18917 !! wikitext
18918 <div itemscope>
18919 <meta itemprop="hello" content="world">
18920 <meta http-equiv="refresh" content="5">
18921 <meta itemprop="hello" http-equiv="refresh" content="5">
18922 <link itemprop="hello" href="{{SERVER}}">
18923 <link rel="stylesheet" href="{{SERVER}}">
18924 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18925 </div>
18926 !! html
18927 <div itemscope="">
18928 <p> <meta itemprop="hello" content="world" />
18929 &lt;meta http-equiv="refresh" content="5"&gt;
18930 <meta itemprop="hello" content="5" />
18931 <link itemprop="hello" href="http&#58;//example.org" />
18932 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18933 <link itemprop="hello" href="http&#58;//example.org" />
18934 </p>
18935 </div>
18936
18937 !! end
18938
18939 !! test
18940 Sanitizer: Strip comments from CSS attributes
18941 !! options
18942 parsoid=wt2html,wt2wt
18943 !! wikitext
18944 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18945 !! html/php
18946 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18947 </p>
18948 !! html/parsoid
18949 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18950 !! end
18951
18952 !! test
18953 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18954 !! wikitext
18955 [[meatball:Soft"Security]]
18956 !! html/php
18957 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18958 </p>
18959 !! html/parsoid
18960 <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>
18961 !! end
18962
18963 !! test
18964 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18965 !! wikitext
18966 [[meatball:Foo<Bar]]
18967 [[meatball:Foo>Bar]]
18968 [[meatball:Foo&lt;bar]]
18969 [[meatball:Foo&gt;bar]]
18970 !! html/php
18971 <p>[[meatball:Foo&lt;Bar]]
18972 [[meatball:Foo&gt;Bar]]
18973 [[meatball:Foo&lt;bar]]
18974 [[meatball:Foo&gt;bar]]
18975 </p>
18976 !! html/parsoid
18977 <p>[[meatball:Foo&lt;Bar]]
18978 [[meatball:Foo>Bar]]
18979 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18980 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18981 !! end
18982
18983 !! test
18984 Language converter: output gets cut off unexpectedly (T7757)
18985 !! options
18986 language=zh
18987 !! wikitext
18988 this bit is safe: }-
18989
18990 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18991
18992 then we get cut off here: }-
18993
18994 all additional text is vanished
18995 !! html/php
18996 <p>this bit is safe: }-
18997 </p><p>but if we add a conversion instance: xxx
18998 </p><p>then we get cut off here: }-
18999 </p><p>all additional text is vanished
19000 </p>
19001 !! html/parsoid
19002 <p>this bit is safe: }-</p>
19003 <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>
19004 <p>then we get cut off here: }-</p>
19005 <p>all additional text is vanished</p>
19006 !! end
19007
19008 !! test
19009 Language converter glossary rules inside attributes (T119158)
19010 !! options
19011 language=sr variant=sr-el
19012 !! wikitext
19013 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19014
19015 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19016 !! html/php
19017 <p>
19018 </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>
19019 </p>
19020 !! html/parsoid
19021 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19022
19023 <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>
19024 !! end
19025
19026 !! test
19027 Self closed html pairs (T7487)
19028 !! wikitext
19029 <center><font id="bug" />Centered text</center>
19030 <div><font id="bug2" />In div text</div>
19031 !! html+tidy
19032 <center><font id="bug"></font>Centered text</center>
19033 <div><font id="bug2"></font>In div text</div>
19034 !! end
19035
19036 !! test
19037 Punctuation: nbsp before exclamation
19038 !! wikitext
19039 C'est grave !
19040 !! html
19041 <p>C'est grave&#160;!
19042 </p>
19043 !! end
19044
19045 !! test
19046 Punctuation: CSS !important (T13874)
19047 !! wikitext
19048 <div style="width:50% !important">important</div>
19049 !! html
19050 <div style="width:50% !important">important</div>
19051
19052 !!end
19053
19054 !! test
19055 Punctuation: CSS ! important (T13874; with space after)
19056 !! wikitext
19057 <div style="width:50% ! important">important</div>
19058 !! html
19059 <div style="width:50%&#32;! important">important</div>
19060
19061 !!end
19062
19063 !! test
19064 HTML bullet list, closed tags (T7497)
19065 !! wikitext
19066 <ul>
19067 <li>One</li>
19068 <li>Two</li>
19069 </ul>
19070 !! html/php
19071 <ul>
19072 <li>One</li>
19073 <li>Two</li>
19074 </ul>
19075
19076 !! html/parsoid
19077 <ul data-parsoid='{"stx":"html"}'>
19078 <li data-parsoid='{"stx":"html"}'>One</li>
19079 <li data-parsoid='{"stx":"html"}'>Two</li>
19080 </ul>
19081
19082 !! end
19083
19084 !! test
19085 HTML bullet list, unclosed tags (T7497)
19086 !! wikitext
19087 <ul>
19088 <li>One
19089 <li>Two
19090 </ul>
19091 !! html/php+tidy
19092 <ul>
19093 <li>One
19094 </li><li>Two
19095 </li></ul>
19096 !! html/parsoid
19097 <ul data-parsoid='{"stx":"html"}'>
19098 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19099 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19100 </ul>
19101
19102 !! end
19103
19104 !! test
19105 HTML ordered list, closed tags (T7497)
19106 !! wikitext
19107 <ol>
19108 <li>One</li>
19109 <li>Two</li>
19110 </ol>
19111 !! html/php
19112 <ol>
19113 <li>One</li>
19114 <li>Two</li>
19115 </ol>
19116
19117 !! html/parsoid
19118 <ol data-parsoid='{"stx":"html"}'>
19119 <li data-parsoid='{"stx":"html"}'>One</li>
19120 <li data-parsoid='{"stx":"html"}'>Two</li>
19121 </ol>
19122
19123 !! end
19124
19125 !! test
19126 HTML ordered list, unclosed tags (T7497)
19127 !! options
19128 !! wikitext
19129 <ol>
19130 <li>One
19131 <li>Two
19132 </ol>
19133 !! html/php+tidy
19134 <ol>
19135 <li>One
19136 </li><li>Two
19137 </li></ol>
19138 !! html/parsoid
19139 <ol data-parsoid='{"stx":"html"}'>
19140 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19141 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19142 </ol>
19143
19144 !! end
19145
19146 !! test
19147 HTML nested bullet list, closed tags (T7497)
19148 !! wikitext
19149 <ul>
19150 <li>One</li>
19151 <li>Two:
19152 <ul>
19153 <li>Sub-one</li>
19154 <li>Sub-two</li>
19155 </ul>
19156 </li>
19157 </ul>
19158 !! html/php
19159 <ul>
19160 <li>One</li>
19161 <li>Two:
19162 <ul>
19163 <li>Sub-one</li>
19164 <li>Sub-two</li>
19165 </ul>
19166 </li>
19167 </ul>
19168
19169 !! html/parsoid
19170 <ul data-parsoid='{"stx":"html"}'>
19171 <li data-parsoid='{"stx":"html"}'>One</li>
19172 <li data-parsoid='{"stx":"html"}'>Two:
19173 <ul data-parsoid='{"stx":"html"}'>
19174 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19175 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19176 </ul>
19177 </li>
19178 </ul>
19179 !! end
19180
19181 !! test
19182 HTML nested bullet list, open tags (T7497)
19183 !! wikitext
19184 <ul>
19185 <li>One
19186 <li>Two:
19187 <ul>
19188 <li>Sub-one
19189 <li>Sub-two
19190 </ul>
19191 </ul>
19192 !! html+tidy
19193 <ul>
19194 <li>One
19195 </li><li>Two:
19196 <ul>
19197 <li>Sub-one
19198 </li><li>Sub-two
19199 </li></ul>
19200 </li></ul>
19201 !! end
19202
19203 !! test
19204 HTML nested ordered list, closed tags (T7497)
19205 !! wikitext
19206 <ol>
19207 <li>One</li>
19208 <li>Two:
19209 <ol>
19210 <li>Sub-one</li>
19211 <li>Sub-two</li>
19212 </ol>
19213 </li>
19214 </ol>
19215 !! html
19216 <ol>
19217 <li>One</li>
19218 <li>Two:
19219 <ol>
19220 <li>Sub-one</li>
19221 <li>Sub-two</li>
19222 </ol>
19223 </li>
19224 </ol>
19225
19226 !! end
19227
19228 !! test
19229 HTML nested ordered list, open tags (T7497)
19230 !! wikitext
19231 <ol>
19232 <li>One
19233 <li>Two:
19234 <ol>
19235 <li>Sub-one
19236 <li>Sub-two
19237 </ol>
19238 </ol>
19239 !! html/php
19240 <ol>
19241 <li>One
19242 <li>Two:
19243 <ol>
19244 <li>Sub-one
19245 <li>Sub-two
19246 </ol>
19247 </ol>
19248
19249 !! html/parsoid
19250 <ol>
19251 <li>One
19252 </li>
19253 <li>Two:
19254 <ol>
19255 <li>Sub-one
19256 </li>
19257 <li>Sub-two
19258 </li>
19259 </ol>
19260 </li>
19261 </ol>
19262
19263 !! end
19264
19265 !! test
19266 HTML ordered list item with parameters oddity
19267 !! wikitext
19268 <ol><li id="fragment">One</li>
19269 </ol>
19270 !! html
19271 <ol><li id="fragment">One</li>
19272 </ol>
19273
19274 !! end
19275
19276 # parsoid doesn't explicitly mark autonumbered links, see T55505
19277 !!test
19278 T7918: autonumbering
19279 !! wikitext
19280 [http://first/] [http://second] [ftp://ftp]
19281
19282 ftp://inlineftp
19283
19284 [mailto:enclosed@mail.tld With target]
19285
19286 [mailto:enclosed@mail.tld]
19287
19288 mailto:inline@mail.tld
19289 !! html/php
19290 <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>
19291 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19292 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19293 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19294 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19295 </p>
19296 !! html/parsoid
19297 <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>
19298 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19299 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19300 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19301 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19302 !! end
19303
19304
19305 #
19306 # Security and HTML correctness
19307 # From Nick Jenkins' fuzz testing
19308 #
19309
19310 !! test
19311 Fuzz testing: Parser13
19312 !! wikitext
19313 {|
19314 | http://a|
19315 !! html
19316 <table>
19317 <tr>
19318 <td>
19319 </td>
19320 </tr>
19321 </table>
19322
19323 !! end
19324
19325 # Note that Parsoid output differs from the PHP parser here: the PHP
19326 # parser breaks the URL for the magic word, while in Parsoid the URL
19327 # production takes precedence.
19328 !! test
19329 Fuzz testing: Parser14
19330 !! wikitext
19331 ==onmouseover===
19332 http://__TOC__
19333 !! html/php
19334 <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>
19335 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>
19336 <ul>
19337 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19338 </ul>
19339 </div>
19340
19341
19342 !! html/php+tidy
19343 <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>
19344 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>
19345 <ul>
19346 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19347 </ul>
19348 </div>
19349 !! html/parsoid
19350 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19351 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19352 !! end
19353
19354 !! test
19355 Fuzz testing: Parser14-table
19356 !! options
19357 parsoid=wt2html,html2html
19358 !! wikitext
19359 ==a==
19360 {| STYLE=__TOC__
19361 !! html
19362 <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>
19363 <table style="&#95;_TOC&#95;_">
19364 <tr><td></td></tr>
19365 </table>
19366
19367 !! html+tidy
19368 <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>
19369 <table style="__TOC__">
19370 <tr>
19371 <td></td>
19372 </tr>
19373 </table>
19374 !! html/parsoid
19375 <h2 id="a">a</h2>
19376 <table style="__TOC__"></table>
19377 !! end
19378
19379 # Known to produce bogus xml (extra </td>)
19380 # Don't add the html/php section since it generates broken HTML
19381 !! test
19382 Fuzz testing: Parser16
19383 !! wikitext
19384 {|
19385 !https://||||||
19386 !! html+tidy
19387 <table>
19388 <tbody><tr>
19389 <th>https://</th>
19390 <th></th>
19391 <th></th>
19392 <th>
19393
19394 </th></tr>
19395 </tbody></table>
19396 !! end
19397
19398 !! test
19399 Fuzz testing: Parser21
19400 !! wikitext
19401 {|
19402 !irc://{{ftp://a" onmouseover="alert('hello world');"
19403 |
19404 !! html
19405 <table>
19406 <tr>
19407 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19408 </th>
19409 <td>
19410 </td>
19411 </tr>
19412 </table>
19413
19414 !! end
19415
19416 !! test
19417 Fuzz testing: Parser22
19418 !! wikitext
19419 http://===r:::https://b
19420
19421 {|
19422 !! html
19423 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19424 </p>
19425 <table>
19426 <tr><td></td></tr>
19427 </table>
19428
19429 !! end
19430
19431 ## Remex doesn't account for fostered content.
19432 ## Known to produce bad XML for now
19433 !! test
19434 Fuzz testing: Parser24
19435 !! options
19436 parsoid=wt2html
19437 !! wikitext
19438 {|
19439 {{{|
19440 <u CLASS=
19441 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19442 <br style="onmouseover='alert(document.cookie);' " />
19443
19444 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19445 |
19446 !! html/php
19447 <table>
19448 {{{|
19449 <u class="&#124;">}}}} &gt;
19450 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19451
19452 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19453 <tr>
19454 <td></u>
19455 </td>
19456 </tr>
19457 </table>
19458
19459 !! html/php+tidy
19460
19461 {{{|
19462 <u class="&#124;">}}}} &gt;
19463 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19464
19465 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19466 </u><table><tbody><tr>
19467 <td>
19468 </td>
19469 </tr>
19470 </tbody></table><p><u class="&#124;">
19471 </u></p>
19472 !! html/parsoid
19473 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19474 {{{|
19475 <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>"}'/>}}}} >
19476 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19477
19478 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19479 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19480 !! end
19481
19482 # Note: the current result listed for this is not what the original one was,
19483 # but the original bug was JavaScript injection, which is fixed in any case.
19484 # It's not clear that the original result listed was any more correct than the
19485 # current one. Original result:
19486 # <p>{{{|
19487 # </p>
19488 # <li class="&#124;&#124;">
19489 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19490 !!test
19491 Fuzz testing: Parser25 (T8055)
19492 !! wikitext
19493 {{{
19494 |
19495 <LI CLASS=||
19496 >
19497 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19498 !! html/php
19499 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19500 </p>
19501 !! html/parsoid
19502 <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"]}'>
19503 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19504 !! end
19505
19506 !!test
19507 Fuzz testing: URL adjacent extension (with space, clean)
19508 !! wikitext
19509 http://example.com <nowiki>junk</nowiki>
19510 !! html/php
19511 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19512 </p>
19513 !! html/parsoid
19514 <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>
19515 !! end
19516
19517 !!test
19518 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19519 !! wikitext
19520 http://example.com<nowiki>junk</nowiki>
19521 !! html/php
19522 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19523 </p>
19524 !! html/parsoid
19525 <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>
19526 !! end
19527
19528 !! test
19529 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19530 !! wikitext
19531 http://example.com<pre>junk</pre>
19532 !! html/php
19533 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19534
19535 !! html/php+tidy
19536 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19537 !! html/parsoid
19538 <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>
19539 !! end
19540
19541 !! test
19542 Fuzz testing: image with bogus manual thumbnail
19543 !! wikitext
19544 [[Image:foobar.jpg|thumbnail= ]]
19545 !! html/php
19546 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19547
19548 !! html/parsoid
19549 <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>
19550 !! end
19551
19552 # Parsoid will emit the newline literally in wt2wt; see next test case.
19553 !! test
19554 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19555 !! options
19556 parsoid=wt2html
19557 !! wikitext
19558 <pre dir="&#10;"></pre>
19559 !! html/php
19560 <pre dir="&#10;"></pre>
19561
19562 !! html/parsoid
19563 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19564 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19565 !! end
19566
19567 !! test
19568 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19569 !! options
19570 parsoid=html2wt
19571 !! html/parsoid
19572 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19573 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19574 !! wikitext
19575 <pre dir="
19576 "></pre>
19577 !! html/php
19578 <pre dir=""></pre>
19579
19580 !! end
19581
19582 !! test
19583 Templates in extension attributes are not expanded
19584 !! wikitext
19585 <pre dir="{{echo|ltr}}"></pre>
19586 !! html/php
19587 <pre dir="{{echo|ltr}}"></pre>
19588
19589 !! html/parsoid
19590 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19591 !! end
19592
19593 !! test
19594 Parsing optional HTML elements (T8171)
19595 !! options
19596 !! wikitext
19597 <table>
19598 <tr>
19599 <td> Some tabular data</td>
19600 <td> More tabular data ...
19601 <td> And yet som tabular data</td>
19602 </tr>
19603 </table>
19604 !! html
19605 <table>
19606 <tr>
19607 <td> Some tabular data</td>
19608 <td> More tabular data ...
19609 </td><td> And yet som tabular data</td>
19610 </tr>
19611 </table>
19612
19613 !! end
19614
19615 !! test
19616 Correct handling of <td>, <tr> (T8171)
19617 !! options
19618 !! wikitext
19619 <table>
19620 <tr>
19621 <td> Some tabular data</td>
19622 <td> More tabular data ...</td>
19623 <td> And yet som tabular data</td>
19624 </tr>
19625 </table>
19626 !! html
19627 <table>
19628 <tr>
19629 <td> Some tabular data</td>
19630 <td> More tabular data ...</td>
19631 <td> And yet som tabular data</td>
19632 </tr>
19633 </table>
19634
19635 !! end
19636
19637
19638 !! test
19639 Parsing crashing regression (fr:JavaScript)
19640 !! wikitext
19641 </body></x>
19642 !! html
19643 <p>&lt;/body&gt;&lt;/x&gt;
19644 </p>
19645 !! end
19646
19647 !! test
19648 Inline wiki vs wiki block nesting
19649 !! wikitext
19650 '''Bold paragraph
19651
19652 New wiki paragraph
19653 !! html
19654 <p><b>Bold paragraph</b>
19655 </p><p>New wiki paragraph
19656 </p>
19657 !! end
19658
19659 # FIXME: The current php output is documented
19660 # and desired output is the parsoid target.
19661 !! test
19662 Inline HTML vs wiki block nesting
19663 !! wikitext
19664 <b>Bold paragraph
19665
19666 New wiki paragraph
19667 !! html/php
19668 <p><b>Bold paragraph
19669 </p><p>New wiki paragraph</b>
19670 </p>
19671 !! html/php+tidy
19672 <p><b>Bold paragraph
19673 </b></p><p><b>New wiki paragraph
19674 </b></p>
19675 !! html/parsoid
19676 <p><b>Bold paragraph</b>
19677 </p><p>New wiki paragraph
19678 </p>
19679 !! end
19680
19681 # Original result was this:
19682 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19683 # </p>
19684 # While that might be marginally more intuitive, maybe, the six-apostrophe
19685 # construct is clearly pathological and the result stated here (which is what
19686 # the parser actually does) is about as reasonable as anything.
19687 !!test
19688 Mixing markup for italics and bold
19689 !! options
19690 !! wikitext
19691 '''bold''''''bold''bolditalics'''''
19692 !! html
19693 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19694 </p>
19695 !! end
19696
19697
19698 !! article
19699 Xyzzyx
19700 !! text
19701 Article for special page transclusion test
19702 !! endarticle
19703
19704 !! test
19705 Special page transclusion
19706 !! options
19707 !! wikitext
19708 {{Special:Prefixindex/Xyzzyx}}
19709 !! html
19710 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19711 </ul>
19712
19713 !! end
19714
19715 !! test
19716 Special page transclusion twice (T7021)
19717 !! options
19718 !! wikitext
19719 {{Special:Prefixindex/Xyzzyx}}
19720 {{Special:Prefixindex/Xyzzyx}}
19721 !! html
19722 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19723 </ul>
19724 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19725 </ul>
19726
19727 !! end
19728
19729 !! test
19730 Transclusion of default MediaWiki message
19731 !! wikitext
19732 {{MediaWiki:Mainpage}}
19733 !! html
19734 <p>Main Page
19735 </p>
19736 !! end
19737
19738 !! test
19739 Transclusion of nonexistent MediaWiki message
19740 !! wikitext
19741 {{MediaWiki:Mainpagexxx}}
19742 !! html
19743 <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>
19744 </p>
19745 !! end
19746
19747 !! test
19748 Transclusion of MediaWiki message with underscore
19749 !! wikitext
19750 {{MediaWiki:history_short}}
19751 !! html
19752 <p>History
19753 </p>
19754 !! end
19755
19756 !! test
19757 Transclusion of MediaWiki message with space
19758 !! wikitext
19759 {{MediaWiki:history short}}
19760 !! html
19761 <p>History
19762 </p>
19763 !! end
19764
19765 !! test
19766 Invalid header with following text
19767 !! wikitext
19768 = x = y
19769 !! html
19770 <p>= x = y
19771 </p>
19772 !! end
19773
19774
19775 !! test
19776 Section extraction test (section 0)
19777 !! options
19778 section=0
19779 !! wikitext
19780 start
19781 ==a==
19782 ===aa===
19783 ====aaa====
19784 ==b==
19785 ===ba===
19786 ===bb===
19787 ====bba====
19788 ===bc===
19789 ==c==
19790 ===ca===
19791 !! html/php
19792 start
19793 !! end
19794
19795 !! test
19796 Section extraction test (section 1)
19797 !! options
19798 section=1
19799 !! wikitext
19800 start
19801 ==a==
19802 ===aa===
19803 ====aaa====
19804 ==b==
19805 ===ba===
19806 ===bb===
19807 ====bba====
19808 ===bc===
19809 ==c==
19810 ===ca===
19811 !! html/php
19812 ==a==
19813 ===aa===
19814 ====aaa====
19815 !! end
19816
19817 !! test
19818 Section extraction test (section 2)
19819 !! options
19820 section=2
19821 !! wikitext
19822 start
19823 ==a==
19824 ===aa===
19825 ====aaa====
19826 ==b==
19827 ===ba===
19828 ===bb===
19829 ====bba====
19830 ===bc===
19831 ==c==
19832 ===ca===
19833 !! html/php
19834 ===aa===
19835 ====aaa====
19836 !! end
19837
19838 !! test
19839 Section extraction test (section 3)
19840 !! options
19841 section=3
19842 !! wikitext
19843 start
19844 ==a==
19845 ===aa===
19846 ====aaa====
19847 ==b==
19848 ===ba===
19849 ===bb===
19850 ====bba====
19851 ===bc===
19852 ==c==
19853 ===ca===
19854 !! html/php
19855 ====aaa====
19856 !! end
19857
19858 !! test
19859 Section extraction test (section 4)
19860 !! options
19861 section=4
19862 !! wikitext
19863 start
19864 ==a==
19865 ===aa===
19866 ====aaa====
19867 ==b==
19868 ===ba===
19869 ===bb===
19870 ====bba====
19871 ===bc===
19872 ==c==
19873 ===ca===
19874 !! html/php
19875 ==b==
19876 ===ba===
19877 ===bb===
19878 ====bba====
19879 ===bc===
19880 !! end
19881
19882 !! test
19883 Section extraction test (section 5)
19884 !! options
19885 section=5
19886 !! wikitext
19887 start
19888 ==a==
19889 ===aa===
19890 ====aaa====
19891 ==b==
19892 ===ba===
19893 ===bb===
19894 ====bba====
19895 ===bc===
19896 ==c==
19897 ===ca===
19898 !! html/php
19899 ===ba===
19900 !! end
19901
19902 !! test
19903 Section extraction test (section 6)
19904 !! options
19905 section=6
19906 !! wikitext
19907 start
19908 ==a==
19909 ===aa===
19910 ====aaa====
19911 ==b==
19912 ===ba===
19913 ===bb===
19914 ====bba====
19915 ===bc===
19916 ==c==
19917 ===ca===
19918 !! html/php
19919 ===bb===
19920 ====bba====
19921 !! end
19922
19923 !! test
19924 Section extraction test (section 7)
19925 !! options
19926 section=7
19927 !! wikitext
19928 start
19929 ==a==
19930 ===aa===
19931 ====aaa====
19932 ==b==
19933 ===ba===
19934 ===bb===
19935 ====bba====
19936 ===bc===
19937 ==c==
19938 ===ca===
19939 !! html/php
19940 ====bba====
19941 !! end
19942
19943 !! test
19944 Section extraction test (section 8)
19945 !! options
19946 section=8
19947 !! wikitext
19948 start
19949 ==a==
19950 ===aa===
19951 ====aaa====
19952 ==b==
19953 ===ba===
19954 ===bb===
19955 ====bba====
19956 ===bc===
19957 ==c==
19958 ===ca===
19959 !! html/php
19960 ===bc===
19961 !! end
19962
19963 !! test
19964 Section extraction test (section 9)
19965 !! options
19966 section=9
19967 !! wikitext
19968 start
19969 ==a==
19970 ===aa===
19971 ====aaa====
19972 ==b==
19973 ===ba===
19974 ===bb===
19975 ====bba====
19976 ===bc===
19977 ==c==
19978 ===ca===
19979 !! html/php
19980 ==c==
19981 ===ca===
19982 !! end
19983
19984 !! test
19985 Section extraction test (section 10)
19986 !! options
19987 section=10
19988 !! wikitext
19989 start
19990 ==a==
19991 ===aa===
19992 ====aaa====
19993 ==b==
19994 ===ba===
19995 ===bb===
19996 ====bba====
19997 ===bc===
19998 ==c==
19999 ===ca===
20000 !! html/php
20001 ===ca===
20002 !! end
20003
20004 !! test
20005 Section extraction test (nonexistent section 11)
20006 !! options
20007 section=11
20008 !! wikitext
20009 start
20010 ==a==
20011 ===aa===
20012 ====aaa====
20013 ==b==
20014 ===ba===
20015 ===bb===
20016 ====bba====
20017 ===bc===
20018 ==c==
20019 ===ca===
20020 !! html/php
20021 !! end
20022
20023 !! test
20024 Section extraction test with bogus heading (section 1)
20025 !! options
20026 section=1
20027 !! wikitext
20028 ==a==
20029 ==bogus== not a legal section
20030 ==b==
20031 !! html/php
20032 ==a==
20033 ==bogus== not a legal section
20034 !! end
20035
20036 !! test
20037 Section extraction test with bogus heading (section 2)
20038 !! options
20039 section=2
20040 !! wikitext
20041 ==a==
20042 ==bogus== not a legal section
20043 ==b==
20044 !! html/php
20045 ==b==
20046 !! end
20047
20048 !! test
20049 Section extraction test with comment after heading (section 1)
20050 !! options
20051 section=1
20052 !! wikitext
20053 ==a==
20054 ==b== <!-- -->
20055 ==c==
20056 !! html/php
20057 ==a==
20058 !! end
20059
20060 !! test
20061 Section extraction test with comment after heading (section 2)
20062 !! options
20063 section=2
20064 !! wikitext
20065 ==a==
20066 ==b== <!-- -->
20067 ==c==
20068 !! html/php
20069 ==b== <!-- -->
20070 !! end
20071
20072 !! test
20073 Section extraction test with bogus <nowiki> heading (section 1)
20074 !! options
20075 section=1
20076 !! wikitext
20077 ==a==
20078 ==bogus== <nowiki>not a legal section</nowiki>
20079 ==b==
20080 !! html/php
20081 ==a==
20082 ==bogus== <nowiki>not a legal section</nowiki>
20083 !! end
20084
20085 !! test
20086 Section extraction test with bogus <nowiki> heading (section 2)
20087 !! options
20088 section=2
20089 !! wikitext
20090 ==a==
20091 ==bogus== <nowiki>not a legal section</nowiki>
20092 ==b==
20093 !! html/php
20094 ==b==
20095 !! end
20096
20097 # Formerly testing for T4587, now resolved by the use of unmarked sections
20098 # instead of respecting commented sections
20099 !! test
20100 Section extraction prefixed by comment (section 1)
20101 !! options
20102 section=1
20103 !! wikitext
20104 <!-- -->==sec1==
20105 ==sec2==
20106 !! html/php
20107 ==sec2==
20108 !!end
20109
20110 !! test
20111 Section extraction prefixed by comment (section 2)
20112 !! options
20113 section=2
20114 !! wikitext
20115 <!-- -->==sec1==
20116 ==sec2==
20117 !! html/php
20118
20119 !!end
20120
20121 # Formerly testing for T4607, now resolved by the use of unmarked sections
20122 # instead of respecting HTML-style headings
20123 !! test
20124 Section extraction, mixed wiki and html (section 1)
20125 !! options
20126 section=1
20127 !! wikitext
20128 <h2>unmarked</h2>
20129 unmarked
20130 ==1==
20131 one
20132 ==2==
20133 two
20134 !! html/php
20135 ==1==
20136 one
20137 !! end
20138
20139 !! test
20140 Section extraction, mixed wiki and html (section 2)
20141 !! options
20142 section=2
20143 !! wikitext
20144 <h2>unmarked</h2>
20145 unmarked
20146 ==1==
20147 one
20148 ==2==
20149 two
20150 !! html/php
20151 ==2==
20152 two
20153 !! end
20154
20155
20156 # Formerly testing for T5342
20157 !! test
20158 Section extraction, heading surrounded by <noinclude>
20159 !! options
20160 section=1
20161 !! wikitext
20162 <noinclude>==unmarked==</noinclude>
20163 ==marked==
20164 !! html/php
20165 ==marked==
20166 !!end
20167
20168 # Test behavior of T21910
20169 !! test
20170 Sectiion with all-equals
20171 !! options
20172 section=2
20173 !! wikitext
20174 ===
20175 The line above must have a trailing space
20176 === <!--
20177 --> <!-- -->
20178 But just in case it doesn't...
20179 !! html/php
20180 === <!--
20181 --> <!-- -->
20182 But just in case it doesn't...
20183 !! end
20184
20185 !! test
20186 Section replacement test (section 0)
20187 !! options
20188 replace=0,"xxx"
20189 !! wikitext
20190 start
20191 ==a==
20192 ===aa===
20193 ====aaa====
20194 ==b==
20195 ===ba===
20196 ===bb===
20197 ====bba====
20198 ===bc===
20199 ==c==
20200 ===ca===
20201 !! html/php
20202 xxx
20203
20204 ==a==
20205 ===aa===
20206 ====aaa====
20207 ==b==
20208 ===ba===
20209 ===bb===
20210 ====bba====
20211 ===bc===
20212 ==c==
20213 ===ca===
20214 !! end
20215
20216 !! test
20217 Section replacement test (section 1)
20218 !! options
20219 replace=1,"xxx"
20220 !! wikitext
20221 start
20222 ==a==
20223 ===aa===
20224 ====aaa====
20225 ==b==
20226 ===ba===
20227 ===bb===
20228 ====bba====
20229 ===bc===
20230 ==c==
20231 ===ca===
20232 !! html/php
20233 start
20234 xxx
20235
20236 ==b==
20237 ===ba===
20238 ===bb===
20239 ====bba====
20240 ===bc===
20241 ==c==
20242 ===ca===
20243 !! end
20244
20245 !! test
20246 Section replacement test (section 2)
20247 !! options
20248 replace=2,"xxx"
20249 !! wikitext
20250 start
20251 ==a==
20252 ===aa===
20253 ====aaa====
20254 ==b==
20255 ===ba===
20256 ===bb===
20257 ====bba====
20258 ===bc===
20259 ==c==
20260 ===ca===
20261 !! html/php
20262 start
20263 ==a==
20264 xxx
20265
20266 ==b==
20267 ===ba===
20268 ===bb===
20269 ====bba====
20270 ===bc===
20271 ==c==
20272 ===ca===
20273 !! end
20274
20275 !! test
20276 Section replacement test (section 3)
20277 !! options
20278 replace=3,"xxx"
20279 !! wikitext
20280 start
20281 ==a==
20282 ===aa===
20283 ====aaa====
20284 ==b==
20285 ===ba===
20286 ===bb===
20287 ====bba====
20288 ===bc===
20289 ==c==
20290 ===ca===
20291 !! html/php
20292 start
20293 ==a==
20294 ===aa===
20295 xxx
20296
20297 ==b==
20298 ===ba===
20299 ===bb===
20300 ====bba====
20301 ===bc===
20302 ==c==
20303 ===ca===
20304 !! end
20305
20306 !! test
20307 Section replacement test (section 4)
20308 !! options
20309 replace=4,"xxx"
20310 !! wikitext
20311 start
20312 ==a==
20313 ===aa===
20314 ====aaa====
20315 ==b==
20316 ===ba===
20317 ===bb===
20318 ====bba====
20319 ===bc===
20320 ==c==
20321 ===ca===
20322 !! html/php
20323 start
20324 ==a==
20325 ===aa===
20326 ====aaa====
20327 xxx
20328
20329 ==c==
20330 ===ca===
20331 !! end
20332
20333 !! test
20334 Section replacement test (section 5)
20335 !! options
20336 replace=5,"xxx"
20337 !! wikitext
20338 start
20339 ==a==
20340 ===aa===
20341 ====aaa====
20342 ==b==
20343 ===ba===
20344 ===bb===
20345 ====bba====
20346 ===bc===
20347 ==c==
20348 ===ca===
20349 !! html/php
20350 start
20351 ==a==
20352 ===aa===
20353 ====aaa====
20354 ==b==
20355 xxx
20356
20357 ===bb===
20358 ====bba====
20359 ===bc===
20360 ==c==
20361 ===ca===
20362 !! end
20363
20364 !! test
20365 Section replacement test (section 6)
20366 !! options
20367 replace=6,"xxx"
20368 !! wikitext
20369 start
20370 ==a==
20371 ===aa===
20372 ====aaa====
20373 ==b==
20374 ===ba===
20375 ===bb===
20376 ====bba====
20377 ===bc===
20378 ==c==
20379 ===ca===
20380 !! html/php
20381 start
20382 ==a==
20383 ===aa===
20384 ====aaa====
20385 ==b==
20386 ===ba===
20387 xxx
20388
20389 ===bc===
20390 ==c==
20391 ===ca===
20392 !! end
20393
20394 !! test
20395 Section replacement test (section 7)
20396 !! options
20397 replace=7,"xxx"
20398 !! wikitext
20399 start
20400 ==a==
20401 ===aa===
20402 ====aaa====
20403 ==b==
20404 ===ba===
20405 ===bb===
20406 ====bba====
20407 ===bc===
20408 ==c==
20409 ===ca===
20410 !! html/php
20411 start
20412 ==a==
20413 ===aa===
20414 ====aaa====
20415 ==b==
20416 ===ba===
20417 ===bb===
20418 xxx
20419
20420 ===bc===
20421 ==c==
20422 ===ca===
20423 !! end
20424
20425 !! test
20426 Section replacement test (section 8)
20427 !! options
20428 replace=8,"xxx"
20429 !! wikitext
20430 start
20431 ==a==
20432 ===aa===
20433 ====aaa====
20434 ==b==
20435 ===ba===
20436 ===bb===
20437 ====bba====
20438 ===bc===
20439 ==c==
20440 ===ca===
20441 !! html/php
20442 start
20443 ==a==
20444 ===aa===
20445 ====aaa====
20446 ==b==
20447 ===ba===
20448 ===bb===
20449 ====bba====
20450 xxx
20451
20452 ==c==
20453 ===ca===
20454 !!end
20455
20456 !! test
20457 Section replacement test (section 9)
20458 !! options
20459 replace=9,"xxx"
20460 !! wikitext
20461 start
20462 ==a==
20463 ===aa===
20464 ====aaa====
20465 ==b==
20466 ===ba===
20467 ===bb===
20468 ====bba====
20469 ===bc===
20470 ==c==
20471 ===ca===
20472 !! html/php
20473 start
20474 ==a==
20475 ===aa===
20476 ====aaa====
20477 ==b==
20478 ===ba===
20479 ===bb===
20480 ====bba====
20481 ===bc===
20482 xxx
20483 !! end
20484
20485 !! test
20486 Section replacement test (section 10)
20487 !! options
20488 replace=10,"xxx"
20489 !! wikitext
20490 start
20491 ==a==
20492 ===aa===
20493 ====aaa====
20494 ==b==
20495 ===ba===
20496 ===bb===
20497 ====bba====
20498 ===bc===
20499 ==c==
20500 ===ca===
20501 !! html/php
20502 start
20503 ==a==
20504 ===aa===
20505 ====aaa====
20506 ==b==
20507 ===ba===
20508 ===bb===
20509 ====bba====
20510 ===bc===
20511 ==c==
20512 xxx
20513 !! end
20514
20515 !! test
20516 Section replacement test with initial whitespace (T15728)
20517 !! options
20518 replace=2,"xxx"
20519 !! wikitext
20520 Preformatted initial line
20521 ==a==
20522 ===a===
20523 !! html/php
20524 Preformatted initial line
20525 ==a==
20526 xxx
20527 !! end
20528
20529
20530 !! test
20531 Section extraction, heading followed by pre with 20 spaces (T8398)
20532 !! options
20533 section=1
20534 !! wikitext
20535 ==a==
20536 a
20537 !! html/php
20538 ==a==
20539 a
20540 !! end
20541
20542 !! test
20543 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20544 !! options
20545 section=1
20546 !! wikitext
20547 ==a==
20548 a
20549 !! html/php
20550 ==a==
20551 a
20552 !! end
20553
20554
20555 !! test
20556 Section extraction, <pre> around bogus header (T12309)
20557 !! options
20558 section=2
20559 !! wikitext
20560 == Section One ==
20561 <pre>
20562 =======
20563 </pre>
20564
20565 == Section Two ==
20566 stuff
20567 !! html/php
20568 == Section Two ==
20569 stuff
20570 !! end
20571
20572 !! test
20573 Section replacement, <pre> around bogus header (T12309)
20574 !! options
20575 replace=2,"xxx"
20576 !! wikitext
20577 == Section One ==
20578 <pre>
20579 =======
20580 </pre>
20581
20582 == Section Two ==
20583 stuff
20584 !! html/php
20585 == Section One ==
20586 <pre>
20587 =======
20588 </pre>
20589
20590 xxx
20591 !! end
20592
20593 !! test
20594 Handling of &#x0A; in URLs
20595 !! wikitext
20596 *irc://&#x0A;a
20597 !! html/php
20598 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20599
20600 !! html/parsoid
20601 <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>
20602 !! end
20603
20604 !! test
20605 Handling of %0A in URLs
20606 !! wikitext
20607 *irc://%0Aa
20608 !! html/php
20609 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20610
20611 !! html/parsoid
20612 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20613 !! end
20614
20615 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20616 !! test
20617 5 quotes, code coverage +1 line
20618 !! options
20619 parsoid=wt2html
20620 !! wikitext
20621 '''''
20622 !! html/php
20623 !! html/parsoid
20624 <p><b><i></i></b></p>
20625 !! end
20626
20627 # same html as previous, but wikitext adjusted to match parsoid html2wt
20628 # note that wt2html and html2html will put the <i> before the <b>
20629 !! test
20630 5 quotes, code coverage +1 line w/ nowiki (1)
20631 !! options
20632 parsoid=wt2wt,html2wt
20633 !! wikitext
20634 '''''<nowiki/>'''''
20635 !! html/php
20636 <p><i></i>
20637 </p>
20638 !! html/parsoid
20639 <p><b><i></i></b></p>
20640 !! end
20641
20642 # same as previous, just swapping the <i> and <b>
20643 !! test
20644 5 quotes, code coverage +1 line w/ nowiki (2)
20645 !! wikitext
20646 '''''<nowiki/>'''''
20647 !! html/php
20648 <p><i></i>
20649 </p>
20650 !! html/parsoid
20651 <p><i><b></b></i></p>
20652 !! end
20653
20654 !! test
20655 Special:Search page linking.
20656 !! wikitext
20657 {{Special:search}}
20658 !! html
20659 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20660 </p>
20661 !! end
20662
20663 !! test
20664 {{!}} is a magic word
20665 !! wikitext
20666 {{!}} is a magic word there and {{!}} is still a magic word here
20667 | is not a magic word here but {{!}} is still a magic word here
20668 !! html/php
20669 <p>| is a magic word there and | is still a magic word here
20670 | is not a magic word here but | is still a magic word here
20671 </p>
20672 !! html/parsoid
20673 <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
20674 | 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>
20675 !! end
20676
20677 !! test
20678 Say the magic word
20679 !! options
20680 title=[[Parser test]]
20681 !! wikitext
20682 *{{PAGENAME}}
20683 *{{PAGENAMEE}}
20684 *{{FULLPAGENAME}}
20685 *{{FULLPAGENAMEE}}
20686 *{{BASEPAGENAME}}
20687 *{{BASEPAGENAMEE}}
20688 *{{SUBPAGENAME}}
20689 *{{SUBPAGENAMEE}}
20690 *{{ROOTPAGENAME}}
20691 *{{ROOTPAGENAMEE}}
20692 *{{TALKPAGENAME}}
20693 *{{TALKPAGENAMEE}}
20694 *{{SUBJECTPAGENAME}}
20695 *{{SUBJECTPAGENAMEE}}
20696 *{{NAMESPACEE}}
20697 *{{NAMESPACE}}
20698 *{{NAMESPACENUMBER}}
20699 *{{TALKSPACE}}
20700 *{{TALKSPACEE}}
20701 *{{SUBJECTSPACE}}
20702 *{{SUBJECTSPACEE}}
20703 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20704 !! html
20705 <ul><li>Parser test</li>
20706 <li>Parser_test</li>
20707 <li>Parser test</li>
20708 <li>Parser_test</li>
20709 <li>Parser test</li>
20710 <li>Parser_test</li>
20711 <li>Parser test</li>
20712 <li>Parser_test</li>
20713 <li>Parser test</li>
20714 <li>Parser_test</li>
20715 <li>Talk:Parser test</li>
20716 <li>Talk:Parser_test</li>
20717 <li>Parser test</li>
20718 <li>Parser_test</li>
20719 <li></li>
20720 <li></li>
20721 <li>0</li>
20722 <li>Talk</li>
20723 <li>Talk</li>
20724 <li></li>
20725 <li></li>
20726 <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>
20727
20728 !! end
20729 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20730
20731 !! test
20732 Gallery with valid attributes
20733 !! wikitext
20734 <gallery type="123" summary="345">
20735 File:File:Foobar.jpg
20736 </gallery>
20737 !! html/php
20738 <ul class="gallery mw-gallery-traditional" type="123">
20739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20740 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20741 <div class="gallerytext">
20742 </div>
20743 </div></li>
20744 </ul>
20745
20746 !! html/parsoid
20747 <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"}}'>
20748 <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>
20749 </ul>
20750 !! end
20751
20752 ## Parsoid thinks the "centre" here is a property, not a caption.
20753 !! test
20754 Gallery
20755 !! options
20756 parsoid={
20757 "modes": ["wt2html"],
20758 "nativeGallery": true
20759 }
20760 !! wikitext
20761 <gallery>
20762 image1.png |
20763 image2.gif|||||
20764
20765 image3|
20766 image4 |300px| centre
20767 image5.svg| http://///////
20768 [[x|xx]]]]
20769 * image6
20770 </gallery>
20771 !! html/php
20772 <ul class="gallery mw-gallery-traditional">
20773 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20774 <div class="thumb" style="height: 150px;">Image1.png</div>
20775 <div class="gallerytext">
20776 </div>
20777 </div></li>
20778 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20779 <div class="thumb" style="height: 150px;">Image2.gif</div>
20780 <div class="gallerytext">
20781 </div>
20782 </div></li>
20783 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20784 <div class="thumb" style="height: 150px;">Image3</div>
20785 <div class="gallerytext">
20786 </div>
20787 </div></li>
20788 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20789 <div class="thumb" style="height: 150px;">Image4</div>
20790 <div class="gallerytext">
20791 <pre>centre
20792 </pre>
20793 </div>
20794 </div></li>
20795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20796 <div class="thumb" style="height: 150px;">Image5.svg</div>
20797 <div class="gallerytext">
20798 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20799 </p>
20800 </div>
20801 </div></li>
20802 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20803 <div class="thumb" style="height: 150px;">* image6</div>
20804 <div class="gallerytext">
20805 </div>
20806 </div></li>
20807 </ul>
20808
20809 !! html/parsoid
20810 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20811 <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>
20812 <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>
20813 <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>
20814 <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>
20815 <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>
20816 <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>
20817 </ul>
20818 !! end
20819
20820 !! test
20821 Gallery (with options, html)
20822 !! options
20823 parsoid={
20824 "modes": ["wt2html", "html2html"],
20825 "nativeGallery": true
20826 }
20827 !! wikitext
20828 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20829 File:Nonexistent.jpg|caption
20830 File:Nonexistent.jpg
20831 image:foobar.jpg|some '''caption''' [[Main Page]]
20832 image:foobar.jpg
20833 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20834 </gallery>
20835 !! html/php
20836 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20837 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20838 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20839 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20840 <div class="gallerytext">
20841 <p>caption
20842 </p>
20843 </div>
20844 </div></li>
20845 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20846 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20847 <div class="gallerytext">
20848 </div>
20849 </div></li>
20850 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20851 <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>
20852 <div class="gallerytext">
20853 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20854 </p>
20855 </div>
20856 </div></li>
20857 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20858 <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>
20859 <div class="gallerytext">
20860 </div>
20861 </div></li>
20862 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20863 <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>
20864 <div class="gallerytext">
20865 <p>blabla.
20866 </p>
20867 </div>
20868 </div></li>
20869 </ul>
20870
20871 !! html/parsoid
20872 <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":{}}'>
20873 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20874 <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>
20875 <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>
20876 <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>
20877 <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>
20878 <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>
20879 </ul>
20880 !! end
20881
20882 !! test
20883 Gallery (with options, extsrc)
20884 !! options
20885 parsoid={
20886 "nativeGallery": false
20887 }
20888 !! wikitext
20889 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20890 File:Nonexistent.jpg|caption
20891 File:Nonexistent.jpg
20892 image:foobar.jpg|some '''caption''' [[Main Page]]
20893 image:foobar.jpg
20894 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20895 </gallery>
20896 !! html/php
20897 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20898 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20899 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20900 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20901 <div class="gallerytext">
20902 <p>caption
20903 </p>
20904 </div>
20905 </div></li>
20906 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20907 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20908 <div class="gallerytext">
20909 </div>
20910 </div></li>
20911 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20912 <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>
20913 <div class="gallerytext">
20914 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20915 </p>
20916 </div>
20917 </div></li>
20918 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20919 <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>
20920 <div class="gallerytext">
20921 </div>
20922 </div></li>
20923 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20924 <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>
20925 <div class="gallerytext">
20926 <p>blabla.
20927 </p>
20928 </div>
20929 </div></li>
20930 </ul>
20931
20932 !! html/parsoid
20933 <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"}}'>
20934 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20935 <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>
20936 <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>
20937 <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>
20938 <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>
20939 <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>
20940 </ul>
20941 !! end
20942
20943 !! test
20944 Gallery (without px units)
20945 !! wikitext
20946 <gallery widths="70" heights="40">
20947 File:Foobar.jpg
20948 </gallery>
20949 !! html/php
20950 <ul class="gallery mw-gallery-traditional">
20951 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20952 <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>
20953 <div class="gallerytext">
20954 </div>
20955 </div></li>
20956 </ul>
20957
20958 !! html/parsoid
20959 <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"}}'>
20960 <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>
20961 </ul>
20962 !! end
20963
20964 !! test
20965 Gallery (with invalid units)
20966 !! wikitext
20967 <gallery widths="70em" heights="40em">
20968 File:Foobar.jpg
20969 </gallery>
20970 !! html/php
20971 <ul class="gallery mw-gallery-traditional">
20972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20973 <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>
20974 <div class="gallerytext">
20975 </div>
20976 </div></li>
20977 </ul>
20978
20979 !! html/parsoid
20980 <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"}}'>
20981 <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>
20982 </ul>
20983 !! end
20984
20985 !! test
20986 Gallery with link that has fragment
20987 !! options
20988 parsoid={
20989 "modes": ["wt2html", "html2html"],
20990 "nativeGallery": true
20991 }
20992 !! wikitext
20993 <gallery>
20994 image:foobar.jpg|link=Main_Page
20995 image:foobar.jpg|link=Main_Page#section
20996 image:foobar.jpg|link=Main Page#section|caption
20997 </gallery>
20998 !! html/php
20999 <ul class="gallery mw-gallery-traditional">
21000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21001 <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>
21002 <div class="gallerytext">
21003 </div>
21004 </div></li>
21005 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21006 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
21007 <div class="gallerytext">
21008 </div>
21009 </div></li>
21010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21011 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/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>
21012 <div class="gallerytext">
21013 <p>caption
21014 </p>
21015 </div>
21016 </div></li>
21017 </ul>
21018
21019 !! html/parsoid
21020 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21021 <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>
21022 <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>
21023 <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>
21024 </ul>
21025 !! end
21026
21027 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
21028 !! test
21029 Gallery with template inside caption
21030 !! options
21031 parsoid={
21032 "nativeGallery": true
21033 }
21034 !! wikitext
21035 <gallery caption="{{echo|hi}}">
21036 File:Foobar.jpg|{{echo|ho}}
21037 </gallery>
21038 !! html/php
21039 <ul class="gallery mw-gallery-traditional">
21040 <li class='gallerycaption'>{{echo|hi}}</li>
21041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21042 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
21043 <div class="gallerytext">
21044 <p>ho
21045 </p>
21046 </div>
21047 </div></li>
21048 </ul>
21049
21050 !! html/parsoid
21051 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21052 <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>
21053 <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>
21054 </ul>
21055 !! end
21056
21057 !! test
21058 Gallery with wikitext inside caption
21059 !! options
21060 parsoid={
21061 "nativeGallery": true
21062 }
21063 !! wikitext
21064 <gallery>
21065 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21066 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21067 </gallery>
21068 !! html/php
21069 <ul class="gallery mw-gallery-traditional">
21070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21071 <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>
21072 <div class="gallerytext">
21073 <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>
21074 </p>
21075 </div>
21076 </div></li>
21077 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21078 <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>
21079 <div class="gallerytext">
21080 <p>This is a test template
21081 </p>
21082 </div>
21083 </div></li>
21084 </ul>
21085
21086 !! html/parsoid
21087 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21088 <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>
21089 <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>
21090 </ul>
21091 !! end
21092
21093 !! test
21094 Gallery (with showfilename option)
21095 !! options
21096 parsoid={
21097 "nativeGallery": true
21098 }
21099 !! wikitext
21100 <gallery showfilename="">
21101 File:Nonexistent.jpg|caption
21102 File:Nonexistent.jpg
21103 File:Foobar.jpg|some '''caption''' [[Main Page]]
21104 File:Foobar.jpg
21105 </gallery>
21106 !! html/php
21107 <ul class="gallery mw-gallery-traditional">
21108 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21109 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21110 <div class="gallerytext">
21111 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21112 caption
21113 </p>
21114 </div>
21115 </div></li>
21116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21117 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21118 <div class="gallerytext">
21119 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21120 </p>
21121 </div>
21122 </div></li>
21123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21124 <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>
21125 <div class="gallerytext">
21126 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21127 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21128 </p>
21129 </div>
21130 </div></li>
21131 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21132 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21133 <div class="gallerytext">
21134 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21135 </p>
21136 </div>
21137 </div></li>
21138 </ul>
21139
21140 !! html/parsoid
21141 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21142 <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>
21143 <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>
21144 <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>
21145 <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>
21146 </ul>
21147 !! end
21148
21149 ## Should Parsoid be preserving these variations? See T151367
21150 !! test
21151 Gallery (with namespace-less filenames)
21152 !! options
21153 parsoid={
21154 "modes": ["wt2html", "html2html"],
21155 "nativeGallery": true
21156 }
21157 !! wikitext
21158 <gallery>
21159 File:Nonexistent.jpg
21160 Nonexistent.jpg
21161 image:foobar.jpg
21162 foobar.jpg
21163 </gallery>
21164 !! html/php
21165 <ul class="gallery mw-gallery-traditional">
21166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21167 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21168 <div class="gallerytext">
21169 </div>
21170 </div></li>
21171 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21172 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21173 <div class="gallerytext">
21174 </div>
21175 </div></li>
21176 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21177 <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>
21178 <div class="gallerytext">
21179 </div>
21180 </div></li>
21181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21182 <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>
21183 <div class="gallerytext">
21184 </div>
21185 </div></li>
21186 </ul>
21187
21188 !! html/parsoid
21189 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21190 <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>
21191 <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>
21192 <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>
21193 <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>
21194 </ul>
21195 !! end
21196
21197 !! test
21198 Gallery override link with wikilink (T36852)
21199 !! options
21200 parsoid={
21201 "nativeGallery": true
21202 }
21203 !! wikitext
21204 <gallery>
21205 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21206 </gallery>
21207 !! html/php
21208 <ul class="gallery mw-gallery-traditional">
21209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21210 <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>
21211 <div class="gallerytext">
21212 </div>
21213 </div></li>
21214 </ul>
21215
21216 !! html/parsoid
21217 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21218 <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>
21219 </ul>
21220 !! end
21221
21222 !! test
21223 Gallery override link with absolute external link (T36852)
21224 !! options
21225 parsoid={
21226 "nativeGallery": true
21227 }
21228 !! wikitext
21229 <gallery>
21230 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21231 </gallery>
21232 !! html/php
21233 <ul class="gallery mw-gallery-traditional">
21234 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21235 <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>
21236 <div class="gallerytext">
21237 </div>
21238 </div></li>
21239 </ul>
21240
21241 !! html/parsoid
21242 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21243 <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>
21244 </ul>
21245 !! end
21246
21247 !! test
21248 Gallery override link with absolute external link with LanguageConverter
21249 !! options
21250 language=zh
21251 !! wikitext
21252 <gallery>
21253 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21254 </gallery>
21255 !! html/php
21256 <ul class="gallery mw-gallery-traditional">
21257 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21258 <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>
21259 <div class="gallerytext">
21260 <p>caption
21261 </p>
21262 </div>
21263 </div></li>
21264 </ul>
21265
21266 !! html/parsoid
21267 <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"}}'>
21268 <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>
21269 </ul>
21270 !! end
21271
21272 !! test
21273 Gallery override link with malicious javascript (T36852)
21274 !! options
21275 parsoid={
21276 "modes": ["wt2html", "html2html"],
21277 "nativeGallery": true
21278 }
21279 !! wikitext
21280 <gallery>
21281 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21282 </gallery>
21283 !! html/php
21284 <ul class="gallery mw-gallery-traditional">
21285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21286 <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>
21287 <div class="gallerytext">
21288 </div>
21289 </div></li>
21290 </ul>
21291
21292 !! html/parsoid
21293 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21294 <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>
21295 </ul>
21296 !! end
21297
21298 # Note that parsoid uses the invalid link as a caption, PHP does not.
21299 !! test
21300 Gallery with invalid title as link (T45964)
21301 !! options
21302 parsoid={
21303 "modes": ["wt2html", "html2html"],
21304 "nativeGallery": true
21305 }
21306 !! wikitext
21307 <gallery>
21308 File:Foobar.jpg|link=<
21309 </gallery>
21310 !! html/php
21311 <ul class="gallery mw-gallery-traditional">
21312 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21313 <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>
21314 <div class="gallerytext">
21315 </div>
21316 </div></li>
21317 </ul>
21318
21319 !! html/parsoid
21320 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21321 <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>
21322 </ul>
21323 !! end
21324
21325 !! test
21326 Serialize gallery without attrs in data-mw
21327 !! options
21328 parsoid={
21329 "modes": ["html2wt"],
21330 "nativeGallery": true
21331 }
21332 !! html/parsoid
21333 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21334 <li class="gallerycaption">123</li>
21335 <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>
21336 </ul>
21337 !! wikitext
21338 <gallery caption="123">
21339 File:Test.png
21340 </gallery>
21341 !! end
21342
21343 !! test
21344 Gallery with class and style attributes
21345 !! options
21346 parsoid={
21347 "nativeGallery": true
21348 }
21349 !! wikitext
21350 <gallery class="center" style="text-align: center;">
21351 File:Foobar.jpg
21352 </gallery>
21353 !! html/php
21354 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21355 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21356 <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>
21357 <div class="gallerytext">
21358 </div>
21359 </div></li>
21360 </ul>
21361
21362 !! html/parsoid
21363 <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":{}}'>
21364 <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>
21365 </ul>
21366 !! end
21367
21368 !! test
21369 Gallery in slideshow mode
21370 !! options
21371 parsoid={
21372 "nativeGallery": true
21373 }
21374 !! wikitext
21375 <gallery mode="slideshow" showthumbnails="">
21376 File:Foobar.jpg
21377 </gallery>
21378 !! html/php
21379 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21381 <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>
21382 <div class="gallerytext">
21383 </div>
21384 </div></li>
21385 </ul>
21386
21387 !! html/parsoid
21388 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21389 <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>
21390 </ul>
21391 !! end
21392
21393 !! test
21394 Serialize gallery image captions on a line
21395 !! options
21396 parsoid={
21397 "modes": ["html2wt"],
21398 "nativeGallery": true
21399 }
21400 !! html/parsoid
21401 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21402 <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>
21403 <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>
21404 </ul>
21405 !! wikitext
21406 <gallery>
21407 File:Foobar.jpg| hi ho
21408 File:Foobar.jpg|hi<br />ho
21409 </gallery>
21410 !! end
21411
21412 !! test
21413 HTML Hex character encoding (spells the word "JavaScript")
21414 !! options
21415 parsoid=wt2html,wt2wt,html2html
21416 !! wikitext
21417 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21418 !! html/php
21419 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21420 </p>
21421 !! html/parsoid
21422 <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>
21423 !! end
21424
21425 !! test
21426 HTML Hex character encoding bogus encoding (T28437 regression check)
21427 !! wikitext
21428 &#xsee;&#XSEE;
21429 !! html
21430 <p>&amp;#xsee;&amp;#XSEE;
21431 </p>
21432 !! end
21433
21434 !! test
21435 HTML Hex character encoding mixed case
21436 !! options
21437 parsoid=wt2html,wt2wt,html2html
21438 !! wikitext
21439 &#xEE;&#Xee;
21440 !! html/php
21441 <p>&#xee;&#xee;
21442 </p>
21443 !! html/parsoid
21444 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21445 !! end
21446
21447 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21448 # Note that U+000C (form feed) is not a valid XML character, so
21449 # it is banned even though allowed in HTML5.
21450 !! test
21451 Illegal character references (T106578)
21452 !! wikitext
21453 ; Null: &#00;
21454 ; FF: &#xC;
21455 ; CR: &#xD;
21456 ; Control (low): &#8;
21457 ; Control (high): &#x7F; &#x9F;
21458 ; Surrogate: &#xD83D;&#xDCA9;
21459 ; This is an okay astral character: &#x1F4A9;
21460 !! html+tidy
21461 <dl><dt>Null</dt>
21462 <dd>&amp;#00;</dd>
21463 <dt>FF</dt>
21464 <dd>&amp;#xC;</dd>
21465 <dt>CR</dt>
21466 <dd>&amp;#xD;</dd>
21467 <dt>Control (low)</dt>
21468 <dd>&amp;#8;</dd>
21469 <dt>Control (high)</dt>
21470 <dd>&amp;#x7F; &amp;#x9F;</dd>
21471 <dt>Surrogate</dt>
21472 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21473 <dt>This is an okay astral character</dt>
21474 <dd>&#x1f4a9;</dd></dl>
21475 !! end
21476
21477 !! test
21478 __FORCETOC__ override
21479 !! wikitext
21480 __NEWSECTIONLINK__
21481 __FORCETOC__
21482 !! html/php
21483 <p><br />
21484 </p>
21485 !! end
21486
21487 !! test
21488 ISBN code coverage
21489 !! wikitext
21490 ISBN 978-0-1234-56&#x20;789
21491 !! html/php
21492 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21493 </p>
21494 !! html/parsoid
21495 <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>
21496 !! end
21497
21498 !! test
21499 ISBN followed by 5 spaces
21500 !! wikitext
21501 ISBN
21502 !! html
21503 <p>ISBN
21504 </p>
21505 !! end
21506
21507 !! test
21508 Double ISBN
21509 !! wikitext
21510 ISBN ISBN 1234567890
21511 !! html/php
21512 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21513 </p>
21514 !! html/parsoid
21515 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21516 !! end
21517
21518 # Uppercase X and lowercase x as well
21519 !! test
21520 ISBN with an X
21521 !! wikitext
21522 ISBN 3-462-04561-X
21523 ISBN 3-462-04561-x
21524 ISBN 080442957X
21525 ISBN 080442957x
21526 ISBN 978080442957X
21527 ISBN 978080442957x
21528 !! html/php
21529 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21530 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21531 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21532 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21533 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21534 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21535 </p>
21536 !! html/parsoid
21537 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21538 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21539 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21540 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21541 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21542 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21543 !! end
21544
21545 !! test
21546 ISBN with empty prefix (parsoid test)
21547 !! wikitext
21548 ISBN 1234567890
21549 !! html/php
21550 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21551 </p>
21552 !! html/parsoid
21553 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21554 !! end
21555
21556 !! test
21557 T24905: <abbr> followed by ISBN followed by </a>
21558 !! wikitext
21559 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21560 !! html/php
21561 <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>
21562 </p>
21563 !! html/parsoid
21564 <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>
21565 !! end
21566
21567 !! test
21568 Double RFC
21569 !! wikitext
21570 RFC RFC 1234
21571 !! html/php
21572 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21573 </p>
21574 !! html/parsoid
21575 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21576 !! end
21577
21578 !! test
21579 Double RFC with a wiki link
21580 !! wikitext
21581 RFC [[RFC 1234]]
21582 !! html/php
21583 <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>
21584 </p>
21585 !! html/parsoid
21586 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21587 !! end
21588
21589 !! test
21590 RFC code coverage
21591 !! wikitext
21592 RFC 983&#x20;987
21593 !! html/php
21594 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21595 </p>
21596 !! html/parsoid
21597 <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>
21598 !! end
21599
21600 !! test
21601 Centre-aligned image
21602 !! wikitext
21603 [[Image:foobar.jpg|centre]]
21604 !! html/php
21605 <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>
21606
21607 !! html/parsoid
21608 <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>
21609 !! end
21610
21611 !! test
21612 None-aligned image
21613 !! wikitext
21614 [[Image:foobar.jpg|none]]
21615 !! html/php
21616 <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>
21617
21618 !! html/parsoid
21619 <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>
21620 !! end
21621
21622 !! test
21623 Width + Height sized image (using px) (height is ignored)
21624 !! wikitext
21625 [[Image:foobar.jpg|640x480px]]
21626 !! html/php
21627 <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>
21628 </p>
21629 !! html/parsoid
21630 <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>
21631 !! end
21632
21633 !! test
21634 Width-sized image (using px, no following whitespace)
21635 !! wikitext
21636 [[Image:foobar.jpg|640px]]
21637 !! html/php
21638 <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>
21639 </p>
21640 !! html/parsoid
21641 <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>
21642 !! end
21643
21644 !! test
21645 Width-sized image (using px, with following whitespace - test regression from r39467)
21646 !! wikitext
21647 [[Image:foobar.jpg|640px ]]
21648 !! html/php
21649 <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>
21650 </p>
21651 !! html/parsoid
21652 <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>
21653 !!end
21654
21655 !! test
21656 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21657 !! wikitext
21658 [[Image:foobar.jpg| 640px]]
21659 !! html/php
21660 <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>
21661 </p>
21662 !! html/parsoid
21663 <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>
21664 !! end
21665
21666 !! test
21667 Image with page parameter
21668 !! options
21669 djvu
21670 !! wikitext
21671 [[File:LoremIpsum.djvu|page=2]]
21672 !! html/php
21673 <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>
21674 </p>
21675 !! html/parsoid
21676 <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>
21677 !! end
21678
21679 !! test
21680 Another italics / bold test
21681 !! wikitext
21682 ''' ''x'
21683 !! html
21684 <pre>'<i> </i>x'
21685 </pre>
21686 !!end
21687
21688 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21689 !! test
21690 dt/dd/dl test
21691 !! wikitext
21692 :;;;::
21693 !! html/php
21694 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21695
21696 !! html/parsoid
21697 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21698
21699 !!end
21700
21701 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21702 !! test
21703 Images with the "|" character in the comment
21704 !! wikitext
21705 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21706 !! html/php
21707 <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>
21708
21709 !! html/parsoid
21710 <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>
21711 !! end
21712
21713 !! test
21714 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21715 !! wikitext
21716 <html><script>alert(1);</script></html>
21717 !! html
21718 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21719 </p>
21720 !! end
21721
21722 !! test
21723 HTML with raw HTML ($wgRawHtml==true)
21724 !! options
21725 wgRawHtml=1
21726 !! wikitext
21727 <html><script>alert(1);</script></html>
21728 !! html/php
21729 <p><script>alert(1);</script>
21730 </p>
21731 !! end
21732
21733 !! test
21734 Parents of subpages, one level up
21735 !! options
21736 subpage title=[[Subpage test/L1/L2/L3]]
21737 !! wikitext
21738 [[../|L2]]
21739 !! html
21740 <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>
21741 </p>
21742 !! end
21743
21744
21745 !! test
21746 Parents of subpages, one level up, not named
21747 !! options
21748 subpage title=[[Subpage test/L1/L2/L3]]
21749 !! wikitext
21750 [[../]]
21751 !! html
21752 <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>
21753 </p>
21754 !! end
21755
21756
21757
21758 !! test
21759 Parents of subpages, two levels up
21760 !! options
21761 subpage title=[[Subpage test/L1/L2/L3]]
21762 !! wikitext
21763 [[../../|L1]]2
21764
21765 [[../../|L1]]l
21766 !! html
21767 <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
21768 </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>
21769 </p>
21770 !! end
21771
21772 !! test
21773 Parents of subpages, two levels up, without trailing slash or name.
21774 !! options
21775 subpage title=[[Subpage test/L1/L2/L3]]
21776 !! wikitext
21777 [[../..]]
21778 !! html
21779 <p>[[../..]]
21780 </p>
21781 !! end
21782
21783 !! test
21784 Parents of subpages, two levels up, with lots of extra trailing slashes.
21785 !! options
21786 subpage title=[[Subpage test/L1/L2/L3]]
21787 !! wikitext
21788 [[../../////]]
21789 !! html
21790 <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>
21791 </p>
21792 !! end
21793
21794 !! article
21795 Subpage test/L1/L2/L3Sibling
21796 !! text
21797 Sibling article
21798 !! endarticle
21799
21800 !! test
21801 Transclusion of a sibling page (one level up)
21802 !! options
21803 subpage title=[[Subpage test/L1/L2/L3]]
21804 !! wikitext
21805 {{../L3Sibling}}
21806 !! html
21807 <p>Sibling article
21808 </p>
21809 !! end
21810
21811 !! test
21812 Transclusion of a child page
21813 !! options
21814 subpage title=[[Subpage test/L1/L2]]
21815 !! wikitext
21816 {{/L3Sibling}}
21817 !! html
21818 <p>Sibling article
21819 </p>
21820 !! end
21821
21822 # This is wt2html only in Parsoid because we add <nowiki>
21823 # because of {{..}} and we don't expect to fix that to
21824 # eliminate the nowikis selective for {{..}} markup.
21825 !! test
21826 Non-transclusion because of too many up levels
21827 !! options
21828 subpage title=[[Subpage test/L1/L2/L3]]
21829 parsoid=wt2html
21830 !! wikitext
21831 {{../../../../More than parent}}
21832 !! html/php
21833 <p>{{../../../../More than parent}}
21834 </p>
21835 !! html/parsoid
21836 <p>{{../../../../More than parent}}</p>
21837 !! end
21838
21839 !! test
21840 Definition list code coverage
21841 !! wikitext
21842 ;title :def
21843 ;title :def
21844 ;title:def
21845 !! html/php
21846 <dl><dt>title</dt>
21847 <dd>def</dd>
21848 <dt>title</dt>
21849 <dd>def</dd>
21850 <dt>title</dt>
21851 <dd>def</dd></dl>
21852
21853 !! html/parsoid
21854 <dl><dt>title </dt><dd>def</dd>
21855 <dt>title </dt><dd>def</dd>
21856 <dt>title</dt><dd>def</dd></dl>
21857 !! end
21858
21859 !! test
21860 Don't fall for the self-closing div
21861 !! wikitext
21862 <div>hello world</div/>
21863 !! html
21864 <div>hello world</div>
21865
21866 !! end
21867
21868 !! test
21869 MSGNW magic word
21870 !! wikitext
21871 {{MSGNW:msg}}
21872 !! html/php
21873 <p>&#91;&#91;:Template:Msg&#93;&#93;
21874 </p>
21875 !! end
21876
21877 !! test
21878 RAW magic word
21879 !! wikitext
21880 {{RAW:QUERTY}}
21881 !! html
21882 <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>
21883 </p>
21884 !! end
21885
21886 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21887 !! test
21888 Always escape literal '>' in output, not just after '<'
21889 !! wikitext
21890 ><>
21891 !! html
21892 <p>&gt;&lt;&gt;
21893 </p>
21894 !! end
21895
21896 !! test
21897 Template caching
21898 !! wikitext
21899 {{Test}}
21900 {{Test}}
21901 !! html
21902 <p>This is a test template
21903 This is a test template
21904 </p>
21905 !! end
21906
21907
21908 !! article
21909 MediaWiki:Fake
21910 !! text
21911 ==header==
21912 !! endarticle
21913
21914 !! test
21915 Inclusion of !userCanEdit() content
21916 !! wikitext
21917 {{MediaWiki:Fake}}
21918 !! html
21919 <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>
21920
21921 !! end
21922
21923
21924 !! test
21925 Out-of-order TOC heading levels
21926 !! wikitext
21927 ==2==
21928 ======6======
21929 ===3===
21930 =1=
21931 =====5=====
21932 ==2==
21933 !! html
21934 <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>
21935 <ul>
21936 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21937 <ul>
21938 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21939 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21940 </ul>
21941 </li>
21942 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21943 <ul>
21944 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21945 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21946 </ul>
21947 </li>
21948 </ul>
21949 </div>
21950
21951 <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>
21952 <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>
21953 <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>
21954 <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>
21955 <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>
21956 <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>
21957
21958 !! end
21959
21960
21961 !! test
21962 ISBN with a dummy number
21963 !! wikitext
21964 ISBN ---
21965 !! html
21966 <p>ISBN ---
21967 </p>
21968 !! end
21969
21970
21971 !! test
21972 ISBN with space-delimited number
21973 !! wikitext
21974 ISBN 92 9017 032 8
21975 !! html/php
21976 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21977 </p>
21978 !! html/parsoid
21979 <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>
21980 !! end
21981
21982
21983 !! test
21984 ISBN with multiple spaces, no number
21985 !! wikitext
21986 ISBN foo
21987 !! html
21988 <p>ISBN foo
21989 </p>
21990 !! end
21991
21992
21993 !! test
21994 ISBN length
21995 !! wikitext
21996 ISBN 123456789
21997
21998 ISBN 1234567890
21999
22000 ISBN 12345678901
22001 !! html/php
22002 <p>ISBN 123456789
22003 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22004 </p><p>ISBN 12345678901
22005 </p>
22006 !! html/parsoid
22007 <p>ISBN 123456789</p>
22008
22009 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22010
22011 <p>ISBN 12345678901</p>
22012 !! end
22013
22014
22015 !! test
22016 ISBN with trailing year (T9110)
22017 !! wikitext
22018 ISBN 1-234-56789-0 - 2006
22019
22020 ISBN 1 234 56789 0 - 2006
22021 !! html/php
22022 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22023 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22024 </p>
22025 !! html/parsoid
22026 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22027
22028 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22029 !! end
22030
22031
22032 !! test
22033 anchorencode
22034 !! config
22035 wgFragmentMode=[ 'html5', 'legacy' ]
22036 !! wikitext
22037 {{anchorencode:foo bar©#%n}}
22038 !! html/php
22039 <p>foo_bar©#%n
22040 </p>
22041 !! html/parsoid
22042 <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>
22043 !! end
22044
22045 !! test
22046 anchorencode (legacy)
22047 !! config
22048 wgFragmentMode=[ 'legacy' ]
22049 !! wikitext
22050 {{anchorencode:foo bar©#%n}}
22051 !! html/php
22052 <p>foo_bar.C2.A9.23.25n
22053 </p>
22054 !! end
22055
22056 !! test
22057 anchorencode trims spaces
22058 !! config
22059 wgFragmentMode=[ 'html5', 'legacy' ]
22060 !! wikitext
22061 {{anchorencode: __pretty__please__}}
22062 !! html/php
22063 <p>pretty_please
22064 </p>
22065 !! html/parsoid
22066 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22067 !! end
22068
22069 !! test
22070 anchorencode deals with links
22071 !! config
22072 wgFragmentMode=[ 'html5', 'legacy' ]
22073 !! wikitext
22074 {{anchorencode: [[hello|world]] [[hi]]}}
22075 !! html/php
22076 <p>world_hi
22077 </p>
22078 !! html/parsoid
22079 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22080 !! end
22081
22082 !! test
22083 anchorencode deals with templates
22084 !! config
22085 wgFragmentMode=[ 'html5', 'legacy' ]
22086 !! wikitext
22087 {{anchorencode: {{Foo}} x}}
22088 !! html/php
22089 <p>FOO_x
22090 </p>
22091 !! html/parsoid
22092 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22093 !! end
22094
22095 !! test
22096 anchorencode encodes like the TOC generator: (T20431)
22097 !! config
22098 wgFragmentMode=[ 'html5', 'legacy' ]
22099 !! wikitext
22100 ===_ +:.3A%3A _ &&amp;]] x===
22101 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22102 __NOEDITSECTION__
22103 !! html/php
22104 <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>
22105 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22106 </p>
22107 !! html/parsoid
22108 <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>
22109 <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>
22110 <meta property="mw:PageProp/noeditsection"/>
22111 !! end
22112
22113 !! test
22114 anchorencode encodes like the TOC generator: (T20431) (legacy)
22115 !! config
22116 wgFragmentMode=[ 'legacy' ]
22117 !! wikitext
22118 ===_ +:.3A%3A&&amp;]]===
22119 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22120 __NOEDITSECTION__
22121 !! html/php
22122 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22123 <p>.2B:.3A.253A.26.26.5D.5D
22124 </p>
22125 !! end
22126
22127 !! test
22128 T8200: blockquotes and paragraph formatting
22129 !! wikitext
22130 <blockquote>
22131 foo
22132 </blockquote>
22133
22134 bar
22135
22136 baz
22137 !! html
22138 <blockquote>
22139 <p>foo
22140 </p>
22141 </blockquote>
22142 <p>bar
22143 </p>
22144 <pre>baz
22145 </pre>
22146 !! end
22147
22148 !! test
22149 T10293: Use of center tag ruins paragraph formatting
22150 !! wikitext
22151 <center>
22152 foo
22153 </center>
22154
22155 bar
22156
22157 baz
22158 !! html
22159 <center>
22160 <p>foo
22161 </p>
22162 </center>
22163 <p>bar
22164 </p>
22165 <pre>baz
22166 </pre>
22167 !! end
22168
22169 !!test
22170 Parsing of overlapping (improperly nested) inline html tags
22171 !! wikitext
22172 <span><s>x</span></s>
22173 !! html/php
22174 <p><span><s>x&lt;/span&gt;</s></span>
22175 </p>
22176 !! html/parsoid
22177 <p><span><s>x</s></span>
22178 </p>
22179 !!end
22180
22181 ###
22182 ### Language variants related tests
22183 ###
22184
22185 # Parsoid does not mark self-links.
22186 # Parsoid does not convert links; PHP will do any necessary redirects.
22187
22188 !! test
22189 Self-link in language variants
22190 !! options
22191 title=[[Dunav]] language=sr
22192 !! wikitext
22193 Both [[Dunav]] and [[Дунав]] are names for this river.
22194 !! html/php
22195 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22196 </p>
22197 !! html/parsoid
22198 <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>
22199 !! end
22200
22201 !! article
22202 Дуна
22203 !! text
22204 content
22205 !! endarticle
22206
22207 !! test
22208 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22209 !! options
22210 title=[[Duna]] language=sr
22211 !! wikitext
22212 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22213 !! html/php
22214 <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.
22215 </p>
22216 !! html/parsoid
22217 <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>
22218 !! end
22219
22220 !! test
22221 Link to a section of a variant of this title shouldn't be parsed as self-link
22222 !! options
22223 title=[[Duna]] language=sr
22224 !! wikitext
22225 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22226 !! html/php
22227 <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.
22228 </p>
22229 !! html/parsoid
22230 <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>
22231 !! end
22232
22233 !! test
22234 Link to pages in language variants
22235 !! options
22236 language=sr
22237 !! wikitext
22238 Main Page can be written as [[Маин Паге]]
22239 !! html/php
22240 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22241 </p>
22242 !! html/parsoid
22243 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22244 !! end
22245
22246
22247 !! test
22248 Multiple links to pages in language variants
22249 !! options
22250 language=sr
22251 !! wikitext
22252 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22253 !! html/php
22254 <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>.
22255 </p>
22256 !! html/parsoid
22257 <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>
22258 !! end
22259
22260
22261 !! test
22262 Simple template in language variants
22263 !! options
22264 language=sr
22265 !! wikitext
22266 {{тест}}
22267 !! html/php
22268 <p>This is a test template
22269 </p>
22270 !! end
22271
22272
22273 !! test
22274 Template with explicit namespace in language variants
22275 !! options
22276 language=sr
22277 !! wikitext
22278 {{Template:тест}}
22279 !! html/php
22280 <p>This is a test template
22281 </p>
22282 !! end
22283
22284
22285 !! test
22286 Basic test for template parameter in language variants
22287 !! options
22288 language=sr
22289 !! wikitext
22290 {{парамтест|param=foo}}
22291 !! html/php
22292 <p>This is a test template with parameter foo
22293 </p>
22294 !! end
22295
22296 !! test
22297 Simple category in language variants
22298 !! options
22299 language=sr cat
22300 !! wikitext
22301 [[Category:МедиаWики Усер'с Гуиде]]
22302 !! html/php
22303 cat=МедиаWики_Усер'с_Гуиде sort=
22304 !! html/parsoid
22305 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22306 !! end
22307
22308 !! article
22309 Category:分类
22310 !! text
22311 blah
22312 !! endarticle
22313
22314 !! article
22315 Category:分類
22316 !! text
22317 blah
22318 !! endarticle
22319
22320 ## We used to, but no longer wt2wt this test since the default serializer
22321 ## will normalize all categories to serialize on their own line.
22322 ## This wikitext usage is going to be fairly uncommon in production and
22323 ## selser will take care of preserving formatting in those scenarios.
22324 !! test
22325 Don't convert blue categorylinks to another variant (T35210)
22326 !! options
22327 cat
22328 language=zh
22329 parsoid=wt2html
22330 !! wikitext
22331 [[A]][[Category:分类]]
22332 !! html/php
22333 cat=分类 sort=
22334 !! html/parsoid
22335 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22336 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22337 !! end
22338
22339 !! test
22340 Stripping -{}- tags (language variants)
22341 !! options
22342 language=sr
22343 !! wikitext
22344 Latin proverb: -{Ne nuntium necare}-
22345 !! html/php
22346 <p>Latin proverb: Ne nuntium necare
22347 </p>
22348 !! html/parsoid
22349 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22350 !! end
22351
22352
22353 !! test
22354 Prevent conversion with -{}- tags (language variants)
22355 !! options
22356 language=sr variant=sr-ec
22357 !! wikitext
22358 Latinski: -{Ne nuntium necare}-
22359 !! html/php
22360 <p>Латински: Ne nuntium necare
22361 </p>
22362 !! html/parsoid
22363 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22364 !! end
22365
22366
22367 !! test
22368 Prevent conversion of text with -{}- tags (language variants)
22369 !! options
22370 language=sr variant=sr-ec
22371 !! wikitext
22372 Latinski: -{Ne nuntium necare}-
22373 !! html/php
22374 <p>Латински: Ne nuntium necare
22375 </p>
22376 !! html/parsoid
22377 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22378 !! end
22379
22380
22381 !! test
22382 Prevent conversion of links with -{}- tags (language variants)
22383 !! options
22384 language=sr variant=sr-ec
22385 !! wikitext
22386 -{[[Main Page]]}-
22387 !! html/php
22388 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22389 </p>
22390 !! html/parsoid
22391 <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>
22392 !! end
22393
22394
22395 !! test
22396 -{}- tags within headlines (within html for parserConvert())
22397 !! config
22398 wgFragmentMode=[ 'html5', 'legacy' ]
22399 !! options
22400 language=sr variant=sr-ec
22401 !! wikitext
22402 ==-{Naslov}-==
22403
22404 Note that even an unprotected headline ID is not affected by language
22405 conversion:
22406
22407 ==Latinski==
22408 !! html/php
22409 <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>
22410 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22411 цонверсион:
22412 </p>
22413 <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>
22414
22415 !! html/parsoid
22416 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22417
22418 <p>Note that even an unprotected headline ID is not affected by language
22419 conversion:</p>
22420
22421 <h2 id="Latinski">Latinski</h2>
22422 !! end
22423
22424 !! test
22425 Explicit definition of language variant alternatives
22426 !! options
22427 language=zh variant=zh-tw
22428 !! wikitext
22429 -{zh:China;zh-tw:Taiwan}-, not China
22430 !! html/php
22431 <p>Taiwan, not China
22432 </p>
22433 !! html/parsoid
22434 <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>
22435 !! end
22436
22437 !! test
22438 Filter syntax for language variants
22439 !! options
22440 language=zh variant=zh-tw
22441 !! wikitext
22442 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22443 !! html/php
22444 <p>fooblog, WEBJOURNAL, WEBLOGquux
22445 </p>
22446 !! html/parsoid
22447 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22448 !! end
22449
22450 # Note that Parsoid post-processing for language variants needs to
22451 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22452 !! test
22453 Conversion around HTML tags
22454 !! options
22455 language=sr variant=sr-ec
22456 !! wikitext
22457 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22458 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22459 !! html/php
22460 <p>
22461 <span title="ЛаCтин">ски</span>
22462 </p>
22463 !! html/parsoid
22464 <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"}]}'/>
22465 <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>
22466 !! end
22467
22468 !! test
22469 Explicit session-wise two-way language variant mapping (A flag and - flag)
22470 !! options
22471 language=zh variant=zh-tw
22472 !! wikitext
22473 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22474
22475 Taiwan is not China.
22476
22477 But -{A|zh:China; zh-tw:Taiwan}- is China,
22478
22479 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22480
22481 and -{China}- is China.
22482 !! html/php
22483 <p>This is Taiwan, but we'll forget that now.
22484 </p><p>Taiwan is not China.
22485 </p><p>But Taiwan is Taiwan,
22486 </p><p>(This should be stripped!)
22487 </p><p>and China is China.
22488 </p>
22489 !! html/parsoid
22490 <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>
22491 <p>Taiwan is not China.</p>
22492 <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>
22493 <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>
22494 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22495 !! end
22496
22497 !! test
22498 Explicit session-wise one-way language variant mapping (A flag and - flag)
22499 !! options
22500 language=zh variant=zh-tw
22501 !! wikitext
22502 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22503
22504 COUNTRY is China or Taiwan.
22505
22506 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22507
22508 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22509
22510 and -{COUNTRY}- is COUNTRY.
22511 !! html/php
22512 <p>This is Taiwan, but we'll forget that now.
22513 </p><p>COUNTRY is China or Taiwan.
22514 </p><p>But Taiwan is Taiwan,
22515 </p><p>(This should be stripped!)
22516 </p><p>and COUNTRY is COUNTRY.
22517 </p>
22518 !! html/parsoid
22519 <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>
22520 <p>COUNTRY is China or Taiwan.</p>
22521 <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>
22522 <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>
22523 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22524 !! end
22525
22526 !! test
22527 Explicit session-wise two-way language variant mapping (H flag for hide)
22528 !! options
22529 language=zh variant=zh-tw
22530 !! wikitext
22531 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22532
22533 Taiwan is China.
22534 !! html/php
22535 <p>(This should be stripped!)
22536 </p><p>Taiwan is Taiwan.
22537 </p>
22538 !! html/parsoid
22539 <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>
22540 <p>Taiwan is China.</p>
22541 !! end
22542
22543 !! test
22544 Explicit session-wise one-way language variant mapping (H flag for hide)
22545 !! options
22546 language=zh variant=zh-tw
22547 !! wikitext
22548 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22549
22550 COUNTRY is Taiwan or China.
22551 !! html/php
22552 <p>(This should be stripped!)
22553 </p><p>Taiwan is Taiwan or China.
22554 </p>
22555 !! html/parsoid
22556 <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>
22557 <p>COUNTRY is Taiwan or China.</p>
22558 !! end
22559
22560 ## Note that parsoid test runner does not support 'showtitle' option.
22561 !! test
22562 Adding explicit conversion rule for title (T flag)
22563 !! options
22564 language=zh variant=zh-tw showtitle
22565 !! wikitext
22566 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22567
22568 Taiwan is China.
22569 !! html/php
22570 Taiwan
22571 <p>Should be stripped!
22572 </p><p>Taiwan is China.
22573 </p>
22574 !! html/parsoid
22575 <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>
22576 <p>Taiwan is China.</p>
22577 !! end
22578
22579 !! test
22580 Code coverage: T combined with H flag
22581 !! options
22582 language=zh variant=zh-tw showtitle
22583 !! wikitext
22584 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22585
22586 Taiwan is China.
22587 !! html/php
22588 Taiwan
22589 <p>Should be stripped!
22590 </p><p>Taiwan is Taiwan.
22591 </p>
22592 !! html/parsoid
22593 <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>
22594 <p>Taiwan is China.</p>
22595 !! end
22596
22597 !! test
22598 Code coverage: T with no variants
22599 !! options
22600 language=zh variant=zh-tw showtitle
22601 !! wikitext
22602 -{H|zh:China; zh-tw:Taiwan}-
22603 Taiwan is China.-{T|Taiwan is China}-
22604 !! html/php
22605 Taiwan is China
22606 <p>
22607 Taiwan is Taiwan.
22608 </p>
22609 !! html/parsoid
22610 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22611 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22612 !! end
22613
22614 !! test
22615 Code coverage: rules with no variants
22616 !! options
22617 language=zh variant=zh-tw
22618 !! wikitext
22619 -{H|zh:China; zh-tw:Taiwan}-
22620 Taiwan is China.
22621 -{H|China}-
22622 Taiwan is China.
22623 !! html/php
22624 <p>
22625 Taiwan is Taiwan.
22626
22627 Taiwan is China.
22628 </p>
22629 !! html/parsoid
22630 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22631 Taiwan is China.
22632 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22633 Taiwan is China.</p>
22634 !! end
22635
22636
22637 !! test
22638 Code coverage: D flag for conversion rule
22639 !! options
22640 language=zh variant=zh-tw
22641 !! wikitext
22642 -{D|zh-cn:XA; zh-tw:YA}-
22643 -{A;D|zh-cn:XB; zh-tw:YB}-
22644 -{D;H|zh-cn:XC; zh-tw:YC}-
22645
22646 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22647
22648 -{D|0=>zh-tw:1}-
22649 -{A;D|2=>zh-tw:3}-
22650 -{D;H|4=>zh-tw:5}-
22651
22652 XA XB XC YA YB YC FOO BAR BAT 012345
22653 !! html/php
22654 <p>大陆:XA;台灣:YA;
22655
22656 大陆:XC;台灣:YC;
22657 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22658 </p><p>0⇒台灣:1;
22659
22660 4⇒台灣:5;
22661 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22662 </p>
22663 !! html/parsoid
22664 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22665 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22666 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22667 <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>
22668 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22669 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22670 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22671 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22672 !! end
22673
22674 !! test
22675 Code coverage: N flag for conversion rule
22676 !! options
22677 language=zh variant=zh-cn
22678 !! wikitext
22679 -{N|zh-cn}-
22680
22681 -{N|zh-tw}-
22682
22683 -{N|sr-ec}-
22684 !! html/php
22685 <p>大陆
22686 </p><p>台灣
22687 </p><p>српски (ћирилица)‎
22688 </p>
22689 !! html/parsoid
22690 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22691 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22692 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22693 !! end
22694
22695 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22696 !! test
22697 Code coverage: N flag for conversion rule (wt2html only)
22698 !! options
22699 language=zh variant=zh-cn
22700 parsoid=wt2html,html2html
22701 !! wikitext
22702 -{D;N|en}-
22703 !! html/php
22704 <p>English
22705 </p>
22706 !! html/parsoid
22707 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22708 !! end
22709
22710 !! test
22711 Testing that changing the language variant here in the tests actually works
22712 !! options
22713 language=zh variant=zh showtitle
22714 !! wikitext
22715 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22716 !! html/php
22717 China
22718 <p>Should be stripped!
22719 </p>
22720 !! html/parsoid
22721 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22722 !! end
22723
22724 !! test
22725 Recursive conversion of alt and title attrs shouldn't clear converter state
22726 !! options
22727 language=zh variant=zh-cn
22728 showtitle
22729 !! wikitext
22730 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22731 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22732 !! html/php
22733 China
22734 <p>
22735 Should be stripped<span title="Exclamation">!</span>
22736 </p>
22737 !! html/parsoid
22738 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22739 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>
22740 !! end
22741
22742 !! test
22743 T26072: more test on conversion rule for title
22744 !! options
22745 language=zh variant=zh-tw showtitle
22746 !! wikitext
22747 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22748
22749 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22750 !! html/php
22751 Taiwan
22752 <p>This should be stripped!
22753 </p><p>This won't take interferes with the title rule.
22754 </p>
22755 !! html/parsoid
22756 <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>
22757 <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>
22758 !! end
22759
22760 !! test
22761 Partly disable title conversion if variant == main language code
22762 !! options
22763 language=zh variant=zh title=[[ZH]] showtitle
22764 !! wikitext
22765 -{T|zh-cn:CN;zh-tw:TW}-
22766 !! html/php
22767 ZH
22768 <p>
22769 </p>
22770 !! html/parsoid
22771 <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>
22772 !! end
22773
22774 !! test
22775 Partly disable title conversion if variant == main language code, more
22776 !! options
22777 language=zh variant=zh title=[[ZH]] showtitle
22778 !! wikitext
22779 -{T|TW}-
22780 !! html/php
22781 ZH
22782 <p>
22783 </p>
22784 !! html/parsoid
22785 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22786 !! end
22787
22788 !! test
22789 Raw output of variant escape tags (R flag)
22790 !! options
22791 language=zh variant=zh-tw
22792 !! wikitext
22793 Raw: -{R|zh:China;zh-tw:Taiwan}-
22794 !! html/php
22795 <p>Raw: zh:China;zh-tw:Taiwan
22796 </p>
22797 !! html/parsoid
22798 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22799 !! end
22800
22801 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22802 !! test
22803 Raw output of variant escape tags (R flag) (wt2html only)
22804 !! options
22805 language=zh variant=zh-tw
22806 parsoid=wt2html,html2html
22807 !! wikitext
22808 -{Variant}- -{D|syntax}- -{D;R|options}-
22809 !! html/php
22810 <p>Variant syntax options
22811 </p>
22812 !! html/parsoid
22813 <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>
22814 !! end
22815
22816 !! test
22817 Nested markup inside raw output of variant escape tags (R flag)
22818 !! options
22819 language=zh variant=zh-tw
22820 !! wikitext
22821 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22822 !! html/php
22823 <p>Nested raw: nested Taiwan nested
22824 </p>
22825 !! html/parsoid
22826 <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>
22827 !! end
22828
22829 !! test
22830 Nested markup and spaces inside raw output of variant escape tags (R flag)
22831 !! options
22832 language=zh variant=zh-tw
22833 !! wikitext
22834 X-{ outer -{ inner }- outer }-X
22835 !! html/php
22836 <p>X outer inner outer X
22837 </p>
22838 !! html/parsoid
22839 <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>
22840 !! end
22841
22842 !! test
22843 Templates inside raw output of variant escape tags (R flag)
22844 !! options
22845 language=zh variant=zh-tw
22846 !! wikitext
22847 Nested raw: -{R|nested {{echo|hi}} templates}-
22848 !! html/php
22849 <p>Nested raw: nested hi templates
22850 </p>
22851 !! html/parsoid
22852 <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>
22853 !! end
22854
22855 !! test
22856 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22857 !! options
22858 language=zh variant=zh-cn
22859 !! wikitext
22860 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22861 !! html/php
22862 <p>0
22863 </p>
22864 !! html/parsoid
22865 <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>
22866 !! end
22867
22868 !! test
22869 Conversion rules from [numeric-only string] to [something else] (T48634)
22870 !! options
22871 language=zh variant=zh-cn
22872 !! wikitext
22873 -{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
22874 !! html/php
22875 <p>D12345EE12345
22876 </p>
22877 !! html/parsoid
22878 <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>
22879 !! end
22880
22881 !! test
22882 Two-way converter rule entries with an empty value should be ignored (T53551)
22883 !! options
22884 language=zh variant=zh-cn
22885 !! wikitext
22886 -{H|zh-cn:foo;zh-tw:;}-foobar
22887 !! html/php
22888 <p>foobar
22889 </p>
22890 !! html/parsoid
22891 <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>
22892 !! end
22893
22894 !! test
22895 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22896 !! options
22897 language=zh variant=zh-cn
22898 !! wikitext
22899 -{H|=>zh-cn:foo;}-foobar
22900 !! html/php
22901 <p>foobar
22902 </p>
22903 !! html/parsoid
22904 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22905 !! end
22906
22907 !! test
22908 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22909 !! options
22910 language=zh variant=zh-cn
22911 !! wikitext
22912 -{H|}-foobar
22913 !! html/php
22914 <p>foobar
22915 </p>
22916 !! html/parsoid
22917 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22918 !! end
22919
22920 !! test
22921 Nested using of manual convert syntax
22922 !! options
22923 language=zh variant=zh-hk
22924 !! wikitext
22925 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22926 !! html/php
22927 <p>Nested: Hello Hong Kong!
22928 </p>
22929 !! html/parsoid
22930 <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>
22931 !! end
22932
22933 !! test
22934 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22935 !! options
22936 language=zh variant=zh-cn
22937 !! wikitext
22938 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22939 !! html/php
22940 <p><span title="X">A</span>
22941 </p>
22942 !! html/parsoid
22943 <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>
22944 !! end
22945
22946 !! test
22947 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22948 !! options
22949 language=zh variant=zh-cn
22950 !! wikitext
22951 -{<span title="-{X}-">A</span>}-
22952 !! html/php+disabled
22953 <p><span title="X">A</span>
22954 </p>
22955 !! html/parsoid
22956 <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>
22957 !! end
22958
22959 # Parsoid and PHP disagree on how to parse this example: Parsoid
22960 # insists that the content of a language converter element be a valid
22961 # DOM fragment or attribute string
22962 !! test
22963 Language converter markup with block content
22964 !! options
22965 language=zh variant=zh-cn
22966 !! wikitext
22967 <span>a-{b<div>c}-d
22968
22969 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22970
22971 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22972 !! html/php+tidy
22973 <span>ab<div>cd
22974 <span>ab<div>cd
22975 <span>ad
22976 </span></div></span></div></span>
22977 !! html/parsoid
22978 <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
22979
22980 <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
22981
22982 <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>
22983 !! end
22984
22985 !! test
22986 LanguageConverter selser (1)
22987 !! options
22988 language=zh variant=zh-cn
22989 parsoid={
22990 "modes": ["wt2wt", "selser"],
22991 "changes": [
22992 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22993 ]
22994 }
22995 !! wikitext
22996 -{raw}-
22997 !! wikitext/edited
22998 -{edited}-
22999 !! end
23000
23001 !! test
23002 LanguageConverter selser (2)
23003 !! options
23004 language=zh variant=zh-cn
23005 parsoid={
23006 "modes": ["wt2wt", "selser"],
23007 "changes": [
23008 ["span[class='x']", "contents", "text", "-{foo}-"],
23009 ["a", "contents", "text", "-{"],
23010 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23011 ]
23012 }
23013 !! wikitext
23014 <span class="x">TEXT1</span>
23015 [http://example.com TEXT2]
23016 [[Foo|TEXT3]]
23017 {{echo|TEXT4}}
23018 !! wikitext/edited
23019 <span class="x"><nowiki>-{foo}-</nowiki></span>
23020 [http://example.com -{]
23021 [[Foo|<nowiki>-{</nowiki>]]
23022 {{1x|<nowiki>-{</nowiki>}}
23023 !! end
23024
23025 # Tests LanguageVariantText in ConstrainedText
23026 !! test
23027 LanguageConverter selser (3)
23028 !! options
23029 language=zh variant=zh-cn
23030 parsoid={
23031 "modes": ["wt2wt", "selser"],
23032 "changes": [
23033 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23034 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23035 ]
23036 }
23037 !! wikitext
23038 {|
23039 |-
23040 |<span>Foo</span>
23041 |}
23042 !! wikitext/edited
23043 {|
23044 |-
23045 |<nowiki/>-{edited}-
23046 |}
23047 !! end
23048
23049 # Tests LanguageVariantText._fromSelSer
23050 !! test
23051 LanguageConverter selser (4)
23052 !! options
23053 language=zh variant=zh-cn
23054 parsoid={
23055 "modes": ["wt2wt", "selser"],
23056 "changes": [
23057 ["td > span.x", "remove"]
23058 ]
23059 }
23060 !! wikitext
23061 {|
23062 |-
23063 |<span class="x">Foo</span>-{Bar}-
23064 ||<span class="x">Foo</span>-{Bar}-
23065 |}
23066 !! wikitext/edited
23067 {|
23068 |-
23069 |<nowiki/>-{Bar}-
23070 ||-{Bar}-
23071 |}
23072 !! end
23073
23074 # Since Parsoid is starting to emit canonical wikitext for links,
23075 # [http://example.com http://example.com] will not RT back to that
23076 # form anymore.
23077 # Parsoid does not language-convert links (it is done in a
23078 # post-processing step)
23079 !! test
23080 Proper conversion of text in external links
23081 !! options
23082 language=sr variant=sr-ec
23083 parsoid=wt2html
23084 !! wikitext
23085 http://www.google.com
23086 gopher://www.google.com
23087 [http://www.google.com http://www.google.com]
23088 [gopher://www.google.com gopher://www.google.com]
23089 [https://www.google.com irc://www.google.com]
23090 [ftp://www.google.com www.google.com/ftp://dir]
23091 [//www.google.com www.google.com]
23092 !! html/php
23093 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23094 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23095 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23096 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23097 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23098 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23099 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23100 </p>
23101 !! html/parsoid
23102 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23103 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23104 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23105 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23106 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23107 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23108 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23109 !! end
23110
23111 !! test
23112 Do not convert roman numbers to language variants
23113 !! options
23114 language=sr variant=sr-ec
23115 !! wikitext
23116 Fridrih IV je car.
23117 !! html/php
23118 <p>Фридрих IV је цар.
23119 </p>
23120 !! html/parsoid
23121 <p>Fridrih IV je car.</p>
23122 !! end
23123
23124 !! test
23125 Unclosed language converter markup "-{"
23126 !! options
23127 language=sr
23128 !! wikitext
23129 -{T|hello
23130 !! html
23131 <p>-{T|hello
23132 </p>
23133 !! end
23134
23135 !! test
23136 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23137 !! options
23138 language=sr
23139 !! wikitext
23140 -{R|=&gt;}-
23141 !! html/php
23142 <p>=&gt;
23143 </p>
23144 !! html/parsoid
23145 <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>
23146 !!end
23147
23148 !! test
23149 Don't break link parsing if language converter markup is in the caption.
23150 !! options
23151 language=sr variant=sr-ec
23152 !! wikitext
23153 [[Main Page|-{R|main page}-]]
23154 !! html/php
23155 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23156 </p>
23157 !! html/parsoid
23158 <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>
23159 !! end
23160
23161 !! test
23162 T146304: Don't break template parsing if language converter markup is in the parameter.
23163 !! options
23164 language=sr variant=sr-ec
23165 !! wikitext
23166 {{echo|-{R|foo}-}}
23167 !! html/php
23168 <p>foo
23169 </p>
23170 !! html/parsoid
23171 <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>
23172 !! end
23173
23174 !! test
23175 T146305: Don't break image parsing if language converter markup is in the caption.
23176 !! options
23177 language=sr
23178 !! wikitext
23179 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23180 !! html/php
23181 <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>
23182
23183 !! html/parsoid
23184 <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>
23185 !! end
23186
23187 !! test
23188 T146305: Don't break image parsing if nested language converter markup is in the caption.
23189 !! options
23190 language=zh variant=zh-cn
23191 !! wikitext
23192 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23193 !! html/php
23194 <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>
23195
23196 !! html/parsoid
23197 <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>
23198 !! end
23199
23200 # XXX html2wt disabled because rich markup in alt is not preserved.
23201 !! test
23202 Don't break gallery if language converter markup is inside.
23203 !! options
23204 language=zh
23205 !! wikitext
23206 <gallery>
23207 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23208 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23209 </gallery>
23210 !! html/php
23211 <ul class="gallery mw-gallery-traditional">
23212 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23213 <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>
23214 <div class="gallerytext">
23215 <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>
23216 </p>
23217 </div>
23218 </div></li>
23219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23220 <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>
23221 <div class="gallerytext">
23222 <p>This is a test template
23223 </p>
23224 </div>
23225 </div></li>
23226 </ul>
23227
23228 !! html/parsoid
23229 <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"}}'>
23230 <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>
23231 <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>
23232 </ul>
23233 !! end
23234
23235 !! test
23236 T153135: Don't break list handling if language converter markup is in the item.
23237 !! options
23238 language=zh variant=zh-cn
23239 !! wikitext
23240 ;-{zh-cn:AAA;zh-tw:BBB}-
23241 ;-{R|foo:bar}-
23242 !! html/php
23243 <dl><dt>AAA</dt>
23244 <dt>foo:bar</dt></dl>
23245
23246 !! html/parsoid
23247 <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>
23248 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23249 </dl>
23250 !! end
23251
23252 // Note that parsoid does not protect colons unless language converter
23253 // markup is properly nested, because it is a backtracking parser.
23254 !! test
23255 T153135: Unclosed markup in definition list (code coverage)
23256 !! options
23257 language=zh variant=zh-cn
23258 !! wikitext
23259 ;<b>foo:bar
23260 ;-{zh-cn:AAA
23261 !! html/php+tidy
23262 <dl><dt><b>foo:bar</b></dt><b>
23263 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23264 </b></p>
23265 !! html/parsoid
23266 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23267 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23268 !! end
23269
23270 !! test
23271 T153135: Nested language converter markup in definition list (code coverage)
23272 !! options
23273 language=zh variant=zh-cn
23274 !! wikitext
23275 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23276 !! html/php
23277 <dl><dt>AAA foo:bar bat:baz</dt>
23278 <dd>def</dd></dl>
23279
23280 !! html/parsoid
23281 <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>
23282 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23283 </dl>
23284 !! end
23285
23286 # html2wt mode disabled due to <nowiki> insertion.
23287 !! test
23288 T153140: Don't break table handling if language converter markup is in the cell.
23289 !! options
23290 language=sr variant=sr-ec
23291 parsoid=wt2html,wt2wt,html2html
23292 !! wikitext
23293 {|
23294 |-
23295 | -{R|B}-
23296 |}
23297 !! html/php
23298 <table>
23299
23300 <tr>
23301 <td>B
23302 </td></tr></table>
23303
23304 !! html/parsoid
23305 <table>
23306 <tbody>
23307 <tr>
23308 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23309 </tr>
23310 </tbody>
23311 </table>
23312 !! end
23313
23314 !! test
23315 Language converter tricky html2wt cases (1)
23316 !! options
23317 language=sr
23318 parsoid=html2wt,wt2wt
23319 !! html/parsoid
23320 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23321 !! wikitext
23322 -{<nowiki>}-</nowiki>}-
23323 !! html/php
23324 <p>&#125;-
23325 </p>
23326 !! end
23327
23328 !! test
23329 Language converter tricky html2wt cases (2)
23330 !! options
23331 language=sr
23332 parsoid=html2wt,wt2wt
23333 !! html/parsoid
23334 <p>-{foo}-</p>
23335 !! wikitext
23336 <nowiki>-{foo}-</nowiki>
23337 !! html/php
23338 <p>-&#123;foo&#125;-
23339 </p>
23340 !! end
23341
23342 !! test
23343 Language converter tricky html2wt cases (3)
23344 !! options
23345 language=sr
23346 parsoid=html2wt,wt2wt
23347 !! html/parsoid
23348 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23349 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23350 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23351 !! wikitext
23352 -{R||}-
23353
23354 -{R|R|raw}-
23355
23356 -{<nowiki>-{foo}-</nowiki>}-
23357 !! html/php
23358 <p>|
23359 </p><p>R|raw
23360 </p><p>-&#123;foo&#125;-
23361 </p>
23362 !! end
23363
23364 !! test
23365 Language converter tricky html2wt cases (4)
23366 !! options
23367 language=sr
23368 parsoid=html2wt,wt2wt
23369 !! html/parsoid
23370 <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>
23371 !! wikitext
23372 -{R|{{echo|hey}}}-
23373 !! html/php
23374 <p>hey
23375 </p>
23376 !! end
23377
23378 # Note that the <nowiki> escaping added by parsoid for source text,
23379 # destination text, and language names only works on the PHP side
23380 # for *destination text*. (HTML entity escaping wouldn't work
23381 # any better.) This is probably a bug, at least for source texts.
23382 # (For language names PHP uses a precise regexp based on the languages
23383 # it currently knows have variants, which is fragile since this set
23384 # can grow/shrink over time.)
23385 !! test
23386 Language converter tricky html2wt cases (5)
23387 !! options
23388 language=zh variant=zh-cn
23389 !! html/parsoid
23390 <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>
23391 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23392 <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>
23393 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23394 <p>a:b=>c xyz</p>
23395 !! wikitext
23396 -{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
23397
23398 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23399
23400 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23401
23402 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23403
23404 a:b=>c xyz
23405 !! html/php+disabled
23406 <p>foobat;xyz=&gt;zh-cn:abc
23407 </p><p>A
23408 </p><p>0;zh-tw:bar
23409 </p><p>abc
23410 </p><p>a:b=&gt;c 0;zh-tw:bar
23411 </p>
23412 !! end
23413
23414 !! test
23415 T179579: Nowiki and lc interaction
23416 !! options
23417 parsoid=wt2html
23418 language=sr
23419 !! wikitext
23420 -{</nowiki>123}-
23421
23422 -{123<nowiki>|</nowiki>456}-
23423 !! html/parsoid
23424 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23425
23426 <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>
23427 !! end
23428
23429 !! test
23430 T2529: Uncovered bullet
23431 !! wikitext
23432 *Foo {{bullet}}
23433 !! html
23434 <ul><li>Foo</li>
23435 <li>Bar</li></ul>
23436
23437 !! end
23438
23439 !! test
23440 T2529: Uncovered bullet in a deeply nested list
23441 !! wikitext
23442 *******Foo {{bullet}}
23443 !! html
23444 <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>
23445 <li>Bar</li></ul>
23446
23447 !! end
23448
23449 !! test
23450 T2529: Uncovered table already at line-start
23451 !! wikitext
23452 x
23453
23454 {{table}}
23455 y
23456 !! html
23457 <p>x
23458 </p>
23459 <table>
23460 <tr>
23461 <td>1</td>
23462 <td>2
23463 </td></tr>
23464 <tr>
23465 <td>3</td>
23466 <td>4
23467 </td></tr></table>
23468 <p>y
23469 </p>
23470 !! end
23471
23472 !! test
23473 T2529: Uncovered bullet in parser function result
23474 !! wikitext
23475 *Foo {{lc:{{bullet}} }}
23476 !! html
23477 <ul><li>Foo</li>
23478 <li>bar</li></ul>
23479
23480 !! end
23481
23482 !! test
23483 T7678: Double-parsed template argument
23484 !! wikitext
23485 {{lc:{{{1}}}|hello}}
23486 !! html
23487 <p>{{{1}}}
23488 </p>
23489 !! end
23490
23491 !! test
23492 T7678: Double-parsed template invocation
23493 !! wikitext
23494 {{lc:{{paramtest {{!}} param = hello }} }}
23495 !! html
23496 <p>{{paramtest | param = hello }}
23497 </p>
23498 !! end
23499
23500 !! test
23501 Case insensitivity of parser functions for non-ASCII characters (T10143)
23502 !! options
23503 language=cs
23504 title=[[Main Page]]
23505 !! wikitext
23506 {{PRVNÍVELKÉ:ěščř}}
23507 {{prvnívelké:ěščř}}
23508 {{PRVNÍMALÉ:ěščř}}
23509 {{prvnímalé:ěščř}}
23510 {{MALÁ:ěščř}}
23511 {{malá:ěščř}}
23512 {{VELKÁ:ěščř}}
23513 {{velká:ěščř}}
23514 !! html
23515 <p>Ěščř
23516 Ěščř
23517 ěščř
23518 ěščř
23519 ěščř
23520 ěščř
23521 ĚŠČŘ
23522 ĚŠČŘ
23523 </p>
23524 !! end
23525
23526 !! test
23527 Morwen/13: Unclosed link followed by heading
23528 !! wikitext
23529 [[link
23530 ==heading==
23531 !! html
23532 <p>[[link
23533 </p>
23534 <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>
23535
23536 !! end
23537
23538 !! test
23539 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23540 !! wikitext
23541 {{foo|
23542 =heading=
23543 !! html
23544 <p>{{foo|
23545 </p>
23546 <h1><span class="mw-headline" id="heading">heading</span></h1>
23547
23548 !! end
23549
23550 !! test
23551 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23552 !! wikitext
23553 {{foo|
23554 ==heading==
23555 !! html
23556 <p>{{foo|
23557 </p>
23558 <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>
23559
23560 !! end
23561
23562 !! test
23563 Tildes in comments
23564 !! options
23565 pst
23566 !! wikitext
23567 <!-- ~~~~ -->
23568 !! html/php
23569 <!-- ~~~~ -->
23570 !! end
23571
23572 !! test
23573 Paragraphs inside divs (no extra line breaks)
23574 !! wikitext
23575 <div>Line one
23576
23577 Line two</div>
23578 !! html
23579 <div>Line one
23580 Line two</div>
23581
23582 !! end
23583
23584 !! test
23585 Paragraphs inside divs (extra line break on open)
23586 !! wikitext
23587 <div>
23588 Line one
23589
23590 Line two</div>
23591 !! html
23592 <div>
23593 <p>Line one
23594 </p>
23595 Line two</div>
23596
23597 !! end
23598
23599 !! test
23600 Paragraphs inside divs (extra line break on close)
23601 !! wikitext
23602 <div>Line one
23603
23604 Line two
23605 </div>
23606 !! html
23607 <div>Line one
23608 <p>Line two
23609 </p>
23610 </div>
23611
23612 !! end
23613
23614 !! test
23615 Paragraphs inside divs (extra line break on open and close)
23616 !! wikitext
23617 <div>
23618 Line one
23619
23620 Line two
23621 </div>
23622 !! html
23623 <div>
23624 <p>Line one
23625 </p><p>Line two
23626 </p>
23627 </div>
23628
23629 !! end
23630
23631 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23632 !! test
23633 Nesting tags, paragraphs on lines which begin with <div>
23634 !! wikitext
23635 <div></div><strong>A
23636 B</strong>
23637 !! html/php+tidy
23638 <div></div><p><strong>A
23639 </strong></p><strong></strong><p><strong>B</strong>
23640 </p>
23641 !! html/parsoid
23642 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23643 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23644 !! end
23645
23646 # T8200: <blockquote> should behave like <div> with respect to line breaks
23647 !! test
23648 T8200: paragraphs inside blockquotes (no extra line breaks)
23649 !! wikitext
23650 <blockquote>Line one
23651
23652 Line two</blockquote>
23653 !! html
23654 <blockquote>Line one
23655 Line two</blockquote>
23656
23657 !! html+tidy
23658 <blockquote><p>Line one
23659 Line two</p></blockquote>
23660 !! end
23661
23662 !! test
23663 T8200: paragraphs inside blockquotes (extra line break on open)
23664 !! wikitext
23665 <blockquote>
23666 Line one
23667
23668 Line two</blockquote>
23669 !! html
23670 <blockquote>
23671 <p>Line one
23672 </p>
23673 Line two</blockquote>
23674
23675 !! html+tidy
23676 <blockquote>
23677 <p>Line one
23678 </p><p>
23679 Line two</p></blockquote>
23680 !! end
23681
23682 !! test
23683 T8200: paragraphs inside blockquotes (extra line break on close)
23684 !! wikitext
23685 <blockquote>Line one
23686
23687 Line two
23688 </blockquote>
23689 !! html
23690 <blockquote>Line one
23691 <p>Line two
23692 </p>
23693 </blockquote>
23694
23695 !! html+tidy
23696 <blockquote><p>Line one
23697 </p><p>Line two
23698 </p>
23699 </blockquote>
23700 !! end
23701
23702 !! test
23703 T8200: paragraphs inside blockquotes (extra line break on open and close)
23704 !! wikitext
23705 <blockquote>
23706 Line one
23707
23708 Line two
23709 </blockquote>
23710 !! html
23711 <blockquote>
23712 <p>Line one
23713 </p><p>Line two
23714 </p>
23715 </blockquote>
23716
23717 !! end
23718
23719 ## This is a corner case interaction between the paragraph wrapping in the
23720 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23721 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23722 ## of which "div" is one, but do p-wrapping inside them. These are referred
23723 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23724 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23725 !! test
23726 Paragraphs inside blockquotes/divs (no extra line breaks)
23727 !! wikitext
23728 <blockquote><div>Line one
23729
23730 Line two</div></blockquote>
23731 !! html
23732 <blockquote><div>Line one
23733 Line two</div></blockquote>
23734
23735 !! end
23736
23737 !! test
23738 Paragraphs inside blockquotes/divs (extra line break on open)
23739 !! wikitext
23740 <blockquote><div>
23741 Line one
23742
23743 Line two</div></blockquote>
23744 !! html
23745 <blockquote><div>
23746 <p>Line one
23747 </p>
23748 Line two</div></blockquote>
23749
23750 !! end
23751
23752 !! test
23753 Paragraphs inside blockquotes/divs (extra line break on close)
23754 !! wikitext
23755 <blockquote><div>Line one
23756
23757 Line two
23758 </div></blockquote>
23759 !! html
23760 <blockquote><div>Line one
23761 <p>Line two
23762 </p>
23763 </div></blockquote>
23764
23765 !! end
23766
23767 !! test
23768 Paragraphs inside blockquotes/divs (extra line break on open and close)
23769 !! wikitext
23770 <blockquote><div>
23771 Line one
23772
23773 Line two
23774 </div></blockquote>
23775 !! html
23776 <blockquote><div>
23777 <p>Line one
23778 </p><p>Line two
23779 </p>
23780 </div></blockquote>
23781
23782 !! end
23783
23784 !! test
23785 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23786 !! options
23787 wgLinkHolderBatchSize=0
23788 !! wikitext
23789 [[meatball:1]]
23790 [[meatball:2]]
23791 [[meatball:3]]
23792 !! html
23793 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23794 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23795 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23796 </p>
23797 !! end
23798
23799 !! test
23800 Free external link invading image caption
23801 !! wikitext
23802 [[Image:Foobar.jpg|thumb|http://x|hello]]
23803 !! html/php
23804 <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>
23805
23806 !! html/parsoid
23807 <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>
23808 !! end
23809
23810 !! test
23811 T17196: localised external link numbers
23812 !! options
23813 language=fa
23814 !! wikitext
23815 [http://en.wikipedia.org/]
23816 !! html/php
23817 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23818 </p>
23819 !! html/parsoid
23820 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23821 !! end
23822
23823 !! test
23824 Multibyte character in padleft
23825 !! wikitext
23826 {{padleft:-Hello|7|Æ}}
23827 !! html/php
23828 <p>Æ-Hello
23829 </p>
23830 !! html/parsoid
23831 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23832 !! end
23833
23834 !! test
23835 Multibyte character in padright
23836 !! wikitext
23837 {{padright:Hello-|7|Æ}}
23838 !! html/php
23839 <p>Hello-Æ
23840 </p>
23841 !! html/parsoid
23842 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23843 !! end
23844
23845 !!test
23846 formatdate parser function
23847 !! wikitext
23848 {{#formatdate:2009-03-24}}
23849 !! html
23850 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23851 </p>
23852 !! end
23853
23854 !!test
23855 formatdate parser function, with default format
23856 !! wikitext
23857 {{#formatdate:2009-03-24|mdy}}
23858 !! html
23859 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23860 </p>
23861 !! end
23862
23863 !! test
23864 Spacing of numbers in formatted dates
23865 !! wikitext
23866 {{#formatdate:January 15}}
23867 !! html
23868 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23869 </p>
23870 !! end
23871
23872 !! test
23873 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
23874 !! options
23875 language=nl title=[[MediaWiki:Common.css]]
23876 !! wikitext
23877 {{#formatdate:2009-03-24|dmy}}
23878 !! html
23879 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23880 </p>
23881 !! end
23882
23883 #
23884 #
23885 #
23886
23887 #
23888 # Edit comments
23889 #
23890
23891 !! test
23892 Edit comment with link
23893 !! options
23894 comment
23895 !! wikitext
23896 I like the [[Main Page]] a lot
23897 !! html/php
23898 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23899 !!end
23900
23901 !! test
23902 Edit comment with link and link text
23903 !! options
23904 comment
23905 !! wikitext
23906 I like the [[Main Page|best pages]] a lot
23907 !! html/php
23908 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23909 !!end
23910
23911 !! test
23912 Edit comment with link and link text with suffix
23913 !! options
23914 comment
23915 !! wikitext
23916 I like the [[Main Page|best page]]s a lot
23917 !! html/php
23918 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23919 !!end
23920
23921 !! test
23922 Edit comment with section link (non-local, eg in history list)
23923 !! options
23924 comment title=[[Main Page]]
23925 !! wikitext
23926 /* External links */ removed bogus entries
23927 !! html/php
23928 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23929 !!end
23930
23931 !! test
23932 Edit comment with section link and text before it (non-local, eg in history list)
23933 !! options
23934 comment title=[[Main Page]]
23935 !! wikitext
23936 pre-comment text /* External links */ removed bogus entries
23937 !! html/php
23938 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>
23939 !!end
23940
23941 !! test
23942 Edit comment with section link (local, eg in diff view)
23943 !! options
23944 comment local title=[[Main Page]]
23945 !! wikitext
23946 /* External links */ removed bogus entries
23947 !! html/php
23948 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23949 !!end
23950
23951 !! test
23952 Edit comment with subpage link (T16080)
23953 !! options
23954 comment
23955 subpage
23956 title=[[Subpage test]]
23957 !! wikitext
23958 Poked at a [[/subpage]] here...
23959 !! html/php
23960 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23961 !!end
23962
23963 !! test
23964 Edit comment with subpage link and link text (T16080)
23965 !! options
23966 comment
23967 subpage
23968 title=[[Subpage test]]
23969 !! wikitext
23970 Poked at a [[/subpage|neat little page]] here...
23971 !! html/php
23972 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23973 !!end
23974
23975 !! test
23976 Edit comment with bogus subpage link in non-subpage NS (T16080)
23977 !! options
23978 comment
23979 title=[[Subpage test]]
23980 !! wikitext
23981 Poked at a [[/subpage]] here...
23982 !! html/php
23983 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...
23984 !!end
23985
23986 !! test
23987 Edit comment with bare anchor link (local, as on diff)
23988 !! options
23989 comment
23990 local
23991 title=[[Main Page]]
23992 !! wikitext
23993 [[#section]]
23994 !! html/php
23995 <a href="#section">#section</a>
23996 !! end
23997
23998 !! test
23999 Edit comment with bare anchor link (non-local, as on history)
24000 !! options
24001 comment
24002 title=[[Main Page]]
24003 !! wikitext
24004 [[#section]]
24005 !! html/php
24006 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24007 !! end
24008
24009 !! test
24010 Anchor starting with underscore
24011 !! options
24012 title=[[Foo]]
24013 !! wikitext
24014 [[#_ref|One]]
24015 !! html/php
24016 <p><a href="#_ref">One</a>
24017 </p>
24018 !! html/parsoid
24019 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24020 !! end
24021
24022 !! test
24023 Id starting with underscore
24024 !! wikitext
24025 <div id="_ref"></div>
24026 !! html/*
24027 <div id="_ref"></div>
24028
24029 !! end
24030
24031 !! test
24032 Edit comment with link with more than one pipe (T99346)
24033 !! options
24034 comment
24035 !! wikitext
24036 [[Main Page|Many|pipes]]
24037 !! html/php
24038 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24039 !! end
24040
24041 !! test
24042 Complex edit comment with link with more than one pipe (T99346)
24043 !! options
24044 comment
24045 !! wikitext
24046 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24047 !! html/php
24048 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;
24049 !! end
24050
24051 !! test
24052 Space normalisation on autocomment (T24784)
24053 !! options
24054 comment
24055 title=[[Main Page]]
24056 !! wikitext
24057 /* __hello__world__ */
24058 !! html/php
24059 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
24060 !! end
24061
24062 !! test
24063 percent-encoding and + signs in comments (T28410)
24064 !! options
24065 comment
24066 !! wikitext
24067 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24068 !! html/php
24069 <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>
24070 !! end
24071
24072 # Parsoid doesn't support this yet: see T75581
24073 # but it *should* omit the 'src' attribute if the image is bad.
24074 # PHP side of tests was disabled in
24075 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24076 # because of issues in the PHP parserTests infrastructure
24077 # (but the output below is indeed what the PHP side emits)
24078 !! test
24079 Bad images - basic functionality
24080 !! wikitext
24081 [[File:Bad.jpg]]
24082 !! html/php+disabled
24083 !! html/parsoid
24084 <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>
24085 !! end
24086
24087 !! test
24088 Bad images - T18039: text after bad image disappears
24089 !! wikitext
24090 Foo bar
24091 [[File:Bad.jpg]]
24092 Bar foo
24093 !! html/php+disabled
24094 <p>Foo bar
24095 </p><p>Bar foo
24096 </p>
24097 !! html/parsoid
24098 <p>Foo bar
24099 <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>
24100 Bar foo</p>
24101 !! end
24102
24103 !! test
24104 Verify that displaytitle works (T24501) no displaytitle
24105 !! options
24106 showtitle
24107 !! config
24108 wgAllowDisplayTitle=true
24109 wgRestrictDisplayTitle=false
24110 !! wikitext
24111 this is not the the title
24112 !! html/php
24113 Parser test
24114 <p>this is not the the title
24115 </p>
24116 !! end
24117
24118 !! test
24119 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24120 !! options
24121 showtitle
24122 title=[[Screen]]
24123 !! config
24124 wgAllowDisplayTitle=true
24125 wgRestrictDisplayTitle=false
24126 !! wikitext
24127 this is not the the title
24128 {{DISPLAYTITLE:whatever}}
24129 !! html/php
24130 whatever
24131 <p>this is not the the title
24132 </p>
24133 !! end
24134
24135 !! test
24136 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24137 !! options
24138 showtitle
24139 title=[[Screen]]
24140 !! config
24141 wgAllowDisplayTitle=true
24142 wgRestrictDisplayTitle=true
24143 !! wikitext
24144 this is not the the title
24145 {{DISPLAYTITLE:whatever}}
24146 !! html/php
24147 Screen
24148 <p>this is not the the title
24149 </p>
24150 !! end
24151
24152 !! test
24153 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24154 !! options
24155 showtitle
24156 title=[[Screen]]
24157 !! config
24158 wgAllowDisplayTitle=true
24159 wgRestrictDisplayTitle=true
24160 !! wikitext
24161 this is not the the title
24162 {{DISPLAYTITLE:screen}}
24163 !! html/php
24164 screen
24165 <p>this is not the the title
24166 </p>
24167 !! end
24168
24169 !! test
24170 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24171 !! options
24172 showtitle
24173 title=[[Screen]]
24174 !! config
24175 wgAllowDisplayTitle=false
24176 !! wikitext
24177 this is not the the title
24178 {{DISPLAYTITLE:screen}}
24179 !! html/php
24180 Screen
24181 <p>this is not the the title
24182 <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>
24183 </p>
24184 !! end
24185
24186 !! test
24187 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24188 !! options
24189 showtitle
24190 title=[[Screen]]
24191 !! config
24192 wgAllowDisplayTitle=false
24193 !! wikitext
24194 this is not the the title
24195 !! html/php
24196 Screen
24197 <p>this is not the the title
24198 </p>
24199 !! end
24200
24201 !! test
24202 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24203 !! options
24204 showtitle
24205 title=[[Screen]]
24206 !! config
24207 wgAllowDisplayTitle=true
24208 wgRestrictDisplayTitle=true
24209 !! wikitext
24210 this is not the the title
24211 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24212 !! html/php
24213 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24214 <p>this is not the the title
24215 </p>
24216 !! end
24217
24218 !! test
24219 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24220 !! options
24221 showtitle
24222 title=[[Screen]]
24223 !! config
24224 wgAllowDisplayTitle=true
24225 wgRestrictDisplayTitle=true
24226 !! wikitext
24227 this is not the the title
24228 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24229 !! html/php
24230 <span style="color: red;">s</span>creen
24231 <p>this is not the the title
24232 </p>
24233 !! end
24234
24235 !! test
24236 Page status indicators: Empty name is invalid
24237 !! options
24238 showindicators
24239 !! wikitext
24240 <indicator name=" "></indicator>
24241 <indicator></indicator>
24242 !! html/php
24243 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24244 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24245 </p>
24246 !! end
24247
24248 !! test
24249 Page status indicators: Weird syntaxes that are okay
24250 !! options
24251 showindicators
24252 !! wikitext
24253 <indicator name="empty" />
24254 <indicator name="name"></indicator>
24255 !! html/php
24256 empty=
24257 name=
24258 <p><br />
24259 </p>
24260 !! end
24261
24262 !! test
24263 Page status indicators: Torture test
24264 !! options
24265 showindicators
24266 !! wikitext
24267 <indicator name="01">hello world</indicator>
24268 <indicator name="02">[[Main Page]]</indicator>
24269 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24270 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24271 <indicator name="05">*foo
24272 *bar</indicator>
24273 <indicator name="06"><nowiki>foo</nowiki></indicator>
24274 <indicator name="07"> Preformatted</indicator>
24275 <indicator name="08"><div>Broken tag</indicator>
24276 <indicator name="09">{| class=wikitable
24277 |cell
24278 |}</indicator>
24279 <indicator name="10">Two
24280
24281 paragraphs</indicator>
24282 !! html/php
24283 01=hello world
24284 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24285 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" />
24286 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>
24287 05=<ul><li>foo</li>
24288 <li>bar</li></ul>
24289
24290 06=foo
24291 07=<pre>Preformatted
24292 </pre>
24293 08=<div>Broken tag</div>
24294
24295 09=<table class="wikitable">
24296 <tr>
24297 <td>cell
24298 </td></tr></table>
24299
24300 10=<p>Two
24301 </p><p>paragraphs
24302 </p>
24303 <p><br />
24304 </p><p><br />
24305 </p><p><br />
24306 </p><p><br />
24307 </p><p><br />
24308 </p>
24309 !! end
24310
24311 !! test
24312 preload: check <noinclude> and <includeonly>
24313 !! options
24314 preload
24315 !! wikitext
24316 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24317 !! html/php
24318 Hello kind world.
24319 !! end
24320
24321 !! test
24322 preload: check <onlyinclude>
24323 !! options
24324 preload
24325 !! wikitext
24326 Goodbye <onlyinclude>Hello world</onlyinclude>
24327 !! html/php
24328 Hello world
24329 !! end
24330
24331 !! test
24332 preload: can pass tags through if we want to
24333 !! options
24334 preload
24335 !! wikitext
24336 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24337 !! html/php
24338 <includeonly>Hello world</includeonly>
24339 !! end
24340
24341 !! test
24342 preload: check that it doesn't try to do tricks
24343 !! options
24344 preload
24345 !! wikitext
24346 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24347 !! html/php
24348 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24349 !! end
24350
24351 !! test
24352 Play a bit with r67090 and T5158
24353 !! wikitext
24354 <div style="width:50% !important">&nbsp;</div>
24355 <div style="width:50%&nbsp;!important">&nbsp;</div>
24356 <div style="width:50%&#160;!important">&nbsp;</div>
24357 <div style="border : solid;">&nbsp;</div>
24358 !! html/php
24359 <div style="width:50% !important">&#160;</div>
24360 <div style="width:50% !important">&#160;</div>
24361 <div style="width:50% !important">&#160;</div>
24362 <div style="border&#32;: solid;">&#160;</div>
24363
24364 !! html/parsoid
24365 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24366 <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>
24367 <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>
24368 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24369
24370 !! end
24371
24372 !! test
24373 French spaces in wikitext
24374 !! wikitext
24375 foo ! bar ? bat 50 % is less than 75 %.
24376
24377 Hello : this ; is « something ‹ else › again »
24378 !! html
24379 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24380 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24381 </p>
24382 !! end
24383
24384 # It would be reasonable for Parsoid and PHP to differ here.
24385 # The PHP behavior is arguably a bug.
24386 !! test
24387 Corner case: french spaces in definition list
24388 !! wikitext
24389 ;foo : bar
24390 !! html+tidy
24391 <dl><dt>foo&#160;</dt>
24392 <dd>bar</dd></dl>
24393 !! end
24394
24395 !! test
24396 T5158: Test for French spaces in attributes
24397 !! wikitext
24398 <br style=" clear : both ; " />
24399 !! html/php
24400 <p><br style="clear&#32;: both&#32;;" />
24401 </p>
24402 !! end
24403
24404 !! test
24405 HTML5 data attributes
24406 !! wikitext
24407 <span data-foo="bar">Baz</span>
24408 <p data-abc-def_hij="">Quuz</p>
24409 !! html/php
24410 <p><span data-foo="bar">Baz</span>
24411 </p>
24412 <p data-abc-def_hij="">Quuz</p>
24413
24414 !! html/parsoid
24415 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24416 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24417 !! end
24418
24419 !! test
24420 Strip reserved data attributes
24421 !! wikitext
24422 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24423 !! html/php
24424 <div data-ok="fred">d</div>
24425
24426 !! html/parsoid
24427 <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>
24428 !! end
24429
24430 !! test
24431 percent-encoding and + signs in internal links (T28410)
24432 !! wikitext
24433 [[User:+%]] [[Page+title%]]
24434 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24435 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24436 [[%33%45]] [[%33%45+]]
24437 !! html/php
24438 <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>
24439 <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>
24440 <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>
24441 <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>
24442 </p>
24443 !! html/parsoid
24444 <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>
24445 <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>
24446 <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>
24447 <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>
24448 !! end
24449
24450 !! test
24451 Special characters in embedded file links (T29679)
24452 !! wikitext
24453 [[File:Contains & ampersand.jpg]]
24454 [[File:Does not exist.jpg|Title with & ampersand]]
24455 !! html/php
24456 <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>
24457 <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>
24458 </p>
24459 !! html/parsoid
24460 <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>
24461 <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>
24462 !! end
24463
24464 !! test
24465 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24466 !! wikitext
24467 Text&apos;s been normalized?
24468 !! html
24469 <p>Text&#39;s been normalized?
24470 </p>
24471 !! end
24472
24473 !! test
24474 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24475 !! wikitext
24476 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24477 !! html
24478 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24479 </p>
24480 !! end
24481
24482 !! test
24483 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24484 !! wikitext
24485 [http://www.example.org/ ideograms]
24486 !! html
24487 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24488 </p>
24489 !! end
24490
24491 !! test
24492 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24493 !! wikitext
24494 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24495 !! html
24496 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24497 </p>
24498 !! end
24499
24500 !! article
24501 Mediawiki:loop1
24502 !! text
24503 {{Identical|A}}
24504 !! endarticle
24505
24506 !! article
24507 Mediawiki:loop2
24508 !! text
24509 {{Identical|B}}
24510 !! endarticle
24511
24512 !! article
24513 Template:Identical
24514 !! text
24515 {{int:loop1}}
24516 {{int:loop2}}
24517 !! endarticle
24518
24519 !! test
24520 T33098 Template which includes system messages which includes the template
24521 !! wikitext
24522 {{Identical}}
24523 !! html
24524 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24525 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24526 </p>
24527 !! end
24528
24529 !! test
24530 T33490 Turkish: ucfirst 'blah'
24531 !! options
24532 language=tr
24533 !! wikitext
24534 {{ucfirst:blah}}
24535 !! html
24536 <p>Blah
24537 </p>
24538 !! end
24539
24540 !! test
24541 T33490 Turkish: ucfirst 'ix'
24542 !! options
24543 language=tr
24544 !! wikitext
24545 {{ucfirst:ix}}
24546 !! html
24547 <p>İx
24548 </p>
24549 !! end
24550
24551 !! test
24552 T33490 Turkish: lcfirst 'BLAH'
24553 !! options
24554 language=tr
24555 !! wikitext
24556 {{lcfirst:BLAH}}
24557 !! html
24558 <p>bLAH
24559 </p>
24560 !! end
24561
24562 !! test
24563 T33490 Turkish: ucfırst (with a dotless i)
24564 !! options
24565 language=tr
24566 !! wikitext
24567 {{ucfırst:blah}}
24568 !! html
24569 <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>
24570 </p>
24571 !! end
24572
24573 !! test
24574 T33490 ucfırst (with a dotless i) with English language
24575 !! options
24576 language=en
24577 !! wikitext
24578 {{ucfırst:blah}}
24579 !! html
24580 <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>
24581 </p>
24582 !! end
24583
24584 # Note that Parsoid doesn't emit an explicit TOC.
24585 # Note also that the html2wt direction tends to emit an extra newline
24586 # between the __TOC__ magicword and the first heading unless *both*
24587 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24588 # it's "{}").
24589
24590 !! test
24591 T28375: TOC with italics
24592 !! options
24593 title=[[Main Page]]
24594 !! wikitext
24595 __TOC__
24596 ==''Lost'' episodes==
24597 !! html/php
24598 <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>
24599 <ul>
24600 <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>
24601 </ul>
24602 </div>
24603
24604 <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>
24605
24606 !! html/parsoid
24607 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24608 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24609 !! end
24610
24611 !! test
24612 T28375: TOC with bold
24613 !! options
24614 title=[[Main Page]]
24615 !! wikitext
24616 __TOC__
24617 =='''should be bold''' then normal text==
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="#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>
24622 </ul>
24623 </div>
24624
24625 <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>
24626
24627 !! html/parsoid
24628 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24629 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24630 !! end
24631
24632 !! test
24633 T35845: Headings become cursive in TOC when they contain an image
24634 !! options
24635 title=[[Main Page]]
24636 !! wikitext
24637 __TOC__
24638 ==Image [[Image:foobar.jpg]]==
24639 !! html/php
24640 <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>
24641 <ul>
24642 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24643 </ul>
24644 </div>
24645
24646 <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>
24647
24648 !! html/parsoid
24649 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24650 <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>
24651 !! end
24652
24653 !! test
24654 T35845 (2): Headings become bold in TOC when they contain a blockquote
24655 !! options
24656 title=[[Main Page]]
24657 !! wikitext
24658 __TOC__
24659 ==<blockquote>Quote</blockquote>==
24660 !! html/php
24661 <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>
24662 <ul>
24663 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24664 </ul>
24665 </div>
24666
24667 <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>
24668
24669 !! html/php+tidy
24670 <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>
24671 <ul>
24672 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24673 </ul>
24674 </div>
24675
24676 <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>
24677 !! html/parsoid
24678 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24679 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24680 !! end
24681
24682 !! test
24683 Unclosed tags in TOC
24684 !! config
24685 wgFragmentMode=[ 'html5', 'legacy' ]
24686 !! options
24687 title=[[Main Page]]
24688 !! wikitext
24689 __TOC__
24690 ==Proof: 2 < 3==
24691 <small>Hanc marginis exiguitas non caperet.</small>
24692 QED
24693 !! html/php
24694 <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>
24695 <ul>
24696 <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>
24697 </ul>
24698 </div>
24699
24700 <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>
24701 <p><small>Hanc marginis exiguitas non caperet.</small>
24702 QED
24703 </p>
24704 !! html/parsoid
24705 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24706 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24707 <p><small>Hanc marginis exiguitas non caperet.</small>
24708 QED</p>
24709 !! end
24710
24711 !! test
24712 Multiple tags in TOC
24713 !! wikitext
24714 __TOC__
24715 ==<i>Foo</i> <b>Bar</b>==
24716
24717 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24718 !! html/php
24719 <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>
24720 <ul>
24721 <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>
24722 <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>
24723 </ul>
24724 </div>
24725
24726 <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>
24727 <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>
24728
24729 !! html/php+tidy
24730 <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>
24731 <ul>
24732 <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>
24733 <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>
24734 </ul>
24735 </div>
24736
24737 <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>
24738 <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>
24739 !! html/parsoid
24740 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24741 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24742
24743 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
24744 !! end
24745
24746 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24747 # html5 tag parsing.
24748 !! test
24749 Tags with parameters in TOC
24750 !! options
24751 parsoid=wt2html
24752 !! wikitext
24753 __TOC__
24754 ==<sup class="in-h2">Hello</sup>==
24755
24756 ==<sup class="a > b">Evilbye</sup>==
24757 !! html/php
24758 <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>
24759 <ul>
24760 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24761 <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>
24762 </ul>
24763 </div>
24764
24765 <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>
24766 <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>
24767
24768 !! html/parsoid
24769 <meta property="mw:PageProp/toc" />
24770 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24771
24772 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24773 !! end
24774
24775 !! test
24776 span tags with directionality in TOC
24777 !! wikitext
24778 __TOC__
24779 ==<span dir="ltr">C++</span>==
24780
24781 ==<span dir="rtl">זבנג!</span>==
24782
24783 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24784
24785 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24786
24787 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24788 !! html/php
24789 <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>
24790 <ul>
24791 <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>
24792 <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>
24793 <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>
24794 <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>
24795 <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>
24796 </ul>
24797 </div>
24798
24799 <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>
24800 <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>
24801 <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>
24802 <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>
24803 <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>
24804
24805 !! html/parsoid
24806 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24807 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24808 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24809 <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>
24810 <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>
24811 <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>
24812 !! end
24813
24814 !! test
24815 T74884: bdi element in ToC
24816 !! wikitext
24817 __TOC__
24818 ==<bdi>test</bdi>==
24819 !! html/php
24820 <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>
24821 <ul>
24822 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24823 </ul>
24824 </div>
24825
24826 <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>
24827
24828 !! html/parsoid
24829 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24830 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24831 !! end
24832
24833 !! test
24834 T35715: s/strike element in ToC
24835 !! wikitext
24836 __TOC__
24837 ==<s>test</s> test <strike>test</strike>==
24838 !! html/php
24839 <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>
24840 <ul>
24841 <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>
24842 </ul>
24843 </div>
24844
24845 <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>
24846
24847 !! html/parsoid
24848 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24849 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24850 !! end
24851
24852 !! test
24853 T198618: style element in ToC
24854 !! options
24855 styletag=1
24856 !! wikitext
24857 __TOC__
24858 ==<style>.foo {}</style>Style<style>.bar {}</style>==
24859 !! html/php
24860 <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>
24861 <ul>
24862 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
24863 </ul>
24864 </div>
24865
24866 <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>
24867
24868 !! html/parsoid
24869 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24870 <h2 id="Style" data-parsoid='{}'><style>.foo {}</style>Style<style>.bar {}</style></h2>
24871 !! end
24872
24873 !! test
24874 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24875 !! wikitext
24876 __TOC__
24877 ==x==
24878 !! html/php
24879 <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>
24880 <ul>
24881 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24882 </ul>
24883 </div>
24884
24885 <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>
24886
24887 !! html/parsoid
24888 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24889 <h2 id="x" data-parsoid='{}'>x</h2>
24890 !! end
24891
24892 !! article
24893 MediaWiki:T34057
24894 !! text
24895 == {{int:headline_sample}} ==
24896 !! endarticle
24897
24898 !! test
24899 T34057: Title needed when expanding <h> nodes.
24900 !! options
24901 title=[[Main Page]]
24902 !! wikitext
24903 {{int:T34057}}
24904 !! html
24905 <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>
24906
24907 !! end
24908
24909 !! test
24910 Strip marker in urlencode
24911 !! wikitext
24912 {{urlencode:x<nowiki/>y}}
24913 {{urlencode:x<nowiki/>y|wiki}}
24914 {{urlencode:x<nowiki/>y|path}}
24915 {{urlencode:x<pre id="one">two</pre>y}}
24916 !! html/php
24917 <p>xy
24918 xy
24919 xy
24920 xy
24921 </p>
24922 !! end
24923
24924 !! test
24925 Strip marker in lc
24926 !! wikitext
24927 {{lc:x<nowiki/>y}}
24928 !! html
24929 <p>xy
24930 </p>
24931 !! end
24932
24933 !! test
24934 Strip marker in uc
24935 !! wikitext
24936 {{uc:x<nowiki/>y}}
24937 !! html
24938 <p>XY
24939 </p>
24940 !! end
24941
24942 !! test
24943 Strip marker in formatNum
24944 !! wikitext
24945 {{formatnum:1<nowiki/>2}}
24946 {{formatnum:1<nowiki/>2|R}}
24947 !! html
24948 <p>12
24949 12
24950 </p>
24951 !! end
24952
24953 !! test
24954 Check noCommafy in formatNum
24955 !! options
24956 language=be-tarask
24957 !! wikitext
24958 {{formatnum:123456.78}}
24959 {{formatnum:123456.78|NOSEP}}
24960 !! html
24961 <p>123 456,78
24962 123456.78
24963 </p>
24964 !! end
24965
24966 !! test
24967 Wrong option for formatNum (T58199)
24968 !! wikitext
24969 {{formatnum:1,234.56|Random}}
24970 {{formatnum:1,234.56|EVERYTHING}}
24971 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24972 !! html
24973 <p>1,234.56
24974 1,234.56
24975 1,234.56
24976 </p>
24977 !! end
24978
24979 !! test
24980 Strip marker in grammar
24981 !! options
24982 language=fi
24983 !! wikitext
24984 {{grammar:elative|foo<nowiki/>bar}}
24985 !! html
24986 <p>foobarista
24987 </p>
24988 !! end
24989
24990 !! test
24991 Strip marker in padleft
24992 !! wikitext
24993 {{padleft:|2|x<nowiki/>y}}
24994 !! html
24995 <p>xy
24996 </p>
24997 !! end
24998
24999 !! test
25000 Strip marker in padright
25001 !! wikitext
25002 {{padright:|2|x<nowiki/>y}}
25003 !! html
25004 <p>xy
25005 </p>
25006 !! end
25007
25008 !! test
25009 Strip marker in anchorencode
25010 !! wikitext
25011 {{anchorencode:x<nowiki/>y}}
25012 !! html/php
25013 <p>xy
25014 </p>
25015 !! html/parsoid
25016 <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>
25017 !! end
25018
25019 !! test
25020 nowiki inside link inside heading (T20295)
25021 !! wikitext
25022 ==[[foo|x<nowiki>y</nowiki>z]]==
25023 !! html
25024 <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>
25025
25026 !! end
25027
25028 !! test
25029 new support for bdi element (T33817)
25030 !! wikitext
25031 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25032 !! html
25033 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25034
25035 !!end
25036
25037 !! test
25038 Ignore pipe between table row attributes
25039 !! wikitext
25040 {|
25041 |quux
25042 |- id=foo | style='color: red'
25043 |bar
25044 |}
25045 !! html
25046 <table>
25047 <tr>
25048 <td>quux
25049 </td></tr>
25050 <tr id="foo" style="color: red">
25051 <td>bar
25052 </td></tr></table>
25053
25054 !! end
25055
25056 !!test
25057 Language parser function
25058 !! wikitext
25059 {{#language:ar}}
25060 !! html
25061 <p>العربية
25062 </p>
25063 !! end
25064
25065 !!test
25066 Padleft and padright (default 0-padding)
25067 !! wikitext
25068 {{padleft:xyz|5}}
25069 {{padright:xyz|5}}
25070 !! html/php
25071 <p>00xyz
25072 xyz00
25073 </p>
25074 !! html/parsoid
25075 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25076 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25077 !! end
25078
25079 !!test
25080 Padleft and padright (partial fill)
25081 !! wikitext
25082 {{padleft:xyz|6|ab}}
25083 {{padright:xyz|6|ab}}
25084 !! html/php
25085 <p>abaxyz
25086 xyzaba
25087 </p>
25088 !! html/parsoid
25089 <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>
25090 <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>
25091 !! end
25092
25093 !!test
25094 Padleft and padright as substr
25095 !! wikitext
25096 {{padleft:|3|abcde}}
25097 {{padright:|3|abcde}}
25098 !! html/php
25099 <p>abc
25100 abc
25101 </p>
25102 !! html/parsoid
25103 <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>
25104 <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>
25105 !! end
25106
25107 !! test
25108 Padleft and padright with non-numerical length (T180403)
25109 !! wikitext
25110 {{padleft:abcdef|junk}}
25111 {{padright:abcdef|junk}}
25112 !! html/php
25113 <p>abcdef
25114 abcdef
25115 </p>
25116 !! end
25117
25118 !!test
25119 Special parser function
25120 !! wikitext
25121 {{#special:RandomPage}}
25122 {{#special:BaDtItLe}}
25123 {{#special:Foobar}}
25124 !! html
25125 <p>Special:Random
25126 Special:Badtitle
25127 Special:Foobar
25128 </p>
25129 !! end
25130
25131 !!test
25132 T36939 - Case insensitive link parsing ([HttP://])
25133 !! wikitext
25134 [HttP://MediaWiki.Org/]
25135 !! html/php
25136 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25137 </p>
25138 !! html/parsoid
25139 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25140 !! end
25141
25142 !!test
25143 T36939 - Case insensitive link parsing ([HttP:// title])
25144 !! wikitext
25145 [HttP://MediaWiki.Org/ MediaWiki]
25146 !! html
25147 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25148 </p>
25149 !! end
25150
25151 !!test
25152 T36939 - Case insensitive link parsing (HttP://)
25153 !! wikitext
25154 HttP://MediaWiki.Org/
25155 !! html/php
25156 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25157 </p>
25158 !! html/parsoid
25159 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25160 !! end
25161
25162 !!test
25163 Disable TOC
25164 !! options
25165 notoc
25166 !! wikitext
25167 Lead
25168 ==Section 1==
25169 ==Section 2==
25170 ==Section 3==
25171 ==Section 4==
25172 ==Section 5==
25173 !! html
25174 <p>Lead
25175 </p>
25176
25177 <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>
25178 <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>
25179 <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>
25180 <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>
25181 <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>
25182
25183 !! end
25184
25185
25186 ###
25187 ### Parsoid-specific tests
25188 ### Parsoid-PHP parser incompatibilities
25189 ###
25190 !!test
25191 1. SOL-sensitive wikitext tokens as template-args
25192 !!options
25193 parsoid=wt2html,wt2wt
25194 !! wikitext
25195 {{echo|*a}}
25196 {{echo|#a}}
25197 {{echo|:a}}
25198 !! html
25199 <span about="#mwt1" typeof="mw:Transclusion">
25200 </span><ul about="#mwt1"><li>a</li>
25201 </ul>
25202 <span about="#mwt2" typeof="mw:Transclusion">
25203 </span><ol about="#mwt2"><li>a</li>
25204 </ol>
25205 <span about="#mwt3" typeof="mw:Transclusion">
25206 </span><dl about="#mwt3"><dd>a</dd>
25207 </dl>
25208 !!end
25209
25210 #### -----------------------------------------------------------------
25211 #### Parsoid-specific functionality tests
25212 #### -----------------------------------------------------------------
25213
25214 # T65642/T68749: Formatting elt fixup around images.
25215 # We know wt2wt will fail, but we expect selser to pass.
25216 # Due to the nature of our testing, wt2wt and selser tests will enter the
25217 # blacklist and we'll catch selser regressions based on changes to the
25218 # blacklist entries for selser tests.
25219 !! test
25220 1. Treebuilder fixup of formatting elt
25221 !! options
25222 parsoid=wt2html,wt2wt
25223 !! wikitext
25224 {|
25225 |
25226 <small>
25227 [[Image:Foobar.jpg|right|Test]]
25228 </small>
25229 |}
25230 !! html/php+tidy
25231 <table>
25232 <tbody><tr>
25233 <td>
25234 <p><small>
25235 </small></p><small>
25236 <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>
25237 </small><p><small></small>
25238 </p>
25239 </td></tr></tbody></table>
25240 !! html/parsoid
25241 <table>
25242 <tbody><tr><td>
25243 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25244 <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>
25245 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25246 </tbody></table>
25247 !! end
25248
25249 !! test
25250 2. Treebuilder fixup of formatting elt
25251 !! options
25252 parsoid=wt2html,wt2wt
25253 !! wikitext
25254 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25255
25256 <small>[[Image:Foobar.jpg|right|300px]]</small>
25257 !! html/php+tidy
25258 <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>
25259 </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>
25260 !! html/parsoid
25261 <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>
25262
25263 <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>
25264 !! end
25265
25266 !! test
25267 3. Treebuilder fixup of formatting elt
25268 !! options
25269 parsoid=wt2html,wt2wt
25270 !! wikitext
25271 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25272 !! html/php+tidy
25273 <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>
25274 </p>
25275 !! html/parsoid
25276 <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>
25277 !! end
25278
25279 !! test
25280 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25281 !! options
25282 parsoid=wt2html,wt2wt
25283 !! wikitext
25284 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25285 !! html/php+tidy
25286 <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>
25287 !! html/parsoid
25288 <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>
25289 !! end
25290
25291 #### ----------------------------------------------------------------
25292 #### Parsoid-only testing of Parsoid's impl of LST
25293 #### Not implemented yet, see
25294 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25295 #### ----------------------------------------------------------------
25296
25297 ## We still need to support serializing the older format while content is stored.
25298 !! test
25299 LST Sections: Backwards compatibility
25300 !! options
25301 parsoid={
25302 "suppressErrors": true,
25303 "modes": ["html2wt"]
25304 }
25305 !! wikitext
25306 <section begin="2011-05-16" />
25307 <section end="2014-04-10 (MW 1.23wmf22)" />
25308 !! html/parsoid
25309 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25310 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25311 !! end
25312
25313 !! test
25314 LST Sections: Newfangled approach
25315 !! wikitext
25316 <section begin="2011-05-16" />
25317 <section end="2014-04-10 (MW 1.23wmf22)" />
25318 !! html/parsoid
25319 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25320 </span>
25321 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25322 </span></p>
25323 !! end
25324
25325 #--------- Test stripping of empty nodes in template content ----------
25326
25327 !! test
25328 Empty LI and TR nodes should be stripped from template content
25329 !! wikitext
25330 {{EmptyLITest}}
25331 {{EmptyTRTest}}
25332 !! html/parsoid
25333 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25334 <li>a</li>
25335 <li>b</li>
25336 </ul>
25337 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25338 <tbody>
25339 <tr>
25340 <td>foo</td>
25341 </tr>
25342 <tr>
25343 <td>bar</td>
25344 </tr>
25345 </tbody>
25346 </table>
25347 !! end
25348
25349 !! test
25350 Empty LI and TR nodes should not be stripped from top-level content
25351 !! wikitext
25352 *a
25353 *
25354 *b
25355
25356 {|
25357 |-
25358 |-
25359 |foo
25360 |}
25361 !! html/parsoid
25362 <ul>
25363 <li>a</li>
25364 <li class='mw-empty-elt'></li>
25365 <li>b</li>
25366 </ul>
25367 <table>
25368 <tbody>
25369 <tr class='mw-empty-elt'></tr>
25370 <tr>
25371 <td>foo</td>
25372 </tr>
25373 </tbody>
25374 </table>
25375 !! end
25376
25377 !! test
25378 Empty TR nodes should not be stripped if they have any attributes set
25379 !! wikitext
25380 {{EmptyTRWithHTMLAttrTest}}
25381 !! html/parsoid
25382 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25383 <tr align='center'></tr>
25384 <tr><td>foo</td></tr>
25385 <tr align='center'></tr>
25386 <tr><td>bar</td></tr>
25387 </table>
25388 !! end
25389
25390 #### ----------------------------------------------------------------
25391 #### The following section of tests are primarily to test
25392 #### wikitext escaping capabilities of Parsoid. Given that
25393 #### escaping can be done any number of ways, the wikitext (input)
25394 #### is always adjusted to reflect how Parsoid adds nowiki
25395 #### escape tags.
25396 ####
25397 #### We are marking several tests as parsoid-only since the
25398 #### HTML in the result section is different from what the
25399 #### PHP parser generates for it.
25400 #### ----------------------------------------------------------------
25401
25402
25403 #### --------------- Headings ---------------
25404 #### 0. Unnested
25405 #### 1. Nested inside html <h1>=foo=</h1>
25406 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25407 #### 3. Nested inside html with wikitext split by html tags
25408 #### 4. No escape needed
25409 #### 5. Empty headings <h1></h1>
25410 #### 6. Heading chars in SOL context
25411 #### ----------------------------------------
25412 !! test
25413 Headings: 0. Unnested
25414 !! options
25415 parsoid=html2wt
25416 !! html/parsoid
25417 <p>=foo=</p>
25418
25419 <p> =foo=
25420 <!--cmt-->
25421 =foo=</p>
25422
25423 <p>=foo<i>a</i>=</p>
25424 !! wikitext
25425 <nowiki>=foo=</nowiki>
25426
25427 <nowiki> </nowiki>=foo=
25428 <!--cmt-->
25429 <nowiki>=foo=</nowiki>
25430
25431 =foo''a''<nowiki>=</nowiki>
25432 !!end
25433
25434 # New headings and existing headings are handled differently
25435 !! test
25436 Headings: 1. Nested inside html
25437 !! options
25438 parsoid=html2wt
25439 !! html/parsoid
25440 <h1>=foo=</h1>
25441 <h2>=foo=</h2>
25442 <h3>=foo=</h3>
25443
25444 <h1 data-parsoid=''>=foo=</h1>
25445 <h2 data-parsoid=''>=foo=</h2>
25446 <h3 data-parsoid=''>=foo=</h3>
25447 <h4 data-parsoid=''>=foo=</h4>
25448 <h5 data-parsoid=''>=foo=</h5>
25449 <h6 data-parsoid=''>=foo=</h6>
25450 !! wikitext
25451 = =foo= =
25452
25453 == =foo= ==
25454
25455 === =foo= ===
25456
25457 =<nowiki>=foo=</nowiki>=
25458 ==<nowiki>=foo=</nowiki>==
25459 ===<nowiki>=foo=</nowiki>===
25460 ====<nowiki>=foo=</nowiki>====
25461 =====<nowiki>=foo=</nowiki>=====
25462 ======<nowiki>=foo=</nowiki>======
25463
25464 !!end
25465
25466 !! test
25467 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25468 !! options
25469 parsoid=html2wt
25470 !! html/parsoid
25471 <h1>foo</h1>*bar
25472 <h1>foo</h1>=bar
25473 <h1>foo</h1>=bar=
25474 !! wikitext
25475 = foo =
25476 <nowiki>*</nowiki>bar
25477
25478 = foo =
25479 =bar
25480
25481 = foo =
25482 <nowiki>=bar=</nowiki>
25483 !!end
25484
25485 !! test
25486 Headings: 3. Nested inside html with wikitext split by html tags
25487 !! options
25488 parsoid=html2wt
25489 !! html/parsoid
25490 <h1>=<b>bold</b>foo=</h1>
25491 !! wikitext
25492 = ='''bold'''foo= =
25493 !!end
25494
25495 !! test
25496 Headings: 4a. No escaping needed (testing just h1 and h2)
25497 !! options
25498 parsoid=html2wt
25499 !! html/parsoid
25500 <h1>=foo</h1>
25501 <h1>foo=</h1>
25502 <h1> =foo= </h1>
25503 <h1>=foo= bar</h1>
25504 <h2>=foo</h2>
25505 <h2>foo=</h2>
25506 <h1>=</h1>
25507 <h1><i>=</i>foo=</h1>
25508 !! wikitext
25509 = =foo =
25510
25511 = foo= =
25512
25513 = =foo= =
25514
25515 = =foo= bar =
25516
25517 == =foo ==
25518
25519 == foo= ==
25520
25521 = = =
25522
25523 = ''=''foo= =
25524 !!end
25525
25526 !! test
25527 Headings: 4b. No escaping needed (inside p-tags)
25528 !! options
25529 parsoid=html2wt
25530 !! html/parsoid
25531 <p>=foo= x
25532 =foo= <s></s>
25533 </p>
25534 !! wikitext
25535 =foo= x
25536 =foo= <s></s>
25537 !! html/php
25538 <p>=foo= x
25539 =foo= <s></s>
25540 </p>
25541 !!end
25542
25543 !! test
25544 Headings: 4c. Short headings (1)
25545 !! options
25546 parsoid=html2wt
25547 !! html/parsoid
25548 <p>===
25549 </p>
25550 !! wikitext
25551 <nowiki>===</nowiki>
25552 !! html/php
25553 <p>===
25554 </p>
25555 !! end
25556
25557 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25558 !! test
25559 Headings: 4d. Short headings (2)
25560 !! options
25561 parsoid=wt2html,html2html
25562 !! wikitext
25563 =
25564 ==
25565 ===
25566 ====
25567 =====
25568 !! html/php
25569 <p>=
25570 ==
25571 </p>
25572 <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>
25573 <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>
25574 <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>
25575
25576 !! html/parsoid
25577 <p>=
25578 ==</p>
25579 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25580 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25581 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25582 !! end
25583
25584 !! test
25585 Headings: 5. Empty headings
25586 !! options
25587 parsoid=html2wt
25588 !! html/parsoid
25589 <h1 data-parsoid='{}'></h1>
25590
25591 <h2 data-parsoid='{}'></h2>
25592
25593 <h3 data-parsoid='{}'></h3>
25594
25595 <h4 data-parsoid='{}'></h4>
25596
25597 <h5 data-parsoid='{}'></h5>
25598
25599 <h6 data-parsoid='{}'></h6>
25600 !! wikitext
25601 =<nowiki/>=
25602
25603 ==<nowiki/>==
25604
25605 ===<nowiki/>===
25606
25607 ====<nowiki/>====
25608
25609 =====<nowiki/>=====
25610
25611 ======<nowiki/>======
25612 !!end
25613
25614 !! test
25615 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25616 !! options
25617 parsoid=html2wt
25618 !! html/parsoid
25619 <p>=a=</p>
25620
25621 <p>=a=</p>
25622
25623 <p>=a=</p>
25624 !! wikitext
25625 <nowiki>=a=</nowiki>
25626
25627 <nowiki>=a=</nowiki>
25628
25629 <nowiki>=a=</nowiki>
25630 !!end
25631
25632 !! test
25633 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25634 !! options
25635 parsoid=html2wt
25636 !! html/parsoid
25637 <p>=a=
25638 b</p>
25639
25640 <p>=a=
25641 b</p>
25642
25643 <p>=a=
25644 b</p>
25645 !! wikitext
25646 <nowiki>=a=</nowiki>
25647 b
25648
25649 <nowiki>=a=</nowiki>
25650 b
25651
25652 <nowiki>=a=</nowiki>
25653 b
25654 !!end
25655
25656 !! test
25657 Headings: 6c. Heading chars in SOL context (leading newline break)
25658 !! options
25659 parsoid=html2wt
25660 !! html/parsoid
25661 <p>a
25662 =b=</p>
25663 !! wikitext
25664 a
25665 <nowiki>=b=</nowiki>
25666 !!end
25667
25668 !! test
25669 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25670 !! options
25671 parsoid=html2wt
25672 !! html/parsoid
25673 <!--c0--><p>=a=</p>
25674
25675 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25676 !! wikitext
25677 <!--c0--><nowiki>=a=</nowiki>
25678
25679 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25680 !!end
25681
25682 !! test
25683 Headings: 6d. Heading chars in SOL context (No escaping needed)
25684 !! options
25685 parsoid=html2wt
25686 !! html/parsoid
25687 =a=<div>b</div>
25688 !! wikitext
25689 =a=<div>b</div>
25690 !!end
25691
25692 !! test
25693 Headings: 7. Insert a newline between new content and headings
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <h2>NEW</h2>
25698 <p>new</p>
25699 <h2 data-parsoid='{}'>A</h2>
25700 <p data-parsoid='{}'>a</p>
25701 !! wikitext
25702 == NEW ==
25703 new
25704
25705 ==A==
25706 a
25707
25708 !! end
25709
25710 !! test
25711 Headings: Used as horizontal rule
25712 !! config
25713 wgFragmentMode=[ 'html5', 'legacy' ]
25714 !! options
25715 parsoid=wt2html
25716 !! wikitext
25717 ===============
25718 !! html/php
25719 <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>
25720
25721 !! html/parsoid
25722 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25723 !! end
25724
25725 #### --------------- Lists ---------------
25726 #### 0. Outside nests (*foo, etc.)
25727 #### 1. Nested inside html <ul><li>*foo</li></ul>
25728 #### 2. Inside definition lists
25729 #### 3. Only bullets at start should be escaped
25730 #### 4. No escapes needed
25731 #### 5. No unnecessary escapes
25732 #### 6. Escape bullets in SOL position
25733 #### 7. Escape bullets in a multi-line context
25734 #### ----------------------------------------
25735
25736 !! test
25737 Lists: 0. Outside nests
25738 !! options
25739 parsoid=html2wt
25740 !! html/parsoid
25741 <p>*foo</p>
25742
25743 <p>#foo</p>
25744
25745 <p>;Foo:bar</p>
25746 !! wikitext
25747 <nowiki>*</nowiki>foo
25748
25749 <nowiki>#</nowiki>foo
25750
25751 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25752 !!end
25753
25754 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25755 ## to test wikitext escaping, and insignificant whitespace diffs
25756 ## cause PHP parser tests to barf
25757 !! test
25758 Lists: 1. Nested inside html (No unnecessary escapes)
25759 !! options
25760 parsoid=html2wt
25761 !! html/parsoid
25762 <ul>
25763 <li>*foo</li>
25764 <li>#foo</li>
25765 <li>:foo</li>
25766 <li>;foo</li>
25767 <li data-parsoid='{}'>*foo</li>
25768 <li data-parsoid='{}'>#foo</li>
25769 <li data-parsoid='{}'>:foo</li>
25770 <li data-parsoid='{}'>;foo</li>
25771 </ul>
25772
25773 <ol>
25774 <li>*foo</li>
25775 <li>#foo</li>
25776 <li>:foo</li>
25777 <li>;foo</li>
25778 <li data-parsoid='{}'>*foo</li>
25779 <li data-parsoid='{}'>#foo</li>
25780 <li data-parsoid='{}'>:foo</li>
25781 <li data-parsoid='{}'>;foo</li>
25782 </ol>
25783 !! wikitext
25784 * *foo
25785 * #foo
25786 * :foo
25787 * ;foo
25788 *<nowiki>*foo</nowiki>
25789 *<nowiki>#foo</nowiki>
25790 *<nowiki>:foo</nowiki>
25791 *<nowiki>;foo</nowiki>
25792
25793 # *foo
25794 # #foo
25795 # :foo
25796 # ;foo
25797 #<nowiki>*foo</nowiki>
25798 #<nowiki>#foo</nowiki>
25799 #<nowiki>:foo</nowiki>
25800 #<nowiki>;foo</nowiki>
25801 !!end
25802
25803 !! test
25804 Lists: 2. Inside definition lists
25805 !! options
25806 parsoid=html2wt
25807 !! html/parsoid
25808 <dl><dt>;foo</dt></dl>
25809 <dl><dt>:foo</dt></dl>
25810 <dl><dt>:foo</dt>
25811 <dd>bar</dd></dl>
25812 <dl><dd>:foo</dd></dl>
25813 !! wikitext
25814 ; ;foo
25815
25816 ; <nowiki>:foo</nowiki>
25817
25818 ; <nowiki>:foo</nowiki>
25819 : bar
25820
25821 : :foo
25822 !!end
25823
25824 !! test
25825 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25826 !! options
25827 parsoid=html2wt
25828 !! html/parsoid
25829 <ul>
25830 <li>*foo*bar</li>
25831 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25832 </ul>
25833 !! wikitext
25834 * *foo*bar
25835 *<nowiki>*foo</nowiki>''it''*bar
25836 !!end
25837
25838 !! test
25839 Lists: 4. No escapes needed
25840 !! options
25841 parsoid=html2wt
25842 !! html/parsoid
25843 <ul>
25844 <li>foo*bar
25845 </li>
25846 </ul>
25847 <ul>
25848 <li><i>foo</i>*bar
25849 </li>
25850 </ul>
25851 <ul>
25852 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25853 </li>
25854 </ul>
25855 <ul>
25856 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25857 </li>
25858 </ul>
25859 !! wikitext
25860 *foo*bar
25861
25862 *''foo''*bar
25863
25864 *[[Foo]]: bar
25865
25866 *[[Foo]]*bar
25867 !!end
25868
25869 !! test
25870 Lists: 5. No unnecessary escapes
25871 !! options
25872 parsoid=html2wt
25873 !! html/parsoid
25874 <ul><li> bar <span>[[foo]]</span></li></ul>
25875 <ul><li> =bar <span>[[foo]]</span></li></ul>
25876 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25877 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25878 <ul><li> =bar <span>foo]]</span>=</li></ul>
25879 <ul><li> <s></s>: a</li></ul>
25880 <ul><li> <i>* foo</i></li></ul>
25881
25882 !! wikitext
25883 * bar <span><nowiki>[[foo]]</nowiki></span>
25884
25885 * =bar <span><nowiki>[[foo]]</nowiki></span>
25886
25887 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25888
25889 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25890
25891 * =bar <span>foo]]</span>=
25892
25893 * <s></s>: a
25894
25895 * ''* foo''
25896 !!end
25897
25898 !! test
25899 Lists: 6. Escape bullets in SOL position
25900 !! options
25901 parsoid=html2wt
25902 !! html/parsoid
25903 <p><!--cmt-->*foo</p>
25904 !! wikitext
25905 <!--cmt--><nowiki>*</nowiki>foo
25906 !!end
25907
25908 !! test
25909 Lists: 7. Escape bullets in a multi-line context
25910 !! options
25911 parsoid=html2wt
25912 !! html/parsoid
25913 <p>a
25914 *b
25915 </p>
25916 !! wikitext
25917 a
25918 <nowiki>*</nowiki>b
25919 !!end
25920
25921 !! test
25922 Lists: 8. Escape colons only if not present in tags
25923 !! options
25924 parsoid=html2wt
25925 !! html/parsoid
25926 <dl><dt>a:b<i>c:d</i></dt></dl>
25927 !! wikitext
25928 ; <nowiki>a:b</nowiki>''c:d''
25929 !! end
25930
25931 #### --------------- HRs ---------------
25932 #### 1. Single line
25933 #### -----------------------------------
25934
25935 !! test
25936 HRs: 1. Single line
25937 !! options
25938 parsoid=html2wt
25939 !! html/parsoid
25940 <hr />----
25941 <hr />=foo=
25942 <hr />*foo
25943 !! wikitext
25944 ----<nowiki>----</nowiki>
25945 ----=foo=
25946 ----*foo
25947 !! end
25948
25949 #### --------------- Tables ---------------
25950 #### 1a. Simple example
25951 #### 1b. No escaping needed (!foo)
25952 #### 1c. No escaping needed (|foo)
25953 #### 1d. No escaping needed (|}foo)
25954 ####
25955 #### 2a. Nested in td (<td>foo|bar</td>)
25956 #### 2b. Nested in td (<td>foo||bar</td>)
25957 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25958 ####
25959 #### 3a. Nested in th (<th>foo!bar</th>)
25960 #### 3b. Nested in th (<th>foo!!bar</th>)
25961 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25962 ####
25963 #### 4a. Escape -
25964 #### 4b. Escape +
25965 #### 4c. No escaping needed
25966 #### --------------------------------------
25967
25968 !! test
25969 Tables: 1a. Simple example
25970 !! options
25971 parsoid=html2wt
25972 !! html/parsoid
25973 <p>{|
25974 |}
25975 </p>
25976 !! wikitext
25977 <nowiki>{|</nowiki>
25978 |}
25979 !! end
25980
25981 !! test
25982 Tables: 1b. No escaping needed
25983 !! options
25984 parsoid=html2wt
25985 !! html/parsoid
25986 <p>!foo
25987 </p>
25988 !! wikitext
25989 !foo
25990 !! end
25991
25992 !! test
25993 Tables: 1c. No escaping needed
25994 !! options
25995 parsoid=html2wt
25996 !! html/parsoid
25997 <p>|foo
25998 </p>
25999 !! wikitext
26000 |foo
26001 !! end
26002
26003 !! test
26004 Tables: 1d. No escaping needed
26005 !! options
26006 parsoid=html2wt
26007 !! html/parsoid
26008 <p>|}foo
26009 </p>
26010 !! wikitext
26011 |}foo
26012 !! end
26013
26014 !! test
26015 Tables: 2a. Nested in td
26016 !! options
26017 parsoid=html2wt
26018 !! html/parsoid
26019 <table><tbody><tr>
26020 <td>foo|bar</td></tr>
26021 <tr><td>x<div>a|b</div></td>
26022 </tbody></table>
26023 !! wikitext
26024 {|
26025 |<nowiki>foo|bar</nowiki>
26026 |-
26027 |x<div><nowiki>a|b</nowiki></div>
26028 |}
26029 !! html/php+tidy
26030 <table>
26031 <tbody><tr>
26032 <td>foo|bar
26033 </td></tr>
26034 <tr>
26035 <td>x<div>a|b</div>
26036 </td></tr></tbody></table>
26037 !! end
26038
26039 !! test
26040 Tables: 2b. Nested in td
26041 !! options
26042 parsoid=html2wt
26043 !! html/parsoid
26044 <table><tbody><tr>
26045 <td>foo||bar</td>
26046 <td>a<i>b||c</i></td>
26047 <td>a<i><div>b||c</div></i></td>
26048 </tr></tbody></table>
26049 !! wikitext
26050 {|
26051 |<nowiki>foo||bar</nowiki>
26052 |a''<nowiki>b||c</nowiki>''
26053 |a''<div><nowiki>b||c</nowiki></div>''
26054 |}
26055 !! html/php
26056 <table>
26057 <tr>
26058 <td>foo||bar
26059 </td>
26060 <td>a<i>b||c</i>
26061 </td>
26062 <td>a<i><div>b||c</div></i>
26063 </td></tr></table>
26064
26065 !! end
26066
26067 !! test
26068 Tables: 2c. Nested in td -- no escaping needed
26069 !! options
26070 parsoid=html2wt
26071 !! html/*
26072 <table>
26073 <tr>
26074 <td>foo!!bar
26075 </td></tr></table>
26076
26077 !! wikitext
26078 {|
26079 |foo!!bar
26080 |}
26081 !! end
26082
26083 !! test
26084 Tables: 3a. Nested in th
26085 !! options
26086 parsoid=html2wt
26087 !! html/*
26088 <table>
26089 <tr>
26090 <th>foo!bar
26091 </th></tr></table>
26092
26093 !! wikitext
26094 {|
26095 !foo!bar
26096 |}
26097 !! end
26098
26099 !! test
26100 Tables: 3b. Nested in th
26101 !! options
26102 parsoid=html2wt
26103 !! html/parsoid
26104 <table><tbody>
26105 <tr><th>foo!!bar</th>
26106 <th><i>foo|bar</i></th>
26107 <th><i>foo!!bar</i></th>
26108 <th><i><span>foo!!bar</span></i></th>
26109 </tr></tbody></table>
26110 !! wikitext
26111 {|
26112 !<nowiki>foo!!bar</nowiki>
26113 !''<nowiki>foo|bar</nowiki>''
26114 !''<nowiki>foo!!bar</nowiki>''
26115 !''<span><nowiki>foo!!bar</nowiki></span>''
26116 |}
26117 !! html/php
26118 <table>
26119 <tr>
26120 <th>foo!!bar
26121 </th>
26122 <th><i>foo|bar</i>
26123 </th>
26124 <th><i>foo!!bar</i>
26125 </th>
26126 <th><i><span>foo!!bar</span></i>
26127 </th></tr></table>
26128
26129 !! end
26130
26131 !! test
26132 Tables: 3c. Nested in th
26133 !! options
26134 parsoid=html2wt
26135 !! html/parsoid
26136 <table><tbody>
26137 <tr><th>foo||bar</th>
26138 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26139 </tr></tbody></table>
26140 !! wikitext
26141 {|
26142 !<nowiki>foo||bar</nowiki>
26143 !<nowiki>foo||bar</nowiki>
26144 |}
26145 !! html/php
26146 <table>
26147 <tr>
26148 <th>foo||bar
26149 </th>
26150 <th>foo||bar
26151 </th></tr></table>
26152
26153 !! end
26154
26155 !! test
26156 Tables: 4a. Escape -
26157 !! options
26158 parsoid=html2wt
26159 !! html/*
26160 <table>
26161 <tr>
26162 <th>-bar
26163 </th></tr>
26164 <tr>
26165 <td>-bar
26166 </td></tr></table>
26167
26168 !! wikitext
26169 {|
26170 !-bar
26171 |-
26172 |<nowiki>-bar</nowiki>
26173 |}
26174 !! end
26175
26176 !! test
26177 Tables: 4b. Escape +
26178 !! options
26179 parsoid=html2wt
26180 !! html/*
26181 <table>
26182 <tr>
26183 <th>+bar
26184 </th></tr>
26185 <tr>
26186 <td>+bar
26187 </td></tr></table>
26188
26189 !! wikitext
26190 {|
26191 !+bar
26192 |-
26193 |<nowiki>+bar</nowiki>
26194 |}
26195 !! end
26196
26197 !! test
26198 Tables: 4c. No escaping needed
26199 !! options
26200 parsoid=html2wt
26201 !! html/parsoid
26202 <table><tbody>
26203 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26204 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26205 <tr><td>foo
26206 <p>bar|baz
26207 +bar
26208 -bar</p></td></tr>
26209 <tr><td>x
26210 <div>a|b</div></td>
26211 </tbody></table>
26212 !! wikitext
26213 {|
26214 |foo-bar
26215 |foo+bar
26216 |-
26217 |''foo''-bar
26218 |''foo''+bar
26219 |-
26220 |foo
26221 bar|baz
26222 +bar
26223 -bar
26224 |-
26225 |x
26226 <div>a|b</div>
26227 |}
26228 !! html/php
26229 <table>
26230 <tr>
26231 <td>foo-bar
26232 </td>
26233 <td>foo+bar
26234 </td></tr>
26235 <tr>
26236 <td><i>foo</i>-bar
26237 </td>
26238 <td><i>foo</i>+bar
26239 </td></tr>
26240 <tr>
26241 <td>foo
26242 <p>bar|baz
26243 +bar
26244 -bar
26245 </p>
26246 </td></tr>
26247 <tr>
26248 <td>x
26249 <div>a|b</div>
26250 </td></tr></table>
26251
26252 !! end
26253
26254 !! test
26255 Tables: 4d. No escaping needed
26256 !! options
26257 parsoid=html2wt
26258 !! html/parsoid
26259 <table>
26260 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26261 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26262 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26263 </tbody></table>
26264 !! wikitext
26265 {|
26266 |[[Foo]]-bar
26267 ||+1
26268 ||-2
26269 |}
26270 !! html/php
26271 <table>
26272 <tr>
26273 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26274 </td>
26275 <td>+1
26276 </td>
26277 <td>-2
26278 </td></tr></table>
26279
26280 !! end
26281
26282 !! test
26283 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26284 !! options
26285 parsoid=html2wt
26286 !! html/parsoid
26287 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26288
26289 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26290
26291 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26292
26293 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26294 !! wikitext
26295 {|
26296 | || align="center" | ||
26297 |}
26298
26299 {|
26300 |
26301 | align="center" |
26302 |
26303 |}
26304
26305 {|
26306 | {{!}}{{!}} align="center" | ||
26307 |}
26308
26309 {|
26310 ! !! align="center" | !!
26311 |}
26312 !! html/php+tidy
26313 <table>
26314 <tbody><tr>
26315 <td></td>
26316 <td align="center"></td>
26317 <td>
26318 </td></tr></tbody></table>
26319 <table>
26320 <tbody><tr>
26321 <td>
26322 </td>
26323 <td align="center">
26324 </td>
26325 <td>
26326 </td></tr></tbody></table>
26327 <table>
26328 <tbody><tr>
26329 <td></td>
26330 <td align="center"></td>
26331 <td>
26332 </td></tr></tbody></table>
26333 <table>
26334 <tbody><tr>
26335 <th></th>
26336 <th align="center"></th>
26337 <th>
26338 </th></tr></tbody></table>
26339 !! end
26340
26341 !! test
26342 T97430: Don't emit empty nowiki pairs around marker meta tags
26343 !! options
26344 parsoid=html2wt
26345 !! html/parsoid
26346 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26347 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26348 !! wikitext
26349 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26350 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26351 !! end
26352
26353 !! test
26354 Unclosed xmlish element in table line shouldn't eat end delimiters
26355 !! options
26356 parsoid=html2wt
26357 !! html/parsoid
26358 <table>
26359 <tbody><tr><td> &lt;foo</td>
26360 <td> bar></td></tr>
26361 </tbody></table>
26362 !! wikitext
26363 {|
26364 | <foo
26365 | bar>
26366 |}
26367 !! html/php
26368 <table>
26369 <tr>
26370 <td>&lt;foo
26371 </td>
26372 <td>bar&gt;
26373 </td></tr></table>
26374
26375 !! end
26376
26377 #### --------------- Links ----------------
26378 #### 1. Quote marks in link text
26379 #### 2. Wikilinks: Escapes needed
26380 #### 3. Wikilinks: No escapes needed
26381 #### 4. Extlinks: Escapes needed
26382 #### 5. Extlinks: No escapes needed
26383 #### --------------------------------------
26384 !! test
26385 Links 1. WikiLinks: No escapes needed
26386 !! options
26387 parsoid=html2wt
26388 !! html/parsoid
26389 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26390 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26391 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26392 !! wikitext
26393 [[Foo|Foo''boo'']]
26394 [[Foo|[Foobar]]]
26395 [[Foo|x [Foobar] x]]
26396 !! html/php
26397 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26398 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26399 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26400 </p>
26401 !! end
26402
26403 !! test
26404 Links 2. WikiLinks: Escapes needed
26405 !! options
26406 parsoid=html2wt
26407 !! html/parsoid
26408 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26409 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26410 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26411 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26412 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26413 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26414 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26415 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26416 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26417 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26418 !! wikitext
26419 [[Foo|<nowiki>Foobar]</nowiki>]]
26420 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26421 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26422 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26423 [[Foo|<nowiki>|Bar</nowiki>]]
26424 [[Foo|<nowiki>]]bar</nowiki>]]
26425 [[Foo|<nowiki>[[bar</nowiki>]]
26426 [[Foo|<nowiki>x [[ y</nowiki>]]
26427 [[Foo|<nowiki>x ]] y</nowiki>]]
26428 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26429 !! html/php
26430 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26431 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26432 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26433 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26434 <a href="/wiki/Foo" title="Foo">|Bar</a>
26435 <a href="/wiki/Foo" title="Foo">]]bar</a>
26436 <a href="/wiki/Foo" title="Foo">[[bar</a>
26437 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26438 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26439 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26440 </p>
26441 !! end
26442
26443 !! test
26444 Links 3. WikiLinks: No escapes needed
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26449 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26450 !! wikitext
26451 [[Foo|[Foobar]]
26452 [[Foo|foo|bar]]
26453 !! html/php
26454 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26455 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26456 </p>
26457 !! end
26458
26459 !! test
26460 Links 4. ExtLinks: Escapes needed
26461 !! options
26462 parsoid=html2wt
26463 !! html/parsoid
26464 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26465 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26466 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26467 <p>[http://google.com]</p>
26468 <p>[http://google.com google]</p>
26469 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26470 <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>
26471 !! wikitext
26472 [http://google.com <nowiki>[google]</nowiki>]
26473 [http://google.com <nowiki>google]</nowiki>]
26474 [http://google.com <nowiki>goog] le</nowiki>]
26475
26476 <nowiki>[http://google.com]</nowiki>
26477
26478 <nowiki>[http://google.com google]</nowiki>
26479
26480 [http://google.com<nowiki>]</nowiki>
26481
26482 [{{echo|http://google.com}}<nowiki>]</nowiki>
26483 !! html/php
26484 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26485 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26486 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26487 </p><p>[http://google.com]
26488 </p><p>[http://google.com google]
26489 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26490 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26491 </p>
26492 !! end
26493
26494 !! test
26495 Links 5. ExtLinks: No escapes needed
26496 !! options
26497 parsoid=html2wt
26498 !! html/parsoid
26499 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26500 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26501 !! wikitext
26502 [http://google.com [google]
26503
26504 [[http://google.com]]
26505 !! html/php
26506 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26507 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26508 </p>
26509 !! end
26510
26511 !! test
26512 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26513 !! options
26514 parsoid=html2wt
26515 !! html/parsoid
26516 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26517 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26518 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26519 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26520 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26521 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26522 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26523 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26524 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26525 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26526 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26527 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26528 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26529 </p>
26530 !! wikitext
26531 x<nowiki/>http://example.com<nowiki/>y
26532 http://example.com<nowiki/>?x
26533 http://example.com<nowiki/>&x
26534 http://example.com<nowiki/>'x
26535 http://example.com<nowiki/>,x
26536 http://example.com<nowiki/>.x
26537 http://example.com<nowiki/>;x
26538 http://example.com<nowiki/>:x
26539 http://example.com<nowiki/>;x
26540 http://example.com<nowiki/>!x
26541 http://example.com<nowiki/>=x
26542 http://example.com<nowiki/>(x)
26543 http://example.com(x<nowiki/>)
26544 !! end
26545
26546 !! test
26547 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26548 !! options
26549 parsoid=html2wt
26550 !! html/parsoid
26551 <p>x
26552 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26553 y
26554 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26555 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26556 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26557 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26558 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26559 </p>
26560 !! wikitext
26561 x
26562 http://example.com
26563 y
26564 "http://example.com"
26565 (http://example.com)
26566 (http://example.com) foo
26567 http://example.com,
26568 http://example.com, foo
26569 !! html/php
26570 <p>x
26571 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26572 y
26573 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26574 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26575 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26576 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26577 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26578 </p>
26579 !! end
26580
26581 !! test
26582 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26583 !! options
26584 parsoid=html2wt
26585 !! html/parsoid
26586 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26587 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26588 !! wikitext
26589 http://example.com.,;:!?\
26590 -http://example.com:
26591 !! html/php
26592 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26593 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26594 </p>
26595 !! end
26596
26597 !! test
26598 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26599 !! options
26600 parsoid=html2wt
26601 !! html/parsoid
26602 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26603 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26604 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26605 !! wikitext
26606 RFC 123<nowiki/>4
26607 RFC 123<nowiki/>y
26608 X<nowiki/>RFC 123<nowiki/>y
26609 !! end
26610
26611 !! test
26612 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26613 !! options
26614 parsoid=html2wt
26615 !! html/parsoid
26616 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26617 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26618 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26619 </p>
26620 !! wikitext
26621 RFC 123?foo
26622 RFC 123&foo
26623 -RFC 123-
26624 !! html/php
26625 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26626 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26627 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26628 </p>
26629 !! end
26630
26631 !! test
26632 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26633 !! options
26634 parsoid=html2wt
26635 !! html/parsoid
26636 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26637 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26638 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26639 !! wikitext
26640 PMID 123<nowiki/>4
26641 PMID 123<nowiki/>y
26642 X<nowiki/>PMID 123<nowiki/>y
26643 !! end
26644
26645 !! test
26646 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26647 !! options
26648 parsoid=html2wt
26649 !! html/parsoid
26650 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26651 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26652 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26653 </p>
26654 !! wikitext
26655 PMID 123?foo
26656 PMID 123&foo
26657 -PMID 123-
26658 !! html/php
26659 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26660 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26661 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26662 </p>
26663 !! end
26664
26665 !! test
26666 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26667 !! options
26668 parsoid=html2wt
26669 !! html/parsoid
26670 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26671 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26672 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26673 </p>
26674 !! wikitext
26675 ISBN 1234567890<nowiki/>1
26676 ISBN 1234567890<nowiki/>x
26677 a<nowiki/>ISBN 1234567890<nowiki/>b
26678 !! end
26679
26680 !! test
26681 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26682 !! options
26683 parsoid=html2wt
26684 !! html/parsoid
26685 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26686 !! wikitext
26687 -ISBN 1234567890's
26688 !! html/php
26689 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26690 </p>
26691 !! end
26692
26693 !! test
26694 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26695 !! options
26696 parsoid=html2wt
26697 !! html/*
26698 <p>this is not a link: http://example.com
26699 </p>
26700 !! wikitext
26701 this is not a link: <nowiki>http://example.com</nowiki>
26702 !! end
26703
26704 !! test
26705 Links 15. Link trails can't become link prefixes.
26706 !! options
26707 language=is
26708 parsoid=html2wt
26709 !! html/parsoid
26710 <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>
26711 !! wikitext
26712 [[Söfnuður]]-[[00]]
26713 !! html/php
26714 <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>
26715 </p>
26716 !! end
26717
26718 #### --------------- Quotes ---------------
26719 #### 1. Quotes inside <b> and <i>
26720 #### 2. Link fragments separated by <i> and <b> tags
26721 #### 3. Link fragments inside <i> and <b>
26722 #### 4. No escaping needed
26723 #### --------------------------------------
26724 !! test
26725 1a. Quotes inside <b> and <i>
26726 !! options
26727 parsoid=html2wt
26728 !! html/*
26729 <p><i>'foo'</i>
26730 <i>''foo''</i>
26731 <i>'''foo'''</i>
26732 <i>foo</i>'s
26733 <b>'foo'</b>
26734 <b>''foo''</b>
26735 <b>'''foo'''</b>
26736 <b>foo'<i>bar'</i>baz</b>
26737 <b>foo</b>'s
26738 '<i>foo</i>
26739 <i>foo</i>'
26740 <i>foo'</i>'
26741 '<i>foo</i>'
26742 '<b>foo</b>
26743 <b>foo</b>'
26744 '<b>foo</b>'
26745 <i>fools'<span> errand</span></i>
26746 <i><span>fool</span>'s errand</i>
26747 '<i>foo</i> bar '<i>baz</i>
26748 a|!*#-:;+-~[]{}b'<i>x</i>
26749 </p>
26750 !! wikitext
26751 ''<nowiki/>'foo'''
26752 ''<nowiki>''foo''</nowiki>''
26753 ''<nowiki>'''foo'''</nowiki>''
26754 ''foo''<nowiki/>'s
26755 '''<nowiki/>'foo''''
26756 '''<nowiki>''foo''</nowiki>'''
26757 '''<nowiki>'''foo'''</nowiki>'''
26758 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26759 '''foo'''<nowiki/>'s
26760 '''foo''
26761 ''foo''<nowiki/>'
26762 ''foo'''<nowiki/>'
26763 '''foo''<nowiki/>'
26764 ''''foo'''
26765 '''foo'''<nowiki/>'
26766 ''''foo'''<nowiki/>'
26767 ''fools'<span> errand</span>''
26768 ''<span>fool</span>'s errand''
26769 '<nowiki/>''foo'' bar '''baz''
26770 a|!*#-:;+-~[]{}b'''x''
26771 !! end
26772
26773 !! test
26774 1b. Quotes inside <b> and <i> with other tags on same line
26775 !! options
26776 parsoid=html2wt
26777 !! html/parsoid
26778 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26779 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26780 <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>
26781 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26782 '<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>
26783 '<i>foo</i> <div title="name">test</div>
26784 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26785 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26786 <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>
26787 </ol>
26788 !! wikitext
26789 '''a'' foo ''[[bar]]''
26790 ''a''' foo ''[[bar]]''
26791 ''a''' foo '''{{echo|[[bar]]}}'''
26792 [[foo]] x'''[[bar]]''
26793 '''foo'' <ref>test</ref>
26794 '''foo'' <div title="name">test</div>
26795 '''foo'' and <br> bar
26796 <references />
26797 !! end
26798
26799 !! test
26800 2. Link fragments separated by <i> and <b> tags
26801 !! options
26802 parsoid=html2wt
26803 !! html/parsoid
26804 <p>[[<i>foo</i>hello]]</p>
26805 <p>[[<b>foo</b>hello]]</p>
26806 !! wikitext
26807 [[''foo''<nowiki>hello]]</nowiki>
26808
26809 [['''foo'''<nowiki>hello]]</nowiki>
26810 !! end
26811
26812 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26813 # this is one of the shortcomings of this format
26814 !! test
26815 3. Link fragments inside <i> and <b>
26816 !! options
26817 parsoid=html2wt
26818 !! html/parsoid
26819 <p><i>[[foo</i>]]</p>
26820 <p><b>[[foo</b>]]</p>
26821 !! wikitext
26822 ''[[foo''<nowiki>]]</nowiki>
26823
26824 '''[[foo'''<nowiki>]]</nowiki>
26825 !! end
26826
26827 !! test
26828 4. No escaping needed
26829 !! options
26830 parsoid=html2wt
26831 !! html/parsoid
26832 <p>'<span><i>bar</i></span>'
26833 '<span><b>bar</b></span>'
26834 'a:b'foo
26835 </p>
26836 !! wikitext
26837 '<span>''bar''</span>'
26838 '<span>'''bar'''</span>'
26839 'a:b'foo
26840 !! end
26841
26842 #### ----------- Paragraphs ---------------
26843 #### 1. No unnecessary escapes
26844 #### --------------------------------------
26845
26846 !! test
26847 1. No unnecessary escapes
26848 !! options
26849 parsoid=html2wt
26850 !! html/parsoid
26851 <p>bar <span>[[foo]]</span>
26852 </p><p>=bar <span>[[foo]]</span>
26853 </p><p>[[bar <span>[[foo]]</span>
26854 </p><p>]]bar <span>[[foo]]</span>
26855 </p><p>=bar <span>foo]]</span>=
26856 </p>
26857 !! wikitext
26858 bar <span><nowiki>[[foo]]</nowiki></span>
26859
26860 =bar <span><nowiki>[[foo]]</nowiki></span>
26861
26862 [[bar <span><nowiki>[[foo]]</nowiki></span>
26863
26864 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26865
26866 =bar <span>foo]]</span><nowiki>=</nowiki>
26867 !!end
26868
26869 #### ----------------------- PRE --------------------------
26870 !! test
26871 1. Leading whitespace in SOL context should be escaped
26872 !! options
26873 parsoid=html2wt
26874 !! html/parsoid
26875 <p> a</p>
26876
26877 <p> a</p>
26878
26879 <p> a(tab)</p>
26880
26881 <p> a
26882 <!--cmt-->
26883 a</p>
26884
26885 <p>a
26886 b</p>
26887
26888 <p>a
26889 b</p>
26890
26891 <p>a
26892 b</p>
26893 !! wikitext
26894 <nowiki> </nowiki>a
26895
26896 <nowiki> </nowiki> a
26897
26898 a(tab)
26899
26900 <nowiki> </nowiki> a
26901 <!--cmt-->
26902 <nowiki> </nowiki>a
26903
26904 a
26905 <nowiki> </nowiki>b
26906
26907 a
26908 b
26909
26910 a
26911 b
26912 !! html/php
26913 <p> a
26914 </p><p> a
26915 </p><p> a(tab)
26916 </p><p> a
26917 a
26918 </p><p>a
26919 b
26920 </p><p>a
26921 b
26922 </p><p>a
26923 b
26924 </p>
26925 !! end
26926
26927 !! test
26928 2. Leading whitespace in non-indent-pre contexts should not be escaped
26929 !! options
26930 parsoid=html2wt
26931 !! html/parsoid
26932 <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>
26933 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26934 <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>
26935 b</span></li>
26936 </ol>
26937 !! wikitext
26938 foo <ref>''a''
26939 b</ref>
26940 <references />
26941 !! end
26942
26943 !! test
26944 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26945 !! options
26946 parsoid=html2wt
26947 !! html/parsoid
26948 <blockquote>
26949 <p>
26950 a
26951 <span>b</span>
26952 c</p>
26953 </blockquote>
26954 !! wikitext
26955 <blockquote>
26956 a
26957 <span>b</span>
26958 c
26959 </blockquote>
26960 !! end
26961
26962 !! test
26963 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26964 !! options
26965 parsoid=html2wt
26966 !! html/parsoid
26967 <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>
26968 !! wikitext
26969 [[File:Foobar.jpg|thumb|caption]]
26970 !! end
26971
26972 !! test
26973 5. Nowiki escaping should account for indent-pres
26974 !! options
26975 parsoid=html2wt
26976 !! html/parsoid
26977 <pre>==foo==</pre>
26978 !! wikitext
26979 ==foo==
26980 !! end
26981
26982 !! test
26983 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26984 !! options
26985 parsoid=html2wt
26986 !! html/parsoid
26987 <pre>
26988 * foo
26989 * bar
26990 </pre>
26991 !! wikitext
26992 * foo
26993 * bar
26994 !! end
26995
26996 !! test
26997 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26998 !! options
26999 parsoid = {
27000 "modes": ["html2wt"],
27001 "scrubWikitext": true
27002 }
27003 !! html/parsoid
27004 <p> foo</p>
27005 <p> %foo</p>
27006 <p> *foo</p>
27007 <p> #foo</p>
27008 <p> =foo=</p>
27009 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27010 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27011 <p> <!--boo-->*foo</p>
27012 <p><!--boo--> *foo</p>
27013 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27014 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27015 !! wikitext
27016 foo
27017
27018 %foo
27019
27020 <nowiki/>*foo
27021
27022 <nowiki/>#foo
27023
27024 <nowiki/>=foo=
27025
27026 [[Category:Foo]]
27027 <nowiki/>*foo
27028
27029 [[Category:Foo]]
27030 <nowiki>*</nowiki>foo
27031
27032 <nowiki/><!--boo-->*foo
27033
27034 <!--boo--><nowiki/>*foo
27035
27036 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27037
27038 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27039 !! end
27040
27041 #### --------------- Behavior Switches --------------------
27042
27043 !! test
27044 1. Valid behavior switches should be escaped
27045 !! options
27046 parsoid=html2wt
27047 !! html/parsoid
27048 __TOC__
27049 <i>__TOC__</i>
27050 !! wikitext
27051 <nowiki>__TOC__</nowiki>
27052 ''<nowiki>__TOC__</nowiki>''
27053 !! end
27054
27055 !! test
27056 2. Invalid behavior switches should not be escaped
27057 !! options
27058 parsoid=html2wt
27059 !! html/parsoid
27060 __TOO__
27061 __|__
27062 !! wikitext
27063 __TOO__
27064 __|__
27065 !! end
27066
27067 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27068 !! test
27069 Behavior switches should be SOL-transparent
27070 !! options
27071 parsoid=html2wt
27072 !! html/parsoid
27073 <meta property="mw:PageProp/toc" />
27074
27075 <!-- this one's bogus -->
27076 <pre>__TOO__</pre>
27077
27078 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27079
27080 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27081 !! wikitext
27082 __TOC__
27083
27084 <!-- this one's bogus -->
27085 __TOO__
27086
27087 __TOC__ foo
27088
27089 __TOC__
27090 bar
27091 !! end
27092
27093 #### --------------- HTML tags ---------------
27094 #### 1. a tags
27095 #### 2. other tags
27096 #### 3. multi-line html tag
27097 #### 4. extension tags
27098 #### -----------------------------------------
27099 !! test
27100 1. a tags
27101 !! options
27102 parsoid=html2wt
27103 !! html/parsoid
27104 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27105 !! wikitext
27106 <a href="http://google.com">google</a>
27107 !! end
27108
27109 !! test
27110 2. other tags
27111 !! options
27112 parsoid=html2wt
27113 !! html/parsoid
27114 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27115 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27116 <li> &lt;td&gt;</li></ul>
27117
27118 !! wikitext
27119 * <nowiki><div>foo</div></nowiki>
27120 * <nowiki><div style="color:red">foo</div></nowiki>
27121 * <nowiki><td></nowiki>
27122 !! end
27123
27124 !! test
27125 3. multi-line html tag
27126 !! options
27127 parsoid=html2wt
27128 !! html/parsoid
27129 <p>&lt;div
27130 &gt;foo&lt;/div
27131 &gt;
27132 </p>
27133 !! wikitext
27134 <nowiki><div
27135 >foo</div
27136 ></nowiki>
27137 !! end
27138
27139 !! test
27140 4. extension tags
27141 !! options
27142 parsoid=html2wt
27143 !! html/parsoid
27144 <p>&lt;ref&gt;foo&lt;/ref&gt;
27145 </p><p>&lt;ref&gt;bar
27146 </p><p>baz&lt;/ref&gt;
27147 </p>
27148 !! wikitext
27149 <nowiki><ref>foo</ref></nowiki>
27150
27151 <nowiki><ref>bar</nowiki>
27152
27153 baz<nowiki></ref></nowiki>
27154 !! end
27155
27156 !! test
27157 Parsoid: newline inducing block nodes don't suppress <nowiki>
27158 !! options
27159 parsoid=html2wt
27160 !! html/parsoid
27161 a<h1>foo</h1>
27162 !! wikitext
27163 <nowiki> </nowiki>a
27164
27165 = foo =
27166 !! end
27167
27168 #### --------------- Others ---------------
27169 !! test
27170 Escaping nowikis
27171 !! options
27172 parsoid=html2wt
27173 !! html/parsoid
27174 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27175 </p>
27176 !! wikitext
27177 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27178 !! end
27179
27180 ## The quote-char in the input is necessary for triggering the bug
27181 !! test
27182 (T54035) Nowiki-escaping should not get tripped by " :" in text
27183 !! options
27184 parsoid=html2wt
27185 !! html/parsoid
27186 <p>foo's bar :</p>
27187 !! wikitext
27188 foo's bar :
27189 !! end
27190
27191 #----------- End of wikitext escaping tests --------------
27192
27193 !! test
27194
27195 Tag-like HTML structures are passed through as text
27196 !! wikitext
27197 <x y>
27198
27199 <x.y>
27200
27201 <x-y>
27202
27203 1>2
27204
27205 x<y
27206
27207 a>b
27208
27209 1<d e>f
27210 !! html
27211 <p>&lt;x y&gt;
27212 </p><p>&lt;x.y&gt;
27213 </p><p>&lt;x-y&gt;
27214 </p><p>1&gt;2
27215 </p><p>x&lt;y
27216 </p><p>a&gt;b
27217 </p><p>1&lt;d e&gt;f
27218 </p>
27219 !! end
27220
27221 !! test
27222 HTML tag with necessary entities in attributes
27223 !! wikitext
27224 <span title="&amp;amp;">foo</span>
27225 !! html
27226 <p><span title="&amp;amp;">foo</span>
27227 </p>
27228 !! end
27229
27230 !! test
27231 HTML tag with 'unnecessary' entity encoding in attributes
27232 !! wikitext
27233 <span title="&amp;">foo</span>
27234 !! html
27235 <p><span title="&amp;">foo</span>
27236 </p>
27237 !! end
27238
27239 !! test
27240 HTML tag with broken attribute value quoting
27241 !! options
27242 parsoid=wt2html,html2html
27243 !! wikitext
27244 <span title="Hello world>Foo</span>
27245 !! html/php
27246 <p><span title="Hello world">Foo</span>
27247 </p>
27248 !! html/parsoid
27249 <p><span title="Hello world">Foo</span></p>
27250 !! end
27251
27252 !! test
27253 Self-closed tag with broken attribute value quoting
27254 !! options
27255 parsoid=wt2html,html2html
27256 !! wikitext
27257 <div title="Hello world />Foo
27258 !! html/php+tidy
27259 <div title="Hello world"></div><p>Foo
27260 </p>
27261 !! html/parsoid
27262 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27263 !! end
27264
27265 !! test
27266 Table with broken attribute value quoting
27267 !! options
27268 parsoid=wt2html,html2html
27269 !! wikitext
27270 {|
27271 | title="Hello world|Foo
27272 |}
27273 !! html/php
27274 <table>
27275 <tr>
27276 <td title="Hello world">Foo
27277 </td></tr></table>
27278
27279 !! html/parsoid
27280 <table>
27281 <tr>
27282 <td title="Hello world">Foo
27283 </td></tr></table>
27284
27285 !! end
27286
27287 !! test
27288 Table with broken attribute value quoting on consecutive lines
27289 !! options
27290 parsoid=wt2html,html2html
27291 !! wikitext
27292 {|
27293 | title="Hello world|Foo
27294 | style="color:red|Bar
27295 |}
27296 !! html/php
27297 <table>
27298 <tr>
27299 <td title="Hello world">Foo
27300 </td>
27301 <td style="color:red">Bar
27302 </td></tr></table>
27303
27304 !! html/parsoid
27305 <table><tbody>
27306 <tr>
27307 <td title="Hello world">Foo
27308 </td><td style="color: red">Bar
27309 </td></tr></tbody></table>
27310
27311 !! end
27312
27313 !!test
27314 Accept empty td cell attribute
27315 !! wikitext
27316 {|
27317 | align="center" |foo|| |
27318 |}
27319 !! html
27320 <table>
27321 <tr>
27322 <td align="center">foo</td>
27323 <td>
27324 </td></tr></table>
27325
27326 !!end
27327
27328 !!test
27329 Non-empty attributes in th-cells
27330 !! wikitext
27331 {|
27332 !Foo!! style="color: red" |Bar
27333 |}
27334 !! html
27335 <table>
27336 <tr>
27337 <th>Foo</th>
27338 <th style="color: red">Bar
27339 </th></tr></table>
27340
27341 !!end
27342
27343 !!test
27344 Accept empty attributes in th-cells
27345 !! wikitext
27346 {|
27347 !|foo!!|bar
27348 |}
27349 !! html
27350 <table>
27351 <tr>
27352 <th>foo</th>
27353 <th>bar
27354 </th></tr></table>
27355
27356 !!end
27357
27358 !!test
27359 Empty table rows go away
27360 !! wikitext
27361 {|
27362 |Hello
27363 |there
27364 |- class="foo"
27365 |-
27366 |}
27367 !! html
27368 <table>
27369 <tr>
27370 <td>Hello
27371 </td>
27372 <td>there
27373 </td></tr>
27374
27375 </table>
27376
27377 !! end
27378
27379 ###
27380 ### Parsoid-centric tests for testing RTing of inter-element separators
27381 ### Edge cases not tested by existing parser tests and specific to
27382 ### Parsoid-specific serialization strategies.
27383 ###
27384
27385 !!test
27386 RT-ed inter-element separators should be valid separators
27387 !! wikitext
27388 {|
27389 |- [[foo]]
27390 |}
27391 !! html/php
27392 <table>
27393
27394 </table>
27395
27396 !! html/parsoid
27397 <table>
27398 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27399 </tbody></table>
27400 !!end
27401
27402 # Parsoid-only test of a DOM pass
27403 !!test
27404 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27405 !! wikitext
27406 {|
27407 |<small>foo
27408 bar
27409 |}
27410
27411 {|
27412 |<small>foo<small>
27413 |}
27414 !! html/parsoid
27415 <table>
27416 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27417 <p>bar</p></small></td></tr>
27418 </tbody></table>
27419
27420 <table>
27421 <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>
27422 </tbody></table>
27423 !!end
27424
27425 # Note that the "style" attribute is really a template parameter here.
27426 # The = would have to be {{=}} if you wanted the literal.
27427 !!test
27428 Empty TD followed by TD with tpl-generated attribute
27429 !! wikitext
27430 {|
27431 |-
27432 |
27433 |{{echo|style='color:red'}}|foo
27434 |}
27435 !! html
27436 <table>
27437
27438 <tr>
27439 <td>
27440 </td>
27441 <td>foo
27442 </td></tr></table>
27443
27444 !!end
27445
27446 !!test
27447 Indented table with an empty td
27448 !! wikitext
27449 {|
27450 |-
27451 |
27452 |foo
27453 |}
27454 !! html
27455 <table>
27456
27457 <tr>
27458 <td>
27459 </td>
27460 <td>foo
27461 </td></tr></table>
27462
27463 !!end
27464
27465 !! test
27466 Indented table with blank lines in between (T85627)
27467 !! wikitext
27468 {|
27469 |foo
27470
27471
27472 |}
27473 !! html/php
27474 <table>
27475 <tr>
27476 <td>foo
27477 <p><br />
27478 </p>
27479 </td></tr></table>
27480
27481 !! html/parsoid
27482 <table>
27483 <tbody><tr><td>foo
27484 <p>
27485 <br /></p></td></tr>
27486 </tbody></table>
27487 !! end
27488
27489 !!test
27490 Indented block & table
27491 !! wikitext
27492 <div>foo</div>
27493 {|
27494 |foo
27495 |}
27496 !! html/php
27497 <div>foo</div>
27498 <table>
27499 <tr>
27500 <td>foo
27501 </td></tr></table>
27502
27503 !! html/parsoid
27504 <div data-parsoid='{"stx":"html"}'>foo</div>
27505 <table><tbody>
27506 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27507 </tbody></table>
27508 !!end
27509
27510 !! test
27511 Indent and comment before table row
27512 !! wikitext
27513 {|
27514 <!--hi-->|-
27515 |there
27516 |}
27517 !! html/php
27518 <table>
27519
27520 <tr>
27521 <td>there
27522 </td></tr></table>
27523
27524 !! html/parsoid
27525 <table>
27526 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27527 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27528 </tbody></table>
27529 !! end
27530
27531 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27532 !!test
27533 Empty TR followed by a template-generated TR
27534 !!options
27535 parsoid
27536 !! wikitext
27537 {|
27538 |-
27539 {{echo|<tr><td>foo</td></tr>}}
27540 |}
27541 !! html
27542 <table>
27543 <tbody>
27544 <tr class='mw-empty-elt'></tr>
27545 <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}}]}'>
27546 <td>foo</td></tr>
27547 </tbody></table>
27548 !!end
27549
27550 ## PHP and parsoid output differ for this, and since this is primarily
27551 ## for testing Parsoid's serializer, marking this Parsoid only
27552 !!test
27553 Empty TR followed by mixed-ws-comment line should RT correctly
27554 !!options
27555 parsoid
27556 !! wikitext
27557 {|
27558 |-
27559 <!--c-->
27560 |-
27561 <!--c--> <!--d-->
27562 |}
27563 !! html
27564 <table>
27565 <tbody>
27566 <tr class='mw-empty-elt'></tr>
27567 <!--c-->
27568 <tr>
27569 <!--c--> </tr><!--d-->
27570 </tbody></table>
27571
27572 !!end
27573
27574 !!test
27575 Multi-line image caption generated by templates with/without trailing newlines
27576 !! wikitext
27577 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27578 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27579 !! html/parsoid
27580 <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>
27581 <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>
27582 !!end
27583
27584 !! test
27585 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27586 !! options
27587 parsoid=html2wt
27588 !! html/parsoid
27589 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
27590
27591 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27592 !! wikitext
27593 <includeonly>foo</includeonly>
27594 new para
27595
27596 [[Category:Foo]]
27597
27598 = new heading =
27599 !! end
27600
27601 ## PHP emits broken html for this, and since this is primarily
27602 ## a Parsoid serializer test, marking this Parsoid only
27603 !!test
27604 Improperly nested inline or quotes tags with whitespace in between
27605 !! wikitext
27606 <span> <s>x</span> </s>
27607 ''' ''x''' ''
27608 !! html/parsoid
27609 <p><span> <s>x</s></span><s> </s>
27610 <b> <i>x</i></b><i> </i>
27611 </p>
27612 !!end
27613
27614 !!test
27615 Encapsulate protected attributes from wt
27616 !! wikitext
27617 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27618
27619 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27620 |ok
27621 |}
27622 !! html/parsoid
27623 <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>
27624
27625 <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">
27626 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27627 </tbody></table>
27628 !!end
27629
27630 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27631 ## Having nested or stray pre tags results in the attempt to add duplicates,
27632 ## causing an assertion fail. This test tries to prevent that situation.
27633 !! test
27634 Ensure ParagraphWrapper can deal with stray closing pre tags
27635 !! options
27636 parsoid=wt2html
27637 !! wikitext
27638 plain text</pre>
27639 !! html/parsoid
27640 <p>plain text</p>
27641 !! end
27642
27643 ## Remex doesn't account for fostered content.
27644 !! test
27645 1. Ensure fostered text content is wrapped in element nodes
27646 !! options
27647 parsoid=wt2html
27648 !! wikitext
27649 <table>hi</table><table>ho</table>
27650 !! html/php+tidy
27651 hi<table></table>ho<table></table>
27652 !! html/parsoid
27653 <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>
27654 !! end
27655
27656 ## Remex doesn't account for fostered content.
27657 !! test
27658 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27659 !! options
27660 parsoid=wt2html,wt2wt
27661 !! wikitext
27662 <table>
27663 <tr> || ||
27664 <td> a
27665 </table>
27666 !! html/php+tidy
27667 || ||
27668 <table>
27669 <tbody><tr><td> a
27670 </td></tr></tbody></table>
27671 !! html/parsoid
27672 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27673 <table data-parsoid='{"stx":"html"}'>
27674 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27675 </td></tr></tbody></table>
27676 !! end
27677
27678 ## Remex doesn't account for fostered content.
27679 !! test
27680 Encapsulation properly handles null DSR information from foster box
27681 !! options
27682 parsoid=wt2html,wt2wt
27683 !! wikitext
27684 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27685 !! html/parsoid
27686 <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>
27687 !! end
27688
27689 ## Remex doesn't account for fostered content.
27690 !! test
27691 1. Encapsulate foster-parented transclusion content
27692 !! options
27693 parsoid=wt2wt,wt2html
27694 !! wikitext
27695 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27696 !! html/php+tidy
27697 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27698 !! html/parsoid
27699 <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>
27700 !! end
27701
27702 !! test
27703 2. Encapsulate foster-parented transclusion content
27704 !! options
27705 parsoid=wt2wt,wt2html
27706 !! wikitext
27707 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27708 !! html/parsoid
27709 <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>
27710 <table>
27711 <tbody>
27712 <tr>
27713 <td>bar</td>
27714 </tr>
27715 </tbody>
27716 </table>
27717 !! end
27718
27719 !! test
27720 3. Encapsulate foster-parented transclusion content
27721 !! options
27722 parsoid=wt2wt,wt2html
27723 !! wikitext
27724 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27725 !! html/parsoid
27726 <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;]}">
27727 <p>foo</p>
27728 </div>
27729 <table>
27730 <tbody>
27731 <tr>
27732 <td>bar</td>
27733 </tr>
27734 </tbody>
27735 </table>
27736 !! end
27737
27738 !! test
27739 4. Encapsulate foster-parented transclusion content
27740 !! options
27741 parsoid=wt2wt,wt2html
27742 !! wikitext
27743 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27744 !! html/parsoid
27745 <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;]}">
27746 <p>foo</p>
27747 </div>
27748 <table>
27749 <tbody>
27750 <tr>
27751 <td>bar</td>
27752 </tr>
27753 </tbody>
27754 </table>
27755 !! end
27756
27757 ## Remex doesn't account for fostered content.
27758 !! test
27759 5. Encapsulate foster-parented transclusion content
27760 !!options
27761 parsoid=wt2wt,wt2html
27762 !! wikitext
27763 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27764 !! html/php+tidy
27765 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27766 !! html/parsoid
27767 <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>
27768 !! end
27769
27770 ## Remex doesn't account for fostered content.
27771 !! test
27772 6. Encapsulate foster-parented transclusion content
27773 !! options
27774 parsoid=wt2wt,wt2html
27775 !! wikitext
27776 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27777 !! html/php+tidy
27778 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27779 !! html/parsoid
27780 <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>
27781 !! end
27782
27783 !! test
27784 7. Encapsulate foster-parented transclusion content
27785 !!options
27786 parsoid=wt2wt,wt2html
27787 !! wikitext
27788 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27789 !! html/parsoid
27790 <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>
27791 <table>
27792 <tbody>
27793 <tr>
27794 <td>bar</td>
27795 </tr>
27796 </tbody>
27797 </table>
27798 !! end
27799
27800 ## Remex doesn't account for fostered content.
27801 # Note that the wt is broken on purpose: the = should be {{=}} if you
27802 # don't want it to be a template parameter key.
27803 !! test
27804 8. Encapsulate foster-parented transclusion content
27805 !! options
27806 parsoid=wt2wt,wt2html
27807 !! wikitext
27808 {{echo|a
27809 }}{|{{echo|style='color:red'}}
27810 |-
27811 |b
27812 |}
27813 !! html/php+tidy
27814 <p>a
27815 </p>
27816 <table>
27817
27818 <tbody><tr>
27819 <td>b
27820 </td></tr></tbody></table>
27821 !! html/parsoid
27822 <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">
27823 </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">
27824 <tbody><tr>
27825 <td>b
27826 </td></tr></tbody></table>
27827 !! end
27828
27829 ## Remex doesn't account for fostered content.
27830 !! test
27831 9. Encapsulate foster-parented transclusion content
27832 !!options
27833 parsoid=wt2wt,wt2html
27834 !! wikitext
27835 <table>{{echo|hi</table>hello}}
27836 !! html/php+tidy
27837 hi<table></table><p>hello
27838 </p>
27839 !! html/parsoid
27840 <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>
27841 !! end
27842
27843 !! test
27844 Table in fosterable position
27845 !!options
27846 parsoid=wt2html
27847 !! wikitext
27848 {{OpenTable}}
27849 <div>
27850 {|
27851 |}
27852 </div>
27853 |}
27854 !! html/parsoid
27855 <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">
27856 </span>
27857 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27858
27859 <table>
27860 </table>
27861 !! end
27862
27863 # Parsoid only for T66747
27864 !! test
27865 Properly encapsulate empty-content transclusions in fosterable positions
27866 !! wikitext
27867 <table>
27868 {{#if:|
27869 <td>foo</td>
27870 }}
27871 </table>
27872 !! html/parsoid
27873 <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"}]]}'>
27874
27875 </table>
27876 !! end
27877
27878 ## No longer captures its original intention
27879 !! test
27880 Always encapsulate foster box when template range is expanded to table
27881 !! options
27882 disabled
27883 parsoid=wt2wt
27884 !! wikitext
27885 {|
27886 hello
27887 {{OpenTable}}
27888 |}
27889 !! html/parsoid
27890
27891 !! end
27892
27893 !! test
27894 T115289: Unclosed table
27895 !! wikitext
27896 {{echo|<table>}}<!--c-->[[Category:Two]]
27897 !! html/parsoid
27898 <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>
27899 !! end
27900
27901 !! test
27902 T115289: Don't migrate newlines out of tables with fostered content
27903 !! wikitext
27904 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27905 !! html/parsoid
27906 <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>
27907 !! end
27908
27909 !! test
27910 T73074: More fostering fun
27911 !! wikitext
27912 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27913 !! html/parsoid
27914 <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>
27915 !! end
27916
27917 !!test
27918 Support <object> element with .data attribute
27919 !!options
27920 parsoid=html2wt
27921 !! html/parsoid
27922 <object data="test.swf"></object>
27923 !! wikitext
27924 <object data="test.swf"></object>
27925 !!end
27926
27927 !! test
27928 Don't block XML namespace declaration
27929 !! wikitext
27930 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27931 !! html/php
27932 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27933 </p>
27934 !! html/parsoid
27935 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27936 !! end
27937
27938 # -----------------------------------------------------------------
27939 # The following section of tests are primarily to spec requirements
27940 # around Parsoid's serialization (old, new, edited content)
27941 #
27942 # All these tests are marked Parsoid html2wt and html2html only
27943 # ----------------------------------------------------------------
27944
27945 !! test
27946 Ignore rel attribute in a-tags during serialization to url-links
27947 !! options
27948 parsoid=html2wt
27949 !! html/parsoid
27950 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27951 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27952 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27953 !! wikitext
27954 http://en.wikipedia.org/wiki/Foobar
27955 http://en.wikipedia.org/wiki/Foobar
27956 http://en.wikipedia.org/wiki/Foobar
27957 !! end
27958
27959 # 'mi' is a localinterwiki prefix as well as a language
27960 !! test
27961 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27962 !! options
27963 parsoid=html2wt
27964 !! html/parsoid
27965 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27966 !! wikitext
27967 [[Foo]]
27968 !! end
27969
27970 !! test
27971 Parsoid should accept interwiki shortcuts
27972 !! options
27973 parsoid=html2wt
27974 !! html/parsoid
27975 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27976 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27977 <a href='./fr:Foo'>Foo</a></p>
27978 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27979 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27980 <a href='fr%3AFoo'>Foo</a></p>
27981 <p><a href='FR%3AFoo'>Foo</a>
27982 <a href='./FR:Foo'>Foo</a></p>
27983 !! wikitext
27984 [[:fr:Foo|Foo]]
27985 [[:fr:Foo|Foo]]
27986 [[:fr:Foo|Foo]]
27987
27988 [[:fr:Foo|Foo]]
27989 [[:fr:Foo|Foo]]
27990 [[:fr:Foo|Foo]]
27991
27992 [[:fr:Foo|Foo]]
27993 [[:fr:Foo|Foo]]
27994 !! end
27995
27996 !! test
27997 Parsoid should not accept invalid interwiki shortcuts
27998 !! options
27999 parsoid=html2wt
28000 !! html/parsoid
28001 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28002 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28003 <a href='news:Foo'>Foo</a></p>
28004 !! wikitext
28005 [news:Foo Foo]
28006 [news:Foo Foo]
28007 [news:Foo Foo]
28008 !! end
28009
28010 # See T93839
28011 !! test
28012 New wikilinks should be serialized properly
28013 !! options
28014 parsoid=html2wt
28015 !! html/parsoid
28016 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28017 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28018 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28019 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28020 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28021 !! wikitext
28022 [[Foo]]
28023 [[Foo]]
28024 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28025 http://en.wikipedia.org/wiki/Foo
28026 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28027 !! end
28028
28029 !! test
28030 New wiki links (href variations)
28031 !! options
28032 parsoid=html2wt
28033 !! html/parsoid
28034 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28035 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28036 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28037 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28038 !! wikitext
28039 [[Foo_bar]]
28040 [[Foo_bar]]
28041 [[Foo_bar]]
28042 [[Toxine bactérienne]]
28043 !! end
28044
28045 !! test
28046 New wiki links (content string variations)
28047 !! options
28048 parsoid=html2wt
28049 !! html/parsoid
28050 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28051 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28052 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28053 !! wikitext
28054 [[Foo_bar]]
28055 [[Foo bar]]
28056 [[Foo_bar|./Foo_bar]]
28057 !! end
28058
28059 !! test
28060 New category links (href variations)
28061 !! options
28062 parsoid=html2wt
28063 !! html/parsoid
28064 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28065 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28066 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28067 !! wikitext
28068 [[Category:Toxine bactérienne]]
28069 [[Category:Toxine bactérienne]]
28070 [[Category:Toxine bactérienne]]
28071 !! end
28072
28073 !! test
28074 New sol transparent links don't need indent-pre nowiki protection
28075 !! options
28076 parsoid=html2wt
28077 language=de
28078 !! html/parsoid
28079 <link rel="mw:PageProp/redirect" href="./Main_Page">
28080 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28081 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28082 !! wikitext
28083 #WEITERLEITUNG [[Main Page]]
28084 <!-- this is good --> [[Category:Good]]
28085 <!-- this is great --> [[Kategorie:Great]]
28086 !! end
28087
28088 !! test
28089 New interlanguage links (href variations)
28090 !! options
28091 parsoid=html2wt
28092 !! html/parsoid
28093 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28094 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28095 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28096 !! wikitext
28097 [[es:Toxine bactérienne]]
28098 [[es:Toxine_bactérienne]]
28099 [[es:Toxine_bactérienne]]
28100 !! end
28101
28102 !! test
28103 Image: Modifying size of an image (1)
28104 !! options
28105 parsoid={
28106 "modes": ["wt2wt"],
28107 "changes": [
28108 ["img[height]", "attr", "height", "22"],
28109 ["img[width]", "attr", "width", "200"]
28110 ]
28111 }
28112 !! wikitext
28113 [[Image:Foobar.jpg|230x230px]]
28114 !! wikitext/edited
28115 [[Image:Foobar.jpg|200x200px]]
28116 !!end
28117
28118 !! test
28119 Image: Modifying size of an image (2)
28120 !! options
28121 parsoid={
28122 "modes": ["wt2wt"],
28123 "changes": [
28124 ["img[height]", "attr", "height", "100"],
28125 ["img[width]", "attr", "width", "500"]
28126 ]
28127 }
28128 !! wikitext
28129 [[Image:Foobar.jpg|230x230px]]
28130 !! wikitext/edited
28131 [[Image:Foobar.jpg|500x500px]]
28132 !!end
28133
28134 # Change in size is ignored so long as class='mw-default-size'
28135 !! test
28136 Image: Modifying size of an image (3)
28137 !! options
28138 parsoid={
28139 "modes": ["wt2wt"],
28140 "changes": [
28141 ["figure[class]", "removeClass", "mw-default-size"],
28142 ["figure img", "attr", "height", "19"],
28143 ["figure img", "attr", "width", "170"]
28144 ]
28145 }
28146 !! wikitext
28147 [[Image:Foobar.jpg|thumb]]
28148 !! wikitext/edited
28149 [[Image:Foobar.jpg|thumb|170x170px]]
28150 !!end
28151
28152 !! test
28153 Image: Modifying alignment of an image (T50665)
28154 !! options
28155 parsoid={
28156 "modes": ["wt2wt"],
28157 "changes": [
28158 ["figure[class]", "removeClass", "mw-halign-right"],
28159 ["figure[class]", "addClass", "mw-halign-left"]
28160 ]
28161 }
28162 !! wikitext
28163 [[Image:Foobar.jpg|thumb|caption|right]]
28164 !! wikitext/edited
28165 [[Image:Foobar.jpg|thumb|caption|left]]
28166 !! end
28167
28168 !! test
28169 Image: Modifying mw-default-size of an frameless image (T64805)
28170 !! options
28171 parsoid={
28172 "modes": ["wt2wt"],
28173 "changes": [
28174 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28175 ]
28176 }
28177 !! wikitext
28178 [[Image:Foobar.jpg|frameless|right]]
28179 !! wikitext/edited
28180 [[Image:Foobar.jpg|frameless|right|220x220px]]
28181 !! end
28182
28183 !! test
28184 Image: Modifying valign of an image (T51221)
28185 !! options
28186 parsoid={
28187 "modes": ["wt2wt"],
28188 "changes": [
28189 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28190 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28191 ]
28192 }
28193 !! wikitext
28194 [[File:Foobar.jpg|20px|middle]]
28195 !! wikitext/edited
28196 [[File:Foobar.jpg|20px|text-top]]
28197 !! end
28198
28199 !! test
28200 Image: Modifying alt attribute of an image (T58400)
28201 !! options
28202 parsoid={
28203 "modes": ["wt2wt"],
28204 "changes": [
28205 ["img[alt]", "attr", "alt", "some alternate edited text"]
28206 ]
28207 }
28208 !! wikitext
28209 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28210 !! wikitext/edited
28211 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28212 !!end
28213
28214 !! test
28215 Image: Modifying caption of an image
28216 !! options
28217 parsoid={
28218 "modes": ["wt2wt"],
28219 "changes": [
28220 ["figcaption", "text", "new caption"]
28221 ]
28222 }
28223 !! wikitext
28224 [[Image:Foobar.jpg|thumb|original caption]]
28225 !! wikitext/edited
28226 [[Image:Foobar.jpg|thumb|new caption]]
28227 !!end
28228
28229 !! test
28230 Image: empty alt attribute (T50924)
28231 !! options
28232 parsoid
28233 !! wikitext
28234 [[File:Foobar.jpg|thumb|alt=|bar]]
28235 !! html
28236 <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>
28237 !! end
28238
28239 !! test
28240 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28241 !! options
28242 parsoid=html2wt
28243 language=ar
28244 disabled
28245 !! html/parsoid
28246 <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>
28247 !! wikitext
28248 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28249 !! end
28250
28251 !! test
28252 Image: Block level image should have \n before and after
28253 !! wikitext
28254 123
28255 [[File:Foobar.jpg|right|thumb|150x150px]]
28256 456
28257 !! html/parsoid
28258 <p>123</p>
28259 <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>
28260 <p>456</p>
28261 !! end
28262
28263 !! test
28264 Image: New block level image should have \n before and after (existing content)
28265 !! wikitext
28266 123
28267 [[File:Foobar.jpg|right|thumb|150x150px]]
28268 456
28269 !! html/parsoid
28270 <p>123</p>
28271 <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>
28272 <p>456</p>
28273 !! end
28274
28275 !! test
28276 Image: upright option (parsoid)
28277 !! wikitext
28278 [[File:Foobar.jpg|thumb|upright|caption]]
28279 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28280 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28281 !! html/parsoid
28282 <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>
28283 <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>
28284 <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>
28285 !! end
28286
28287 !! test
28288 Image: upright option is ignored on inline and frame images (parsoid)
28289 !! wikitext
28290 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28291 !! html/parsoid
28292 <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>
28293 !! end
28294
28295 !! test
28296 Image: in template parameter with empty parameter
28297 !! wikitext
28298 {{echo|[[File:Foobar.jpg|link=]]}}
28299 !! html/parsoid
28300 <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>
28301 !! end
28302
28303 !! test
28304 Image: from basic HTML (1)
28305 !! options
28306 parsoid=html2wt
28307 !! html/parsoid
28308 <span typeof="mw:Image">
28309 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28310 </span>
28311 !! wikitext
28312 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28313 !! end
28314
28315 !! test
28316 Image: from basic HTML (2)
28317 !! options
28318 parsoid=html2wt
28319 !! html/parsoid
28320 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28321 !! wikitext
28322 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28323 !! end
28324
28325 !! test
28326 Image: from basic HTML (3)
28327 !! options
28328 parsoid=html2wt
28329 !! html/parsoid
28330 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28331 !! wikitext
28332 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28333 !! end
28334
28335 !! test
28336 Image: from basic HTML (4)
28337 !! options
28338 parsoid=html2wt
28339 !! html/parsoid
28340 <img src="./File:Foobar.jpg">
28341 !! wikitext
28342 [[File:Foobar.jpg|link=]]
28343 !! end
28344
28345 !! test
28346 Image: Invalid title as link
28347 !! wikitext
28348 [[File:Foobar.jpg|link=<]]
28349 !! html/php
28350 <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>
28351 </p>
28352 !! html/parsoid
28353 <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>
28354 !! end
28355
28356 !! test
28357 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28358 !! options
28359 parsoid=html2wt
28360 !! html/parsoid
28361 <ul>
28362 <li><p>foo</p></li>
28363 </ul>
28364 !! wikitext
28365 * foo
28366 !! end
28367
28368 !! test
28369 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28370 !! options
28371 parsoid=html2wt
28372 !! html/parsoid
28373 <ul> <li>foo</li></ul>
28374 !! wikitext
28375 * foo
28376 !! end
28377
28378 !! test
28379 Don't strip leading whitespace when handling indent-pre suppressing tags
28380 !! options
28381 parsoid=html2wt
28382 !! html/parsoid
28383 <table>
28384 <tr><td> indented row</td></tr>
28385 </table>
28386 <blockquote><p>
28387 <b>This is very bold of you!</b>
28388 </p>
28389 <table><tr><td>
28390 indented cell (no pre-wrapping!)
28391 </td></tr></table>
28392 </blockquote>
28393 <p>foo</p>
28394 <div>bar</div>
28395 !! wikitext
28396 {|
28397 | indented row
28398 |}
28399 <blockquote>
28400 '''This is very bold of you!'''
28401
28402 {|
28403 |
28404 indented cell (no pre-wrapping!)
28405 |}
28406 </blockquote>
28407 foo
28408 <div>bar</div>
28409 !! end
28410
28411 !! test
28412 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28413 !! options
28414 parsoid=html2wt
28415 !! html/parsoid
28416 <p>foo</p>
28417 <span>bar</span>
28418
28419 <span>foo2
28420 </span>bar2
28421
28422 <div>foo</div>
28423 <span>bar</span>
28424
28425 <div>
28426 <span>foo</span>
28427 </div>
28428 !! wikitext
28429 foo
28430
28431 <span>bar</span>
28432
28433 <span>foo2
28434 <nowiki> </nowiki></span>bar2
28435
28436 <div>foo</div>
28437 <nowiki> </nowiki><span>bar</span>
28438
28439 <div>
28440 <nowiki> </nowiki><span>foo</span>
28441 </div>
28442 !! end
28443
28444 !! test
28445 Lists: Dont insert newlines in a serialized list item.
28446 !! options
28447 parsoid=html2wt
28448 !! html/parsoid
28449 <ul><li>a<br>b</li><li>c</li></ul>
28450 !! wikitext
28451 * a<br />b
28452 * c
28453 !! end
28454
28455 !! test
28456 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28457 !! options
28458 parsoid={
28459 "modes": ["html2wt"],
28460 "scrubWikitext": false
28461 }
28462 !! html/parsoid
28463 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28464 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28465
28466 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28467 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28468
28469 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28470
28471 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28472 !! wikitext
28473 == hello there [[Category:A1]] ==
28474
28475 == [[Category:A2]] hi pal ==
28476
28477 == <!--foo--> [[Category:A3]] how goes it ==
28478
28479 == it goes well [[Category:A4]] <!--bar--> ==
28480
28481 ==howdy [[Category:A5]]==
28482
28483 == __TOC__ ok ==
28484 !! end
28485
28486 !! test
28487 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28488 !! options
28489 parsoid={
28490 "modes": ["html2wt"],
28491 "scrubWikitext": true
28492 }
28493 !! html/parsoid
28494 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28495 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28496
28497 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28498 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28499
28500 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28501 !! wikitext
28502 == hello there ==
28503 [[Category:A1]]
28504 [[Category:A2]]
28505
28506 == hi pal ==
28507
28508 <!--foo-->[[Category:A3]]
28509
28510 == how goes it ==
28511
28512 == it goes well ==
28513 [[Category:A4]] <!--bar-->
28514
28515 __TOC__
28516
28517 == ok ==
28518 !! end
28519
28520 !! test
28521 Headings: Don't hoist metas that come from templates
28522 !! options
28523 parsoid={
28524 "modes": ["html2wt"],
28525 "scrubWikitext": true
28526 }
28527 !! html/parsoid
28528 <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>
28529 !! wikitext
28530 == {{echo|foo [[Category:Foo]]}} ==
28531 !! end
28532
28533 !! test
28534 Headings: Category in ref isn't hoisted
28535 !! options
28536 parsoid={
28537 "modes": ["html2wt"],
28538 "scrubWikitext": true
28539 }
28540 !! html/parsoid
28541 <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>
28542
28543 <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>
28544 !! wikitext
28545 == foo <ref>bar
28546 [[Category:Baz]] </ref> ==
28547
28548 <references />
28549 !! end
28550
28551 !! test
28552 Parsoid: Serialize positional parameters with = in them as named parameter
28553 !! options
28554 parsoid=html2wt
28555 !! html/parsoid
28556 <p about="#mwt1" typeof="mw:Transclusion"
28557 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28558
28559 <p about="#mwt1" typeof="mw:Transclusion"
28560 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28561
28562 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28563 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28564 <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>
28565 !! wikitext
28566 {{echo|1=f=oo}}
28567
28568 {{echo|1=f=oo|2=bar}}
28569
28570 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28571 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28572 {{echo|<nowiki>f=oo</nowiki>|bar}}
28573 !! end
28574
28575 !! test
28576 Parsoid: Serialize positional parameters with = in extlink as named parameter
28577 !! options
28578 parsoid=html2wt
28579 !! html/parsoid
28580 <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>
28581 !! wikitext
28582 {{echo|1=http://stuff?is=ok}}
28583 !! end
28584
28585 !! test
28586 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28587 !! options
28588 parsoid=html2wt
28589 !! html/parsoid
28590 <div>a<p>b</p></div>
28591 <div>a
28592 <p>b</p></div>
28593 <div>
28594 a
28595 <p>b</p></div>
28596 !! wikitext
28597 <div>a
28598 b
28599 </div>
28600 <div>a
28601 b
28602 </div>
28603 <div>
28604 a
28605
28606 b
28607 </div>
28608 !! end
28609
28610 !! test
28611 Substrings resembling wikitext in hrefs should not get nowiki escapes
28612 !! options
28613 parsoid=html2wt
28614 !! html/parsoid
28615 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28616 !! wikitext
28617 [[Foo''bar''baz]]
28618 !! end
28619
28620 !! test
28621 Enforce single-line context in the serializer
28622 !! options
28623 parsoid=html2wt
28624 !! html/parsoid
28625 <h2>testing
28626 123</h2>
28627
28628 <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">
28629 </span><span about="#mwt1">you</span> </h2>
28630
28631 <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>
28632
28633 <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
28634 there</span></li></ol>
28635
28636 <ul><li>asd
28637 sdf</li></ul>
28638
28639 <ul><li>foo
28640 bar
28641 baz</li>
28642 <li>foo <b>bar</b>
28643 baz</li></ul>
28644
28645 <dl><dt>hi
28646 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28647 ho</dd></dl>
28648
28649 <dl><dd> <table>
28650 <tbody><tr><td> ha
28651 ha
28652 ha</td></tr>
28653 </tbody></table></dd></dl>
28654 !! wikitext
28655 == testing 123 ==
28656
28657 == hi {{bogus|there
28658 you}} ==
28659
28660 == foo <ref>hello
28661 there</ref> ==
28662
28663 <references />
28664
28665 * asd sdf
28666
28667 * foo bar baz
28668 * foo '''bar''' baz
28669
28670 ; hi ho : hi ho
28671
28672 : {|
28673 | ha
28674 ha
28675 ha
28676 |}
28677 !! end
28678
28679 !! test
28680 Serialize new placeholder space without spans
28681 !! options
28682 parsoid=html2wt
28683 !! html/parsoid
28684 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28685
28686 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28687
28688 <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>
28689 !! wikitext
28690 foo : bar
28691
28692 foo : bar
28693
28694 <ref>foo : bar</ref>ok
28695 !! end
28696
28697
28698 #-----------------------
28699 # Tag minimization tests
28700 #-----------------------
28701
28702 !! test
28703 1. I/B quote minimization: wikitext-only tags should be combined
28704 !! options
28705 parsoid=html2wt
28706 !! html/parsoid
28707 <p><i>A</i><i>B</i></p>
28708 <p><b>A</b><b>B</b></p>
28709 <p><i>A</i><b><i>B</i></b></p>
28710 <p><b>A</b><i><b>B</b></i></p>
28711 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28712 <p><i><b>A</b></i><i><b>B</b></i></p>
28713 <p><i><b>A</b></i><b><i>B</i></b></p>
28714 <p><b><i>A</i></b><i><b>B</b></i></p>
28715 !! wikitext
28716 ''AB''
28717
28718 '''AB'''
28719
28720 ''A'''B'''''
28721
28722 '''A''B'''''
28723
28724 '''A''BC''D'''
28725
28726 '''''AB'''''
28727
28728 '''''AB'''''
28729
28730 '''''AB'''''
28731 !! end
28732
28733 !! test
28734 2. I/B quote minimization: wikitext and html tags should not be combined
28735 !! options
28736 parsoid=html2wt
28737 !! html/parsoid
28738 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28739 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28740 !! wikitext
28741 ''A''<i>B</i>
28742
28743 ''A''<nowiki/>'''<i>B</i>'''
28744 !! end
28745
28746 !! test
28747 3. I/B quote minimization: templated content stops minimization
28748 !! options
28749 parsoid=html2wt
28750 !! html/parsoid
28751 <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>
28752 <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>
28753 !! wikitext
28754 ''A''{{echo|''B''}}
28755
28756 ''A''{{echo|'''''B'''''}}
28757 !! end
28758
28759 !! test
28760 4. I/B quote minimization: new content should be mimimized with adjacent old content
28761 !! options
28762 parsoid=html2wt
28763 !! html/parsoid
28764 <p><i>A</i><i>B</i></p>
28765 <p><b>A</b><b>B</b></p>
28766 <p><i>A</i><b><i>B</i></b></p>
28767 !! wikitext
28768 ''AB''
28769
28770 '''AB'''
28771
28772 ''A'''B'''''
28773 !! end
28774
28775 !! test
28776 5a. Merge adjacent quote nodes if they've been edited
28777 !! options
28778 parsoid={
28779 "modes": ["wt2wt", "selser"],
28780 "changes": [
28781 ["p", "contents", "remove", ":contains('b')"]
28782 ]
28783 }
28784 !! wikitext
28785 ''a''b''c''
28786 !! wikitext/edited
28787 ''ac''
28788 !! end
28789
28790 !! test
28791 5b. Merge adjacent quote nodes if they've been edited
28792 !! options
28793 parsoid={
28794 "modes": ["wt2wt", "selser"],
28795 "changes": [
28796 ["#x", "remove"]
28797 ]
28798 }
28799 !! wikitext
28800 ''a''<span id="x">b</span>''c''
28801 !! wikitext/edited
28802 ''ac''
28803 !! end
28804
28805 !! test
28806 1. Merge adjacent link nodes as long as at least one element is new
28807 !! options
28808 parsoid={
28809 "modes": ["html2wt"],
28810 "scrubWikitext": true
28811 }
28812 !! html/parsoid
28813 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28814 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28815 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28816 !! wikitext
28817 [[Football]]
28818 [[Football]]
28819 [[Football|Foot]][[Football|ball]]
28820 !! end
28821
28822 !! test
28823 2. Merge adjacent link nodes and enable additional normalizations
28824 !! options
28825 parsoid={
28826 "modes": ["html2wt"],
28827 "scrubWikitext": true
28828 }
28829 !! html/parsoid
28830 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28831 !! wikitext
28832 ''[[Football]]''
28833 !! end
28834
28835 !! test
28836 3. Don't merge adjacent link nodes if scrubWikitext is false
28837 !! options
28838 parsoid={
28839 "modes": ["html2wt"],
28840 "scrubWikitext": false
28841 }
28842 !! html/parsoid
28843 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28844 !! wikitext
28845 [[Football|Foot]][[Football|ball]]
28846 !! end
28847
28848 !! test
28849 1. Move format tags outside of WikiLink
28850 !! options
28851 parsoid={
28852 "modes": ["html2wt"],
28853 "scrubWikitext": true
28854 }
28855 !! html/parsoid
28856 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28857 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28858 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28859 !! wikitext
28860 ''[[Football]]''
28861 '''''[[Football]]'''''
28862 <u>'''''[[Football]]'''''</u>
28863 !! end
28864
28865 !! test
28866 2. Move format tags outside of WikiLink with mergable A tags
28867 !! options
28868 parsoid={
28869 "modes": ["html2wt"],
28870 "scrubWikitext": true
28871 }
28872 !! html/parsoid
28873 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28874 !! wikitext
28875 '''''[[Football]]'''''
28876 !! end
28877
28878 !! test
28879 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28880 !! options
28881 parsoid={
28882 "modes": ["html2wt"],
28883 "scrubWikitext": true
28884 }
28885 !! html/parsoid
28886 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28887 !! wikitext
28888 <font color="red"><u>'''[[Foo]]'''</u></font>
28889 !! end
28890
28891 !! test
28892 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28893 !! options
28894 parsoid={
28895 "modes": ["html2wt"],
28896 "scrubWikitext": true
28897 }
28898 !! html/parsoid
28899 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28900 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28901 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28902 !! wikitext
28903 [[Foo|<font color="red">Foo</font>]]
28904 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28905 [[Foo|<span class="Bar">Foo</span>]]
28906 !! end
28907
28908 !! test
28909 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28910 !! options
28911 parsoid={
28912 "modes": ["selser"],
28913 "scrubWikitext": true,
28914 "changes": [
28915 ["a", "html", "<i>Foo</i>"]
28916 ]
28917 }
28918 !! wikitext
28919 [[Foo]]
28920 !! wikitext/edited
28921 ''[[Foo]]''
28922 !! end
28923
28924 !! test
28925 6. Regression test: Manual edit test to ensure diff markers are not lost
28926 !! options
28927 parsoid={
28928 "modes": ["selser"],
28929 "scrubWikitext": true,
28930 "changes": [
28931 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28932 ]
28933 }
28934 !! wikitext
28935 ''Foo''
28936 !! wikitext/edited
28937 ''[[Foo]]''
28938 !! end
28939
28940 !! test
28941 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
28942 !! options
28943 parsoid={
28944 "modes": ["selser"],
28945 "scrubWikitext": true,
28946 "changes": [
28947 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
28948 ]
28949 }
28950 !! wikitext
28951 <div>placeholder</div>
28952 !! wikitext/edited
28953 <div>placeholder</div>
28954 [[Foo]] , placeholder
28955 !! end
28956
28957 #------------------------------
28958 # End of tag minimization tests
28959 #------------------------------
28960
28961 !!test
28962 T56262: New entities
28963 !! options
28964 parsoid=html2wt
28965 !! html/parsoid
28966 <span typeof="mw:Entity">&nbsp;</span>
28967 !! wikitext
28968 &nbsp;
28969 !! end
28970
28971 ## Note that there is no wikitext output for 'unknownproperty' ##
28972 ## Unknown magic words are silently dropped ##
28973
28974 !! test
28975 Magic words
28976 !! options
28977 parsoid=html2wt
28978 !! html/parsoid
28979 <meta property='mw:PageProp/toc' />
28980 <meta property='mw:PageProp/notoc' />
28981 <meta property='mw:PageProp/forcetoc' />
28982 <meta property='mw:PageProp/index' />
28983 <meta property='mw:PageProp/noindex' />
28984 <meta property='mw:PageProp/nogallery' />
28985 <meta property='mw:PageProp/noeditsection' />
28986 <meta property='mw:PageProp/notitleconvert' />
28987 <meta property='mw:PageProp/nocontentconvert' />
28988 <meta property='mw:PageProp/unknownproperty' />
28989 !! wikitext
28990 __TOC__
28991 __NOTOC__
28992 __FORCETOC__
28993 __INDEX__
28994 __NOINDEX__
28995 __NOGALLERY__
28996 __NOEDITSECTION__
28997 __NOTITLECONVERT__
28998 __NOCONTENTCONVERT__
28999 !! end
29000
29001 !! test
29002 Consecutive <pre>s should not get merged
29003 !! options
29004 parsoid=html2wt,html2html
29005 !! html/parsoid
29006 <pre>a</pre><pre>b</pre>
29007
29008 <pre>c
29009 </pre><pre>
29010 d</pre>
29011
29012 <pre>e
29013
29014 </pre><pre>
29015
29016 f</pre>
29017 !! wikitext
29018 a
29019
29020 b
29021
29022 c
29023
29024 d
29025
29026 e
29027
29028
29029
29030 f
29031 !! end
29032
29033 !! test
29034 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29035 !! options
29036 parsoid=html2wt
29037 !! html/parsoid
29038 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29039 !! wikitext
29040 [[Special:BookSources/1234567890|ISBN 1234567895]]
29041 !! end
29042
29043 !! test
29044 Edited RFC links not serializable as RFC links should serialize as extlinks
29045 !! options
29046 parsoid=html2wt
29047 !! html/parsoid
29048 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29049 !! wikitext
29050 [https://tools.ietf.org/html/rfc123 New RFC]
29051 !! end
29052
29053 !! test
29054 Edited PMID links not serializable as PMID links should serialize as extlinks
29055 !! options
29056 parsoid=html2wt
29057 !! html/parsoid
29058 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29059 !! wikitext
29060 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29061 !! end
29062
29063 !! test
29064 WTS of autolinks with trailing/surrounding context
29065 !! options
29066 parsoid=html2wt
29067 !! html/parsoid
29068 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29069 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29070 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29071 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29072 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29073 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29074 !! wikitext
29075 http://cscott.net'''foo'''
29076
29077 http://cscott.net<b>foo</b>
29078
29079 '''http://cscott.net'''
29080
29081 '''http://cscott.net '''
29082
29083 '''http://cscott.net<nowiki/>x'''
29084
29085 http://cscott.net<nowiki/>x
29086 !! end
29087
29088 !! test
29089 WTS of autolinks with nowikis (round-trip)
29090 !! wikitext
29091 x<nowiki/>http://cscott.net<nowiki/>x
29092 !! html/parsoid
29093 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29094 !! end
29095
29096 # this is the "easy" test because it leaves in place all the
29097 # data-parsoid information indicating this is an autolink
29098 !! test
29099 WTS of autolinks with escapes (editing)
29100 !! options
29101 parsoid={
29102 "modes": ["wt2wt"],
29103 "changes": [
29104 [ "span", "remove" ]
29105 ]
29106 }
29107 !! wikitext
29108 x<nowiki/>http://cscott.net<nowiki/>x
29109 !! wikitext/edited
29110 x<nowiki/>http://cscott.net<nowiki/>x
29111 !! end
29112
29113 !! test
29114 WTS of edited autolink-like text (T103364)
29115 !! options
29116 parsoid={
29117 "modes": ["wt2wt"],
29118 "changes": [
29119 [ "span[typeof]", "removeAttr", "typeof" ]
29120 ]
29121 }
29122 !! wikitext
29123 Not a link: <nowiki>http://example.com</nowiki>.
29124 !! wikitext/edited
29125 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29126 !! end
29127
29128 !! test
29129 WTS of newly-authored autolink-like text (T103364)
29130 !! options
29131 parsoid=html2wt
29132 !! html/parsoid
29133 <p>http://example.com is not a link.</p>
29134 !! wikitext
29135 <nowiki>http://example.com</nowiki> is not a link.
29136 !! end
29137
29138 !! test
29139 WTS of autolink-like text after an autolink (T108563)
29140 !! options
29141 parsoid=html2wt
29142 !! html/parsoid
29143 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29144 !! wikitext
29145 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29146 !! end
29147
29148 !! test
29149 Magic links inside links (not autolinked)
29150 !! wikitext
29151 [[Foo|http://example.com]]
29152 [[Foo|RFC 1234]]
29153 [[Foo|PMID 1234]]
29154 [[Foo|ISBN 123456789x]]
29155
29156 [http://foo.com http://example.com]
29157 [http://foo.com RFC 1234]
29158 [http://foo.com PMID 1234]
29159 [http://foo.com ISBN 123456789x]
29160 !! html+tidy
29161 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29162 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29163 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29164 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29165 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29166 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29167 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29168 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29169 </p>
29170 !! html/parsoid
29171 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29172 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29173 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29174 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29175
29176 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29177 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29178 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29179 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29180 !! end
29181
29182 !! test
29183 Magic links inside image captions (autolinked)
29184 !! wikitext
29185 [[File:Foobar.jpg|thumb|http://example.com]]
29186 [[File:Foobar.jpg|thumb|RFC 1234]]
29187 [[File:Foobar.jpg|thumb|PMID 1234]]
29188 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29189 !! html+tidy
29190 <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>
29191 <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>
29192 <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>
29193 <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>
29194 !! html/parsoid
29195 <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>
29196 <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>
29197 <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>
29198 <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>
29199 !! end
29200
29201 !! test
29202 WTS of magic word text (T109371)
29203 !! options
29204 parsoid=html2wt
29205 !! html/parsoid
29206 <p>RFC 1234</p>
29207 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29208 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29209 !! wikitext
29210 <nowiki>RFC 1234</nowiki>
29211
29212 [http://foo.com RFC 1234]
29213
29214 [[Foo|RFC 1234]]
29215 !! end
29216
29217 !! test
29218 Edited Redirect link should emit a non-piped wikitext link
29219 !! options
29220 parsoid=html2wt
29221 !! html/parsoid
29222 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29223 !! wikitext
29224 #REDIRECT [[Bar]]
29225 !! end
29226
29227 !! test
29228 T75121: Infer extension name from typeOf if data-mw is not present
29229 !! options
29230 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29231 !! html/parsoid
29232 <div typeOf="mw:Extension/foo"></div>
29233 !! wikitext
29234 <foo />
29235 !! end
29236
29237 # Note that the <p> wrapping isn't present in PHP parser output
29238 # The important thing for this test is that P-wrapping doesn't
29239 # interfere with the <nowiki> protection for leading - in <td>
29240 # (which isn't necessary for <th>).
29241 !! test
29242 T88318: p-wrapped dash in table.
29243 !! options
29244 parsoid=html2wt,wt2wt
29245 !! html/parsoid
29246 <table><tbody>
29247 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29248 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29249 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29250 </tbody></table>
29251 !! wikitext
29252 {|
29253 !-
29254 !-
29255 |-
29256 |<nowiki>-</nowiki>
29257 |<nowiki>- </nowiki>
29258 |-
29259 |<small>-</small>
29260 |<br />
29261 -
29262 |<br />-
29263 |}
29264 !! html/php+tidy
29265 <table>
29266 <tbody><tr>
29267 <th>-
29268 </th>
29269 <th>-
29270 </th></tr>
29271 <tr>
29272 <td>-
29273 </td>
29274 <td>-
29275 </td></tr>
29276 <tr>
29277 <td><small>-</small>
29278 </td>
29279 <td><br />
29280 <p>-
29281 </p>
29282 </td>
29283 <td><br />-
29284 </td></tr></tbody></table>
29285 !! end
29286
29287 !! test
29288 T149209: WTS: Handle newlines in table cells properly
29289 !! options
29290 parsoid=html2wt
29291 !! html/parsoid
29292 <table>
29293 <tbody>
29294 <tr><td>a
29295 b
29296 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29297 <tr><td><p>x</p>
29298 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29299 </tbody></table>
29300 <table>
29301 <tbody>
29302 <tr><th>a
29303 b
29304 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29305 <tr><th><p>x</h>
29306 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29307 </tbody></table>
29308 !! wikitext
29309 {|
29310 |a
29311 b
29312 |c
29313 |-
29314 |x
29315 {{!}}y
29316 |}
29317 {|
29318 !a
29319 b
29320 !c
29321 |-
29322 !x
29323 !y
29324 |}
29325 !! end
29326
29327 !! test
29328 T149209: Selser: Handle newlines in table cells properly
29329 !! options
29330 parsoid={
29331 "modes": ["selser"],
29332 "changes": [
29333 [ "#h1", "html", "a\nb\n" ],
29334 [ "#h2", "html", "a\nb\n" ],
29335 [ "#c1", "html", "a\nb\n" ],
29336 [ "#c2", "html", "<p>a</p>" ],
29337 [ "#c3", "html", "<p>a</p>" ],
29338 [ "#c4", "html", "edit-me<p>a</p>" ]
29339 ]
29340 }
29341 !! wikitext
29342 {|
29343 ! id="h1" |edit-me!!1
29344 |-
29345 ! id="h2" |edit-me||2
29346 |-
29347 | id="c1" |edit-me||3
29348 |-
29349 | id="c2" |edit-me||4
29350 |-
29351 | id="c3" |edit-me||p||q||r
29352 |-
29353 | id="c4" |edit-me||p||q||r
29354 |}
29355 !! wikitext/edited
29356 {|
29357 ! id="h1" |a
29358 b
29359 !1
29360 |-
29361 ! id="h2" |a
29362 b
29363 !2
29364 |-
29365 | id="c1" |a
29366 b
29367 |3
29368 |-
29369 | id="c2" |a
29370 |4
29371 |-
29372 | id="c3" |a
29373 |p||q||r
29374 |-
29375 | id="c4" |edit-me
29376 a
29377 |p||q||r
29378 |}
29379 !! end
29380
29381 !! test
29382 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29383 !! options
29384 parsoid=html2wt
29385 !! html/parsoid
29386 <table id='mwAb'>
29387 <td id='mwAc'>foo</td>
29388 <td id='serialize-this'>bar</td>
29389 </table>
29390 !! wikitext
29391 {|
29392 |foo
29393 | id="serialize-this" |bar
29394 |}
29395 !! end
29396
29397 !! test
29398 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29399 !! options
29400 parsoid=html2wt
29401 !! html/parsoid
29402 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29403 !! wikitext
29404 <div id="hello">ok</div>
29405 !! end
29406
29407 !! test
29408 Testing serialization after deletion in references
29409 !! options
29410 parsoid={
29411 "modes": ["wt2wt"],
29412 "changes": [
29413 ["#x", "remove"]
29414 ]
29415 }
29416 !! wikitext
29417 hi <ref><div id="x">ho</div></ref>
29418
29419 <references />
29420 !! wikitext/edited
29421 hi <ref></ref>
29422
29423 <references />
29424 !! end
29425
29426 !!test
29427 Testing serialization after deletion of table cells
29428 !!options
29429 parsoid={
29430 "modes": ["wt2wt", "selser"],
29431 "changes": [
29432 ["#x", "remove"]
29433 ]
29434 }
29435 !!wikitext
29436 {|
29437 !h1 !!h2 !!h3
29438 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29439 |}
29440 !! wikitext/edited
29441 {|
29442 !h1!!h2!!h3
29443 |c2|||c3
29444 |}
29445 !!end
29446
29447 !! test
29448 Testing selser after addition of new row before first row (T125419)
29449 !! options
29450 parsoid={
29451 "modes": ["wt2wt", "selser"],
29452 "changes": [
29453 [ "tr", "before", "<tr><td>X</td></tr>" ]
29454 ]
29455 }
29456 !! wikitext
29457 {|
29458 |a
29459 |}
29460 !! wikitext/edited
29461 {|
29462 |X
29463 |-
29464 |a
29465 |}
29466 !! end
29467
29468 !! test
29469 Serialize new table rows in a HTML table using HTML tags
29470 !! options
29471 parsoid={
29472 "modes": ["wt2wt", "selser"],
29473 "changes": [
29474 [ "tr", "before", "<tr><td>X</td></tr>" ]
29475 ]
29476 }
29477 !! wikitext
29478 <table><tr><td>a</td></tr></table>
29479 !! wikitext/edited
29480 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29481 !! end
29482
29483 !! test
29484 Serialize new table cells in a HTML row using HTML tags
29485 !! options
29486 parsoid={
29487 "modes": ["wt2wt", "selser"],
29488 "changes": [
29489 [ "td", "before", "<td>X</td>" ]
29490 ]
29491 }
29492 !! wikitext
29493 <table><tr><td>a</td></tr></table>
29494 !! wikitext/edited
29495 <table><tr><td>X</td><td>a</td></tr></table>
29496 !! end
29497
29498 !! test
29499 Serialize wikitext list items as HTML list items when embedded in a HTML list
29500 !! options
29501 parsoid=html2wt
29502 !! html
29503 <ul data-parsoid='{"stx": "html"}'>
29504 <li data-parsoid='{}'>a</li>
29505 <li>b</li>
29506 </ul>
29507 !! wikitext
29508 <ul>
29509 <li>a</li>
29510 <li>b</li>
29511 </ul>
29512 !! end
29513
29514 # SSS FIXME: Is this actually a good thing given the
29515 # odd nested list output that is generated by MW?
29516 # <ul><li>foo<ul>..</ul></li></ul> instead of
29517 # <ul><li>foo</li><ul>..</ul></ul>
29518 !! test
29519 Wikitext lists can be nested inside HTML lists
29520 !! options
29521 parsoid=html2wt
29522 !! html
29523 <ul data-parsoid='{"stx": "html"}'>
29524 <li data-parsoid='{"stx": "html"}'>a
29525 <ul><li>b</li></ul>
29526 </li>
29527 </ul>
29528
29529 <ul data-parsoid='{"stx": "html"}'>
29530 <li>x
29531 <ul><li>y</li></ul>
29532 </li>
29533 </ul>
29534 !! wikitext
29535 <ul>
29536 <li>a
29537 * b
29538 </li>
29539 </ul>
29540
29541 <ul>
29542 <li>x
29543 * y
29544 </li>
29545 </ul>
29546 !! end
29547
29548 !! test
29549 WTS change modes
29550 !! options
29551 parsoid={
29552 "modes": ["wt2wt"],
29553 "changes": [
29554 [ "#xyz", "before", "<b>before</b> stuff " ],
29555 [ "#xyz", "after", " stuff <i>after</i>" ],
29556 [ "#xyz", "html", "x <b>y</b> z" ]
29557 ]
29558 }
29559 !! wikitext
29560 <span id="xyz">hello</span>
29561 !! wikitext/edited
29562 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29563 !! end
29564
29565 !! test
29566 Never serialize a-tag as html, regardless of what data-parsoid has to say
29567 !! options
29568 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29569 !! html/parsoid
29570 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29571 !! wikitext
29572 [[Foo]]
29573 !! end
29574
29575 ## SSS FIXME: This is broken output nevertheless.
29576 ## What might be a reasonable non-broken output for this?
29577 ## This is an edge case unlikely to be seen in production
29578 ## that I am not wasting more time on this right now.
29579 !! test
29580 Never serialize a-tag as html, no matter what attributes it has
29581 !! options
29582 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29583 !! html/parsoid
29584 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29585 !! wikitext
29586 [http://boo.org http://boohoo.org]
29587 !! end
29588
29589 # Misnested is an indication that selser can reuse the source but these have
29590 # shown to sneak through on occasion. See T101768.
29591 # The original wikitext here is: [http://test.com [[one]] two three]
29592 !! test
29593 Strip span tags added to mark misnested links
29594 !! options
29595 parsoid=html2wt
29596 !! html/parsoid
29597 <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>
29598 !! wikitext
29599 [http://test.com][[one]] two three
29600 !! end
29601
29602 !! test
29603 Catch regression when unpacking misnested links
29604 !! options
29605 parsoid=wt2html
29606 !! wikitext
29607 {{echo|hi}}[http://example.com [[ho]]]
29608 !! html/parsoid
29609 <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>
29610 !! end
29611
29612 !! test
29613 Catch regression when unpacking with trailing content
29614 !! wikitext
29615 {{echo|Foo <references/> bar}}
29616 !! html/parsoid
29617 <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>
29618 !! end
29619
29620 !! test
29621 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29622 !! options
29623 parsoid=html2wt
29624 !! html/parsoid
29625 <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|}"]}'>
29626 <tbody><tr><td>d
29627 </td></tr>
29628 </tbody></table>
29629 !! wikitext
29630 {{echo|a}}
29631 {|{{echo|c
29632 {{!}}d
29633 }}
29634 |}
29635 !! end
29636
29637 ## This test verifies the presence and computation of this attribute indirectly
29638 ## by making an edit and ensuring that the serialization is correct (which it would be
29639 ## only if firstWikitextNode is properly set).
29640 !! test
29641 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29642 !! options
29643 parsoid= {
29644 "modes": ["wt2wt"],
29645 "changes": [
29646 [ "div#x", "remove" ],
29647 [ "div", "before", "<div>new</div>" ]
29648 ]
29649 }
29650 !! wikitext
29651 <div id="x">foo</div>
29652 {|
29653 {{echo|<div>boo</div>
29654 {{!}}b}}
29655 |c
29656 |}
29657 !! wikitext/edited
29658
29659 <div>new</div>
29660 {|
29661 {{echo|<div>boo</div>
29662 {{!}}b}}
29663 |c
29664 |}
29665 !! end
29666
29667 # --------------------------------------------
29668 # Tests spec'ing wikitext serialization norms |
29669 # --------------------------------------------
29670
29671 !! test
29672 Serialize multi-line indent-pre starting with wikitext syntax
29673 !! options
29674 parsoid=html2wt
29675 !! html/parsoid
29676 <pre>* 1
29677 ** 2
29678 * 3</pre>
29679 !! wikitext
29680 * 1
29681 ** 2
29682 * 3
29683 !! end
29684
29685 !! test
29686 1. Categories should always be serialized on their own line
29687 !! options
29688 parsoid=html2wt
29689 !! html/parsoid
29690 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29691 !! wikitext
29692 foo
29693 [[Category:Foo]]
29694 bar
29695 !! end
29696
29697 !! test
29698 2. Categories that are part of templates should not introduce a line break
29699 !! wikitext
29700 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29701 !! html/parsoid
29702 <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>
29703 !! end
29704
29705 # Careful while editing these next 2 tests. There are \u200f characters
29706 # before and after the <link> tags in the HTML and following some
29707 # of the categories in wikitext
29708 # Do not remove these characters in edits.
29709 #
29710 # As part of the serialization, these bidi characters will get stripped.
29711 !! test
29712 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29713 !! options
29714 parsoid={
29715 "modes": ["html2wt"],
29716 "scrubWikitext": true
29717 }
29718 !! html/parsoid
29719 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29720 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29721 !! wikitext
29722 [[קטגוריה:טקסים]]
29723 [[קטגוריה: שיטות משפט]]
29724 !! end
29725
29726 !! test
29727 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29728 !! options
29729 parsoid={
29730 "modes": ["html2wt"],
29731 "scrubWikitext": true
29732 }
29733 !! html/parsoid
29734 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29735 !! wikitext
29736 [[קטגוריה:טקסים]]
29737 ‏y
29738 !! end
29739
29740 !! test
29741 Lists: Add space after bullets
29742 !! options
29743 parsoid=html2wt
29744 !! html/parsoid
29745 <ul>
29746 <li>foo</li>
29747 <li> bar</li>
29748 <li><span> baz</span></li>
29749 </ul>
29750 !! wikitext
29751 * foo
29752 * bar
29753 * <span> baz</span>
29754 !! end
29755
29756 !! test
29757 1. Headings: Add space before/after == (T53744)
29758 !! options
29759 parsoid=html2wt
29760 !! html/parsoid
29761 <h2>foo</h2>
29762 <h2> bar</h2>
29763 <h2>baz </h2>
29764 <h2><span> baz</span></h2>
29765 !! wikitext
29766 == foo ==
29767
29768 == bar ==
29769
29770 == baz ==
29771
29772 == <span> baz</span> ==
29773 !! end
29774
29775 !! test
29776 2. Headings: Add space before/after == even after hoisted content
29777 !! options
29778 parsoid={
29779 "modes": ["html2wt"],
29780 "scrubWikitext": true
29781 }
29782 !! html/parsoid
29783 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29784 !! wikitext
29785 [[Category:A2]]
29786
29787 == ok ==
29788 !! end
29789
29790 !! test
29791 1. Headings: suppress newly created empty headings
29792 !! options
29793 parsoid={
29794 "modes": ["html2wt"],
29795 "scrubWikitext": true
29796 }
29797 !! html/parsoid
29798 <h2></h2>
29799 !! wikitext
29800 !! end
29801
29802 !! test
29803 2. Headings: don't suppress empty headings if scrubWikitext is false
29804 !! options
29805 parsoid=html2wt
29806 !! html/parsoid
29807 <h2></h2>
29808 !! wikitext
29809 ==<nowiki/>==
29810 !! end
29811
29812 !! test
29813 3. Headings: suppress empty headings on edits
29814 !! options
29815 parsoid={
29816 "modes": ["selser"],
29817 "scrubWikitext": true,
29818 "changes": [
29819 [ "#x", "remove"]
29820 ]
29821 }
29822 !! wikitext
29823 ==<span id="x">foo</span>==
29824 !! wikitext/edited
29825 !! end
29826
29827 !! test
29828 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29829 !! options
29830 parsoid={
29831 "modes": ["html2wt"],
29832 "scrubWikitext": true
29833 }
29834 !! html/parsoid
29835 <h2>foo<br/>bar</h2>
29836 <h2>foo <span><br/>bar</span> baz</h2>
29837 !! wikitext
29838 == foo bar ==
29839
29840 == foo <span> bar</span> baz ==
29841 !! end
29842
29843 !! test
29844 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29845 !! options
29846 parsoid={
29847 "modes": ["html2wt"],
29848 "scrubWikitext": false
29849 }
29850 !! html/parsoid
29851 <h2>foo<br/>bar</h2>
29852 !! wikitext
29853 == foo<br />bar ==
29854 !! end
29855
29856 !! test
29857 1. WT Quote Tags: suppress newly created empty style tags
29858 !! options
29859 parsoid={
29860 "modes": ["html2wt"],
29861 "scrubWikitext": true
29862 }
29863 !! html/parsoid
29864 <i></i><b></b>
29865 !! wikitext
29866 !! end
29867
29868 !! test
29869 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29870 !! options
29871 parsoid=html2wt
29872 !! html/parsoid
29873 <i></i><b></b>
29874 !! wikitext
29875 ''<nowiki/>'''''<nowiki/>'''
29876 !! end
29877
29878 !! test
29879 3. WT Quote Tags: suppress empty style tags on edits
29880 !! options
29881 parsoid={
29882 "modes": ["selser"],
29883 "scrubWikitext": true,
29884 "changes": [
29885 [ "#x", "remove"]
29886 ]
29887 }
29888 !! wikitext
29889 '''<span id="x">foo</span>'''
29890 !! wikitext/edited
29891 !! end
29892
29893 !! test
29894 1. Anchors: suppress newly created empty anchors
29895 !! options
29896 parsoid={
29897 "modes": ["html2wt"],
29898 "scrubWikitext": true
29899 }
29900 !! html/parsoid
29901 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29902 !! wikitext
29903 !! end
29904
29905 !! test
29906 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29907 !! options
29908 parsoid={
29909 "modes": ["html2wt"],
29910 "scrubWikitext": false
29911 }
29912 !! html/parsoid
29913 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29914 !! wikitext
29915 [[Test|<nowiki/>]]
29916 !! end
29917
29918 !! test
29919 3. Anchors: suppress empty anchors on edits
29920 !! options
29921 parsoid={
29922 "modes": ["selser"],
29923 "scrubWikitext": true,
29924 "changes": [
29925 [ "#x", "remove"]
29926 ]
29927 }
29928 !! wikitext
29929 [[Test|<span id="x">foo</span>]]
29930 !! wikitext/edited
29931 !! end
29932
29933 !! test
29934 3a. Anchors: do not suppress numbered extlinks
29935 !! options
29936 parsoid={
29937 "modes": ["wt2wt"],
29938 "scrubWikitext": true
29939 }
29940 !! wikitext
29941 [http://foo.com]
29942 !! html/parsoid
29943 <a rel="mw:ExtLink" href="http://foo.com"></a>
29944 !! end
29945
29946 !! test
29947 3b. Anchors: do not suppress numbered extlinks
29948 !! options
29949 parsoid={
29950 "modes": ["wt2wt"],
29951 "scrubWikitext": true,
29952 "changes": [
29953 [ "#x", "remove"]
29954 ]
29955 }
29956 !! wikitext
29957 [http://foo.com <span id="x">foo</span>]
29958 !! wikitext/edited
29959 [http://foo.com]
29960 !! end
29961
29962 !!test
29963 Normalizations should be restricted to edited content
29964 !!options
29965 parsoid={
29966 "modes": ["selser"],
29967 "scrubWikitext": true,
29968 "changes": [
29969 [ "h1", "before", "<i></i>"]
29970 ]
29971 }
29972 !!wikitext
29973 a
29974 = =
29975 b
29976 !!wikitext/edited
29977 a
29978 = =
29979 b
29980 !!end
29981
29982 !! test
29983 1. Multiple normalizations (html2wt)
29984 !! options
29985 parsoid={
29986 "modes": ["html2wt"],
29987 "scrubWikitext": true
29988 }
29989 !! html
29990 <h2><i></i></h2>
29991 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29992 </a><b><i></i></b>x</p>
29993 !! wikitext
29994
29995 [[foo]]
29996 x
29997
29998 !! end
29999
30000 !! test
30001 2. Multiple normalizations (selser)
30002 !! options
30003 parsoid={
30004 "modes": ["selser"],
30005 "scrubWikitext": true,
30006 "changes": [
30007 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
30008 ]
30009 }
30010 !! wikitext
30011 <span id="x">foo</span>
30012 !! wikitext/edited
30013 <span id="x">foo</span>
30014
30015 x
30016 !! end
30017
30018 !! test
30019 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30020 !! options
30021 parsoid={
30022 "modes": ["html2wt"],
30023 "scrubWikitext": true
30024 }
30025 !! html/parsoid
30026 <p> hi</p>
30027 <p> hello</p>
30028 !! wikitext
30029 hi
30030
30031 hello
30032 !! end
30033
30034 !! test
30035 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30036 !! options
30037 parsoid=html2wt
30038 !! html/parsoid
30039 <p> hi</p>
30040 <p> hello</p>
30041 !! wikitext
30042 <nowiki> </nowiki>hi
30043
30044 <nowiki> </nowiki> hello
30045 !! end
30046
30047 !! test
30048 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30049 !! options
30050 parsoid={
30051 "modes": ["html2wt"],
30052 "scrubWikitext": true
30053 }
30054 !! html/parsoid
30055 <p>Foo
30056 bar
30057 baz</p>
30058
30059 <table><tr><td>Foo
30060 bar
30061 baz bang</td></tr></table>
30062
30063 <p><!--boo--> foo
30064 bar</p>
30065
30066 <p> foo
30067 bar<span>boo</span></p>
30068 !! wikitext
30069 Foo
30070 bar
30071 baz
30072
30073 {|
30074 |Foo
30075 bar
30076 baz bang
30077 |}
30078
30079 <!--boo-->foo
30080 bar
30081
30082 foo
30083 bar<span>boo</span>
30084 !! end
30085
30086 !! test
30087 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30088 !! options
30089 parsoid={
30090 "modes": ["selser"],
30091 "scrubWikitext": true,
30092 "changes": [
30093 [ "p", "html", " a\n b" ]
30094 ]
30095 }
30096 !! wikitext
30097 xyz
30098 !! wikitext/edited
30099 a
30100 b
30101 !! end
30102
30103 !! test
30104 1. New links that end in spaces
30105 !! options
30106 parsoid={
30107 "modes": ["html2wt"],
30108 "scrubWikitext": false
30109 }
30110 !! html/parsoid
30111 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30112 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30113 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30114 !! wikitext
30115 [[Berlin ]]<nowiki/>is the capital of Germany.
30116
30117 [[Foo ]]'''bar'''
30118
30119 [[Boston ]] is a city.
30120 !! end
30121
30122 !! test
30123 2. New links that end in spaces
30124 !! options
30125 parsoid={
30126 "modes": ["html2wt"],
30127 "scrubWikitext": true
30128 }
30129 !! html/parsoid
30130 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30131 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30132 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30133 !! wikitext
30134 [[Berlin]] is the capital of Germany.
30135
30136 [[Foo]] '''bar'''
30137
30138 [[Boston]] is a city.
30139 !! end
30140
30141 !! test
30142 1. Table cells with escapable prefixes
30143 !! options
30144 parsoid={
30145 "modes": ["html2wt"],
30146 "scrubWikitext": false
30147 }
30148 !! html
30149 <table>
30150 <tr><td>a</td></tr>
30151 <tr><td>-</td></tr>
30152 <tr><td>+</td></tr>
30153 </table>
30154 !! wikitext
30155 {|
30156 |a
30157 |-
30158 |<nowiki>-</nowiki>
30159 |-
30160 |<nowiki>+</nowiki>
30161 |}
30162 !! end
30163
30164 !! test
30165 2. Table cells with escapable prefixes
30166 !! options
30167 parsoid={
30168 "modes": ["html2wt"],
30169 "scrubWikitext": true
30170 }
30171 !! html
30172 <table>
30173 <tr><td>a</td></tr>
30174 <tr><td>-</td></tr>
30175 <tr><td>+</td></tr>
30176 </table>
30177 !! wikitext
30178 {|
30179 |a
30180 |-
30181 | -
30182 |-
30183 | +
30184 |}
30185 !! end
30186
30187 !! test
30188 3a. Table cells with escapable prefixes after edits
30189 !! options
30190 parsoid={
30191 "modes": ["selser"],
30192 "scrubWikitext": true,
30193 "changes": [
30194 [ "table tbody tr:first-child td:first-child", "remove"]
30195 ]
30196 }
30197 !! wikitext
30198 {|
30199 |a||-
30200 |}
30201 !! wikitext/edited
30202 {|
30203 | -
30204 |}
30205 !! end
30206
30207 !! test
30208 3b. Table cells with escapable prefixes after edits
30209 !! options
30210 parsoid={
30211 "modes": ["selser"],
30212 "scrubWikitext": true,
30213 "changes": [
30214 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30215 [ "#x", "remove" ]
30216 ]
30217 }
30218 !! wikitext
30219 {|
30220 |pqr
30221 |<span id="x">foo</span>+
30222 |}
30223 !! wikitext/edited
30224 {|
30225 | -
30226 | +
30227 |}
30228 !! end
30229
30230 # FIXME: This test will fail because
30231 # normalization doesn't realize that the id attribute
30232 # will eliminate the escapable scenario
30233 !! test
30234 4a. Table cells without escapable prefixes after edits
30235 !! options
30236 parsoid={
30237 "modes": ["selser"],
30238 "scrubWikitext": true,
30239 "changes": [
30240 [ "#x", "html", "-" ]
30241 ]
30242 }
30243 !! wikitext
30244 {|
30245 | id="x" |abcd
30246 |}
30247 !! wikitext/edited
30248 {|
30249 | id="x" |-
30250 |}
30251 !! end
30252
30253 ## This tests normalizer's ability to discriminate between
30254 ## cells having identical content.
30255 !! test
30256 4b. Table cells without escapable prefixes after edits
30257 !! options
30258 parsoid={
30259 "modes": ["selser"],
30260 "scrubWikitext": true,
30261 "changes": [
30262 [ "td", "html", "-" ]
30263 ]
30264 }
30265 !! wikitext
30266 {|
30267 |a||b
30268 |}
30269 !! wikitext/edited
30270 {|
30271 | -||-
30272 |}
30273 !! end
30274
30275 ## This tests normalizer's ability to not be tripped by
30276 ## comments (and whitespace)
30277 !! test
30278 4c. Table cells without escapable prefixes after edits
30279 !! options
30280 parsoid={
30281 "modes": ["selser"],
30282 "scrubWikitext": true,
30283 "changes": [
30284 [ "table tbody tr td:first-child", "remove" ]
30285 ]
30286 }
30287 !! wikitext
30288 {|
30289 |-
30290 <!--foo--> |a||-
30291 |}
30292 !! wikitext/edited
30293 {|
30294 |-
30295 <!--foo--> | -
30296 |}
30297 !! end
30298
30299 ## This tests normalizer's ability to handle HTML cells
30300 !! test
30301 4d. Table cells without escapable prefixes after edits
30302 !! options
30303 parsoid={
30304 "modes": ["selser"],
30305 "scrubWikitext": true,
30306 "changes": [
30307 [ "td", "html", "-" ]
30308 ]
30309 }
30310 !! wikitext
30311 <table>
30312 <tr><td>a</td></tr>
30313 </table>
30314 !! wikitext/edited
30315 <table>
30316 <tr><td>-</td></tr>
30317 </table>
30318 !! end
30319
30320 ## T111151 Remove font elements without attributes
30321 !! test
30322 5a. font tags without attributes should be dropped in scrubWikitext mode
30323 !! options
30324 parsoid={
30325 "modes": ["html2wt"],
30326 "scrubWikitext": true
30327 }
30328 !! html
30329 <font>foo</font>
30330 <font><font>bar</font></font>
30331 <font class="x">boo</font>
30332 !! wikitext
30333 foo
30334 bar
30335 <font class="x">boo</font>
30336 !! end
30337
30338 !! test
30339 5b. font tags should not be dropped without scrubWikitext being enabled
30340 !! options
30341 parsoid={
30342 "modes": ["html2wt"],
30343 "scrubWikitext": false
30344 }
30345 !! html
30346 <font>foo</font>
30347 !! wikitext
30348 <font>foo</font>
30349 !! end
30350
30351 !! test
30352 Escape nowiki DOM elements
30353 !! options
30354 parsoid=html2wt
30355 !! html/parsoid
30356 <nowiki><i>foo</i></nowiki>
30357 !! wikitext
30358 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30359 !! end
30360
30361 # This is meant to be an interim fix while we go about figuring out
30362 # how to not introduce these trailing <nowiki/>s in the first place.
30363 !! test
30364 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30365 !! options
30366 parsoid=html2wt
30367 !! html/parsoid
30368 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30369 y</p>
30370 <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>
30371 <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>
30372 !! wikitext
30373 x
30374 y
30375
30376 {{echo|
30377 1 = <nowiki/>}}
30378
30379 {{echo|
30380 1 = <nowiki/>
30381 }}
30382 !! end
30383
30384 !! test
30385 New list is serialized on newlines
30386 !! options
30387 parsoid=html2wt
30388 !! html/parsoid
30389 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30390 <li>Yesterday</li>
30391 <li>Today</li>
30392 <li>Tomorrow</li>
30393 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30394 !! wikitext
30395 The quick brown fox jumps over the lazy dog.
30396
30397 * Yesterday
30398 * Today
30399 * Tomorrow
30400
30401 The quick onyx goblin jumps over the lazy dwarf.
30402 !! end
30403
30404 !! test
30405 New lists in formatting elements serialized w/o newlines
30406 !! options
30407 parsoid=html2wt
30408 !! html/parsoid
30409 <small>
30410
30411 <ul>
30412 <li>123</li>
30413 </ul>
30414
30415 </small>
30416
30417 <small><ul><li>hi</li></ul></small>
30418 !! wikitext
30419 <small>
30420 * 123
30421 </small>
30422
30423 <small>
30424 * hi
30425 </small>
30426 !! end
30427
30428 !! test
30429 New list in table doesn't need newlines
30430 !! options
30431 parsoid=html2wt
30432 !! html/parsoid
30433 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30434 !! wikitext
30435 {|
30436 |
30437 * test
30438 * 123
30439 |}
30440 !! end
30441
30442 # ---------------------------------------------------
30443 # End of tests spec'ing wikitext serialization norms |
30444 # ---------------------------------------------------
30445
30446 # T104032
30447 !! test
30448 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30449 !! options
30450 parsoid=html2wt
30451 !! html/parsoid
30452 a<p>b</p>
30453 <b>c</b><p>d</p>
30454 <table><tr>
30455 <td>a<p>b</p></td>
30456 <td><b>c</b><p>d</p></td>
30457 </tr></table>
30458 !! wikitext
30459 a
30460
30461 b
30462
30463 '''c'''
30464
30465 d
30466 {|
30467 |a
30468 b
30469 |'''c'''
30470 d
30471 |}
30472 !! end
30473
30474 !! test
30475 Anchor without href scenarios
30476 !! options
30477 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30478 !! html/parsoid
30479 <a class="bc"></a>
30480 <a class="no">dice</a>
30481 <a name="foo"></a>
30482 !! wikitext
30483
30484 dice
30485 <span name="foo"></span>
30486 !! end
30487
30488 !! test
30489 New transclusion added after a list should be serialized after the list
30490 !! options
30491 parsoid=html2wt
30492 !! html/parsoid
30493 <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>
30494 !! wikitext
30495 * a
30496 {{echo|foo}}
30497 !! end
30498
30499 # -----------------------------------------------------------------
30500 # End of section for Parsoid-only html2wt tests for serialization
30501 # of new content
30502 # -----------------------------------------------------------------
30503
30504 # -----------------------------------------------------------------
30505 # The following section of tests are primarily to spec behavior of
30506 # the selective serializer. All these tests have manual selser
30507 # changes. The automated selser changes for all tests handle the
30508 # wide variation of changes, but these tests here capture specs
30509 # deterministically.
30510 # ----------------------------------------------------------------
30511
30512 ## T90517
30513 !! test
30514 Selser: New comments should not be lost
30515 !! options
30516 parsoid={
30517 "modes": ["selser"],
30518 "changes": [
30519 [ "#a", "after", "<!--c1-->" ],
30520 [ "#b", "before", "<!--c2-->" ]
30521 ]
30522 }
30523 !! wikitext
30524 <span id="a">a</span>
30525
30526 <span id="b">b</span>
30527 !! wikitext/edited
30528 <span id="a">a</span><!--c1-->
30529
30530 <!--c2--><span id="b">b</span>
30531 !! end
30532
30533 ## T89383
30534 !! test
30535 Selser: Check for validity of DSR before using it
30536 !! options
30537 parsoid={
30538 "modes": ["selser"],
30539 "changes": [
30540 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30541 ]
30542 }
30543 !! wikitext
30544 <span id="a">a</span>
30545 !! wikitext/edited
30546 {{DISPLAYTITLE:foo}}
30547 <span id="a">a</span>
30548 !! end
30549
30550 !! test
30551 1. DOMDiff: Changes to <ref> content should be looked up using id
30552 !! options
30553 parsoid={
30554 "modes": ["selser"],
30555 "changes": [
30556 ["#X", "after", "bar"],
30557 ["#Y", "after", "baz"]
30558 ]
30559 }
30560 !! wikitext
30561 X <ref><span id="X">foo</span></ref>
30562 Y <ref name="a" />
30563 <references>
30564 <ref name="a"><span id="Y">foo</span></ref>
30565 </references>
30566 !! wikitext/edited
30567 X <ref><span id="X">foo</span>bar</ref>
30568 Y <ref name="a" />
30569 <references>
30570 <ref name="a"><span id="Y">foo</span>baz</ref>
30571 </references>
30572 !! end
30573
30574 !! test
30575 2. DOMDiff: Changes to <ref> content should be looked up using id
30576 !! options
30577 parsoid={
30578 "modes": ["selser"],
30579 "changes": [
30580 ["#Z", "after", "bar"]
30581 ]
30582 }
30583 !! wikitext
30584 A <ref>foo bar for a</ref>
30585 B <ref group="X" name="b" />
30586
30587 <references />
30588
30589 <references group="X">
30590 <ref name="b"><span id="Z">foo</span></ref>
30591 </references>
30592 !! wikitext/edited
30593 A <ref>foo bar for a</ref>
30594 B <ref group="X" name="b" />
30595
30596 <references />
30597
30598 <references group="X">
30599 <ref name="b"><span id="Z">foo</span>bar</ref>
30600 </references>
30601 !! end
30602
30603 !! test
30604 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30605 !! options
30606 parsoid={
30607 "modes": ["selser"],
30608 "changes": [
30609 [ "div:first-child", "text", "bar" ]
30610 ]
30611 }
30612 !! wikitext
30613 <div style="{{1x|color:red;}}%">foo</div>
30614 !! wikitext/edited
30615 <div style="{{1x|color:red;}}%">bar</div>
30616 !! end
30617
30618 !! test
30619 Empty LI (T49673)
30620 !! wikitext
30621 *a
30622 *
30623 *
30624 *b
30625 !! html+tidy
30626 <ul><li>a</li>
30627 <li class="mw-empty-elt"></li>
30628 <li class="mw-empty-elt"></li>
30629 <li>b</li></ul>
30630 !! end
30631
30632 !! test
30633 Thumbnail output
30634 !! wikitext
30635 [[File:Thumb.png|thumb]]
30636 !! html/php+tidy
30637 <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>
30638 !! html/parsoid
30639 <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>
30640 !! end
30641
30642 !! test
30643 unclosed internal link XSS (T137264)
30644 !! wikitext
30645 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30646 !! html/php
30647 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30648 </p>
30649 !! html/parsoid
30650 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30651 !! end
30652
30653 !! test
30654 Validating that <style> isn't eaten by tidy (T167349)
30655 !! options
30656 styletag=1
30657 !! wikitext
30658 <div class="foo">
30659 <style>.foo::before { content: "<foo>"; }</style>
30660 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30661 </div>
30662 !! html/php+tidy
30663 <div class="foo">
30664 <style>.foo::before { content: "<foo>"; }</style>
30665 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30666 </div>
30667 !! end
30668
30669 !! test
30670 Validating that <style> isn't wrapped in a paragraph (T186965)
30671 !! options
30672 styletag=1
30673 !! wikitext
30674 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30675
30676 <style>.foo::before { content: "<foo>"; }</style>
30677
30678 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30679
30680 But if it's on a line with other content, let it be wrapped.
30681
30682 <style>.foo::before { content: "<foo>"; }</style> bar
30683
30684 foo <style>.foo::before { content: "<foo>"; }</style>
30685
30686 foo <style>.foo::before { content: "<foo>"; }</style> bar
30687
30688 And the same if we have non-paragraph-breaking whitespace
30689
30690 foo
30691 <style>.foo::before { content: "<foo>"; }</style>
30692 bar
30693 !! html/php
30694 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30695 </p>
30696 <style>.foo::before { content: "<foo>"; }</style>
30697 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30698 <p>But if it's on a line with other content, let it be wrapped.
30699 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30700 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30701 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30702 </p><p>And the same if we have non-paragraph-breaking whitespace
30703 </p><p>foo
30704 <style>.foo::before { content: "<foo>"; }</style>
30705 bar
30706 </p>
30707 !! end
30708
30709 !! test
30710 Validating that <link> isn't wrapped in a paragraph (T186965)
30711 !! options
30712 styletag=1
30713 !! wikitext
30714 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30715
30716 <link rel="foo" href="bar"/>
30717
30718 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30719
30720 But if it's on a line with other content, let it be wrapped.
30721
30722 <link rel="foo" href="bar"/> bar
30723
30724 foo <link rel="foo" href="bar"/>
30725
30726 foo <link rel="foo" href="bar"/> bar
30727
30728 And the same if we have non-paragraph-breaking whitespace
30729
30730 foo
30731 <link rel="foo" href="bar"/>
30732 bar
30733 !! html/php
30734 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30735 </p>
30736 <link rel="foo" href="bar"/>
30737 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30738 <p>But if it's on a line with other content, let it be wrapped.
30739 </p><p><link rel="foo" href="bar"/> bar
30740 </p><p>foo <link rel="foo" href="bar"/>
30741 </p><p>foo <link rel="foo" href="bar"/> bar
30742 </p><p>And the same if we have non-paragraph-breaking whitespace
30743 </p><p>foo
30744 <link rel="foo" href="bar"/>
30745 bar
30746 </p>
30747 !! end
30748
30749 !! test
30750 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30751 !! config
30752 wgFragmentMode=[ 'html5', 'legacy' ]
30753 !! wikitext
30754 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30755 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30756 !! html/php
30757 <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>
30758 <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>
30759 </p>
30760 !! html/parsoid
30761 <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>
30762 <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>
30763 !! end
30764
30765 !! test
30766 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30767 !! config
30768 wgFragmentMode=[ 'legacy' ]
30769 !! wikitext
30770 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30771 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30772 !! html/php
30773 <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>
30774 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30775 </p>
30776 !! end
30777
30778 !! test
30779 Decoding of HTML entities in embedded HTML tags
30780 !! wikitext
30781 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30782 !! html/php
30783 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30784
30785 !! html/parsoid
30786 <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>
30787 !! end
30788
30789 !! test
30790 Decoding of HTML entities in indicator names for IDs (T104196)
30791 !! options
30792 parsoid=wt2html,html2html
30793 showindicators
30794 !! wikitext
30795 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30796 !! html/php
30797 1&2&3&amp;4&amp;amp;5=Indicator
30798
30799 !! html/parsoid
30800 <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>
30801 !! end
30802
30803 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30804 !! test
30805 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30806 !! options
30807 showindicators
30808 !! wikitext
30809 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30810 !! html/php
30811 1&2&3&amp;4&amp;amp;5=Indicator
30812
30813 !! html/parsoid
30814 <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>
30815 !! end
30816
30817 # This fragment mode is what Parsoid supports.
30818 !! test
30819 HTML5 ids: fallback to legacy
30820 !! config
30821 wgFragmentMode=[ 'html5', 'legacy' ]
30822 !! wikitext
30823 ==Foo bar==
30824
30825 ==foo Bar==
30826
30827 ==Тест==
30828
30829 ==Тест==
30830
30831 ==тест==
30832
30833 ==Hey < # " > % : '==
30834 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30835
30836 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30837
30838 <!-- These two links should produce identical HTML -->
30839 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30840
30841 !! html/php
30842 <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>
30843 <ul>
30844 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30845 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30846 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30847 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30848 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30849 <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>
30850 </ul>
30851 </div>
30852
30853 <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>
30854 <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>
30855 <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>
30856 <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>
30857 <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>
30858 <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>
30859 <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>
30860 </p><p>💩 <span id="💩"></span>
30861 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30862 </p>
30863 !! html/parsoid
30864 <h2 id="Foo_bar">Foo bar</h2>
30865
30866 <h2 id="foo_Bar_2">foo Bar</h2>
30867
30868 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30869
30870 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30871
30872 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30873
30874 <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>
30875 <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>
30876
30877 <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>
30878
30879 <!-- These two links should produce identical HTML -->
30880 <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>
30881 !! end
30882
30883 # Parsoid doesn't support this mode
30884 !! test
30885 HTML5 ids: legacy with a fallback to modern
30886 !! config
30887 wgFragmentMode=[ 'legacy', 'html5' ]
30888 !! wikitext
30889 ==Foo bar==
30890
30891 ==foo Bar==
30892
30893 ==Тест==
30894
30895 ==Тест==
30896
30897 ==тест==
30898
30899 ==Hey < # " > % : '==
30900 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30901
30902 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30903
30904 <!-- These two links should produce identical HTML -->
30905 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30906
30907 !! html/php
30908 <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>
30909 <ul>
30910 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30911 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30912 <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>
30913 <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>
30914 <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>
30915 <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>
30916 </ul>
30917 </div>
30918
30919 <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>
30920 <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>
30921 <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>
30922 <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>
30923 <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>
30924 <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>
30925 <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>
30926 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30927 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30928 </p>
30929 !! end
30930
30931 # Parsoid doesn't support this mode.
30932 !! test
30933 HTML5 ids: no legacy
30934 !! config
30935 wgFragmentMode=[ 'html5' ]
30936 !! wikitext
30937 ==Foo bar==
30938
30939 ==foo Bar==
30940
30941 ==Тест==
30942
30943 ==Тест==
30944
30945 ==тест==
30946
30947 ==Hey < # " > % : '==
30948 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30949
30950 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30951
30952 <!-- These two links should produce identical HTML -->
30953 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30954
30955 !! html/php
30956 <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>
30957 <ul>
30958 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30959 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30960 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30961 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30962 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30963 <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>
30964 </ul>
30965 </div>
30966
30967 <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>
30968 <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>
30969 <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>
30970 <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>
30971 <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>
30972 <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>
30973 <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>
30974 </p><p>💩 <span id="💩"></span>
30975 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30976 </p>
30977 !! end
30978
30979 !! test
30980 T90902: Normalize weird characters in section IDs
30981 !! config
30982 wgFragmentMode=[ 'html5', 'legacy' ]
30983 !! wikitext
30984 ==Foo&nbsp;bar==
30985 [[#Foo&nbsp;bar]]
30986
30987 !! html/php
30988 <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>
30989 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30990 </p>
30991 !! html/parsoid
30992 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30993 <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>
30994 !! end
30995
30996 !! test
30997 T51672: Test for brackets in attributes of elements in external link texts
30998 !! wikitext
30999 [http://example.com/ link <span title="title with [brackets]">span</span>]
31000 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31001
31002 !! html/php
31003 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31004 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31005 </p>
31006 !! html/parsoid
31007 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31008 <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>
31009 !! end
31010
31011 !! test
31012 T72875: Test for brackets in attributes of elements in internal link texts
31013 !! wikitext
31014 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31015 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31016
31017 !! html/php
31018 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31019 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31020 </p>
31021 !! html/parsoid
31022 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31023 <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>
31024 !! end
31025
31026 !! test
31027 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31028 !! options
31029 parsoid={
31030 "modes": ["html2wt"]
31031 }
31032 !! html/parsoid
31033 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31034 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total">10</a>
31035 !! wikitext
31036 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31037 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31038 !! end
31039
31040 !! test
31041 T179544: {{anchorencode:}} output should be always usable in links
31042 !! config
31043 wgFragmentMode=[ 'html5' ]
31044 !! wikitext
31045 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31046 !! html/php
31047 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31048 </p>
31049 !! html/parsoid
31050 <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>
31051 !! end
31052
31053 ## ------------------------------
31054 ## Parsoid section-wrapping tests
31055 ## ------------------------------
31056 !! test
31057 Section wrapping for well-nested sections (no leading content)
31058 !! options
31059 parsoid={
31060 "wrapSections": true
31061 }
31062 !! wikitext
31063 =1=
31064 a
31065
31066 =2=
31067 b
31068
31069 ==2.1==
31070 c
31071
31072 ==2.2==
31073 d
31074
31075 ===2.2.1===
31076 e
31077
31078 =3=
31079 f
31080 !! html/parsoid
31081 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31082 <p>a</p>
31083
31084 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31085 <p>b</p>
31086
31087 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31088 <p>c</p>
31089
31090 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31091 <p>d</p>
31092
31093 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31094 <p>e</p>
31095
31096 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31097 <p>f</p>
31098
31099 </section>
31100 !! end
31101
31102 !! test
31103 Section wrapping for well-nested sections (with leading content)
31104 !! options
31105 parsoid={
31106 "wrapSections": true
31107 }
31108 !! wikitext
31109 Para 1.
31110
31111 Para 2 with a <div>nested in it</div>
31112
31113 Para 3.
31114
31115 =1=
31116 a
31117
31118 =2=
31119 b
31120
31121 ==2.1==
31122 c
31123 !! html/parsoid
31124 <section data-mw-section-id="0"><p>Para 1.</p>
31125
31126 <p>Para 2 with a </p><div>nested in it</div>
31127
31128 <p>Para 3.</p>
31129
31130 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31131 <p>a</p>
31132
31133 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31134 <p>b</p>
31135
31136 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31137 <p>c</p>
31138
31139 </section></section>
31140 !! end
31141
31142 !! test
31143 Section wrapping with template-generated sections (good nesting 1)
31144 !! options
31145 parsoid={
31146 "wrapSections": true
31147 }
31148 !! wikitext
31149 =1=
31150 a
31151
31152 {{echo|1=
31153 ==1.1==
31154 b
31155 }}
31156
31157 ==1.2==
31158 c
31159
31160 =2=
31161 d
31162 !! html/parsoid
31163 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31164 <p>a</p>
31165
31166 <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">
31167 </span><p about="#mwt1">b</p>
31168 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31169 <p>c</p>
31170
31171 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31172 <p>d</p></section>
31173 !! end
31174
31175 # In this example, the template scope is mildly expanded to incorporate the
31176 # trailing newline after the transclusion since that is part of section 1.1.1
31177 !! test
31178 Section wrapping with template-generated sections (good nesting 2)
31179 !! options
31180 parsoid={
31181 "wrapSections": true,
31182 "modes": ["wt2html", "wt2wt"]
31183 }
31184 !! wikitext
31185 =1=
31186 a
31187
31188 {{echo|1=
31189 ==1.1==
31190 b
31191 ===1.1.1===
31192 d
31193 }}
31194 =2=
31195 e
31196 !! html/parsoid
31197 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31198 <p>a</p>
31199
31200 <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">
31201 </span><p about="#mwt1">b</p><span about="#mwt1">
31202 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31203 </span><p about="#mwt1">d</p><span about="#mwt1">
31204 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31205 <p>e</p></section>
31206 !! end
31207
31208 # In this example, the template scope is mildly expanded to incorporate the
31209 # trailing newline after the transclusion since that is part of section 1.2.1
31210 !! test
31211 Section wrapping with template-generated sections (good nesting 3)
31212 !! options
31213 parsoid={
31214 "wrapSections": true,
31215 "modes": ["wt2html", "wt2wt"]
31216 }
31217 !! wikitext
31218 =1=
31219 a
31220
31221 {{echo|1=
31222 x
31223 ==1.1==
31224 b
31225 ==1.2==
31226 c
31227 ===1.2.1===
31228 d
31229 }}
31230 =2=
31231 e
31232 !! html/parsoid
31233 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31234 <p>a</p>
31235
31236 <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">
31237 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31238 </span><p about="#mwt1">b</p><span about="#mwt1">
31239 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31240 </span><p about="#mwt1">c</p><span about="#mwt1">
31241 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31242 </span><p about="#mwt1">d</p><span about="#mwt1">
31243 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31244 <p>e</p></section>
31245 !! end
31246
31247 # Because of section-wrapping and template-wrapping interactions,
31248 # the scope of the template is expanded so that the template markup
31249 # is valid in the presence of <section> tags.
31250 # This exercises the s1 is null scenario in the wrapSections code
31251 !! test
31252 Section wrapping with template-generated sections (bad nesting 1)
31253 !! options
31254 parsoid={
31255 "wrapSections": true
31256 }
31257 !! wikitext
31258 <div>
31259 a
31260
31261 {{echo|
31262 =1=
31263 b
31264 }}
31265
31266 c
31267 </div>
31268 !! html/parsoid
31269 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31270 <p>a</p>
31271
31272 <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"]}'>
31273 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31274 </span><p about="#mwt1">b
31275 </p><span about="#mwt1">
31276
31277 </span><p about="#mwt1">c</p><span about="#mwt1">
31278 </span></section></div></section>
31279 !! end
31280
31281 # Because of section-wrapping and template-wrapping interactions,
31282 # the scope of the template is expanded so that the template markup
31283 # is valid in the presence of <section> tags.
31284 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31285 !! test
31286 Section wrapping with template-generated sections (bad nesting 2)
31287 !! options
31288 parsoid={
31289 "wrapSections": true
31290 }
31291 !! wikitext
31292 =1=
31293 a
31294
31295 {{echo|1=
31296 =2=
31297 b
31298 ==2.1==
31299 c
31300 }}
31301
31302 d
31303
31304 =3=
31305 e
31306 !! html/parsoid
31307 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31308 <p>a</p>
31309
31310 </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">
31311 </span><p about="#mwt1">b</p><span about="#mwt1">
31312 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31313 </span><p about="#mwt1">c</p><span about="#mwt1">
31314
31315 </span><p about="#mwt1">d</p><span about="#mwt1">
31316
31317 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31318 <p>e</p></section>
31319 !! end
31320
31321 # Because of section-wrapping and template-wrapping interactions,
31322 # additional template wrappers are added to <section> tags
31323 # so that template wrapping semantics are valid whether section
31324 # tags are retained or stripped. But, the template scope can expand
31325 # greatly when accounting for section tags.
31326 # This exercises the s1 and s2 are in different subtrees scenario
31327 !! test
31328 Section wrapping with template-generated sections (bad nesting 3)
31329 !! options
31330 parsoid={
31331 "wrapSections": true,
31332 "modes": ["wt2html", "wt2wt"]
31333 }
31334 !! wikitext
31335 =1=
31336 a
31337
31338 {{echo|1=
31339 ==1.2==
31340 b
31341 =2=
31342 c
31343 }}
31344
31345 d
31346
31347 =3=
31348 e
31349 !! html/parsoid
31350 <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>
31351 <p>a</p>
31352
31353 <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">
31354 </span><p about="#mwt1">b</p><span about="#mwt1">
31355 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31356 </span><p about="#mwt1">c</p>
31357
31358 <p>d</p>
31359 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31360 <p>e</p></section>
31361 !! end
31362
31363 !! test
31364 Section wrapping with uneditable lead section + div wrapping multiple sections
31365 !! options
31366 parsoid={
31367 "wrapSections": true
31368 }
31369 !! wikitext
31370 foo
31371
31372 <div style="border:1px solid red;">
31373 =1=
31374 a
31375
31376 ==1.1==
31377 b
31378
31379 =2=
31380 c
31381 </div>
31382
31383 =3=
31384 d
31385
31386 ==3.1==
31387 e
31388 !! html/parsoid
31389 <section data-mw-section-id="-1"><p>foo</p>
31390
31391 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31392 <section data-mw-section-id="1"><h1 id="1">1</h1>
31393 <p>a</p>
31394
31395 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31396 <p>b</p>
31397
31398 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31399 <p>c</p>
31400 </section></div>
31401
31402 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31403 <p>d</p>
31404
31405 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31406 <p>e</p>
31407 </section></section>
31408 !! end
31409
31410 !! test
31411 Section wrapping with editable lead section + div overlapping multiple sections
31412 !! options
31413 parsoid={
31414 "wrapSections": true
31415 }
31416 !! wikitext
31417 foo
31418
31419 =1=
31420 a
31421 <div style="border:1px solid red;">
31422 b
31423
31424 ==1.1==
31425 c
31426
31427 =2=
31428 d
31429 </div>
31430 e
31431
31432 =3=
31433 f
31434
31435 ==3.1==
31436 g
31437 !! html/parsoid
31438 <section data-mw-section-id="0"><p>foo</p>
31439
31440 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31441 <p>a</p>
31442 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31443 <p>b</p>
31444
31445 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31446 <p>c</p>
31447
31448 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31449 <p>d</p>
31450 </section></div>
31451 <p>e</p>
31452
31453 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31454 <p>f</p>
31455
31456 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31457 <p>g</p>
31458 </section></section>
31459 !! end
31460
31461 !! test
31462 HTML header tags should not be wrapped in section tags
31463 !! options
31464 parsoid={
31465 "wrapSections": true
31466 }
31467 !! wikitext
31468 foo
31469
31470 <h1>a</h1>
31471
31472 =b=
31473
31474 <h1>c</h1>
31475
31476 =d=
31477 !! html/parsoid
31478 <section data-mw-section-id="0"><p>foo</p>
31479
31480 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31481
31482 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31483
31484 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31485
31486 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31487 !! end
31488
31489 !! test
31490 Lead section containing only whitespace and comments.
31491 !! options
31492 parsoid={
31493 "wrapSections": true
31494 }
31495 !! wikitext
31496
31497 <!-- this is a comment, presumably significant to editors -->
31498 =1=
31499 a
31500
31501 =2=
31502 b
31503 !! html/parsoid
31504 <section data-mw-section-id="0" data-parsoid="{}">
31505 <!-- this is a comment, presumably significant to editors -->
31506 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31507 <p>a</p>
31508
31509 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31510 <p>b</p></section>
31511 !! end
31512
31513 !! test
31514 Pseudo-sections emitted by templates should have id -2
31515 !! options
31516 parsoid={
31517 "wrapSections": true
31518 }
31519 !! wikitext
31520 foo
31521 {{echo|<div>
31522 ==a==
31523 ==b==
31524 </div>
31525 }}
31526 !! html/parsoid
31527 <section data-mw-section-id="-1"><p>foo</p>
31528 </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}}]}'>
31529 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31530 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31531 </section></div><span about="#mwt1">
31532 </span></section>
31533 !! end
31534
31535 ##########################################################################
31536 Tests demonstrating white-space insensitivity in input wikitext
31537 for wikitext headings, wikitext list items, and wikitext table captions,
31538 headings, and cells. HTML versions of the same should preserve whitespace.
31539 ##########################################################################
31540 !! test
31541 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31542 !! options
31543 parsoid={
31544 "modes": ["wt2html"],
31545 "preserveIEW": true
31546 }
31547 !! wikitext
31548 __NOTOC__
31549 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31550 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31551 == <!--Headings with fallback ids--> Личная жизнь ==
31552 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31553 ; <!--term to define--> term : <!--term's definition--> definition
31554 {|
31555 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31556 |-
31557 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31558 |-
31559 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31560 |-
31561 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31562 |-
31563 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31564 |}
31565 : {|
31566 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31567 |} foo <!--c1-->
31568 !! html/php+tidy
31569 <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>
31570 <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>
31571 <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>
31572 <ul><li>List item</li></ul>
31573 <dl><dt>term&#160;</dt>
31574 <dd>definition</dd></dl>
31575 <table>
31576 <caption>Table Caption
31577 </caption>
31578 <tbody><tr>
31579 <th>Table Heading 1</th>
31580 <th>Table Heading 2
31581 </th></tr>
31582 <tr>
31583 <td>Table Cell 1</td>
31584 <td>Table Cell 2
31585 </td></tr>
31586 <tr>
31587 <td>class="foo"</td>
31588 <td>Table Cell 3
31589 </td></tr>
31590 <tr>
31591 <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
31592 </td></tr></tbody></table>
31593 <dl><dd><table>
31594 <tbody><tr>
31595 <td>Table Cell 1</td>
31596 <td>Table Cell 2
31597 </td></tr></tbody></table> foo</dd></dl>
31598 !! html/parsoid
31599 <meta property="mw:PageProp/notoc">
31600 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31601 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31602 <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>
31603 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31604 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31605 <table>
31606 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31607 <tbody><tr>
31608 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31609 <tr>
31610 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31611 <tr>
31612 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31613 <tr>
31614 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31615 </tbody></table>
31616 <dl><dd><table>
31617 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31618 </tbody></table> foo<!--c1--></dd></dl>
31619 !! end
31620
31621 # Looks like <caption> is not accepted in HTML
31622 !! test
31623 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31624 !! options
31625 parsoid={
31626 "modes": ["wt2html"],
31627 "preserveIEW": true
31628 }
31629 !! wikitext
31630 __NOTOC__
31631 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31632 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31633 <table>
31634 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31635 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31636 </table>
31637 !! html/php+tidy
31638 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31639 <ul><li> List item </li></ul>
31640 <table>
31641 <tbody><tr><th> Table Heading </th><th></th></tr>
31642 <tr><td> Table Cell </td><th></th></tr>
31643 </tbody></table>
31644 !! html/parsoid
31645 <meta property="mw:PageProp/notoc"/>
31646 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31647 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31648 <table>
31649 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31650 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31651 </tbody></table>
31652 !! end
31653
31654 !! test
31655 Do not trim whitespace in links and quotes
31656 !! options
31657 parsoid={
31658 "modes": ["wt2html"],
31659 "preserveIEW": true
31660 }
31661 !! wikitext
31662 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31663 [[Foo| some text ]]
31664 !! html/php+tidy
31665 <p>foo <i> italic </i> and <b> bold </b>
31666 <a href="/wiki/Foo" title="Foo"> some text </a>
31667 </p>
31668 !! html/parsoid
31669 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31670 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31671 !! end
31672
31673 !! test
31674 Remove p tags surrounding a single element in a figcaption
31675 !! options
31676 parsoid=html2wt
31677 !! wikitext
31678 [[File:Foobar.jpg|right|200x200px|Caption]]
31679 !! html/parsoid
31680 <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>
31681 !! end
31682
31683 !! test
31684 Selser preserves lack of newline before list and allows newline after the list
31685 !! options
31686 parsoid={
31687 "modes": ["selser"],
31688 "scrubWikitext": true,
31689 "changes": [
31690 [ "ul", "after", "<p>footer</p>" ]
31691 ]
31692 }
31693 !! wikitext
31694 header
31695 *foo
31696 *bar
31697 !! wikitext/edited
31698 header
31699 *foo
31700 *bar
31701
31702 footer
31703 !! end
31704
31705
31706 !! test
31707 Selser does not introduce newlines between unedited paragraph preceding the list
31708 !! options
31709 parsoid={
31710 "modes": ["selser"],
31711 "changes": [
31712 [ "table tbody tr td p:last-child", "empty" ]
31713 ]
31714 }
31715 !! wikitext
31716 {|
31717 |
31718 header
31719 *foo
31720 *bar
31721 footer
31722 |}
31723 !! wikitext/edited
31724 {|
31725 |
31726 header
31727 *foo
31728 *bar
31729
31730 |}
31731 !! end
31732
31733 !! test
31734 Selser does not introduce newlines between unedited paragraph following the list
31735 !! options
31736 parsoid={
31737 "modes": ["selser"],
31738 "changes": [
31739 [ "table tbody tr td p:first-child", "empty" ]
31740 ]
31741 }
31742 !! wikitext
31743 {|
31744 |
31745 header
31746 *foo
31747 *bar
31748 footer
31749 |}
31750 !! wikitext/edited
31751 {|
31752 |
31753
31754 *foo
31755 *bar
31756 footer
31757 |}
31758 !! end
31759
31760 !! test
31761 Remove a list item but do not insert newline above list
31762 !! options
31763 parsoid={
31764 "modes": ["selser"],
31765 "changes": [
31766 [ "ul li:last-child", "remove" ]
31767 ]
31768 }
31769 !! wikitext
31770 header
31771 *foo
31772 *bar
31773 footer
31774 !! wikitext/edited
31775 header
31776 *foo
31777 footer
31778 !! end