Don't infer parsoid-only parser tests based on presence of parsoid option.
[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, wgMediaInTargetLanguage
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 Foo''s bar''s
61 !!text
62 Article titles can contain single quotes!
63 !!endarticle
64
65 !!article
66 Template:Foo
67 !!text
68 FOO
69 !!endarticle
70
71 !! article
72 Template:redirect to foo
73 !! text
74 #REDIRECT [[Template:Foo]]
75 !! endarticle
76
77 !! article
78 Template:Blank
79 !! text
80 !! endarticle
81
82 !! article
83 Template:pipe
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:=
90 !! text
91 <nowiki>=</nowiki>
92 !! endarticle
93
94 !!article
95 MediaWiki:bad image list
96 !!text
97 * [[File:Bad.jpg]] except [[Nasty page]]
98 !!endarticle
99
100 !! article
101 Template:inner list
102 !! text
103 * item 1
104 !! endarticle
105
106 !! article
107 Template:tbl-start
108 !! text
109 {|
110 !! endarticle
111
112 !! article
113 Template:tbl-end
114 !! text
115 |}
116 !! endarticle
117
118 !! article
119 Template:echo
120 !! text
121 {{{1}}}
122 !! endarticle
123
124 !! article
125 Template:echo3
126 !! text
127 {{{1}}}
128 {{{1}}}
129 {{{1}}}
130 !! endarticle
131
132 // For Serbian; localize Template namespace
133 !! article
134 Шаблон:Echo
135 !! text
136 {{{1}}}
137 !! endarticle
138
139 !! article
140 Template:echo_with_span
141 !! text
142 <span>{{{1}}}</span>
143 !! endarticle
144
145 !! article
146 Template:echo_with_div
147 !! text
148 <div>{{{1}}}</div>
149 !! endarticle
150
151 !! article
152 Template:echo with depth
153 !! text
154 {{echo|{{{1}}}}}
155 !! endarticle
156
157 !! article
158 Template:blank_param
159 !! text
160 {{{1}}}
161 {{{}}}
162 !! endarticle
163
164 !! article
165 Template:table_attribs
166 !! text
167 <noinclude>
168 |</noinclude>style="color:red;"|Foo
169 !! endarticle
170
171 !! article
172 Template:table_attribs_2
173 !! text
174 <noinclude>
175 |</noinclude>style="color:red;"|Foo
176 |Bar||Baz
177 !! endarticle
178
179 !! article
180 Template:table_attribs_3
181 !! text
182 <noinclude>
183 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
184 !! endarticle
185
186 !! article
187 Template:table_attribs_4
188 !! text
189 | style="background-color:#DC241f;" width="10px" |
190 !! endarticle
191
192 !! article
193 Template:table_attribs_5
194 !! text
195 <noinclude>
196 |</noinclude>style="color:red;"||Bar
197 !! endarticle
198
199 !! article
200 Template:table_attribs_6
201 !! text
202 style="background: <nowiki>
203
204
205 red;</nowiki>" |
206 !! endarticle
207
208 !! article
209 Template:table_attribs_7
210 !! text
211 <noinclude>
212 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
213 !! endarticle
214
215 !! article
216 Template:table_header_cells
217 !! text
218 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:table_cells
223 !! text
224 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
225 !! endarticle
226
227 !! article
228 Template:PartialTable
229 !! text
230 {|
231 |-
232 !! endarticle
233
234 !! article
235 Template:image_attribs
236 !! text
237 <noinclude>
238 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
239 !! endarticle
240
241 ## See T48811 for details
242 !! article
243 Template:mixed_attr_content_template
244 !! text
245 style="color:red;" title="T48811"
246 |-
247 |foo
248 !! endarticle
249
250 !! article
251 Template:definition_list
252 !! text
253 one
254 ::two
255 !! endarticle
256
257 !! article
258 A?b
259 !! text
260 Weirdo titles!
261 !! endarticle
262
263 !!article
264 Template:Bullet
265 !!text
266 *Bar
267 !!endarticle
268
269 !!article
270 Template:OpenTable
271 !!text
272 {|
273 !!endarticle
274
275 !!article
276 Template:EmptyLITest
277 !!text
278 *a
279 *
280 *
281 *b
282 !!endarticle
283
284 !!article
285 Template:EmptyTRTest
286 !!text
287 {|
288 |-
289 |-
290 |foo
291 |-
292 |-
293 |bar
294 |}
295 !!endarticle
296
297 !!article
298 Template:EmptyTRWithHTMLAttrTest
299 !!text
300 <table>
301 <tr align="center"></tr>
302 <tr><td>foo</td></tr>
303 <tr align="center"></tr>
304 <tr><td>bar</td></tr>
305 </table>
306 !!endarticle
307
308 !! article
309 Template:With: Colon
310 !! text
311 Template with colon
312 !! endarticle
313
314 ###
315 ### Basic tests
316 ###
317
318 !! test
319 Blank input
320 !! wikitext
321 !! html
322 !! end
323
324 !! test
325 Simple paragraph
326 !! wikitext
327 This is a simple paragraph.
328 !! html
329 <p>This is a simple paragraph.
330 </p>
331 !! end
332
333 !! test
334 Paragraphs with extra newline spacing
335 !! wikitext
336 a
337
338 b (+2 nls)
339
340
341 c (+3 nls)
342
343
344
345 d (+4 nls)
346
347
348
349
350 e (+5 nls)
351 !! html
352 <p>a
353 </p><p>b (+2 nls)
354 </p><p><br />
355 c (+3 nls)
356 </p><p><br />
357 </p><p>d (+4 nls)
358 </p><p><br />
359 </p><p><br />
360 e (+5 nls)
361 </p>
362 !! end
363
364 !! test
365 Paragraphs with newline spacing with comment lines in between
366 !! wikitext
367 ----
368 a
369 <!--foo-->
370 b
371 ----
372 a
373 <!--foo--><!--More than 1 comment, still stripped-->
374 b
375 ----
376 a
377 <!--foo--> <!----> <!-- bar -->
378 b
379 ----
380 a
381 <!--foo-->
382
383 b
384 ----
385 a
386
387 <!--foo-->
388 b
389 ----
390 a
391 <!--foo-->
392
393
394 b
395 ----
396 a
397
398
399 <!--foo-->
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 b
406 </p>
407 <hr />
408 <p>a
409 b
410 </p>
411 <hr />
412 <p>a
413 b
414 </p>
415 <hr />
416 <p>a
417 </p><p>b
418 </p>
419 <hr />
420 <p>a
421 </p><p>b
422 </p>
423 <hr />
424 <p>a
425 </p><p><br />
426 b
427 </p>
428 <hr />
429 <p>a
430 </p><p><br />
431 b
432 </p>
433 <hr />
434
435 !! end
436
437 !! test
438 Paragraphs with newline spacing with non-empty white-space lines in between
439 !! wikitext
440 ----
441 a
442
443 b
444 ----
445 a
446
447
448 b
449 ----
450 !! html
451 <hr />
452 <p>a
453 </p><p>b
454 </p>
455 <hr />
456 <p>a
457 </p><p><br />
458 b
459 </p>
460 <hr />
461
462 !! end
463
464 !! test
465 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
466 !! wikitext
467 ----
468 a
469 <!--foo-->
470 b
471 ----
472 a
473 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
474 b
475 ----
476 a
477
478 <!--foo-->
479 <!--bar-->
480 b
481 ----
482 a
483
484 <!--foo-->
485 <!--bar-->
486
487 b
488 ----
489 !! html
490 <hr />
491 <p>a
492 b
493 </p>
494 <hr />
495 <p>a
496 b
497 </p>
498 <hr />
499 <p>a
500 </p><p>b
501 </p>
502 <hr />
503 <p>a
504 </p><p><br />
505 b
506 </p>
507 <hr />
508
509 !! end
510
511 !! test
512 Extra newlines: More paragraphs with indented comment
513 !! wikitext
514 a
515
516 <!--boo-->
517
518 b
519 !! html
520 <p>a
521 </p><p><br />
522 b
523 </p>
524 !!end
525
526 !! test
527 Extra newlines followed by heading
528 !! wikitext
529 a
530
531
532 =b=
533 [[a]]
534
535
536 =b=
537 !! html
538 <p>a
539 </p><p><br />
540 </p>
541 <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>
542 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
543 </p><p><br />
544 </p>
545 <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>
546
547 !! end
548
549 !! test
550 Extra newlines between heading and content are swallowed (Parsoid does not)
551 !! wikitext
552 =b=
553
554
555
556 [[a]]
557 !! html/php+tidy
558 <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>
559 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
560 </p>
561 !! html/parsoid
562 <h1 id="b">b</h1>
563 <p>
564 <br></p>
565
566 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
567 !! end
568
569 !! test
570 Extra new lines before and after lists are preserved
571 !! wikitext
572 a
573
574
575 *b
576
577
578 c
579 !! html/php+tidy
580 <p>a
581 </p><p><br />
582 </p>
583 <ul><li>b</li></ul>
584 <p><br />
585 c
586 </p>
587 !! html/parsoid
588 <p>a</p>
589 <p>
590 <br></p>
591 <ul><li>b</li></ul>
592 <p>
593 <br>
594 c</p>
595 !! end
596
597 # Parsoid regression test
598 !!test
599 Multiple newlines after tables are converted to p-br-p tags
600 !!options
601 parsoid=wt2html,wt2wt
602 !!wikitext
603 {|
604 |x
605 |}
606
607
608
609
610 =b=
611 !!html/php+tidy
612 <table>
613 <tbody><tr>
614 <td>x
615 </td></tr></tbody></table>
616 <p><br />
617 </p><p><br />
618 </p>
619 <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>
620 !!html/parsoid
621 <table>
622 <tbody>
623 <tr>
624 <td>x</td>
625 </tr>
626 </tbody>
627 </table>
628 <p><br/></p>
629 <p><br/></p>
630 <h1 id="b">b</h1>
631 !!end
632
633 !! test
634 Heading with line break in nowiki
635 !! options
636 parsoid=wt2html
637 !! config
638 wgFragmentMode=[ 'html5', 'legacy' ]
639 !! wikitext
640 ==A <nowiki>B
641 C</nowiki>==
642 !! html/php
643 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
644 C">A B
645 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>
646
647 !! html/parsoid
648 <h2 id="A_B
649 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
650 C</span></h2>
651 !! end
652
653 !! test
654 Parsing an URL
655 !! wikitext
656 http://fr.wikipedia.org/wiki/🍺
657 <!-- EasterEgg we love beer, better be able be able to link to it -->
658 !! html
659 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
660 </p>
661 !! end
662
663 !! test
664 Simple list
665 !! wikitext
666 *Item 1
667 *Item 2
668 !! html
669 <ul><li>Item 1</li>
670 <li>Item 2</li></ul>
671
672 !! end
673
674 !! test
675 Italics and bold
676 !! wikitext
677 *plain
678 *plain''italic''plain
679 *plain''italic''plain''italic''plain
680 *plain'''bold'''plain
681 *plain'''bold'''plain'''bold'''plain
682 *plain''italic''plain'''bold'''plain
683 *plain'''bold'''plain''italic''plain
684 *plain''italic'''bold-italic'''italic''plain
685 *plain'''bold''bold-italic''bold'''plain
686 *plain'''''bold-italic'''italic''plain
687 *plain'''''bold-italic''bold'''plain
688 *plain''italic'''bold-italic'''''plain
689 *plain'''bold''bold-italic'''''plain
690 *plain l'''italic''plain
691 *plain l''''bold''' plain
692 !! html
693 <ul><li>plain</li>
694 <li>plain<i>italic</i>plain</li>
695 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
696 <li>plain<b>bold</b>plain</li>
697 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
698 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
699 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
700 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
701 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
702 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
703 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
704 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
705 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
706 <li>plain l'<i>italic</i>plain</li>
707 <li>plain l'<b>bold</b> plain</li></ul>
708
709 !! end
710
711 # this example taken from the [[simple:Moon]] article (T49326)
712 !! test
713 Italics and possessives (1)
714 !! wikitext
715 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
716 !! html
717 <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
718 </p>
719 !! end
720
721 # this example taken from [[en:Flaming Pie]] (T51926)
722 !! test
723 Italics and possessives (2)
724 !! wikitext
725 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
726 !! html
727 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
728 </p>
729 !! end
730
731 # this example taken from [[en:Dictionary]] (T51926)
732 !! test
733 Italics and possessives (3)
734 !! wikitext
735 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''.
736 !! html
737 <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>.
738 </p>
739 !! end
740
741
742 ###
743 ### 2-quote opening sequence tests
744 ###
745 !! test
746 Italics and bold: 2-quote opening sequence: (2,2)
747 !! wikitext
748 ''foo''
749 !! html
750 <p><i>foo</i>
751 </p>
752 !!end
753
754 !! test
755 Italics and bold: 2-quote opening sequence: (2,3)
756 !! wikitext
757 ''foo'''
758 !! html/*
759 <p><i>foo'</i>
760 </p>
761 !!end
762
763 !! test
764 Italics and bold: 2-quote opening sequence: (2,4)
765 !! options
766 parsoid=wt2html
767 !! wikitext
768 ''foo''''
769 !! html/*
770 <p><i>foo''</i>
771 </p>
772 !!end
773
774 # same html as previous, but wikitext adjusted to match parsoid html2wt
775 !! test
776 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
777 !! wikitext
778 ''foo<nowiki>''</nowiki>''
779 !! html
780 <p><i>foo''</i>
781 </p>
782 !! end
783
784 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
785 !! test
786 Italics and bold: 2-quote opening sequence: (2,5)
787 !! options
788 parsoid=wt2html
789 !! wikitext
790 ''foo'''''
791 !! html/php
792 <p><i>foo</i>
793 </p>
794 !! html/parsoid
795 <p><i>foo</i><b></b>
796 </p>
797 !!end
798
799 # same html as previous, but wikitext adjusted to match parsoid html2wt
800 !! test
801 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
802 !! wikitext
803 ''foo'''''<nowiki/>'''
804 !! html/php
805 <p><i>foo</i>
806 </p>
807 !! html/parsoid
808 <p><i>foo</i><b></b>
809 </p>
810 !! end
811
812
813 ###
814 ### 3-quote opening sequence tests
815 ###
816
817 !! test
818 Italics and bold: 3-quote opening sequence: (3,2)
819 !! wikitext
820 '''foo''
821 !! html/*
822 <p>'<i>foo</i>
823 </p>
824 !!end
825
826 !! test
827 Italics and bold: 3-quote opening sequence: (3,3)
828 !! wikitext
829 '''foo'''
830 !! html
831 <p><b>foo</b>
832 </p>
833 !!end
834
835 !! test
836 Italics and bold: 3-quote opening sequence: (3,4)
837 !! wikitext
838 '''foo''''
839 !! html/*
840 <p><b>foo'</b>
841 </p>
842 !!end
843
844 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
845 !! test
846 Italics and bold: 3-quote opening sequence: (3,5)
847 !! options
848 parsoid=wt2html
849 !! wikitext
850 '''foo'''''
851 !! html/php
852 <p><b>foo</b>
853 </p>
854 !! html/parsoid
855 <p><b>foo</b><i></i>
856 </p>
857 !!end
858
859 # same html as previous, but wikitext adjusted to match parsoid html2wt
860 !! test
861 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
862 !! wikitext
863 '''foo'''''<nowiki/>''
864 !! html/php
865 <p><b>foo</b>
866 </p>
867 !! html/parsoid
868 <p><b>foo</b><i></i>
869 </p>
870 !! end
871
872
873 ###
874 ### 4-quote opening sequence tests
875 ###
876
877 !! test
878 Italics and bold: 4-quote opening sequence: (4,2)
879 !! options
880 parsoid=wt2html
881 !! wikitext
882 ''''foo''
883 !! html/*
884 <p>''<i>foo</i>
885 </p>
886 !!end
887
888 # same html as previous, but wikitext adjusted to match parsoid html2wt
889 !! test
890 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
891 !! wikitext
892 <nowiki>''</nowiki>''foo''
893 !! html
894 <p>''<i>foo</i>
895 </p>
896 !! end
897
898 !! test
899 Italics and bold: 4-quote opening sequence: (4,3)
900 !! wikitext
901 ''''foo'''
902 !! html/*
903 <p>'<b>foo</b>
904 </p>
905 !!end
906
907 !! test
908 Italics and bold: 4-quote opening sequence: (4,4)
909 !! options
910 parsoid=wt2html
911 !! wikitext
912 ''''foo''''
913 !! html/*
914 <p>'<b>foo'</b>
915 </p>
916 !!end
917
918 # same html as previous, but wikitext adjusted to match parsoid html2wt
919 !! test
920 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
921 !! wikitext
922 '<nowiki/>'''foo''''
923 !! html
924 <p>'<b>foo'</b>
925 </p>
926 !! end
927
928 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
929 !! test
930 Italics and bold: 4-quote opening sequence: (4,5)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 ''''foo'''''
935 !! html/php
936 <p>'<b>foo</b>
937 </p>
938 !! html/parsoid
939 <p>'<b>foo</b><i></i>
940 </p>
941 !!end
942
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
946 !! wikitext
947 '<nowiki/>'''foo'''''<nowiki/>''
948 !! html/php
949 <p>'<b>foo</b>
950 </p>
951 !! html/parsoid
952 <p>'<b>foo</b><i></i>
953 </p>
954 !! end
955
956
957 ###
958 ### 5-quote opening sequence tests
959 ###
960
961 !! test
962 Italics and bold: 5-quote opening sequence: (5,2)
963 !! options
964 parsoid=wt2html
965 !! wikitext
966 '''''foo''
967 !! html/*
968 <p><b><i>foo</i></b>
969 </p>
970 !!end
971
972 # same html as previous, but wikitext adjusted to match parsoid html2wt
973 !! test
974 Italics and bold: 5-quote opening sequence: (5,2+3)
975 !! wikitext
976 '''''foo'''''
977 !! html/*
978 <p><i><b>foo</b></i>
979 </p>
980 !! end
981
982 !! test
983 Italics and bold: 5-quote opening sequence: (5,3)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 '''''foo'''
988 !! html/*
989 <p><i><b>foo</b></i>
990 </p>
991 !!end
992
993 # same html as previous, but wikitext adjusted to match parsoid html2wt
994 !! test
995 Italics and bold: 5-quote opening sequence: (5,3+2)
996 !! wikitext
997 '''''foo'''''
998 !! html
999 <p><i><b>foo</b></i>
1000 </p>
1001 !! end
1002
1003 !! test
1004 Italics and bold: 5-quote opening sequence: (5,4)
1005 !! options
1006 parsoid=wt2html
1007 !! wikitext
1008 '''''foo''''
1009 !! html/*
1010 <p><i><b>foo'</b></i>
1011 </p>
1012 !!end
1013
1014 !! test
1015 Italics and bold: 5-quote opening sequence: (5,5)
1016 !! wikitext
1017 '''''foo'''''
1018 !! html
1019 <p><i><b>foo</b></i>
1020 </p>
1021 !!end
1022
1023 !! test
1024 Italics and bold: 5-quote opening sequence: (5,6)
1025 !! wikitext
1026 '''''foo''''''
1027 !! html/*
1028 <p><i><b>foo'</b></i>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### multiple quote sequences in a line
1034 ###
1035
1036 !! test
1037 Italics and bold: multiple quote sequences: (2,4,2)
1038 !! options
1039 parsoid=wt2html
1040 !! wikitext
1041 ''foo''''bar''
1042 !! html/*
1043 <p><i>foo'<b>bar</b></i>
1044 </p>
1045 !! end
1046
1047 # same html as previous, but wikitext adjusted to match parsoid html2wt
1048 !! test
1049 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1050 !! wikitext
1051 ''foo'<nowiki/>'''bar'''''
1052 !! html
1053 <p><i>foo'<b>bar</b></i>
1054 </p>
1055 !! end
1056
1057 !! test
1058 Italics and bold: multiple quote sequences: (2,4,3)
1059 !! options
1060 parsoid=wt2html
1061 !! wikitext
1062 ''foo''''bar'''
1063 !! html/*
1064 <p><i>foo'<b>bar</b></i>
1065 </p>
1066 !! end
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1071 !! wikitext
1072 ''foo'<nowiki/>'''bar'''''
1073 !! html
1074 <p><i>foo'<b>bar</b></i>
1075 </p>
1076 !! end
1077
1078 !! test
1079 Italics and bold: multiple quote sequences: (2,4,4)
1080 !! options
1081 parsoid=wt2html
1082 !! wikitext
1083 ''foo''''bar''''
1084 !! html/*
1085 <p><i>foo'<b>bar'</b></i>
1086 </p>
1087 !! end
1088
1089 # same html as previous, but wikitext adjusted to match parsoid html2wt
1090 !! test
1091 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1092 !! wikitext
1093 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1094 !! html
1095 <p><i>foo'<b>bar'</b></i>
1096 </p>
1097 !! end
1098
1099 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1100 !! test
1101 Italics and bold: multiple quote sequences: (3,4,2)
1102 !! options
1103 parsoid=wt2html
1104 !! wikitext
1105 '''foo''''bar''
1106 !! html/php
1107 <p><b>foo'</b>bar
1108 </p>
1109 !! html/parsoid
1110 <p><b>foo'</b>bar<i></i>
1111 </p>
1112 !! end
1113
1114 # same html as previous, but wikitext adjusted to match parsoid html2wt
1115 !! test
1116 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1117 !! wikitext
1118 '''foo''''bar''<nowiki/>''
1119 !! html/php
1120 <p><b>foo'</b>bar
1121 </p>
1122 !! html/parsoid
1123 <p><b>foo'</b>bar<i></i>
1124 </p>
1125 !! end
1126
1127 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1128 !! test
1129 Italics and bold: multiple quote sequences: (3,4,3)
1130 !! options
1131 parsoid=wt2html
1132 !! wikitext
1133 '''foo''''bar'''
1134 !! html/php
1135 <p><b>foo'</b>bar
1136 </p>
1137 !! html/parsoid
1138 <p><b>foo'</b>bar<b></b>
1139 </p>
1140 !! end
1141
1142 # same html as previous, but wikitext adjusted to match parsoid html2wt
1143 !! test
1144 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1145 !! wikitext
1146 '''foo''''bar'''<nowiki/>'''
1147 !! html/php
1148 <p><b>foo'</b>bar
1149 </p>
1150 !! html/parsoid
1151 <p><b>foo'</b>bar<b></b>
1152 </p>
1153 !! end
1154
1155 ###
1156 ### other quote tests
1157 ###
1158 !! test
1159 Italics and bold: other quote tests: (2,3,5)
1160 !! wikitext
1161 ''this is about '''foo's family'''''
1162 !! html
1163 <p><i>this is about <b>foo's family</b></i>
1164 </p>
1165 !!end
1166
1167
1168 !! test
1169 Italics and bold: other quote tests: (2,(3,3),2)
1170 !! wikitext
1171 ''this is about '''foo's''' family''
1172 !! html
1173 <p><i>this is about <b>foo's</b> family</i>
1174 </p>
1175 !!end
1176
1177
1178 !! test
1179 Italics and bold: other quote tests: (3,2,3,2)
1180 !! options
1181 parsoid=wt2html
1182 !! wikitext
1183 '''this is about ''foo'''s family''
1184 !! html/*
1185 <p><b>this is about <i>foo</i></b><i>s family</i>
1186 </p>
1187 !!end
1188
1189
1190 # same html as previous, but wikitext adjusted to match parsoid html2wt
1191 !! test
1192 Italics and bold: other quote tests: (3,2,3+2+2,2)
1193 !! wikitext
1194 '''this is about ''foo'''''<nowiki/>''s family''
1195 !! html
1196 <p><b>this is about <i>foo</i></b><i>s family</i>
1197 </p>
1198 !! end
1199
1200
1201 !! test
1202 Italics and bold: other quote tests: (3,2,3,3)
1203 !! wikitext
1204 '''this is about ''foo'''s family'''
1205 !! html/*
1206 <p>'<i>this is about </i>foo<b>s family</b>
1207 </p>
1208 !!end
1209
1210
1211 !! test
1212 Italics and bold: other quote tests: (3,(2,2),3)
1213 !! wikitext
1214 '''this is about ''foo's'' family'''
1215 !! html
1216 <p><b>this is about <i>foo's</i> family</b>
1217 </p>
1218 !!end
1219
1220
1221 !! test
1222 Italicized possessive
1223 !! wikitext
1224 The ''[[Main Page]]'''s talk page.
1225 !! html/php
1226 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1227 </p>
1228 !! html/parsoid
1229 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1230 !! end
1231
1232 !! test
1233 Quote balancing context should be restricted to td/th cells on the same wikitext line
1234 !! options
1235 parsoid=wt2html,wt2wt
1236 !! wikitext
1237 {|
1238 !''a!!''b
1239 |''a||''b
1240 |}
1241 !! html+tidy
1242 <table>
1243 <tbody><tr>
1244 <th><i>a</i></th>
1245 <th><i>b</i>
1246 </th>
1247 <td><i>a</i></td>
1248 <td><i>b</i>
1249 </td></tr></tbody></table>
1250 !! end
1251
1252 ###
1253 ### Non-html5 tags
1254 ###
1255
1256 !! test
1257 Non-html5 tags should be accepted
1258 !! wikitext
1259 <center>''foo''</center>
1260 <big>''foo''</big>
1261 <font>''foo''</font>
1262 <strike>''foo''</strike>
1263 <tt>''foo''</tt>
1264 !! html
1265 <center><i>foo</i></center>
1266 <p><big><i>foo</i></big>
1267 <font><i>foo</i></font>
1268 <strike><i>foo</i></strike>
1269 <tt><i>foo</i></tt>
1270 </p>
1271 !! end
1272
1273 !! test
1274 <wbr> is valid wikitext (T54468)
1275 !! wikitext
1276 <wbr>
1277 !! html
1278 <p><wbr />
1279 </p>
1280 !! end
1281
1282 # <strike> is HTML4, <s> is HTML4/5.
1283 !! test
1284 <s> or <strike> for strikethrough
1285 !! wikitext
1286 <strike>strike</strike>
1287
1288 <s>s</s>
1289 !! html
1290 <p><strike>strike</strike>
1291 </p><p><s>s</s>
1292 </p>
1293 !! end
1294
1295 ## a not permitted
1296 ## i,b,br omitted
1297 !! test
1298 Text-level semantic html elements in wikitext
1299 !! wikitext
1300 <em>text</em>
1301 <strong>text</strong>
1302 <small>text</small>
1303 <s>text</s>
1304 <cite>text</cite>
1305 <q>text</q>
1306 <dfn>text</dfn>
1307 <abbr>text</abbr>
1308 <data>text</data>
1309 <time>text</time>
1310 <code>text</code>
1311 <var>text</var>
1312 <samp>text</samp>
1313 <kbd>text</kbd>
1314 <sub>text</sub>
1315 <u>text</u>
1316 <mark>text</mark>
1317 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1318 <bdi>text</bdi>
1319 <bdo>text</bdo>
1320 <span>text</span>
1321 <wbr />
1322 !! html
1323 <p><em>text</em>
1324 <strong>text</strong>
1325 <small>text</small>
1326 <s>text</s>
1327 <cite>text</cite>
1328 <q>text</q>
1329 <dfn>text</dfn>
1330 <abbr>text</abbr>
1331 <data>text</data>
1332 <time>text</time>
1333 <code>text</code>
1334 <var>text</var>
1335 <samp>text</samp>
1336 <kbd>text</kbd>
1337 <sub>text</sub>
1338 <u>text</u>
1339 <mark>text</mark>
1340 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1341 <bdi>text</bdi>
1342 <bdo>text</bdo>
1343 <span>text</span>
1344 <wbr />
1345 </p>
1346 !! end
1347
1348 # test cases taken from
1349 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1350 !! test
1351 Ruby markup (W3C-style)
1352 !! wikitext
1353 ;Mono-ruby for individual base characters
1354 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1355 ;Group ruby
1356 :<ruby>今日<rt>きょう</rt></ruby>
1357 ;Jukugo ruby
1358 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1359 ;Inline ruby
1360 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1361 ;Double-sided ruby
1362 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1363
1364 <ruby>
1365 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1366 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1367 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1368 </ruby>
1369 !! html
1370 <dl><dt>Mono-ruby for individual base characters</dt>
1371 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1372 <dt>Group ruby</dt>
1373 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1374 <dt>Jukugo ruby</dt>
1375 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1376 <dt>Inline ruby</dt>
1377 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1378 <dt>Double-sided ruby</dt>
1379 <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>
1380 <p><ruby>
1381 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1382 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1383 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1384 </ruby>
1385 </p>
1386 !! end
1387
1388 # The next two test different paths in the sanitizer.
1389 !! test
1390 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1391 !! wikitext
1392 <blockquote|>a</blockquote>
1393
1394 <b→> doesn't terminate </b→>
1395
1396 <bä> doesn't terminate </bä>
1397
1398 <boo> doesn't terminate </boo>
1399
1400 <s.foo> doesn't terminate </s.foo>
1401
1402 <sub-ID#1>
1403 !! html/php
1404 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1405 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1406 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1407 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1408 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1409 </p><p>&lt;sub-ID#1&gt;
1410 </p>
1411 !! end
1412
1413 !! test
1414 Non-word characters don't terminate tag names
1415 !! wikitext
1416 <blockquote|>a</blockquote>
1417
1418 <b→> doesn't terminate </b→>
1419
1420 <bä> doesn't terminate </bä>
1421
1422 <boo> doesn't terminate </boo>
1423
1424 <s.foo> doesn't terminate </s.foo>
1425
1426 <sub-ID#1>
1427 !! html+tidy
1428 <p>&lt;blockquote|&gt;a
1429 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1430 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1431 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1432 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1433 </p><p>&lt;sub-ID#1&gt;
1434 </p>
1435 !! end
1436
1437 ###
1438 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1439 ### This checks that HTML5 tags (with non-word characters in the tag
1440 ### name) make it safely through the parser -- the Sanitizer will
1441 ### munge them later, as it should.
1442 ###
1443 !! test
1444 Non-word characters are valid in extension tags (T19663)
1445 !! wikitext
1446 <tåg>tåg</tåg>
1447 !! html/php
1448 <pre>
1449 'tåg'
1450 array (
1451 )
1452 </pre>
1453
1454 !! html/parsoid
1455 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1456 !! end
1457
1458 !! test
1459 Isolated close tags should be treated as literal text (T54760)
1460 !! options
1461 parsoid=wt2html
1462 !! wikitext
1463 </b>
1464
1465 <s.foo>s</s>
1466 !! html+tidy
1467 <p class="mw-empty-elt">
1468 </p><p>&lt;s.foo&gt;s
1469 </p>
1470 !! end
1471
1472 ###
1473 ### Special characters
1474 ###
1475
1476 !! test
1477 Bare pipe character (T54363)
1478 !! wikitext
1479 |
1480 !! html
1481 <p>|
1482 </p>
1483 !! end
1484
1485 !! test
1486 Bare pipe character from a template (T54363)
1487 !! wikitext
1488 {{pipe}}
1489 !! html
1490 <p>|
1491 </p>
1492 !! end
1493
1494 ###
1495 ### <nowiki> test cases
1496 ###
1497
1498 !! test
1499 <nowiki> unordered list
1500 !! wikitext
1501 <nowiki>* This is not an unordered list item.</nowiki>
1502 !! html/php
1503 <p>* This is not an unordered list item.
1504 </p>
1505 !! html/parsoid
1506 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1507 !! end
1508
1509 !! test
1510 <nowiki> spacing
1511 !! wikitext
1512 <nowiki>Lorem ipsum dolor
1513
1514 sed abit.
1515 sed nullum.
1516
1517 :and a colon
1518 </nowiki>
1519 !! html/php
1520 <p>Lorem ipsum dolor
1521
1522 sed abit.
1523 sed nullum.
1524
1525 :and a colon
1526
1527 </p>
1528 !! html/parsoid
1529 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1530
1531 sed abit.
1532 sed nullum.
1533
1534 :and a colon
1535 </span></p>
1536 !! end
1537
1538 !! test
1539 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1540 !! wikitext
1541 <nowiki><span class="error"></nowiki>
1542 !! html/php
1543 <p>&lt;span class="error"&gt;
1544 </p>
1545 !! html/parsoid
1546 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1547 !! end
1548
1549 !! test
1550 nowiki 3
1551 !! wikitext
1552 :There is not nowiki.
1553 :There is <nowiki>nowiki</nowiki>.
1554
1555 #There is not nowiki.
1556 #There is <nowiki>nowiki</nowiki>.
1557
1558 *There is not nowiki.
1559 *There is <nowiki>nowiki</nowiki>.
1560 !! html/php
1561 <dl><dd>There is not nowiki.</dd>
1562 <dd>There is nowiki.</dd></dl>
1563 <ol><li>There is not nowiki.</li>
1564 <li>There is nowiki.</li></ol>
1565 <ul><li>There is not nowiki.</li>
1566 <li>There is nowiki.</li></ul>
1567
1568 !! html/parsoid
1569 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1570 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1571
1572 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1573 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1574
1575 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1576 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1577 !! end
1578
1579 !! test
1580 Entities inside <nowiki>
1581 !! wikitext
1582 <nowiki>&lt;</nowiki>
1583 !! html/php
1584 <p>&lt;
1585 </p>
1586 !! html/parsoid
1587 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1588 !! end
1589
1590 !! test
1591 Entities inside template parameters
1592 !! wikitext
1593 {{echo|&ndash;}}
1594 !! html/php+tidy
1595 <p>&#8211;
1596 </p>
1597 !! html/parsoid
1598 <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>
1599 !! end
1600
1601 !! test
1602 Properly escape nowiki when combined with other wiki markup
1603 !! options
1604 parsoid=html2wt
1605 !! html/parsoid
1606 <p>* &lt;/nowiki&gt; tag</p>
1607 !! wikitext
1608 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1609 !! end
1610
1611 !! test
1612 T93824: Put escaped HTML tags inside nowiki
1613 !! options
1614 parsoid=html2wt
1615 !! html/parsoid
1616 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1617 !! wikitext
1618 <nowiki><h2>foo</h2></nowiki>
1619 !! end
1620
1621 !! test
1622 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1623 !! options
1624 parsoid=html2wt
1625 !! html/parsoid
1626 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1627 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1628 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1629 !! wikitext
1630 This text: L'[[Foo]]
1631 This text: L<nowiki>''</nowiki>[[Foo]]
1632 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1633 !! end
1634
1635 # This test fails because wikitext whitespace is not normalized before comparing.
1636 !! test
1637 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1638 !! options
1639 parsoid=html2wt
1640 !! html/parsoid
1641 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1642 </p>
1643 !! wikitext
1644 This text : L<nowiki>''</nowiki>[[Foo]]
1645 !! end
1646
1647 # This test and the next one are html2wt only as they test that incorrect wikitext
1648 # passed in template arguments gets escaped or wrapped in nowikis where required.
1649 !! test
1650 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1651 !! options
1652 parsoid=html2wt
1653 !! html/parsoid
1654 <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>
1655 <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>
1656 !! wikitext
1657 {{echo|foo{{!}}bar}}
1658 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1659 !! end
1660
1661 !! test
1662 T53961: Output correct nowikis in template arguments
1663 !! options
1664 parsoid=html2wt
1665 !! html/parsoid
1666 <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>
1667 <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>
1668 <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>
1669 <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>
1670 <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>
1671 !! wikitext
1672 {{echo|a [ b}}
1673 {{echo|<nowiki>a }} b</nowiki>}}
1674 {{echo|<nowiki>a [[ b</nowiki>}}
1675 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1676 {{echo|a <nowiki>}</nowiki>}}
1677 !! end
1678
1679 !! test
1680 Cases where "!!" needs nowiki protection
1681 !! options
1682 parsoid=html2wt
1683 !! html/parsoid
1684 <table>
1685 <tr><th>this needs protection !! here</th></tr>
1686 </table>
1687
1688 <table>
1689 <tr><th>this does not need
1690 protection !! here</th></tr>
1691 </table>
1692 !! wikitext
1693 {|
1694 !<nowiki>this needs protection !! here</nowiki>
1695 |}
1696
1697 {|
1698 !this does not need
1699 protection !! here
1700 |}
1701 !! end
1702
1703 ###
1704 ### Comments
1705 ###
1706 !! test
1707 Comments and Indent-Pre
1708 !! wikitext
1709 <!-- comment 1 --> asdf
1710
1711 <!-- comment 1 --> asdf
1712 <!-- comment 2 -->
1713
1714 <!-- comment 1 --> asdf
1715 <!-- comment 2 -->xyz
1716
1717 <!-- comment 1 --> asdf
1718 <!-- comment 2 --> xyz
1719 !! html
1720 <pre>asdf
1721 </pre>
1722 <pre>asdf
1723 </pre>
1724 <pre>asdf
1725 </pre>
1726 <p>xyz
1727 </p>
1728 <pre>asdf
1729 xyz
1730 </pre>
1731 !! end
1732
1733 !! test
1734 Comment test 2a
1735 !! wikitext
1736 asdf
1737 <!-- comment 1 -->
1738 jkl
1739 !! html
1740 <p>asdf
1741 jkl
1742 </p>
1743 !! end
1744
1745 !! test
1746 Comment test 2b
1747 !! wikitext
1748 asdf
1749 <!-- comment 1 -->
1750
1751 jkl
1752 !! html
1753 <p>asdf
1754 </p><p>jkl
1755 </p>
1756 !! end
1757
1758 !! test
1759 Comment test 3
1760 !! wikitext
1761 asdf
1762 <!-- comment 1 -->
1763 <!-- comment 2 -->
1764 jkl
1765 !! html
1766 <p>asdf
1767 jkl
1768 </p>
1769 !! end
1770
1771 !! test
1772 Comment test 4
1773 !! wikitext
1774 asdf<!-- comment 1 -->jkl
1775 !! html
1776 <p>asdfjkl
1777 </p>
1778 !! end
1779
1780 !! test
1781 Comment spacing
1782 !! wikitext
1783 a
1784 <!-- foo --> b <!-- bar -->
1785 c
1786 !! html
1787 <p>a
1788 </p>
1789 <pre> b
1790 </pre>
1791 <p>c
1792 </p>
1793 !! end
1794
1795 !! test
1796 Comment whitespace
1797 !! wikitext
1798 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1799 !! html
1800
1801 !! end
1802
1803 !! test
1804 Comment semantics and delimiters
1805 !! wikitext
1806 <!-- --><!----><!-----><!------>
1807 !! html/php
1808
1809 !! html/parsoid
1810 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1811 !! end
1812
1813 !! test
1814 Comment semantics and delimiters, redux
1815 !! wikitext
1816 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1817 -- foo -- funky huh? ... -->
1818 !! html/php
1819
1820 !! html/parsoid
1821 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1822 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1823 !! end
1824
1825 !! test
1826 Comment semantics and delimiters: directors cut
1827 !! wikitext
1828 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1829 everything starting with < followed by !-- until the first -- and > we see,
1830 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1831 -->-->
1832 !! html/php
1833 <p>--&gt;
1834 </p>
1835 !! html/parsoid
1836 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1837 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1838 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1839 --><p>--></p>
1840 !! end
1841
1842 !! test
1843 Comment semantics: nesting
1844 !! wikitext
1845 <!--<!-- no, we're not going to do anything fancy here -->-->
1846 !! html/php
1847 <p>--&gt;
1848 </p>
1849 !! html/parsoid
1850 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1851 !! end
1852
1853 # Parsoid closes the unclosed comment, even if it means a slight
1854 # round-trip diff.
1855 !! test
1856 Comment semantics: unclosed comment at end
1857 !! options
1858 parsoid=wt2html,html2html
1859 !! wikitext
1860 <!--This comment will run out to the end of the document
1861 !! html/php
1862
1863 !! html/parsoid
1864 <!--This comment will run out to the end of the document-->
1865 !! end
1866
1867 !! test
1868 Comment semantics: normalize comments to play nice with XML and browsers
1869 !! wikitext
1870 <!-- Browsers --!> think this is closed -->
1871 <!--> This would normally be text -->
1872 <!---> As would this -->
1873 <!-- XML doesn't like trailing dashes -------->
1874 <!-- Nor doubled hyphens -- anywhere in the data -->
1875 But this is not a comment.
1876 !! html/php
1877 <p>But this is not a comment.
1878 </p>
1879 !! html/parsoid
1880 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1881 <!--&#x3E; This would normally be text -->
1882 <!--&#x2D;&#x3E; As would this -->
1883 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1884 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1885 <p>But this is not a comment.</p>
1886 !! end
1887
1888 !! test
1889 Comment semantics: round-trip even text which contains encoded -->
1890 !! wikitext
1891 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1892 !! html/parsoid
1893 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1894 !! end
1895
1896 !! test
1897 Comment in template title
1898 !! wikitext
1899 {{f<!---->oo}}
1900 !! html
1901 <p>FOO
1902 </p>
1903 !! end
1904
1905 !! test
1906 Comment on its own line post-expand
1907 !! wikitext
1908 a
1909 {{blank}}<!---->
1910 b
1911 !! html
1912 <p>a
1913 </p><p>b
1914 </p>
1915 !! end
1916
1917 !! test
1918 Comment on its own line post-expand with non-significant whitespace
1919 !! wikitext
1920 a
1921 {{blank}} <!---->
1922 b
1923 !! html
1924 <p>a
1925 </p><p>b
1926 </p>
1927 !! end
1928
1929 !! test
1930 post-expand include size being exceeded
1931 !! options
1932 maxincludesize=20
1933 !! wikitext
1934 {{echo3|1234567890}}
1935 !! html
1936 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1937 </p>
1938 !! end
1939
1940 !! test
1941 max template depth being reached
1942 !! options
1943 maxtemplatedepth=1
1944 !! wikitext
1945 {{echo with depth|too deep!}}
1946 !! html
1947 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1948 </p>
1949 !! end
1950
1951 !! test
1952 multiple templates that are redirects
1953 !! wikitext
1954 {{redirect to foo}}
1955 {{redirect to foo}}
1956 !! html
1957 <p>FOO
1958 FOO
1959 </p>
1960 !! end
1961
1962 !! test
1963 Multiple comments should still parse as SOL-transparent
1964 !! options
1965 parsoid=wt2html,wt2wt
1966 !! wikitext
1967 <!--c1-->*a
1968 <!--c2--><!--c3--><!--c4-->*b
1969 !! html/php
1970 <ul><li>a</li>
1971 <li>b</li></ul>
1972
1973 !! html/parsoid
1974 <!--c1--><ul>
1975 <li>a
1976 </li>
1977 <!--c2--><!--c3--><!--c4-->
1978 <li>b
1979 </li>
1980 </ul>
1981 !! end
1982
1983 ## Make sure ">" gets escaped in comments to avoid XSS
1984 !! test
1985 IE conditional comments
1986 !! wikitext
1987 <!--[if lt IE 9]>
1988 <script>alert('hi');</script>
1989 <![endif]-->
1990 !! html/parsoid
1991 <!--[if lt IE 9]&#x3E;
1992 <script&#x3E;alert('hi');</script&#x3E;
1993 <![endif]-->
1994 !! end
1995
1996 ###
1997 ### paragraph wrapping tests
1998 ###
1999
2000 !! test
2001 No block tags
2002 !! wikitext
2003 a
2004
2005 b
2006 !! html
2007 <p>a
2008 </p><p>b
2009 </p>
2010 !! end
2011
2012 !! test
2013 Block tag on one line (<div>)
2014 !! wikitext
2015 a <div>foo</div>
2016
2017 b
2018 !! html
2019 a <div>foo</div>
2020 <p>b
2021 </p>
2022 !! html+tidy
2023 <p>a </p><div>foo</div>
2024 <p>b
2025 </p>
2026 !! end
2027
2028 !! test
2029 No p-wrappable content
2030 !! options
2031 parsoid=wt2html,html2html
2032 !! wikitext
2033 <span><div>x</div></span>
2034 <span><s><div>x</div></s></span>
2035 <small><em></em></small><span><s><div>x</div></s></span>
2036 !! html+tidy
2037 <span><div>x</div></span>
2038 <span><s><div>x</div></s></span>
2039 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2040 !! end
2041
2042 # T177612: Parsoid-only test
2043 !! test
2044 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2045 !! wikitext
2046 {{echo|<span><div>x</div></span>}}
2047 x
2048 !! html/parsoid
2049 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
2050 <p>x</p>
2051 !! end
2052
2053 !! test
2054 Block tag on one line (<blockquote>)
2055 !! wikitext
2056 a <blockquote>foo</blockquote>
2057
2058 b
2059 !! html
2060 a <blockquote>foo</blockquote>
2061 <p>b
2062 </p>
2063 !! html+tidy
2064 <p>a </p><blockquote><p>foo</p></blockquote>
2065 <p>b
2066 </p>
2067 !! end
2068
2069 !! test
2070 Block tag on both lines (<div>)
2071 !! wikitext
2072 a <div>foo</div>
2073
2074 b <div>foo</div>
2075 !! html
2076 a <div>foo</div>
2077 b <div>foo</div>
2078
2079 !! html+tidy
2080 <p>a </p><div>foo</div><p>
2081 b </p><div>foo</div>
2082 !! end
2083
2084 !! test
2085 Block tag on both lines (<blockquote>)
2086 !! wikitext
2087 a <blockquote>foo</blockquote>
2088
2089 b <blockquote>foo</blockquote>
2090 !! html
2091 a <blockquote>foo</blockquote>
2092 b <blockquote>foo</blockquote>
2093
2094 !! html+tidy
2095 <p>a </p><blockquote><p>foo</p></blockquote><p>
2096 b </p><blockquote><p>foo</p></blockquote>
2097 !! end
2098
2099 !! test
2100 Multiple lines without block tags
2101 !! wikitext
2102 <div>foo</div> a
2103 b
2104 c
2105 d<!--foo--> e
2106 x <div>foo</div> z
2107 !! html
2108 <div>foo</div> a
2109 <p>b
2110 c
2111 d e
2112 </p>
2113 x <div>foo</div> z
2114
2115 !! html+tidy
2116 <div>foo</div><p> a
2117 </p><p>b
2118 c
2119 d e
2120 </p><p>
2121 x </p><div>foo</div><p> z
2122 </p>
2123 !! end
2124
2125 !! test
2126 Empty lines between lines with block tags
2127 !! wikitext
2128 <div></div>
2129
2130
2131 <div></div>a
2132
2133 b
2134 <div>a</div>b
2135
2136 <div>b</div>d
2137
2138
2139 <div>e</div>
2140 !! html
2141 <div></div>
2142 <p><br />
2143 </p>
2144 <div></div>a
2145 <p>b
2146 </p>
2147 <div>a</div>b
2148 <div>b</div>d
2149 <p><br />
2150 </p>
2151 <div>e</div>
2152
2153 !! html+tidy
2154 <div></div>
2155 <p><br />
2156 </p>
2157 <div></div><p>a
2158 </p><p>b
2159 </p>
2160 <div>a</div><p>b
2161 </p><div>b</div><p>d
2162 </p><p><br />
2163 </p>
2164 <div>e</div>
2165 !! html/parsoid
2166 <div data-parsoid='{"stx":"html"}'></div>
2167
2168 <p><br /></p>
2169 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2170
2171 <p>b</p>
2172 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2173
2174 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2175
2176 <p><br /></p>
2177 <div data-parsoid='{"stx":"html"}'>e</div>
2178 !! end
2179
2180 !! test
2181 Unclosed HTML p-tags should be handled properly
2182 !! wikitext
2183 <div><p>foo</div>
2184 a
2185
2186 b
2187 !! html/php+tidy
2188 <div><p>foo</p></div>
2189 <p>a
2190 </p><p>b
2191 </p>
2192 !! html/parsoid
2193 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2194 <p>a</p>
2195 <p>b</p>
2196 !! end
2197
2198 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2199 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2200 ## them for now.
2201 !! test
2202 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2203 !! options
2204 parsoid=wt2html
2205 !! wikitext
2206 a [[Category:A1]] [[Category:A2]]
2207 [[Category:A3]]
2208 [[Category:A4]]
2209 !! html/parsoid
2210 <p>a</p>
2211 <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"/>
2212 !! end
2213
2214 !! test
2215 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2216 !! options
2217 parsoid=wt2html
2218 !! wikitext
2219 [[Category:A1]]a
2220 !! html/parsoid
2221 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2222 !! end
2223
2224 !! test
2225 No paragraph necessary for SOL transparent template
2226 !! wikitext
2227 <span><div>foo</div></span>
2228 [[Category:Foo]]
2229
2230 <span><div>foo</div></span>
2231 {{echo|[[Category:Foo]]}}
2232 !! html/php
2233 <span><div>foo</div></span>
2234 <span><div>foo</div></span>
2235
2236 !! html/parsoid
2237 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2238 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2239
2240 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2241 <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}}]}'/>
2242 !! end
2243
2244 !! test
2245 Avoid expanding multiline sol transparent template ranges unnecessarily
2246 !! wikitext
2247 hi
2248
2249
2250 {{echo|<br/>
2251 }}
2252
2253 [[Category:Ho]]
2254 !! html/php
2255 <p>hi
2256 </p><p><br />
2257 <br />
2258 </p>
2259 !! html/parsoid
2260 <p>hi</p>
2261
2262 <p><br />
2263 <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">
2264 </span></p>
2265
2266 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2267 !! end
2268
2269 !! test
2270 Paragraph wrapping following unclosed table
2271 !! options
2272 parsoid=wt2html,html2html
2273 !! wikitext
2274 {|
2275 |-
2276
2277 {|
2278 | x
2279 |}
2280
2281 a
2282
2283 b
2284
2285 c
2286 !! html/php+tidy
2287 <table>
2288
2289
2290 </table><table>
2291 <tbody><tr>
2292 <td>x
2293 </td></tr></tbody></table>
2294 <p>a
2295 </p><p>b
2296 </p><p>c
2297 </p>
2298 !! html/parsoid
2299 <table data-parsoid='{"autoInsertedEnd":true}'>
2300 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2301
2302 </tbody></table><table>
2303 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2304 </tbody></table>
2305
2306 <p>a</p>
2307
2308 <p>b</p>
2309
2310 <p>c</p>
2311 !! end
2312
2313 !! test
2314 Paragraph wrapping suppressed in html p
2315 !! options
2316 parsoid=wt2html,html2html
2317 !! wikitext
2318 <p>
2319
2320
2321 hi
2322
2323
2324
2325 </p>
2326 !! html/php+tidy
2327 <p>
2328
2329
2330 hi
2331
2332
2333
2334 </p>
2335 !! html/parsoid
2336 <p data-parsoid='{"stx":"html"}'>
2337
2338
2339 hi
2340
2341
2342
2343 </p>
2344 !! end
2345
2346 !! test
2347 Dangling table row doesn't prevent p-wrapping
2348 !! options
2349 parsoid=wt2html,html2html
2350 !! wikitext
2351 {|
2352 | hi
2353 |-
2354 |} ho
2355 !! html/parsoid
2356 <table>
2357 <tbody><tr><td>hi</td></tr>
2358 <tr class="mw-empty-elt"></tr>
2359 </tbody></table><p> ho</p>
2360 !! end
2361
2362 ###
2363 ### Preformatted text
2364 ###
2365
2366 !! test
2367 Preformatted text
2368 !! wikitext
2369 This is some
2370 Preformatted text
2371 With ''italic''
2372 And '''bold'''
2373 And a [[Main Page|link]]
2374 !! html
2375 <pre>This is some
2376 Preformatted text
2377 With <i>italic</i>
2378 And <b>bold</b>
2379 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2380 </pre>
2381 !! end
2382
2383 !! test
2384 Tabs don't trigger preformatted text
2385 !! wikitext
2386 This is not
2387 preformatted text.
2388 This is preformatted text.
2389 So is this.
2390 !! html/php
2391 <p> This is not
2392 preformatted text.
2393 </p>
2394 <pre>This is preformatted text.
2395 So is this.
2396 </pre>
2397 !! html/parsoid
2398 <p> This is not
2399 preformatted text.</p>
2400 <pre>This is preformatted text.
2401 So is this.</pre>
2402 !! end
2403
2404 !! test
2405 Space before tab needs nowiki pre protection
2406 !! options
2407 parsoid=html2wt
2408 !! html/parsoid
2409 <p> a</p>
2410 !! wikitext
2411 <nowiki> </nowiki> a
2412 !! end
2413
2414 !! test
2415 Ident preformatting with inline content
2416 !! wikitext
2417 a
2418 ''b''
2419 !! html
2420 <pre>a
2421 <i>b</i>
2422 </pre>
2423 !! end
2424
2425 !! test
2426 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2427 !! wikitext
2428 <pre><nowiki>
2429 <b>
2430 <cite>
2431 <em>
2432 </nowiki></pre>
2433 !! html
2434 <pre>
2435 &lt;b&gt;
2436 &lt;cite&gt;
2437 &lt;em&gt;
2438 </pre>
2439
2440 !! end
2441
2442 !! test
2443 Regression with preformatted in <center>
2444 !! wikitext
2445 <center>
2446 Blah
2447 </center>
2448 !! html
2449 <center>
2450 <pre>Blah
2451 </pre>
2452 </center>
2453
2454 !! end
2455
2456 !! test
2457 T54763: Preformatted in <blockquote>
2458 !! wikitext
2459 <blockquote>
2460 Blah
2461 {|
2462 |
2463 indented cell (no pre-wrapping!)
2464 |}
2465 </blockquote>
2466 !! html
2467 <blockquote>
2468 <p> Blah
2469 </p>
2470 <table>
2471 <tr>
2472 <td>
2473 <p> indented cell (no pre-wrapping!)
2474 </p>
2475 </td></tr></table>
2476 </blockquote>
2477
2478 !! end
2479
2480 !! test
2481 T53086: Double newlines in blockquotes should be turned into paragraphs
2482 !! wikitext
2483 <blockquote>
2484 Foo
2485
2486 Bar
2487 </blockquote>
2488 !! html
2489 <blockquote>
2490 <p>Foo
2491 </p><p>Bar
2492 </p>
2493 </blockquote>
2494
2495 !! end
2496
2497 !! test
2498 T17491: <ins>/<del> in blockquote
2499 !! wikitext
2500 <blockquote>
2501 Foo <del>bar</del> <ins>baz</ins> quux
2502 </blockquote>
2503 !! html
2504 <blockquote>
2505 <p>Foo <del>bar</del> <ins>baz</ins> quux
2506 </p>
2507 </blockquote>
2508
2509 !! html+tidy
2510 <blockquote>
2511 <p>Foo <del>bar</del> <ins>baz</ins> quux
2512 </p>
2513 </blockquote>
2514 !! end
2515
2516 !! test
2517 T17491: <ins>/<del> in blockquote (2)
2518 !! wikitext
2519 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2520 </blockquote>
2521 !! html
2522 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2523 </blockquote>
2524
2525 !! html+tidy
2526 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2527 </p></blockquote>
2528 !! end
2529
2530 !! test
2531 <pre> with attributes (T5202)
2532 !! wikitext
2533 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2534 !! html
2535 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2536
2537 !! end
2538
2539 !! test
2540 <pre> with width attribute (T5202)
2541 !! wikitext
2542 <pre width="8">Narrow screen goodies</pre>
2543 !! html
2544 <pre width="8">Narrow screen goodies</pre>
2545
2546 !! end
2547
2548 !! test
2549 <pre> with forbidden attribute (T5202)
2550 !! wikitext
2551 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2552 !! html
2553 <pre width="8">Narrow screen goodies</pre>
2554
2555 !! end
2556
2557 !! test
2558 Entities inside <pre>
2559 !! wikitext
2560 <pre>&lt;</pre>
2561 !! html
2562 <pre>&lt;</pre>
2563
2564 !! end
2565
2566 !! test
2567 <pre> with forbidden attribute values (T5202)
2568 !! wikitext
2569 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2570 !! html
2571 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2572
2573 !! end
2574
2575 !! test
2576 <nowiki> inside <pre> (T15238)
2577 !! wikitext
2578 <pre>
2579 <nowiki>
2580 </pre>
2581 <pre>
2582 <nowiki></nowiki>
2583 </pre>
2584 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2585 !! html
2586 <pre>
2587 &lt;nowiki&gt;
2588 </pre>
2589 <pre>
2590
2591 </pre>
2592 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2593
2594 !! end
2595
2596 !! test
2597 <nowiki> inside of #tag:pre
2598 !! wikitext
2599 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2600 !! html/php
2601 <pre>Foo &#8594;bar</pre>
2602
2603 !! html/parsoid
2604 <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>
2605 !! end
2606
2607 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2608 ## aren't enclosed in nowikis.
2609 !! test
2610 <nowiki> and <pre> preference (first one wins)
2611 !! options
2612 parsoid=wt2html
2613 !! wikitext
2614 <pre>
2615 <nowiki>
2616 </pre>
2617 </nowiki>
2618 </pre>
2619
2620 <nowiki>
2621 <pre>
2622 <nowiki>
2623 </pre>
2624 </nowiki>
2625 </pre>
2626
2627 !! html/php
2628 <pre>
2629 &lt;nowiki&gt;
2630 </pre>
2631 <p>&lt;/nowiki&gt;
2632 &lt;/pre&gt;
2633 </p><p>
2634 &lt;pre&gt;
2635 &lt;nowiki&gt;
2636 &lt;/pre&gt;
2637
2638 &lt;/pre&gt;
2639 </p>
2640 !! html/parsoid
2641 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2642 </pre>
2643 <p>&lt;/nowiki></p>
2644
2645
2646 <p><span typeof="mw:Nowiki">
2647 &lt;pre>
2648 &lt;nowiki>
2649 &lt;/pre>
2650 </span></p>
2651 !! end
2652
2653 !! test
2654 </pre> inside nowiki
2655 !! wikitext
2656 <nowiki></pre></nowiki>
2657 !! html
2658 <p>&lt;/pre&gt;
2659 </p>
2660 !! end
2661
2662 !! test
2663 Empty pre; pre inside other HTML tags (T56946)
2664 !! wikitext
2665 a
2666
2667 <div><pre>
2668 foo
2669 </pre></div>
2670 <pre></pre>
2671 !! html/php+tidy
2672 <p>a
2673 </p>
2674 <div><pre>foo
2675 </pre></div>
2676 <pre></pre>
2677 !! html/parsoid
2678 <p>a</p>
2679
2680 <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
2681 </pre></div>
2682 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2683 !! end
2684
2685 !! test
2686 HTML pre followed by indent-pre
2687 !! wikitext
2688 <pre>foo</pre>
2689 bar
2690 !! html
2691 <pre>foo</pre>
2692 <pre>bar
2693 </pre>
2694 !! end
2695
2696 !! test
2697 Block tag pre
2698 !! wikitext
2699 <p><pre>foo</pre></p>
2700 !! html/php+tidy
2701 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2702 !! html/parsoid
2703 <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>
2704 !! end
2705
2706 !!test
2707 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2708 !! wikitext
2709 {{echo|}}
2710 !! html
2711
2712 !!end
2713
2714 !!test
2715 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2716 !! wikitext
2717 {{echo|
2718 foo}}
2719 !! html
2720 <p>foo
2721 </p>
2722 !!end
2723
2724 !! test
2725 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2726 !! wikitext
2727 {{echo|a
2728 b}}
2729 !! html
2730 <pre>a
2731 </pre>
2732 <p>b
2733 </p>
2734 !!end
2735
2736 !! test
2737 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2738 !! wikitext
2739 {{echo|a
2740 b
2741 c
2742 d
2743 e
2744 }}
2745 !! html
2746 <pre>a
2747 </pre>
2748 <p>b
2749 c
2750 </p>
2751 <pre>d
2752 </pre>
2753 <p>e
2754 </p>
2755 !!end
2756
2757 !!test
2758 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2759 !! wikitext
2760 {{echo| foo}}
2761
2762 {{echo| foo}}{{echo| bar}}
2763
2764 {{echo| foo}}
2765 {{echo| bar}}
2766
2767 {{echo|<!--cmt--> foo}}
2768
2769 <!--cmt-->{{echo| foo}}
2770
2771 {{echo|{{echo| }}bar}}
2772 !! html
2773 <pre>foo
2774 </pre>
2775 <pre>foo bar
2776 </pre>
2777 <pre>foo
2778 bar
2779 </pre>
2780 <pre>foo
2781 </pre>
2782 <pre>foo
2783 </pre>
2784 <pre>bar
2785 </pre>
2786 !!end
2787
2788 !! test
2789 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2790 !! wikitext
2791 {{echo| }}a
2792
2793 {{echo|
2794 }}a
2795
2796 {{echo|
2797 b}}
2798
2799 {{echo|a
2800 }}b
2801
2802 {{echo|a
2803 }} b
2804 !! html
2805 <pre>a
2806 </pre>
2807 <p><br />
2808 </p>
2809 <pre>a
2810 </pre>
2811 <p><br />
2812 </p>
2813 <pre>b
2814 </pre>
2815 <p>a
2816 </p>
2817 <pre>b
2818 </pre>
2819 <p>a
2820 </p>
2821 <pre>b
2822 </pre>
2823 !!end
2824
2825 ## Hmm, should Parsoid rt this?
2826 !! test
2827 Pres with newline attributes
2828 !! options
2829 parsoid=wt2html,html2html
2830 !! wikitext
2831 <pre class="one
2832 two">hi</pre>
2833 !! html/php
2834 <pre class="one two">hi</pre>
2835
2836 !! html/parsoid
2837 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2838 !! end
2839
2840 !! test
2841 Things that look like <pre> tags aren't treated as such
2842 !! wikitext
2843 Barack Obama <President> of the United States
2844 <President></President>
2845 !! html
2846 <p>Barack Obama &lt;President&gt; of the United States
2847 &lt;President&gt;&lt;/President&gt;
2848 </p>
2849 !! end
2850
2851 ## Remex doesn't account for fostered content.
2852 ## The difference between Parsoid and the PHP parser can be attributed to core
2853 ## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
2854 ## tokenize unmatched extension tags that shadow html tags as strings to ease
2855 ## an escaping mechanism. See the comment in `maybeExtensionTag`.
2856 !! test
2857 Handle broken pre-like tags (T66025)
2858 !! options
2859 parsoid=wt2html
2860 !! wikitext
2861 {{echo|<pre <pre>x</pre>}}
2862
2863 <table><pre </table>
2864 !! html/php
2865 <pre>x</pre>
2866 <table>&lt;pre </table>
2867
2868 !! html/php+tidy
2869 <pre>x</pre>
2870 &lt;pre <table></table>
2871 !! html/parsoid
2872 <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>
2873
2874 <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>
2875 !! end
2876
2877 ## Similar to the above, but shows the difference between extension and html tags
2878 !! test
2879 Less than in attribute position
2880 !! wikitext
2881 <pre <pre>123</pre>
2882
2883 <div <div>123</div>
2884 !! html/php+tidy
2885 <pre>123</pre><p>
2886 &lt;div </p><div>123</div>
2887 !! html/parsoid
2888 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"&lt;pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
2889
2890 &lt;div </p><div>123</div>
2891 !! end
2892
2893 !! test
2894 Parsoid: handle pre with space after attribute
2895 !! options
2896 parsoid=wt2html
2897 !! wikitext
2898 <pre style="width:50%;" >{{echo|foo}}</pre>
2899 !! html/php
2900 <pre style="width:50%;">{{echo|foo}}</pre>
2901
2902 !! html/parsoid
2903 <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>
2904 !! end
2905
2906 !! test
2907 Self-closed pre
2908 !! wikitext
2909 <pre />
2910 !! html/php
2911 <pre></pre>
2912
2913 !! html/parsoid
2914 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
2915 !! end
2916
2917 !! test
2918 Newline before table-close generates empty table row: T208619
2919 !! wikitext
2920 {|
2921
2922 |}
2923 !! html/php+tidy
2924 <table>
2925
2926 <tbody><tr><td></td></tr></tbody></table>
2927 !! html/parsoid
2928 <table data-parsoid='{}'>
2929
2930 </table>
2931 !! end
2932
2933 # PHP has one more row in the output than Parsoid does: T208619
2934 !! test
2935 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2936 !! options
2937 parsoid=wt2html
2938 !! wikitext
2939 {|
2940 <td>
2941 <td>
2942 </td>
2943
2944
2945
2946 |}
2947 !! html/php+tidy
2948 <table>
2949 <tbody><tr><td>
2950 </td><td>
2951 </td>
2952
2953
2954
2955 </tr><tr><td></td></tr></tbody></table>
2956 !! html/parsoid
2957 <table>
2958
2959 <tbody>
2960 <tr>
2961 <td></td>
2962
2963 <td>
2964 </td></tr>
2965
2966
2967
2968 </tbody></table>
2969 !! end
2970
2971
2972 #--------------------------------------------------------------------
2973 # Transclusion parameter whitespace stripping tests
2974 # Behavior is different for positional and named parameters
2975 #--------------------------------------------------------------------
2976 !! test
2977 Templates: Strip leading and trailing whitespace from named-param values
2978 !! wikitext
2979 {{echo|1= a }}
2980
2981 {{echo|1= {{echo|b}} }}
2982
2983 {{echo| 1 =
2984 c }}
2985
2986 {{echo| 1 =
2987 * d
2988 }}
2989 !! html
2990 <p>a
2991 </p><p>b
2992 </p><p>c
2993 </p>
2994 <ul><li>d</li></ul>
2995
2996 !! end
2997
2998 !! test
2999 Templates: Don't strip whitespace from positional-param values
3000 !! wikitext
3001 {{echo|a }}
3002
3003 {{echo|{{echo|b}} }}
3004
3005 {{echo| c
3006 }}
3007
3008 {{echo| {{echo|d}}
3009 }}
3010
3011 {{echo|
3012 e}}
3013
3014 {{echo|
3015 *f}}
3016
3017 {{echo|
3018 }}g
3019 !! html
3020 <p>a
3021 </p><p>b
3022 </p>
3023 <pre>c
3024 </pre>
3025 <p><br />
3026 </p>
3027 <pre>d
3028 </pre>
3029 <p><br />
3030 </p>
3031 <pre>e
3032 </pre>
3033 <p><br />
3034 </p>
3035 <ul><li>f</li></ul>
3036 <p><br />
3037 </p>
3038 <pre>g
3039 </pre>
3040 !! end
3041
3042 !! test
3043 Templates: Don't recognize targets split by newlines
3044 !! options
3045 parsoid=wt2html
3046 !! wikitext
3047 {{ech
3048 o|foo}}
3049 !! html/php
3050 <p>{{ech
3051 o|foo}}
3052 </p>
3053 !! html/parsoid
3054 <p>{{ech
3055 o|foo}}</p>
3056 !! end
3057
3058 !! test
3059 Templates: Recognize targets when newlines and comments don't split the target
3060 !! options
3061 parsoid=wt2html
3062 !! wikitext
3063 {{
3064 <!--X--> ech<!--X-->o<!--X-->
3065 <!--X--> <!--X-->
3066
3067 |foo}}
3068 !! html/php
3069 <p>foo
3070 </p>
3071 !! html/parsoid
3072 <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>
3073 !! end
3074
3075 !! test
3076 Templates: Handle empty comment-and-ws-only lines correctly
3077 !! wikitext
3078 {{echo|foo
3079 <!--should be ignored-->
3080 <!--should be ignored as well-->
3081 bar}}
3082 !! html/php
3083 <p>foo
3084 bar
3085 </p>
3086 !! html/parsoid
3087 <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>
3088 !! end
3089
3090 !! test
3091 Templates: Handle comments in the target
3092 !! wikitext
3093 {{echo
3094 <!-- should be ignored -->
3095 |foo}}
3096
3097 {{echo
3098 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3099 |foo}}
3100
3101 {{echo<!-- should be ignored -->
3102 |foo}}
3103
3104 {{echo<!-- should be ignored -->|foo}}
3105
3106 {{<!-- should be ignored -->echo|foo}}
3107 !! html/php
3108 <p>foo
3109 </p><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\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3116
3117 <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>
3118
3119 <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>
3120
3121 <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>
3122
3123 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3124 !! end
3125
3126 !! test
3127 Templates: Handle comments in parameter names (T69657)
3128 !! wikitext
3129 {{echo|1
3130 <!-- should be ignored -->
3131 =foo}}
3132
3133 {{echo|
3134 <!-- should be ignored -->
3135 1 = foo}}
3136
3137 {{echo|1<!-- should be ignored -->=foo}}
3138
3139 {{echo|<!-- should be ignored -->1=foo}}
3140 !! html/php
3141 <p>foo
3142 </p><p>foo
3143 </p><p>foo
3144 </p><p>foo
3145 </p>
3146 !! html/parsoid
3147 <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>
3148
3149 <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>
3150
3151 <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>
3152
3153 <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>
3154 !! end
3155
3156 !! test
3157 Templates: Other wikitext in parameter names (T69657)
3158 !! wikitext
3159 {{echo|''1''=foo}}
3160 !! html/php
3161 <p>{{{1}}}
3162 </p>
3163 !! html/parsoid
3164 <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>
3165 !! end
3166
3167 !! test
3168 Templates: With colons
3169 !! wikitext
3170 {{With: Colon}}
3171 !! html/php
3172 <p>Template with colon
3173 </p>
3174 !! html/parsoid
3175 <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>
3176 !! end
3177
3178 #--------------------------------------------------------------------
3179 # Transclusion parameter escaping tests
3180 #--------------------------------------------------------------------
3181
3182 !! test
3183 Templates: Parsoid parameter escaping test 1
3184 !! wikitext
3185 {{echo|[foo]|{{echo|[bar]}}}}
3186 !! html/php+tidy
3187 <p>[foo]
3188 </p>
3189 !! html/parsoid
3190 <p about="#mwt1" typeof="mw:Transclusion"
3191 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3192 !! end
3193
3194 !! test
3195 Parsoid: Pipes in external links in template parameter
3196 !! wikitext
3197 {{echo|[{{echo|http://example.com}} link]}}
3198 !! html/php+tidy
3199 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3200 </p>
3201 !! html/parsoid
3202 <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>
3203 !! end
3204
3205 !! test
3206 Parsoid: pipe in transclusion parameter
3207 !! wikitext
3208 {{echo|http://foo.com/a&#124;b}}
3209 !! html/php+tidy
3210 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3211 </p>
3212 !! html/parsoid
3213 <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>
3214 !! end
3215
3216 !! test
3217 Parsoid: Pipe in external link target and content in template parameter
3218 !! options
3219 parsoid=html2wt,wt2wt
3220 !! wikitext
3221 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3222 !! html/php+tidy
3223 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3224 </p>
3225 !! html/parsoid
3226 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3227 typeof="mw:Transclusion"
3228 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3229 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3230 !! end
3231
3232 !! test
3233 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3234 !! wikitext
3235 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3236 !! html/php+tidy
3237 <p><a rel="nofollow" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit">bar</a>
3238 </p>
3239 !! html/parsoid
3240 <p><a rel="mw:ExtLink" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>bar</a></p>
3241 !! end
3242
3243 !! test
3244 Templates: Don't escape already nowiki-escaped text in template parameters
3245 !! options
3246 parsoid=html2wt,wt2wt
3247 !! wikitext
3248 {{echo|foo<nowiki>|</nowiki>bar}}
3249 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3250 {{echo|<nowiki></nowiki>}}
3251 !! html/php+tidy
3252 <p>foo|bar
3253 &lt;div&gt;
3254
3255 </p>
3256 !! html/parsoid
3257 <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>
3258 <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>
3259 <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>
3260 </p>
3261 !! end
3262
3263 ## T54824
3264 !! test
3265 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3266 !! options
3267 parsoid=html2wt,wt2wt
3268 !! wikitext
3269 {{echo|{{echo|1=bar}}}}
3270 !! html/php+tidy
3271 <p>bar
3272 </p>
3273 !! html/parsoid
3274 <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>
3275 !! end
3276
3277 ## T58733
3278 !! test
3279 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3280 !! wikitext
3281 {{echo|a : b}}
3282 !! html/php+tidy
3283 <p>a&#160;: b
3284 </p>
3285 !! html/parsoid
3286 <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>
3287 !! end
3288
3289 ## T73412
3290 !! test
3291 Templates: Preserve blank parameter names
3292 !! wikitext
3293 {{echo|=foo}}
3294 !! html/php+tidy
3295 <p>{{{1}}}
3296 </p>
3297 !! html/parsoid
3298 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3299 !! end
3300
3301 !! test
3302 Templates: Preserve blank parameter names in other positions
3303 !! wikitext
3304 {{blank_param|bar|=foo}}
3305 !! html/php+tidy
3306 <p>bar
3307 foo
3308 </p>
3309 !! html/parsoid
3310 <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
3311 foo</p>
3312 !! end
3313
3314 ###
3315 ### Parsoid-centric tests for testing RT edge cases for pre
3316 ###
3317
3318 !!test
3319 1a. Indent-Pre and Comments
3320 !! wikitext
3321 a
3322 <!--a-->
3323 c
3324 !! html
3325 <pre>a
3326 </pre>
3327 <p>c
3328 </p>
3329 !!end
3330
3331 !!test
3332 1b. Indent-Pre and Comments
3333 !! wikitext
3334 a
3335 <!--a-->
3336 c
3337 !! html
3338 <pre>a
3339 </pre>
3340 <p>c
3341 </p>
3342 !!end
3343
3344 !!test
3345 1c. Indent-Pre and Comments
3346 !! wikitext
3347 <!--a--> a
3348
3349 <!--a--> a
3350 !! html
3351 <pre> a
3352 </pre>
3353 <pre> a
3354 </pre>
3355 !!end
3356
3357 !!test
3358 1d. Indent-Pre and Comments
3359 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3360 !! wikitext
3361 <!--a--> a
3362
3363 <!--b-->b
3364 !! html
3365 <pre>a
3366 </pre>
3367 <pre>b
3368 </pre>
3369 !!end
3370
3371 !!test
3372 2a. Indent-Pre and tables
3373 !! wikitext
3374 {|
3375 |-
3376 !h1!!h2
3377 |foo||bar
3378 |}
3379 !! html
3380 <table>
3381
3382 <tr>
3383 <th>h1</th>
3384 <th>h2
3385 </th>
3386 <td>foo</td>
3387 <td>bar
3388 </td></tr></table>
3389
3390 !!end
3391
3392 !!test
3393 2b. Indent-Pre and tables
3394 !! wikitext
3395 {|
3396 |-
3397 |foo
3398 |}
3399 !! html
3400 <table>
3401
3402 <tr>
3403 <td>foo
3404 </td></tr></table>
3405
3406 !!end
3407
3408 !!test
3409 2c. Indent-Pre and tables (T44252)
3410 !! wikitext
3411 {|
3412 |+foo
3413 ! |bar
3414 |}
3415 !! html
3416 <table>
3417 <caption>foo
3418 </caption>
3419 <tr>
3420 <th>bar
3421 </th></tr></table>
3422
3423 !!end
3424
3425 !!test
3426 2d. Indent-Pre and tables
3427 !! wikitext
3428 a
3429 {|
3430 |b
3431 |}
3432 !! html/php
3433 <pre>a
3434 </pre>
3435 <table>
3436 <tr>
3437 <td>b
3438 </td></tr></table>
3439
3440 !! html/parsoid
3441 <pre>a</pre>
3442 <table>
3443 <tbody><tr><td> b</td></tr>
3444 </tbody></table>
3445 !!end
3446
3447 !!test
3448 2e. Indent-Pre and table-line syntax
3449 !! wikitext
3450 a
3451 | b
3452 | c
3453 !! html/php
3454 <pre>a
3455 | b
3456 | c
3457 </pre>
3458 !!end
3459
3460 !!test
3461 2f. Indent-pre started by table-line syntax
3462 !! wikitext
3463 a
3464 | b
3465 | c
3466 !! html/php
3467 <p>a
3468 </p>
3469 <pre>| b
3470 | c
3471 </pre>
3472 !! html/parsoid
3473 <p>a</p>
3474 <pre>
3475 | b
3476 | c</pre>
3477 !!end
3478
3479 !! test
3480 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3481 !! wikitext
3482 <table>
3483 <tr>
3484 <td>
3485 Text that should be rendered preformatted
3486 </td>
3487 </tr>
3488 </table>
3489 !! html
3490 <table>
3491 <tr>
3492 <td>
3493 <pre>Text that should be rendered preformatted
3494 </pre>
3495 </td>
3496 </tr>
3497 </table>
3498
3499 !! end
3500
3501 !! test
3502 2h. Indent pre in tables
3503 !! options
3504 parsoid=wt2html,html2html
3505 !! wikitext
3506 {|
3507 !
3508 foo
3509 !
3510 bar
3511 |-
3512 |
3513 baz
3514 {{!}}
3515 bam
3516 |}
3517 !! html/php
3518 <table>
3519 <tr>
3520 <th>
3521 <pre>foo
3522 </pre>
3523 </th>
3524 <th>
3525 <pre>bar
3526 </pre>
3527 </th></tr>
3528 <tr>
3529 <td>
3530 <pre>baz
3531 </pre>
3532 </td>
3533 <td>
3534 <pre>bam
3535 </pre>
3536 </td></tr></table>
3537
3538 !! html/parsoid
3539 <table>
3540 <tbody><tr><th>
3541 <pre>foo</pre>
3542 </th><th>
3543 <pre>bar</pre>
3544 </th></tr><tr>
3545 <td>
3546 <pre>baz</pre>
3547 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3548 <pre>bam</pre>
3549 </td></tr></tbody></table>
3550 !! end
3551
3552 !! test
3553 3a. Indent-Pre and block tags (single-line html)
3554 !! wikitext
3555 a <p> foo </p>
3556 b <div> foo </div>
3557 c <blockquote> foo </blockquote>
3558 <span> foo </span>
3559 !! html
3560 a <p> foo </p>
3561 b <div> foo </div>
3562 c <blockquote> foo </blockquote>
3563 <pre><span> foo </span>
3564 </pre>
3565 !! html/php+tidy
3566 <p> a </p><p> foo </p><p>
3567 b </p><div> foo </div><p>
3568 c </p><blockquote><p> foo </p></blockquote>
3569 <pre><span> foo </span>
3570 </pre>
3571 !! html/parsoid
3572 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3573 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3574 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3575 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3576 !! end
3577
3578 !! test
3579 3b. Indent-Pre and block tags (multi-line html)
3580 !! wikitext
3581 a <span>foo</span>
3582 <!-- comment --> b <div> foo </div>
3583 !! html/php
3584 <pre>a <span>foo</span>
3585 </pre>
3586 b <div> foo </div>
3587
3588 !! html/parsoid
3589 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3590 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3591 !! html/php+tidy
3592 <pre>a <span>foo</span>
3593 </pre><p>
3594 b </p><div> foo </div>
3595 !! end
3596
3597 !!test
3598 3c. Indent-Pre and block tags (pre-content on separate line)
3599 !! wikitext
3600 <p>
3601 foo
3602 </p>
3603
3604 <div>
3605 foo
3606 </div>
3607
3608 <center>
3609 foo
3610 </center>
3611
3612 <blockquote>
3613 foo
3614 </blockquote>
3615
3616 <blockquote>
3617 <pre>
3618 foo
3619 </pre>
3620 </blockquote>
3621
3622 <table><tr><td>
3623 foo
3624 </td></tr></table>
3625
3626 <ul><li>
3627 foo
3628 </li></ul>
3629
3630 !! html
3631 <p>
3632 foo
3633 </p>
3634 <div>
3635 <pre>foo
3636 </pre>
3637 </div>
3638 <center>
3639 <pre>foo
3640 </pre>
3641 </center>
3642 <blockquote>
3643 <p> foo
3644 </p>
3645 </blockquote>
3646 <blockquote>
3647 <pre>
3648 foo
3649 </pre>
3650 </blockquote>
3651 <table><tr><td>
3652 <pre>foo
3653 </pre>
3654 </td></tr></table>
3655 <ul><li>
3656 foo
3657 </li></ul>
3658
3659 !!end
3660
3661 !! test
3662 4. Indent-Pre and extension tags
3663 !! options
3664 parsoid=wt2html,html2html
3665 !! wikitext
3666 a <tag />
3667 !! html/php+tidy
3668 <p> a </p><pre>NULL
3669 array (
3670 )
3671 </pre>
3672 !! html/parsoid
3673 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3674 !! end
3675
3676 !! test
3677 5. Indent-Pre and html pre
3678 !! wikitext
3679 <pre class="123">hi</pre>
3680 !! html/php
3681 <pre class="123">hi</pre>
3682
3683 !! html/parsoid
3684 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3685 !! end
3686
3687 !!test
3688 Render paragraphs when indent-pre is suppressed in blocklevels
3689 !! wikitext
3690 <blockquote>
3691 foo
3692
3693 bar
3694 </blockquote>
3695 !! html
3696 <blockquote>
3697 <p> foo
3698 </p><p> bar
3699 </p>
3700 </blockquote>
3701
3702 !!end
3703
3704 !!test
3705 4. Multiple spaces at start-of-line
3706 !! wikitext
3707 <p> foo </p>
3708 foo
3709 {|
3710 |foo
3711 |}
3712 !! html
3713 <p> foo </p>
3714 <pre> foo
3715 </pre>
3716 <table>
3717 <tr>
3718 <td>foo
3719 </td></tr></table>
3720
3721 !!end
3722
3723 ## NOTE: the leading white-space chars on empty line are significant
3724 !! test
3725 5a. White-space in indent-pre
3726 !! wikitext
3727 a<br />
3728
3729 b
3730 !! html
3731 <pre>a<br />
3732
3733 b
3734 </pre>
3735 !! end
3736
3737 ## NOTE: the leading white-space chars on empty line are significant
3738 !! test
3739 5b. White-space in indent-pre
3740 !! wikitext
3741 a
3742
3743 b
3744
3745
3746 c
3747 !! html
3748 <pre>a
3749
3750 b
3751
3752
3753 c
3754 </pre>
3755 !! end
3756
3757 !! test
3758 5c. White-space in indent-pre
3759 !! wikitext
3760 ''a''
3761 ''b''
3762 ''c''
3763 !! html
3764 <pre><i>a</i>
3765 <i>b</i>
3766 <i>c</i>
3767 </pre>
3768 !! end
3769
3770 !! test
3771 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3772 !! wikitext
3773 a
3774
3775 <!-- continue -->
3776 b
3777
3778 c
3779
3780 d
3781 !! html
3782 <pre>a
3783
3784 b
3785 </pre>
3786 <pre>c
3787
3788 </pre>
3789 <p>d
3790 </p>
3791 !! end
3792
3793 !! test
3794 7a. Indent-pre and category links
3795 !! options
3796 parsoid=wt2html,wt2wt
3797 !! wikitext
3798 [[Category:foo]] <!-- No pre-wrapping -->
3799 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3800 !! html/php+tidy
3801 !! html/parsoid
3802 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3803 <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 -->
3804 !! end
3805
3806 ## We used to, but no longer wt2wt this test since the default serializer
3807 ## will normalize all categories to serialize on their own line.
3808 ## This wikitext usage is going to be fairly uncommon in production and
3809 ## selser will take care of preserving formatting in those scenarios.
3810 !! test
3811 7b. Indent-pre and category links
3812 !! options
3813 parsoid=wt2html
3814 !! wikitext
3815 [[Category:foo]] a
3816 [[Category:foo]] {{echo|b}}
3817 !! html/parsoid
3818 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3819 <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>
3820 !! end
3821
3822 !! test
3823 Indent-Pre: Newlines in comments shouldn't affect sol state
3824 !! wikitext
3825 a <!--
3826 foo
3827 --> b
3828 !! html/php+tidy
3829 <p>a b
3830 </p>
3831 !! html/parsoid
3832 <p>a <!--
3833 foo
3834 --> b</p>
3835 !! end
3836
3837 ###
3838 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3839 ###
3840
3841 !!test
3842 HTML-pre: 1. embedded newlines
3843 !! wikitext
3844 <pre>foo</pre>
3845
3846 <pre>
3847 foo
3848 </pre>
3849
3850 <pre>
3851
3852 foo
3853 </pre>
3854
3855 <pre>
3856
3857
3858 foo
3859 </pre>
3860 !! html/php+tidy
3861 <pre>foo</pre>
3862 <pre>foo
3863 </pre>
3864 <pre>
3865
3866 foo
3867 </pre>
3868 <pre>
3869
3870
3871 foo
3872 </pre>
3873 !! html/parsoid
3874 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3875
3876 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3877 </pre>
3878
3879 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3880
3881 foo
3882 </pre>
3883
3884 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3885
3886
3887 foo
3888 </pre>
3889 !!end
3890
3891 !! test
3892 HTML-pre: big spaces
3893 !! wikitext
3894 <pre>
3895
3896
3897
3898
3899 haha
3900
3901
3902
3903
3904 haha
3905
3906
3907
3908
3909 </pre>
3910 !! html/php+tidy
3911 <pre>
3912
3913
3914
3915
3916 haha
3917
3918
3919
3920
3921 haha
3922
3923
3924
3925
3926 </pre>
3927 !! html/parsoid
3928 <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"}}'>
3929
3930
3931
3932
3933 haha
3934
3935
3936
3937
3938 haha
3939
3940
3941
3942
3943 </pre>
3944 !! end
3945
3946 !!test
3947 HTML-pre: 2: indented text
3948 !! wikitext
3949 <pre>
3950 foo
3951 </pre>
3952 !! html
3953 <pre>
3954 foo
3955 </pre>
3956
3957 !!end
3958
3959 !!test
3960 HTML-pre: 3: other wikitext
3961 !! wikitext
3962 <pre>
3963 * foo
3964 # bar
3965 = no-h =
3966 '' no-italic ''
3967 [[ NoLink ]]
3968 </pre>
3969 !! html/php
3970 <pre>
3971 * foo
3972 # bar
3973 = no-h =
3974 '' no-italic ''
3975 [[ NoLink ]]
3976 </pre>
3977
3978 !! html/parsoid
3979 <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
3980 # bar
3981 = no-h =
3982 '' no-italic ''
3983 [[ NoLink ]]
3984 </pre>
3985 !!end
3986
3987 ###
3988 ### Definition lists
3989 ###
3990 !! test
3991 Simple definition
3992 !! wikitext
3993 ;name :Definition
3994 !! html
3995 <dl><dt>name</dt>
3996 <dd>Definition</dd></dl>
3997
3998 !! end
3999
4000 !! test
4001 Definition list for indentation only
4002 !! wikitext
4003 :Indented text
4004 !! html
4005 <dl><dd>Indented text</dd></dl>
4006
4007 !! end
4008
4009 !! test
4010 Definition list with no space
4011 !! wikitext
4012 ;name:Definition
4013 !! html
4014 <dl><dt>name</dt>
4015 <dd>Definition</dd></dl>
4016
4017 !!end
4018
4019 !! test
4020 Definition list with URL link
4021 !! wikitext
4022 ;http://example.com/ :definition
4023 !! html
4024 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
4025 <dd>definition</dd></dl>
4026
4027 !! end
4028
4029 !! test
4030 Definition list with bracketed URL link
4031 !! wikitext
4032 ;[http://www.example.com/ Example]:Something about it
4033 !! html
4034 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4035 <dd>Something about it</dd></dl>
4036
4037 !! end
4038
4039 !! test
4040 Definition list with wikilink containing colon
4041 !! wikitext
4042 ;[[Help:FAQ]]:The least-read page on Wikipedia
4043 !! html
4044 <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>
4045 <dd>The least-read page on Wikipedia</dd></dl>
4046
4047 !! end
4048
4049 # At Brion's and JeLuF's insistence... :)
4050 !! test
4051 Definition list with news link containing colon
4052 !! wikitext
4053 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4054 !! html/php
4055 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4056 <dd>This isn't even a real newsgroup!</dd></dl>
4057
4058 !! html/parsoid
4059 <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>
4060 !! end
4061
4062 !! test
4063 Malformed definition list with colon
4064 !! wikitext
4065 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4066 !! html
4067 <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>
4068
4069 !! end
4070
4071 !! test
4072 Definition lists: colon in external link text
4073 !! wikitext
4074 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4075 !! html
4076 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4077 <dd>OK, I made that up</dd></dl>
4078
4079 !! end
4080
4081 !! test
4082 Definition lists: colon in HTML attribute
4083 !! wikitext
4084 ;<b style="display: inline">bold</b>
4085 !! html
4086 <dl><dt><b style="display: inline">bold</b></dt></dl>
4087
4088 !! end
4089
4090 !! test
4091 Definition lists: self-closed tag
4092 !! wikitext
4093 ;one<br/>two :two-line fun
4094 !! html
4095 <dl><dt>one<br />two</dt>
4096 <dd>two-line fun</dd></dl>
4097
4098 !! end
4099
4100 !! test
4101 Definition lists: ignore colons inside tags
4102 !! wikitext
4103 ;one <b>two : tag <i>fun:</i>:</b>:def
4104 !! html
4105 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4106 <dd>def</dd></dl>
4107
4108 !! end
4109
4110 !! test
4111 Definition lists: excess closed tags
4112 !! wikitext
4113 ;one</b>two :bad tag fun
4114 !! html/php+tidy
4115 <dl><dt>onetwo</dt>
4116 <dd>bad tag fun</dd></dl>
4117 !! html/parsoid
4118 <dl>
4119 <dt>onetwo</dt>
4120 <dd>bad tag fun</dd>
4121 </dl>
4122 !! end
4123
4124 !! test
4125 T13748: Literal closing tags
4126 !! wikitext
4127 <dl>
4128 <dt>test 1</dt>
4129 <dd>test test test test test</dd>
4130 <dt>test 2</dt>
4131 <dd>test test test test test</dd>
4132 </dl>
4133 !! html
4134 <dl>
4135 <dt>test 1</dt>
4136 <dd>test test test test test</dd>
4137 <dt>test 2</dt>
4138 <dd>test test test test test</dd>
4139 </dl>
4140
4141 !! end
4142
4143 !! test
4144 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4145 !! wikitext
4146 <ul><li>
4147 ;term :description
4148 *unordered
4149 </li></ul>
4150 !! html
4151 <ul><li>
4152 <dl><dt>term</dt>
4153 <dd>description</dd></dl>
4154 <ul><li>unordered</li></ul>
4155 </li></ul>
4156
4157 !! end
4158
4159 !! test
4160 Definition list with empty definition and following paragraph
4161 !! wikitext
4162 ;term:
4163
4164 Paragraph text
4165 !! html
4166 <dl><dt>term</dt>
4167 <dd></dd></dl>
4168 <p>Paragraph text
4169 </p>
4170 !! end
4171
4172 !! test
4173 Nested definition lists using html syntax
4174 !! wikitext
4175 <dl><dt>x</dt>
4176 <dd>a</dd>
4177 <dd>b</dd></dl>
4178 !! html
4179 <dl><dt>x</dt>
4180 <dd>a</dd>
4181 <dd>b</dd></dl>
4182
4183 !! end
4184
4185 !! test
4186 Definition Lists: No nesting: Multiple dd's
4187 !! wikitext
4188 ;x
4189 :a
4190 :b
4191 !! html
4192 <dl><dt>x</dt>
4193 <dd>a</dd>
4194 <dd>b</dd></dl>
4195
4196 !! end
4197
4198 !! test
4199 Definition Lists: Indentation: Regular
4200 !! wikitext
4201 :i1
4202 ::i2
4203 :::i3
4204 !! html
4205 <dl><dd>i1
4206 <dl><dd>i2
4207 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4208
4209 !! end
4210
4211 !! test
4212 Definition Lists: Indentation: Missing 1st level
4213 !! wikitext
4214 ::i2
4215 :::i3
4216 !! html
4217 <dl><dd><dl><dd>i2
4218 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4219
4220 !! end
4221
4222 !! test
4223 Definition Lists: Indentation: Multi-level indent
4224 !! wikitext
4225 :::i3
4226 !! html
4227 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4228
4229 !! end
4230
4231 !! test
4232 Definition Lists: Hacky use to indent tables
4233 !! wikitext
4234 ::{|
4235 |foo
4236 |bar
4237 |}
4238 this text
4239 should be left alone
4240 !! html
4241 <dl><dd><dl><dd><table>
4242 <tr>
4243 <td>foo
4244 </td>
4245 <td>bar
4246 </td></tr></table></dd></dl></dd></dl>
4247 <p>this text
4248 should be left alone
4249 </p>
4250 !! end
4251
4252 !! test
4253 Definition Lists: Hacky use to indent tables (with content following table)
4254 !! wikitext
4255 :{|
4256 |foo
4257 |bar
4258 |} <!--c1--> this text should be part of the dl
4259 !! html/php+tidy
4260 <dl><dd><table>
4261 <tbody><tr>
4262 <td>foo
4263 </td>
4264 <td>bar
4265 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4266 !! html/parsoid
4267 <dl><dd><table>
4268 <tbody><tr>
4269 <td>foo
4270 </td>
4271 <td>bar
4272 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4273 !! end
4274
4275 !! test
4276 Definition Lists: Hacky use to indent tables, with comments (T65979)
4277 !! wikitext
4278 <!-- foo -->
4279 ::{|
4280 |foo
4281 |bar
4282 |}<!-- bar -->
4283 this text
4284 should be left alone
4285 !! html/parsoid
4286 <!-- foo -->
4287 <dl><dd><dl><dd><table><tr>
4288 <td>foo</td>
4289 <td>bar</td>
4290 </tr></table><!-- bar --></dd></dl></dd></dl>
4291 <p>this text
4292 should be left alone</p>
4293 !! end
4294
4295 !! test
4296 Definition Lists: Hacky use to indent tables, with comment before table
4297 !!options
4298 parsoid=wt2html
4299 !! wikitext
4300 ::<!-- foo -->{|
4301 |foo
4302 |}
4303 !! html/parsoid
4304 <dl><dd><dl><dd><!-- foo --><table><tr>
4305 <td>foo</td>
4306 </tr></table></dd></dl></dd></dl>
4307 !! end
4308
4309 # The trailing whitespace in this test is to catch a regression in
4310 # Parsoid after T54473.
4311 !! test
4312 Definition Lists: Hacky use to indent tables (WS-insensitive)
4313 !! wikitext
4314 :{|
4315 |a
4316 |}
4317 !! html/php
4318 <dl><dd><table>
4319 <tr>
4320 <td>a
4321 </td></tr></table></dd></dl>
4322
4323 !! html/parsoid
4324 <dl><dd><table>
4325 <tbody><tr><td>a</td></tr>
4326 </tbody></table></dd></dl>
4327 !! end
4328
4329 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4330 ## as an empty dt item. It also ignores all but the last ";" when followed
4331 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4332 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4333 ## ";"s.
4334 ##
4335 ## Ex: ";;t2 ::d2" is transformed into:
4336 ##
4337 ## <dl>
4338 ## <dt>t2 </dt>
4339 ## <dd>
4340 ## <dl>
4341 ## <dt></dt>
4342 ## <dd>d2</dd>
4343 ## </dl>
4344 ## </dd>
4345 ## </dl>
4346 ##
4347 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4348 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4349 ##
4350 ## <dl>
4351 ## <dt>
4352 ## <dl>
4353 ## <dt>t2 </dt>
4354 ## <dd>:d2</dd>
4355 ## </dl>
4356 ## </dt>
4357 ## </dl>
4358 ##
4359 ## All Parsoid only definition list tests have this difference.
4360 ##
4361 ## See also: https://phabricator.wikimedia.org/T8569
4362 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4363
4364 !! test
4365 Table / list interaction: indented table with lists in table contents
4366 !! wikitext
4367 :{|
4368 |-
4369 |a
4370
4371 *b
4372 |-
4373 |c
4374
4375 *d
4376 |}
4377 !! html
4378 <dl><dd><table>
4379
4380 <tr>
4381 <td>a
4382 <ul><li>b</li></ul>
4383 </td></tr>
4384 <tr>
4385 <td>c
4386 <ul><li>d</li></ul>
4387 </td></tr></table></dd></dl>
4388
4389 !! end
4390
4391 !!test
4392 Table / list interaction: lists nested in tables nested in indented lists
4393 !! wikitext
4394 :{|
4395 |
4396 :a
4397 :b
4398 |
4399 *c
4400 *d
4401 |}
4402
4403 *e
4404 *f
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td>
4409 <dl><dd>a</dd>
4410 <dd>b</dd></dl>
4411 </td>
4412 <td>
4413 <ul><li>c</li>
4414 <li>d</li></ul>
4415 </td></tr></table></dd></dl>
4416 <ul><li>e</li>
4417 <li>f</li></ul>
4418
4419 !!end
4420
4421 !! test
4422 Definition Lists: Nesting: Multi-level (Parsoid only)
4423 !! wikitext
4424 ;t1 :d1
4425 ;;t2 ::d2
4426 ;;;t3 :::d3
4427 !! html/parsoid
4428 <dl>
4429 <dt>t1 </dt>
4430 <dd>d1</dd>
4431 <dt>
4432 <dl>
4433 <dt>t2 </dt>
4434 <dd>:d2</dd>
4435 <dt>
4436 <dl>
4437 <dt>t3 </dt>
4438 <dd>::d3</dd>
4439 </dl>
4440 </dt>
4441 </dl>
4442 </dt>
4443 </dl>
4444
4445
4446 !! end
4447
4448
4449 !! test
4450 Definition Lists: Nesting: Test 2
4451 !! wikitext
4452 ;t1
4453 ::d2
4454 !! html+tidy
4455 <dl><dt>t1</dt>
4456 <dd>
4457 <dl><dd>d2</dd></dl></dd></dl>
4458 !! end
4459
4460
4461 !! test
4462 Definition Lists: Nesting: Test 3
4463 !! wikitext
4464 :;t1
4465 ::::d2
4466 !! html+tidy
4467 <dl><dd><dl><dt>t1</dt>
4468 <dd>
4469 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4470 !! end
4471
4472
4473 !! test
4474 Definition Lists: Nesting: Test 4
4475 !! wikitext
4476 ::;t3
4477 :::d3
4478 !! html
4479 <dl><dd><dl><dd><dl><dt>t3</dt>
4480 <dd>d3</dd></dl></dd></dl></dd></dl>
4481
4482 !! end
4483
4484
4485 ## The Parsoid team believes the following three test exposes a
4486 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4487 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4488 ## It also exposes a "misfeature" in tidy, which doesn't like
4489 ## <dl> tags with a single <dt> child; it converts the <dt> into
4490 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4491 !! test
4492 Definition Lists: Mixed Lists: Test 1
4493 !! wikitext
4494 :;*foo
4495 ::*bar
4496 :;baz
4497 !! html/php
4498 <dl><dd><dl><dt><ul><li>foo</li>
4499 <li>bar</li></ul></dt></dl>
4500 <dl><dt>baz</dt></dl></dd></dl>
4501
4502 !! html/php+tidy
4503 <dl><dd><dl><dt><ul><li>foo</li>
4504 <li>bar</li></ul></dt></dl>
4505 <dl><dt>baz</dt></dl></dd></dl>
4506 !! html/parsoid
4507 <dl>
4508 <dd><dl>
4509 <dt><ul>
4510 <li>foo
4511 </li>
4512 </ul></dt>
4513 <dd><ul>
4514 <li>bar
4515 </li>
4516 </ul></dd>
4517 <dt>baz</dt>
4518 </dl></dd>
4519 </dl>
4520 !! end
4521
4522 !! test
4523 Definition Lists: Mixed Lists: Test 2
4524 !! wikitext
4525 *:d1
4526 *:d2
4527 !! html
4528 <ul><li><dl><dd>d1</dd>
4529 <dd>d2</dd></dl></li></ul>
4530
4531 !! end
4532
4533
4534 !! test
4535 Definition Lists: Mixed Lists: Test 3
4536 !! wikitext
4537 *:::d1
4538 *:::d2
4539 !! html
4540 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4541 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4542
4543 !! end
4544
4545
4546 !! test
4547 Definition Lists: Mixed Lists: Test 4
4548 !! wikitext
4549 *;d1 :d2
4550 *;d3 :d4
4551 !! html
4552 <ul><li><dl><dt>d1</dt>
4553 <dd>d2</dd>
4554 <dt>d3</dt>
4555 <dd>d4</dd></dl></li></ul>
4556
4557 !! end
4558
4559
4560 !! test
4561 Definition Lists: Mixed Lists: Test 5
4562 !! wikitext
4563 *:d1
4564 *::d2
4565 !! html
4566 <ul><li><dl><dd>d1
4567 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4568
4569 !! end
4570
4571
4572 !! test
4573 Definition Lists: Mixed Lists: Test 6
4574 !! wikitext
4575 #*:d1
4576 #*:::d3
4577 !! html
4578 <ol><li><ul><li><dl><dd>d1
4579 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4580
4581 !! end
4582
4583
4584 !! test
4585 Definition Lists: Mixed Lists: Test 7
4586 !! wikitext
4587 :*d1
4588 :*d2
4589 !! html
4590 <dl><dd><ul><li>d1</li>
4591 <li>d2</li></ul></dd></dl>
4592
4593 !! end
4594
4595
4596 !! test
4597 Definition Lists: Mixed Lists: Test 8
4598 !! wikitext
4599 :*d1
4600 ::*d2
4601 !! html
4602 <dl><dd><ul><li>d1</li></ul>
4603 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4604
4605 !! end
4606
4607
4608 !! test
4609 Definition Lists: Mixed Lists: Test 9
4610 !! wikitext
4611 *;foo :bar
4612 !! html
4613 <ul><li><dl><dt>foo</dt>
4614 <dd>bar</dd></dl></li></ul>
4615
4616 !! end
4617
4618
4619 !! test
4620 Definition Lists: Mixed Lists: Test 10
4621 !! wikitext
4622 *#;foo :bar
4623 !! html
4624 <ul><li><ol><li><dl><dt>foo</dt>
4625 <dd>bar</dd></dl></li></ol></li></ul>
4626
4627 !! end
4628
4629 # The Parsoid team disagrees with the PHP parser's seemingly-random
4630 # rules regarding dd/dt on the next few tests. Parsoid is more
4631 # consistent, and recognizes the shared nesting and keeps the
4632 # still-open tags around until the nesting is complete.
4633
4634 # This is a regression test for T175099
4635 !! test
4636 Definition Lists: Mixed Lists: Test 11
4637 !! wikitext
4638 ;a
4639 :*b
4640 !! html/php
4641 <dl><dt>a</dt>
4642 <dd>
4643 <ul><li>b</li></ul></dd></dl>
4644
4645 !! html/parsoid
4646 <dl><dt>a
4647 <dd><ul><li>b</li></ul></dd></dl>
4648 !! end
4649
4650 # FIXME: Maybe get rid of this test?
4651 !! test
4652 Definition Lists: Mixed Lists: Test 12
4653 !! wikitext
4654 *#*#;*;;foo :bar
4655 *#*#;boo :baz
4656 !! html/php
4657 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4658 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4659 <dl><dt>boo</dt>
4660 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4661
4662 !! html/php+tidy
4663 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4664 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4665 <dl><dt>boo</dt>
4666 <dd>baz</dd></dl></li></ol></li></ul>
4667 !! html/parsoid
4668 <ul>
4669 <li>
4670 <ol>
4671 <li>
4672 <ul>
4673 <li>
4674 <ol>
4675 <li>
4676 <dl>
4677 <dt>
4678 <ul>
4679 <li>
4680 <dl>
4681 <dt>
4682 <dl>
4683 <dt>foo</dt>
4684 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4685 </dl></dt>
4686 </dl></li>
4687 </ul></dt>
4688 <dt>boo</dt>
4689 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4690 </dl></li>
4691 </ol></li>
4692 </ul></li>
4693 </ol></li>
4694 </ul>
4695 !! end
4696
4697 !! test
4698 Definition Lists: Mixed Lists: Test 13
4699 !! wikitext
4700 *#*#;*;;foo : bar
4701 *#*#;boo : baz
4702 !! html+tidy
4703 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4704 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4705 <dl><dt>boo&#160;</dt>
4706 <dd>baz</dd></dl></li></ol></li></ul>
4707 !! end
4708
4709 # FIXME: Maybe get rid of this test?
4710 # From whitelist:
4711 # * The test is wrong, there are two colons where there should be :;
4712 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4713 !! test
4714 Definition Lists: Weird Ones: Test 1
4715 !! wikitext
4716 *#;*::;;foo :bar (who uses this?)
4717 !! html/php+tidy
4718 <ul><li><ol><li><dl><dt>foo</dt>
4719 <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>
4720 !! html/parsoid
4721 <ul>
4722 <li>
4723 <ol>
4724 <li>
4725 <dl>
4726 <dt>
4727 <ul>
4728 <li>
4729 <dl>
4730 <dd>
4731 <dl>
4732 <dd>
4733 <dl>
4734 <dt>
4735 <dl>
4736 <dt>foo</dt>
4737 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4738 </dl></dt>
4739 </dl></dd>
4740 </dl></dd>
4741 </dl></li>
4742 </ul></dt>
4743 </dl></li>
4744 </ol></li>
4745 </ul>
4746 !! end
4747
4748 !! test
4749 Definition Lists: colons occurring in tags
4750 !! wikitext
4751 ;a:b
4752 ;'''a:b'''
4753 ;<i>a:b</i>
4754 ;<span>a:b</span>
4755 ;<div>a:b</div>
4756 ;<div>a
4757 :b</div>
4758 ;{{echo|a:b}}
4759 ;{{echo|''a:b''}}
4760 ;;;''a:b''
4761 !! html+tidy
4762 <dl><dt>a</dt>
4763 <dd>b</dd>
4764 <dt><b>a:b</b></dt>
4765 <dt><i>a:b</i></dt>
4766 <dt><span>a:b</span></dt>
4767 <dt><div>a:b</div></dt>
4768 <dt><div>a</div></dt>
4769 <dd>b</dd>
4770 <dt>a</dt>
4771 <dd>b</dd>
4772 <dt><i>a:b</i></dt></dl>
4773 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4774 !! html/parsoid
4775 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4776 <dt><b>a:b</b></dt>
4777 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4778 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4779 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4780 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4781 <dd>b</dd>
4782 <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>
4783 <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>
4784 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4785 !! end
4786
4787 # Parsoid's output differs here again because it shares
4788 # nesting between the two lists unlike the PHP parser.
4789 # Unsure which is more desirable.
4790 !! test
4791 Definition Lists: colons and tables 1
4792 !! wikitext
4793 :{|
4794 |x
4795 |}
4796 :{|
4797 |y
4798 |}
4799 !! html/php
4800 <dl><dd><table>
4801 <tr>
4802 <td>x
4803 </td></tr></table></dd></dl>
4804 <dl><dd><table>
4805 <tr>
4806 <td>y
4807 </td></tr></table></dd></dl>
4808
4809 !! html/parsoid
4810 <dl><dd><table>
4811 <tr>
4812 <td>x
4813 </td></tr></table></dd>
4814 <dd><table>
4815 <tr>
4816 <td>y
4817 </td></tr></table></dd></dl>
4818 !! end
4819
4820 # FIXME: Does this need a html/php section?
4821 !! test
4822 Definition Lists: template interaction
4823 !! wikitext
4824 ::{{definition_list}}
4825
4826 :one
4827 ::{{definition_list}}
4828 :::two
4829 :::three
4830 ::four
4831 !! html/parsoid
4832 <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">
4833 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4834
4835 <dl><dd data-parsoid='{}'>one
4836 <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">
4837 </span><dd about="#mwt2">two
4838 <dl><dd>two</dd>
4839 <dd>three</dd></dl></dd>
4840 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4841 !! end
4842
4843
4844 ###
4845 ### External links
4846 ###
4847 !! test
4848 External links: non-bracketed
4849 !! wikitext
4850 Non-bracketed: http://example.com
4851 !! html
4852 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4853 </p>
4854 !! end
4855
4856 # parsoid doesn't explicitly mark autonumbered links, see T55505
4857 !! test
4858 External links: numbered
4859 !! wikitext
4860 Numbered: [http://example.com]
4861 Numbered: [http://example.net]
4862 Numbered: [http://example.com]
4863 !! html/php
4864 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4865 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4866 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4867 </p>
4868 !! html/parsoid
4869 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4870 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4871 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4872 !!end
4873
4874 !! test
4875 External links: specified text
4876 !! wikitext
4877 Specified text: [http://example.com link]
4878 !! html
4879 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4880 </p>
4881 !!end
4882
4883 !! test
4884 External links: trail
4885 !! wikitext
4886 Linktrails should not work for external links: [http://example.com link]s
4887 !! html
4888 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4889 </p>
4890 !! end
4891
4892 !! test
4893 External links: dollar sign in URL
4894 !! wikitext
4895 http://example.com/1$2345
4896 !! html
4897 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4898 </p>
4899 !! end
4900
4901 # parsoid doesn't explicitly mark autonumbered links, see T55505
4902 !! test
4903 External links: dollar sign in URL (autonumber)
4904 !! wikitext
4905 [http://example.com/1$2345]
4906 !! html/php
4907 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4911 !!end
4912
4913 !! test
4914 External links: open square bracket forbidden in URL (T6377)
4915 !! options
4916 parsoid=wt2html,wt2wt,html2html
4917 !! wikitext
4918 http://example.com/1[2345
4919 !! html/php
4920 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4921 </p>
4922 !! html/parsoid
4923 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4924 !! end
4925
4926 !! test
4927 External links: open square bracket forbidden in URL (named) (T6377)
4928 !! options
4929 parsoid=wt2html,html2html
4930 !! wikitext
4931 [http://example.com/1[2345]
4932 !! html/php
4933 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4934 </p>
4935 !! html/parsoid
4936 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4937 !!end
4938
4939 # parsoid adds a space before the link name
4940 !! test
4941 External links: open square bracket forbidden in URL (named) (T6377)
4942 Parsoid variant.
4943 !! wikitext
4944 [http://example.com/1 [2345]
4945 !! html
4946 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4947 </p>
4948 !!end
4949
4950 !! test
4951 External links: nowiki in URL link text (T8230)
4952 !! wikitext
4953 [http://example.com/ <nowiki>''example site''</nowiki>]
4954 !! html
4955 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4956 </p>
4957 !! end
4958
4959 !! test
4960 External links: newline forbidden in text (T8230 regression check)
4961 !! wikitext
4962 [http://example.com/ first
4963 second]
4964 !! html
4965 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4966 second]
4967 </p>
4968 !!end
4969
4970 !! test
4971 External links: Pipe char between url and text
4972 !! wikitext
4973 [http://example.com | link]
4974 !! html
4975 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4976 </p>
4977 !!end
4978
4979 !! test
4980 External links: protocol-relative URL in brackets
4981 !! wikitext
4982 [//example.com/ Test]
4983 !! html
4984 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4985 </p>
4986 !! end
4987
4988 # parsoid doesn't explicitly mark autonumbered links, see T55505
4989 !! test
4990 External links: protocol-relative URL in brackets without text
4991 !! wikitext
4992 [//example.com]
4993 !! html/php
4994 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4998 !! end
4999
5000 !! test
5001 External links: protocol-relative URL in free text is left alone
5002 !! wikitext
5003 //example.com/Foo
5004 !! html
5005 <p>//example.com/Foo
5006 </p>
5007 !!end
5008
5009 !! test
5010 External links: protocol-relative URL in the middle of a word is left alone (T32269)
5011 !! wikitext
5012 foo//example.com/Foo
5013 !! html
5014 <p>foo//example.com/Foo
5015 </p>
5016 !! end
5017
5018 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
5019 !! test
5020 External links: with no contents
5021 !! options
5022 parsoid=wt2html,wt2wt
5023 !! wikitext
5024 [http://en.wikipedia.org/wiki/Foo]
5025
5026 [[wikipedia:Foo|Bar]]
5027
5028 [[wikipedia:Foo|<span>Bar</span>]]
5029 !! html/php
5030 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
5031 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
5032 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5033 </p>
5034 !! html/parsoid
5035 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5036 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5037 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5038 !! end
5039
5040 !! test
5041 External links: Free with trailing punctuation
5042 !! wikitext
5043 http://example.com,
5044 http://example.com;
5045 http://example.com\
5046 http://example.com.
5047 http://example.com:
5048 http://example.com!
5049 http://example.com?
5050 http://example.com)
5051 http://example.com/url_with_(brackets)
5052 (http://example.com/url_without_brackets)
5053 http://example.com/url_with_entity&amp;
5054 http://example.com/url_with_entity&#x26;
5055 http://example.com/url_with_entity&#038;
5056 http://example.com/url_with_entity&nbsp;
5057 http://example.com/url_with_entity&#xA0;
5058 http://example.com/url_with_entity&#160;
5059 http://example.com/url_with_entity&lt;
5060 http://example.com/url_with_entity&#x3C;
5061 http://example.com/url_with_entity&#60;
5062 !! html/php
5063 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5064 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5065 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5066 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5067 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5068 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5069 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5070 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5071 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5072 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5073 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5074 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5075 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5076 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5077 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5078 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5079 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5080 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5081 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5082 </p>
5083 !! html/parsoid
5084 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5085 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5086 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5087 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5088 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5089 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5090 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5091 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5092 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5093 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5094 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5095 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5096 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5097 <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>
5098 <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>
5099 <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>
5100 <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>
5101 <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>
5102 <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>
5103 !! end
5104
5105 !! test
5106 External links: tricky Parsoid html2html case
5107 !! options
5108 parsoid=wt2html,wt2wt,html2html
5109 !! wikitext
5110 http://example.com/url_with_entity&amp;amp;
5111 !! html/php
5112 <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>;
5113 </p>
5114 !! html/parsoid
5115 <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>
5116 !! end
5117
5118 !! test
5119 External links: Free with trailing quotes (T113666)
5120 !! wikitext
5121 '''News:''' Stuff here
5122
5123 news:'a'b''c''d e
5124 !! html/php
5125 <p><b>News:</b> Stuff here
5126 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5127 </p>
5128 !! html/parsoid
5129 <p><b>News:</b> Stuff here</p>
5130 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5131 !! end
5132
5133 !! test
5134 External links: with entity
5135 !! wikitext
5136 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5137 !! html/php
5138 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5139 </p>
5140 !! html/parsoid
5141 <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>
5142 !! end
5143
5144 !! test
5145 External links: Lone protocols are never linked (T105697)
5146 !! wikitext
5147 http://
5148 http://;
5149 (http://)
5150 bitcoin:
5151 bitcoin:;
5152 (bitcoin:)
5153 !! html
5154 <p>http://
5155 http://;
5156 (http://)
5157 bitcoin:
5158 bitcoin:;
5159 (bitcoin:)
5160 </p>
5161 !! end
5162
5163 !! test
5164 External links: No preceding word characters allowed (T67278)
5165 !! wikitext
5166 NOPEhttp://example.com
5167 N0http://example.com
5168 ok:http://example.com
5169 ok-http://example.com
5170 !! html
5171 <p>NOPEhttp://example.com
5172 N0http://example.com
5173 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5174 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5175 </p>
5176 !! end
5177
5178 !! test
5179 External links: nofollow domain exception
5180 !! wikitext
5181 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5182 !! html
5183 <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>.
5184 </p>
5185 !!end
5186
5187 !! test
5188 External image
5189 !! wikitext
5190 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5191 !! html
5192 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5193 </p>
5194 !! end
5195
5196 !! test
5197 External image from https
5198 !! wikitext
5199 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5200 !! html
5201 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5202 </p>
5203 !! end
5204
5205 !! test
5206 External image (when not allowed)
5207 !! options
5208 wgAllowExternalImages=0
5209 !! wikitext
5210 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5211 !! html
5212 <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>
5213 </p>
5214 !! end
5215
5216 !! test
5217 Link to non-http image, no img tag
5218 !! wikitext
5219 Link to non-http image, no img tag: ftp://example.com/test.jpg
5220 !! html
5221 <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>
5222 </p>
5223 !! end
5224
5225 !! test
5226 External links: terminating separator
5227 !! wikitext
5228 Terminating separator: http://example.com/thing,
5229 !! html
5230 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5231 </p>
5232 !! end
5233
5234 !! test
5235 External links: intervening separator
5236 !! wikitext
5237 Intervening separator: http://example.com/1,2,3
5238 !! html
5239 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5240 </p>
5241 !! end
5242
5243 !! test
5244 External links: old bug with URL in query
5245 !! wikitext
5246 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5247 !! html
5248 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5249 </p>
5250 !! end
5251
5252 !! test
5253 External links: old URL-in-URL bug, mixed protocols
5254 !! wikitext
5255 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5256 !! html
5257 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5258 </p>
5259 !!end
5260
5261 # Since Parsoid is starting to emit canonical wikitext for links,
5262 # [http://example.com http://example.com] will not RT back to that
5263 # form anymore.
5264 !! test
5265 External links: URL in text
5266 !! options
5267 parsoid=wt2html
5268 !! wikitext
5269 URL in text: [http://example.com http://example.com]
5270 !! html/php
5271 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5272 </p>
5273 !! html/parsoid
5274 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5275 !! end
5276
5277 !! test
5278 External links: Clickable images
5279 !! wikitext
5280 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5281 !! html/php
5282 <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>
5283 </p>
5284 !! html/parsoid
5285 <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>
5286 !! end
5287
5288 !! test
5289 External links: raw ampersand
5290 !! wikitext
5291 Old &amp; use: http://x&y
5292 !! html
5293 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5294 </p>
5295 !! end
5296
5297 !! test
5298 External links: encoded ampersand
5299 !! wikitext
5300 Old &amp; use: http://x&amp;y
5301 !! html/php
5302 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5303 </p>
5304 !! html/parsoid
5305 <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>
5306 !! end
5307
5308 !! test
5309 External links: encoded equals (T8102)
5310 !! wikitext
5311 http://example.com/?foo&#61;bar
5312 !! html/php
5313 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5314 </p>
5315 !! html/parsoid
5316 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5317 !! end
5318
5319 ##
5320 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5321 ## does it number them. As discussed in T55505, we can identify
5322 ## autonumbered links via CSS.
5323 ##
5324
5325 !! test
5326 External links: [raw ampersand]
5327 !! wikitext
5328 Old &amp; use: [http://x&y]
5329 !! html/php
5330 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5331 </p>
5332 !! html/parsoid
5333 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5334 !! end
5335
5336 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5337 # mode will return the [raw ampersand] wikitext
5338 !! test
5339 External links: [encoded ampersand]
5340 !! options
5341 parsoid=wt2html,wt2wt,html2html
5342 !! wikitext
5343 Old &amp; use: [http://x&amp;y]
5344 !! html/php
5345 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5346 </p>
5347 !! html/parsoid
5348 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5349 !! end
5350
5351 !! test
5352 External links: [raw equals]
5353 !! wikitext
5354 [http://example.com/?foo=bar]
5355 !! html/php
5356 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5357 </p>
5358 !! html/parsoid
5359 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5360 !! end
5361
5362 # note that parsoid html is identical to [raw equals] case; so html2wt
5363 # mode will return the [raw equals] wikitext
5364 !! test
5365 External links: [encoded equals] (T8102)
5366 !! options
5367 parsoid=wt2html,wt2wt,html2html
5368 !! wikitext
5369 [http://example.com/?foo&#61;bar]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5372 </p>
5373 !! html/parsoid
5374 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5375 !! end
5376
5377 # xxx parsoid strips the IDN character, so the round-trip tests will
5378 # obviously fail and are disabled. --cscott
5379 !! test
5380 External links: [IDN ignored character reference in hostname; strip it right off]
5381 !! options
5382 parsoid=wt2html,wt2wt,html2html
5383 !! wikitext
5384 [http://e&zwnj;xample.com/]
5385 !! html/php
5386 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5387 </p>
5388 !! html/parsoid
5389 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5390 !! end
5391
5392 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5393 # Where an external link could easily circumvent the sanitization of the text of
5394 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5395 # test demands a higher standard. That's a bit strange.
5396 #
5397 # Example:
5398 #
5399 # http://e‌xample.com -> [http://example.com|http://example.com]
5400 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5401 #
5402 # The first example is sanitized, but the second is not. Any security benefits
5403 # from this production are trivial to circumvent. Either remove this test and
5404 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5405 # the test accordingly.
5406 #
5407 # All our love,
5408 # The Parsoid team.
5409 # xxx parsoid strips the IDN character, so the round-trip tests will
5410 # obviously fail and are disabled. --cscott
5411 !! test
5412 External links: IDN ignored character reference in hostname; strip it right off
5413 !! options
5414 parsoid=wt2html,html2html
5415 !! wikitext
5416 http://e&zwnj;xample.com/
5417 !! html/php
5418 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5419 </p>
5420 !! html/parsoid
5421 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5422 !! end
5423
5424 !! test
5425 External links: www.jpeg.org (T2554)
5426 !! wikitext
5427 http://www.jpeg.org
5428 !! html
5429 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5430 </p>
5431 !! end
5432
5433 # parsoid doesn't explicitly mark autonumbered links, see T55505
5434 !! test
5435 External links: URL within URL (T2002)
5436 !! wikitext
5437 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5438 !! html/php
5439 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5440 </p>
5441 !! html/parsoid
5442 <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>
5443 !! end
5444
5445 !! test
5446 T2361: URL inside bracketed URL
5447 !! wikitext
5448 [http://www.example.com/foo http://www.example.com/bar]
5449 !! html
5450 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5451 </p>
5452 !! end
5453
5454 !! test
5455 T2361: URL within URL, not bracketed
5456 !! wikitext
5457 http://www.example.com/foo?=http://www.example.com/bar
5458 !! html
5459 <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>
5460 </p>
5461 !! end
5462
5463 !! test
5464 T2289: ">"-token in URL-tail
5465 !! wikitext
5466 http://www.example.com/<hello>
5467 !! html
5468 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5469 </p>
5470 !!end
5471
5472 !! test
5473 T2289: literal ">"-token in URL-tail
5474 !! wikitext
5475 http://www.example.com/<b>html</b>
5476 !! html/php
5477 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5478 </p>
5479 !! html/parsoid
5480 <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>
5481 !! end
5482
5483 !! test
5484 T2289: ">"-token in bracketed URL
5485 !! wikitext
5486 [http://www.example.com/<hello> stuff]
5487 !! html
5488 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5489 </p>
5490 !!end
5491
5492 !! test
5493 T2289: literal ">"-token in bracketed URL
5494 !! wikitext
5495 [http://www.example.com/<b>html</b> stuff]
5496 !! html
5497 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5498 </p>
5499 !!end
5500
5501 !! test
5502 T2289: literal double quote at end of URL
5503 !! wikitext
5504 http://www.example.com/"hello"
5505 !! html
5506 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5507 </p>
5508 !!end
5509
5510 !! test
5511 T2289: literal double quote in bracketed URL
5512 !! wikitext
5513 [http://www.example.com/"hello" stuff]
5514 !! html
5515 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5516 </p>
5517 !!end
5518
5519 !! test
5520 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5521 !! wikitext
5522 [http://www.example.com test]
5523 !! html
5524 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5525 </p>
5526 !! end
5527
5528 !! test
5529 External links: link text with spaces
5530 !! wikitext
5531 [http://www.example.com a b c]
5532 [http://www.example.com ''a'' ''b'']
5533 !! html
5534 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5535 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5536 </p>
5537 !! end
5538
5539 # Note edge case difference between PHP and Parsoid here.
5540 !! test
5541 External links: wiki links within external link (T5695)
5542 !! options
5543 parsoid=wt2html,html2html
5544 !! wikitext
5545 [http://example.com [[wikilink]] embedded in ext link]
5546
5547 [http://example.com test [[wikilink]] embedded in ext link]
5548 !! html/php
5549 <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>
5550 </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>
5551 </p>
5552 !! html/parsoid
5553 <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>
5554 <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>
5555 !! end
5556
5557 !! test
5558 T2787: Links with one slash after the url protocol are invalid
5559 !! wikitext
5560 http:/example.com
5561
5562 [http:/example.com title]
5563 !! html
5564 <p>http:/example.com
5565 </p><p>[http:/example.com title]
5566 </p>
5567 !! end
5568
5569 !! test
5570 Bracketed external links with template-generated invalid target
5571 !! wikitext
5572 [{{echo|http:/example.com}} title]
5573 !! html
5574 <p>[http:/example.com title]
5575 </p>
5576 !! end
5577
5578 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5579 !! test
5580 Broken wikilinks (but not external links) prevent templates from closing
5581 !! options
5582 parsoid=wt2html
5583 !! wikitext
5584 [http://example.com x
5585
5586 {{echo|[http://example.com x}}
5587
5588 [[Foo
5589
5590 {{echo|[[Foo}}
5591 !! html/php
5592 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5593 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5594 </p><p>[[Foo
5595 </p><p>{{echo|[[Foo}}
5596 </p>
5597 !! html/parsoid
5598 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5599 <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>
5600 <p>[[Foo</p>
5601 <p>{{echo|[[Foo}}</p>
5602 !! end
5603
5604 !! test
5605 Wikilinks with embedded newlines are not broken
5606 !! wikitext
5607 {{echo|[[ Foo
5608 B
5609 C]]}}
5610 !! html/php
5611 <p>[[ Foo
5612 B
5613 C]]
5614 </p>
5615 !! html/parsoid
5616 <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>
5617 !! end
5618
5619 !! test
5620 Broken templates
5621 !! options
5622 parsoid=wt2html
5623 !! wikitext
5624 {{echo|[[Foo|}}]]
5625
5626 [[Foo|{{echo|]]}}
5627 !! html/php
5628 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5629 </p><p>[[Foo|]]
5630 </p>
5631 !! html/parsoid
5632 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5633 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5634 !! end
5635
5636 !! test
5637 T4702: Mismatched <i>, <b> and <a> tags are invalid
5638 !! wikitext
5639 ''[http://example.com text'']
5640 [http://example.com '''text]'''
5641 ''Something [http://example.com in italic'']
5642 ''Something [http://example.com mixed''''', even bold]'''
5643 '''''Now [http://example.com both''''']
5644 !! html
5645 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5646 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5647 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5648 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5649 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5650 </p>
5651 !! end
5652
5653
5654 !! test
5655 T6781: %26 in URL
5656 !! wikitext
5657 http://www.example.com/?title=AT%26T
5658 !! html/php
5659 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5660 </p>
5661 !! html/parsoid
5662 <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>
5663 !! end
5664
5665 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5666 # % is actually legal in HTML5. Any change in output would need testing though.
5667 !! test
5668 T6781, T7267: %25 in URL
5669 !! wikitext
5670 http://www.example.com/?title=100%25_Bran
5671 !! html/php
5672 <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>
5673 </p>
5674 !! html/parsoid
5675 <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>
5676 !! end
5677
5678 !! test
5679 T6781, T7267: %28, %29 in URL
5680 !! wikitext
5681 http://www.example.com/?title=Ben-Hur_%281959_film%29
5682 !! html/php
5683 <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>
5684 </p>
5685 !! html/parsoid
5686 <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>
5687 !! end
5688
5689
5690 !! test
5691 T6781: %26 in autonumber URL
5692 !! wikitext
5693 [http://www.example.com/?title=AT%26T]
5694 !! html/php
5695 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5696 </p>
5697 !! html/parsoid
5698 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5699 !! end
5700
5701 !! test
5702 T6781, T7267: %26 in autonumber URL
5703 !! wikitext
5704 [http://www.example.com/?title=100%25_Bran]
5705 !! html/php
5706 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5707 </p>
5708 !! html/parsoid
5709 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5710 !! end
5711
5712 !! test
5713 T6781, T7267: %28, %29 in autonumber URL
5714 !! wikitext
5715 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5716 !! html/php
5717 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5718 </p>
5719 !! html/parsoid
5720 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5721 !! end
5722
5723
5724 !! test
5725 T6781: %26 in bracketed URL
5726 !! wikitext
5727 [http://www.example.com/?title=AT%26T link]
5728 !! html/php
5729 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5730 </p>
5731 !! html/parsoid
5732 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5733 !! end
5734
5735 !! test
5736 T6781, T7267: %25 in bracketed URL
5737 !! wikitext
5738 [http://www.example.com/?title=100%25_Bran link]
5739 !! html
5740 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5741 </p>
5742 !! end
5743
5744 !! test
5745 T6781, T7267: %28, %29 in bracketed URL
5746 !! wikitext
5747 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5748 !! html/php
5749 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5750 </p>
5751 !! html/parsoid
5752 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5753 !! end
5754
5755 !! test
5756 External link containing a period in the anchor. (T65947)
5757 !! wikitext
5758 [//foo.org/bar#baz. bang]
5759
5760 [//foo.org/bar. bang]
5761 !! html/php
5762 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5763 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5764 </p>
5765 !! html/parsoid
5766 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5767 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5768 !! end
5769
5770 !! test
5771 External link containing a single quote. (T65947)
5772 !! wikitext
5773 [//foo.org/bar'baz]
5774
5775 [//foo.org/bar'baz bang]
5776 !! html/php
5777 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5778 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5779 </p>
5780 !! html/parsoid
5781 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5782 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5783 !! end
5784
5785 !! test
5786 External link containing double-single-quotes in text '' (T6598 sanity check)
5787 !! wikitext
5788 Some [http://example.com/ pretty ''italics'' and stuff]!
5789 !! html
5790 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5791 </p>
5792 !! end
5793
5794 !! test
5795 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5796 !! wikitext
5797 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5798 !! html
5799 <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>
5800 </p>
5801 !! end
5802
5803 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5804 !! test
5805 External link containing double-single-quotes with no space separating the url from text in italics
5806 !! wikitext
5807 [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]].]
5808 !! html/php+tidy
5809 <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>.
5810 </p>
5811 !! html/parsoid
5812 <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>
5813 !! end
5814
5815 !! test
5816 External link with comments in link text
5817 !! wikitext
5818 [http://www.google.com Google <!-- comment -->]
5819 !! html/php
5820 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5821 </p>
5822 !! html/parsoid
5823 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5824 !! end
5825
5826 !! test
5827 External link to bare IPv4 address
5828 !! wikitext
5829 [http://192.168.0.1 Link]
5830 !! html/php
5831 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5832 </p>
5833 !! html/parsoid
5834 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5835 !! end
5836
5837 !! test
5838 URL-encoding in URL functions (single parameter)
5839 !! wikitext
5840 {{localurl:Some page|amp=&}}
5841 !! html
5842 <p>/index.php?title=Some_page&amp;amp=&amp;
5843 </p>
5844 !! end
5845
5846 !! test
5847 URL-encoding in URL functions (multiple parameters)
5848 !! wikitext
5849 {{localurl:Some page|q=?&amp=&}}
5850 !! html
5851 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5852 </p>
5853 !! end
5854
5855 !! test
5856 Brackets in urls
5857 !! wikitext
5858 http://example.com/index.php?foozoid%5B%5D=bar
5859
5860 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5861 !! html/php
5862 <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>
5863 </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>
5864 </p>
5865 !! html/parsoid
5866 <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>
5867
5868 <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>
5869 !! end
5870
5871 !! test
5872 IPv6 urls, autolink format (T23261)
5873 !! wikitext
5874 http://[2404:130:0:1000::187:2]/index.php
5875
5876 Examples from RFC 2373, section 2.2:
5877
5878 *http://[1080::8:800:200C:417A]/unicast
5879 *http://[FF01::101]/multicast
5880 *http://[::1]/loopback
5881 *http://[::]/unspecified
5882 *http://[::13.1.68.3]/ipv4compat
5883 *http://[::FFFF:129.144.52.38]/ipv4compat
5884
5885 Examples from RFC 2732, section 2:
5886
5887 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5888 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5889 *http://[3ffe:2a00:100:7031::1]
5890 *http://[1080::8:800:200C:417A]/foo
5891 *http://[::192.9.5.5]/ipng
5892 *http://[::FFFF:129.144.52.38]:80/index.html
5893 *http://[2010:836B:4179::836B:4179]
5894 !! html/php
5895 <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>
5896 </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:
5897 </p>
5898 <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>
5899 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5900 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5901 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5902 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5903 <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>
5904 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5905 </p>
5906 <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>
5907 <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>
5908 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5909 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5910 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5911 <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>
5912 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5913
5914 !! html/parsoid
5915 <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>
5916
5917 <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>
5918 <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>
5919 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5920 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5921 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5922 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5923 <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>
5924
5925 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5926 <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>
5927 <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>
5928 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5929 <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>
5930 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5931 <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>
5932 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5933 !! end
5934
5935 !! test
5936 IPv6 urls, bracketed format (T23261)
5937 !! wikitext
5938 [http://[2404:130:0:1000::187:2]/index.php test]
5939
5940 Examples from RFC 2373, section 2.2:
5941
5942 *[http://[1080::8:800:200C:417A] unicast]
5943 *[http://[FF01::101] multicast]
5944 *[http://[::1]/ loopback]
5945 *[http://[::] unspecified]
5946 *[http://[::13.1.68.3] ipv4compat]
5947 *[http://[::FFFF:129.144.52.38] ipv4compat]
5948
5949 Examples from RFC 2732, section 2:
5950
5951 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5952 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5953 *[http://[3ffe:2a00:100:7031::1] 3]
5954 *[http://[1080::8:800:200C:417A]/foo 4]
5955 *[http://[::192.9.5.5]/ipng 5]
5956 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5957 *[http://[2010:836B:4179::836B:4179] 7]
5958 !! html/php
5959 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5960 </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:
5961 </p>
5962 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5963 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5964 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5965 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5966 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5967 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5968 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5969 </p>
5970 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5971 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5972 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5973 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5974 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5975 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5976 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5977
5978 !! html/parsoid
5979 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5980
5981 <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>
5982 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5983 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5984 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5985 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5986 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5987 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5988
5989 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5990 <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>
5991 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5992 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5993 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5994 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5995 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5996 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5997 !! end
5998
5999 !! test
6000 Non-extlinks in brackets
6001 !! wikitext
6002 [foo]
6003 [foo bar]
6004 [foo ''bar'']
6005 [fool's] errand
6006 [fool's errand]
6007 [{{echo|foo}}]
6008 [{{echo|foo}} bar]
6009 [{{echo|foo}} ''bar'']
6010 [{{echo|foo}}l's] errand
6011 [{{echo|foo}}l's errand]
6012 [url={{echo|foo}}]
6013 [url=http://example.com]
6014 [http:// bare protocols don't count]
6015 !! html/php
6016 <p>[foo]
6017 [foo bar]
6018 [foo <i>bar</i>]
6019 [fool's] errand
6020 [fool's errand]
6021 [foo]
6022 [foo bar]
6023 [foo <i>bar</i>]
6024 [fool's] errand
6025 [fool's errand]
6026 [url=foo]
6027 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
6028 [http:// bare protocols don't count]
6029 </p>
6030 !! html/parsoid
6031 <p>[foo]
6032 [foo bar]
6033 [foo <i>bar</i>]
6034 [fool's] errand
6035 [fool's errand]
6036 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6037 [<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]
6038 [<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>]
6039 [<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
6040 [<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]
6041 [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>]
6042 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6043 [http:// bare protocols don't count]</p>
6044 !! end
6045
6046 !! test
6047 Percent encoding in external links
6048 !! wikitext
6049 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6050 !! html/php
6051 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6052 </p>
6053 !! html/parsoid
6054 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6055 !! end
6056
6057 !! test
6058 Use url link syntax for links where the content is equal the link target
6059 !! wikitext
6060 http://example.com
6061 !! html/php
6062 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6063 </p>
6064 !! html/parsoid
6065 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6066 !! end
6067
6068 !! test
6069 Parenthesis in external links, especially URL links
6070 !! wikitext
6071 http://example.com)
6072
6073 http://example.com/test)
6074
6075 http://example.com/(test)
6076
6077 http://example.com/((test)
6078
6079 (http://example.com/(test))
6080
6081 (http://example.com/(test)))))
6082
6083 http://example.com/a)b
6084
6085 [http://example.com) foo]
6086 !! html/php
6087 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6088 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6089 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6090 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6091 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6092 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6093 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6094 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6095 </p>
6096 !! html/parsoid
6097 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6098 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6099 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6100 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6101 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6102 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6103 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6104 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6105 !! end
6106
6107 !! test
6108 Parenthesis in external links, w/ transclusion or comment
6109 !! wikitext
6110 (http://example.com/{{echo|hi}})
6111
6112 (http://example.com<!-- hi -->)
6113 !! html/php
6114 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6115 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6116 </p>
6117 !! html/parsoid
6118 <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>
6119
6120 <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>
6121 !! end
6122
6123 !! test
6124 Serialize <a> tags with invalid link targets as plain text
6125 !! options
6126 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6127 !! html/parsoid
6128 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6129 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6130 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6131 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6132 !! wikitext
6133 text
6134 <nowiki>*</nowiki>text
6135 <nowiki>[[foo]]</nowiki>
6136 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6137 !! end
6138
6139 !! test
6140 mw:ExtLink -vs- mw:WikiLink (T94723)
6141 !! options
6142 parsoid=html2wt
6143 !! html/parsoid
6144 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6145 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6146 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6147 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6148 <p>
6149 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6150 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6151 </p>
6152 !! wikitext
6153 [[Foo|Bar]]
6154 [[Foo|Bar]]
6155 [[:en:Foo|Bar]]
6156 [[:en:Foo|Bar]]
6157
6158 [[:en:European_Robin|European Robin]]
6159 [[:en:European_Robin|European Robin]]
6160 !! end
6161
6162 !! test
6163 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6164 !! options
6165 parsoid=wt2wt
6166 !! wikitext
6167 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6168 !! html/parsoid
6169 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6170 !! end
6171
6172
6173 ###
6174 ### Quotes
6175 ###
6176
6177 !! test
6178 Quotes
6179 !! wikitext
6180 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6181
6182 Normal text. '''''Bold italic text.''''' Normal text.
6183 !! html
6184 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6185 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6186 </p>
6187 !! end
6188
6189 !! test
6190 Quotes wrapping HTML table
6191 !! wikitext
6192 '''<table><tr><td>hi</td></tr></table>'''
6193 !! html/php+tidy
6194 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6195 !! html/parsoid
6196 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6197 !! end
6198
6199 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6200 # parser strips. The wikitext contains just the first half of the bold
6201 # quote pair.
6202 !! test
6203 Unclosed and unmatched quotes
6204 !! wikitext
6205 '''''Bold italic text '''with bold deactivated''' in between.'''''
6206
6207 '''''Bold italic text ''with italic deactivated'' in between.'''''
6208
6209 '''Bold text..
6210
6211 ..spanning two paragraphs (should not work).'''
6212
6213 '''Bold tag left open
6214
6215 ''Italic tag left open
6216
6217 Normal text.
6218
6219 <!-- Unmatching number of opening, closing tags: -->
6220 '''This year''''s election ''should'' beat '''last year''''s.
6221
6222 ''Tom'''s car is bigger than ''Susan'''s.
6223
6224 Plain ''italic'''s plain
6225 !! html/php
6226 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6227 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6228 </p><p><b>Bold text..</b>
6229 </p><p>..spanning two paragraphs (should not work).
6230 </p><p><b>Bold tag left open</b>
6231 </p><p><i>Italic tag left open</i>
6232 </p><p>Normal text.
6233 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6234 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6235 </p><p>Plain <i>italic'</i>s plain
6236 </p>
6237 !! html/parsoid
6238 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6239 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6240 </p><p><b>Bold text..</b>
6241 </p><p>..spanning two paragraphs (should not work).<b></b>
6242 </p><p><b>Bold tag left open</b>
6243 </p><p><i>Italic tag left open</i>
6244 </p><p>Normal text.
6245 </p>
6246 <!-- Unmatching number of opening, closing tags: -->
6247 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6248 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6249 </p><p>Plain <i>italic'</i>s plain
6250 </p>
6251 !! end
6252
6253 ###
6254 ### Tables
6255 ###
6256 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6257 ###
6258
6259 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6260 # is the bare minimum required by the spec, see:
6261 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6262 # Parsoid team replies: empty table tags are legal in HTML5
6263 !! test
6264 A table with no data.
6265 !! options
6266 parsoid=wt2html
6267 !! wikitext
6268 {||}
6269 !! html/php
6270
6271 !! html/parsoid
6272 <table></table>
6273
6274 !! end
6275
6276 # Note that the PHP parser output appears to be broken when the table
6277 # end tag is not separated by a space from the style attribute
6278 !! test
6279 A table with stray table end tags on start tag line (wt2html)
6280 !! options
6281 parsoid=wt2html
6282 !! wikitext
6283 {|style="color: red;"|}
6284
6285 {|style="color: red;" |}
6286 |foo
6287 |}
6288
6289 {|style="color: red;"|} id="foo"
6290 |foo
6291 |}
6292
6293 {|style="color: red;" |} id="foo"
6294 |foo
6295 |}
6296 !! html/php+tidy
6297 <table style="&quot;color:">
6298
6299 </table><table style="color: red;">
6300 <tbody><tr>
6301 <td>foo
6302 </td></tr></tbody></table>
6303 <table style="&quot;color:" id="foo">
6304 <tbody><tr>
6305 <td>foo
6306 </td></tr></tbody></table>
6307 <table style="color: red;" id="foo">
6308 <tbody><tr>
6309 <td>foo
6310 </td></tr></tbody></table>
6311 !! html/parsoid
6312 <table style="color: red;"></table>
6313
6314 <table style="color: red;">
6315 <tbody><tr>
6316 <td>foo</td>
6317 </tr></tbody>
6318 </table>
6319
6320 <table style="color: red;" id="foo">
6321 <tbody><tr>
6322 <td>foo</td>
6323 </tr></tbody>
6324 </table>
6325
6326 <table style="color: red;" id="foo">
6327 <tbody><tr>
6328 <td>foo</td>
6329 </tr></tbody>
6330 </table>
6331
6332 !! end
6333
6334 !! test
6335 A table with no data (take 2)
6336 !! wikitext
6337 {|
6338 |}
6339 !! html/parsoid
6340 <table></table>
6341 !! end
6342
6343 # A table with nothing but a caption is invalid XHTML, we might want to render
6344 # this as <p>caption</p>
6345 # Parsoid team replies: table with only a caption is legal in HTML5
6346 !! test
6347 A table with nothing but a caption
6348 !! wikitext
6349 {|
6350 |+caption
6351 |}
6352 !! html/php
6353 <table>
6354 <caption>caption
6355 </caption><tr><td></td></tr></table>
6356
6357 !! html/parsoid
6358 <table><caption>caption</caption></table>
6359 !! end
6360
6361 !! test
6362 A table with caption with default-spaced attributes and a table row
6363 !! wikitext
6364 {|
6365 |+ style="color: red;" |caption1
6366 |-
6367 |foo
6368 |}
6369 !! html
6370 <table>
6371 <caption style="color: red;">caption1
6372 </caption>
6373 <tr>
6374 <td>foo
6375 </td></tr></table>
6376
6377 !! end
6378
6379 !! test
6380 A table with captions with non-default spaced attributes and a table row
6381 !! wikitext
6382 {|
6383 |+style="color: red;"|caption2
6384 |+ style="color: red;"|caption3
6385 |-
6386 |foo
6387 |}
6388 !! html
6389 <table>
6390 <caption style="color: red;">caption2
6391 </caption>
6392 <caption style="color: red;">caption3
6393 </caption>
6394 <tr>
6395 <td>foo
6396 </td></tr></table>
6397
6398 !! end
6399
6400 !! test
6401 Table td-cell syntax variations
6402 !! wikitext
6403 {|
6404 |foo bar foo|baz
6405 |foo bar foo||baz
6406 |style='color:red;'|baz
6407 |style='color:red;'||baz
6408 |}
6409 !! html
6410 <table>
6411 <tr>
6412 <td>baz
6413 </td>
6414 <td>foo bar foo</td>
6415 <td>baz
6416 </td>
6417 <td style="color:red;">baz
6418 </td>
6419 <td>style='color:red;'</td>
6420 <td>baz
6421 </td></tr></table>
6422
6423 !! end
6424
6425 !! test
6426 Simple table
6427 !! wikitext
6428 {|
6429 |1||2
6430 |-
6431 |3||4
6432 |}
6433 !! html
6434 <table>
6435 <tr>
6436 <td>1</td>
6437 <td>2
6438 </td></tr>
6439 <tr>
6440 <td>3</td>
6441 <td>4
6442 </td></tr></table>
6443
6444 !! end
6445
6446 !! test
6447 Simple table but with multiple dashes for row wikitext
6448 !! wikitext
6449 {|
6450 |foo
6451 |-----
6452 |bar
6453 |}
6454 !! html
6455 <table>
6456 <tr>
6457 <td>foo
6458 </td></tr>
6459 <tr>
6460 <td>bar
6461 </td></tr></table>
6462
6463 !! end
6464
6465 !! test
6466 Multiplication table
6467 !! wikitext
6468 {| border="1" cellpadding="2"
6469 |+Multiplication table
6470 |-
6471 !&times;!!1!!2!!3
6472 |-
6473 !1
6474 |1||2||3
6475 |-
6476 !2
6477 |2||4||6
6478 |-
6479 !3
6480 |3||6||9
6481 |-
6482 !4
6483 |4||8||12
6484 |-
6485 !5
6486 |5||10||15
6487 |}
6488 !! html
6489 <table border="1" cellpadding="2">
6490 <caption>Multiplication table
6491 </caption>
6492 <tr>
6493 <th>&#215;</th>
6494 <th>1</th>
6495 <th>2</th>
6496 <th>3
6497 </th></tr>
6498 <tr>
6499 <th>1
6500 </th>
6501 <td>1</td>
6502 <td>2</td>
6503 <td>3
6504 </td></tr>
6505 <tr>
6506 <th>2
6507 </th>
6508 <td>2</td>
6509 <td>4</td>
6510 <td>6
6511 </td></tr>
6512 <tr>
6513 <th>3
6514 </th>
6515 <td>3</td>
6516 <td>6</td>
6517 <td>9
6518 </td></tr>
6519 <tr>
6520 <th>4
6521 </th>
6522 <td>4</td>
6523 <td>8</td>
6524 <td>12
6525 </td></tr>
6526 <tr>
6527 <th>5
6528 </th>
6529 <td>5</td>
6530 <td>10</td>
6531 <td>15
6532 </td></tr></table>
6533
6534 !! end
6535
6536 !! test
6537 Accept "||" in table headings
6538 !! wikitext
6539 {|
6540 !h1||h2
6541 |}
6542 !! html
6543 <table>
6544 <tr>
6545 <th>h1</th>
6546 <th>h2
6547 </th></tr></table>
6548
6549 !! end
6550
6551 !! test
6552 Accept "!!" in table data
6553 !! wikitext
6554 {|
6555 |Foo!!||
6556 |}
6557 !! html
6558 <table>
6559 <tr>
6560 <td>Foo!!</td>
6561 <td>
6562 </td></tr></table>
6563
6564 !! html/parsoid
6565 <table>
6566 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6567 </tbody></table>
6568 !! end
6569
6570 !! test
6571 Accept "||" in indented table headings
6572 !! wikitext
6573 :{|
6574 !h1||h2
6575 |}
6576 !! html
6577 <dl><dd><table>
6578 <tr>
6579 <th>h1</th>
6580 <th>h2
6581 </th></tr></table></dd></dl>
6582
6583 !! end
6584
6585 !! test
6586 Accept "!!" in templates
6587 !! wikitext
6588 {|
6589 !a {{echo|b!!c}}
6590 |}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <th>a b</th>
6595 <th>c
6596 </th></tr></table>
6597
6598 !! html/parsoid
6599 <table>
6600 <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>
6601 !! end
6602
6603 !! test
6604 Accept "!!" in table headings after newline
6605 !! wikitext
6606 {|
6607 !a
6608 b!!c
6609 |}
6610 !! html/php
6611 <table>
6612 <tr>
6613 <th>a
6614 <p>b!!c
6615 </p>
6616 </th></tr></table>
6617
6618 !! html/parsoid
6619 <table>
6620 <tbody><tr><th>a
6621 <p>b!!c</p></th></tr>
6622 </tbody></table>
6623 !! end
6624
6625 !! test
6626 Accept "!!" in table data of mixed wikitext / html syntax
6627 !! wikitext
6628 {|
6629 !a
6630 <tr><td>b!!c</td></tr>
6631 |}
6632 !! html/php+tidy
6633 <table>
6634 <tbody><tr>
6635 <th>a
6636 </th></tr><tr><td>b!!c</td></tr>
6637 </tbody></table>
6638 !! html/parsoid
6639 <table>
6640 <tbody><tr><th>a</th></tr>
6641 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6642 </tbody></table>
6643 !! end
6644
6645 !! test
6646 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6647 !! wikitext
6648 {|
6649 !|h1
6650 ||a
6651 |}
6652 !! html
6653 <table>
6654 <tr>
6655 <th>h1
6656 </th>
6657 <td>a
6658 </td></tr></table>
6659
6660 !! end
6661
6662 !!test
6663 Accept "| !" at start of line in tables (ignore !-attribute)
6664 !! wikitext
6665 {|
6666 |-
6667 |!style="color:red"|bar
6668 |}
6669 !! html
6670 <table>
6671
6672 <tr>
6673 <td>bar
6674 </td></tr></table>
6675
6676 !!end
6677
6678 !!test
6679 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 +/-
6680 !! wikitext
6681 {|
6682 |-
6683 |style='color:red;'|+1
6684 |style='color:blue;'|-1
6685 |-
6686 |1||2||3
6687 |1||+2||-3
6688 |-
6689 | +1
6690 | -1
6691 |}
6692 !! html
6693 <table>
6694
6695 <tr>
6696 <td style="color:red;">+1
6697 </td>
6698 <td style="color:blue;">-1
6699 </td></tr>
6700 <tr>
6701 <td>1</td>
6702 <td>2</td>
6703 <td>3
6704 </td>
6705 <td>1</td>
6706 <td>+2</td>
6707 <td>-3
6708 </td></tr>
6709 <tr>
6710 <td>+1
6711 </td>
6712 <td>-1
6713 </td></tr></table>
6714
6715 !!end
6716
6717 !! test
6718 Table rowspan
6719 !! wikitext
6720 {| border=1
6721 |Cell 1, row 1
6722 |rowspan=2|Cell 2, row 1 (and 2)
6723 |Cell 3, row 1
6724 |-
6725 |Cell 1, row 2
6726 |Cell 3, row 2
6727 |}
6728 !! html
6729 <table border="1">
6730 <tr>
6731 <td>Cell 1, row 1
6732 </td>
6733 <td rowspan="2">Cell 2, row 1 (and 2)
6734 </td>
6735 <td>Cell 3, row 1
6736 </td></tr>
6737 <tr>
6738 <td>Cell 1, row 2
6739 </td>
6740 <td>Cell 3, row 2
6741 </td></tr></table>
6742
6743 !! end
6744
6745 !! test
6746 Nested table
6747 !! wikitext
6748 {| border=1
6749 | &alpha;
6750 |
6751 {| bgcolor=#ABCDEF border=2
6752 |nested
6753 |-
6754 |table
6755 |}
6756 |the original table again
6757 |}
6758 !! html
6759 <table border="1">
6760 <tr>
6761 <td>&#945;
6762 </td>
6763 <td>
6764 <table bgcolor="#ABCDEF" border="2">
6765 <tr>
6766 <td>nested
6767 </td></tr>
6768 <tr>
6769 <td>table
6770 </td></tr></table>
6771 </td>
6772 <td>the original table again
6773 </td></tr></table>
6774
6775 !! end
6776
6777 !! test
6778 Invalid attributes in table cell (T3830)
6779 !! wikitext
6780 {|
6781 |Cell:|broken
6782 |}
6783 !! html
6784 <table>
6785 <tr>
6786 <td>broken
6787 </td></tr></table>
6788
6789 !! end
6790
6791 !! test
6792 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6793 !! wikitext
6794 {|
6795 |title="foo" |bar
6796 |title="foo<nowiki>|</nowiki>" |bar
6797 |title="foo<nowiki>|</nowiki>" bar
6798 |}
6799 !! html/php
6800 <table>
6801 <tr>
6802 <td title="foo">bar
6803 </td>
6804 <td title="foo&#124;">bar
6805 </td>
6806 <td>title="foo|" bar
6807 </td></tr></table>
6808
6809 !! html/parsoid
6810 <table>
6811 <tbody><tr><td title="foo">bar</td>
6812 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6813 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6814 </tbody></table>
6815 !! end
6816
6817 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6818 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6819 # *2wt modes will fail.
6820 !! test
6821 Table security: embedded pipes
6822 !! options
6823 parsoid=wt2html,html2html
6824 !! wikitext
6825 {|
6826 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6827 !! html/php
6828 <table>
6829 <tr>
6830 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6831 <td>]" onmouseover="alert(document.cookie)"&gt;test
6832 </td>
6833 </tr>
6834 </table>
6835
6836 !! html/parsoid
6837 <table><tbody>
6838 <tr>
6839 <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>
6840 !! end
6841
6842 !! test
6843 Element attributes with double ! should not be broken up by <th>
6844 !! wikitext
6845 {|
6846 !hi <div class="!!">ha</div> ho
6847 |}
6848 !! html/php
6849 <table>
6850 <tr>
6851 <th>hi <div class="!!">ha</div> ho
6852 </th></tr></table>
6853
6854 !! html/parsoid
6855 <table>
6856 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6857 </tbody></table>
6858 !! end
6859
6860 !! test
6861 ! and || in element attributes should not be parsed as <th>/<td>
6862 !! wikitext
6863 {|
6864 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6865 |}
6866 !! html/php
6867 <table>
6868 <tr>
6869 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6870 </td></tr></table>
6871
6872 !! html/parsoid
6873 <table>
6874 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6875 </tbody></table>
6876 !! end
6877
6878 # FIXME: The output seems broken. Filed as T110268.
6879 !! test
6880 ! and || in td attributes should not be parsed as <th>/<td>
6881 !! options
6882 parsoid=wt2html
6883 !! wikitext
6884 {|
6885 |style="color: red !important;" data-contrived="put this here ||"|foo
6886 |}
6887 !! html/php
6888 <table>
6889 <tr>
6890 <td>style="color: red !important;" data-contrived="put this here</td>
6891 <td>foo
6892 </td></tr></table>
6893
6894 !! html/parsoid
6895 <table>
6896 <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>
6897 </tbody></table>
6898 !! end
6899
6900 !! test
6901 Break on | in element attribute in template
6902 !! options
6903 parsoid=wt2html,html2html
6904 !! wikitext
6905 {{echo|1=<div class="hi|ho">ha</div>}}
6906 !! html/php
6907 <p>ho"&gt;ha&lt;/div&gt;
6908 </p>
6909 !! html/parsoid
6910 <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>
6911 !! end
6912
6913 !! test
6914 Break on | in element attribute name in template
6915 !! wikitext
6916 {{echo|<div cla|ss="hiho">ha</div>}}
6917 !! html/parsoid
6918 <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>
6919 !! end
6920
6921 !! test
6922 Don't break on | in extension attribute in template
6923 !! wikitext
6924 {{echo|<ref name="hi|ho">ha</ref>}}
6925
6926 <references />
6927 !! html/parsoid
6928 <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>
6929
6930 <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>
6931 !! end
6932
6933 ## We don't support roundtripping of these attributes in Parsoid.
6934 ## Selective serialization takes care of preventing dirty diffs.
6935 ## But, on edits, we dirty-diff the invalid attribute text.
6936 !! test
6937 Invalid text in table attributes should be discarded
6938 !! options
6939 parsoid=wt2html
6940 !! wikitext
6941 {| <span>boo</span> style='border:1px solid black'
6942 | <span>boo</span> style='color:blue' |1
6943 |<span>boo</span> style='color:blue'|2
6944 |}
6945 !! html/php
6946 <table style="border:1px solid black">
6947 <tr>
6948 <td style="color:blue">1
6949 </td>
6950 <td style="color:blue">2
6951 </td></tr></table>
6952
6953 !! html/parsoid
6954 <table style="border:1px solid black">
6955 <tr>
6956 <td style="color:blue">1</td>
6957 <td style="color:blue">2</td>
6958 </tr>
6959 </table>
6960 !! end
6961
6962 !! test
6963 Invalid text in table attributes should be preserved by selective serializer
6964 !! options
6965 parsoid={
6966 "modes": ["selser"],
6967 "changes": [
6968 ["td:first-child", "text", "abc"],
6969 ["td + td", "text", "xyz"]
6970 ]
6971 }
6972 !! wikitext
6973 {| <span>boo</span> style='border:1px solid black'
6974 | <span>boo</span> style='color:blue' | 1
6975 |<span>boo</span> style='color:blue'| 2
6976 |}
6977 !! wikitext/edited
6978 {| <span>boo</span> style='border:1px solid black'
6979 | <span>boo</span> style='color:blue' | abc
6980 |<span>boo</span> style='color:blue'| xyz
6981 |}
6982 !! end
6983
6984 !! test
6985 1. Template-generated table cell attributes and cell content
6986 !! wikitext
6987 {|
6988 |{{table_attribs}}
6989 | {{table_attribs}}
6990 || {{table_attribs_5}}
6991 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6992 |align=center {{table_attribs}}
6993 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6994 |}
6995 !! html
6996 <table>
6997 <tr>
6998 <td style="color:red;">Foo
6999 </td>
7000 <td style="color:red;">Foo
7001 </td>
7002 <td>style="color:red;"</td>
7003 <td>Bar
7004 </td>
7005 <td style="color:red;">Foo
7006 </td>
7007 <td align="center" style="color:red;">Foo
7008 </td>
7009 <td align="center" style="color:red;">Foo
7010 </td></tr></table>
7011
7012 !! end
7013
7014 !! test
7015 2. Template-generated table cell attributes and cell content
7016 !! wikitext
7017 {|
7018 |{{table_attribs_2}}
7019 |}
7020 !! html/php
7021 <table>
7022 <tr>
7023 <td style="color:red;">Foo
7024 </td>
7025 <td>Bar</td>
7026 <td>Baz
7027 </td></tr></table>
7028
7029 !! html/parsoid
7030 <table>
7031 <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>
7032 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
7033 </tbody></table>
7034 !! end
7035
7036 !! test
7037 3. Template-generated table cell attributes and cell content
7038 !! wikitext
7039 {|
7040 !align=center {{table_header_cells}}
7041 |-
7042 |align=center {{table_cells}}
7043 |}
7044 !! html/php
7045 <table>
7046 <tr>
7047 <th align="center" style="color:red;">Foo</th>
7048 <th style="color:red;"><i>Bar</i></th>
7049 <th style="color:brown;"><i>Foo</i> and Baz
7050 </th></tr>
7051 <tr>
7052 <td align="center" style="color:red;">Foo</td>
7053 <td style="color:red;"><i>Bar</i></td>
7054 <td style="color:brown;"><i>Foo</i> and Baz
7055 </td></tr></table>
7056
7057 !! html/parsoid
7058 <table>
7059 <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>
7060 <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>
7061 </tbody></table>
7062 !! end
7063
7064 !! test
7065 4. Template-generated table cell attributes and cell content inside a templated table
7066 !! wikitext
7067 {{tbl-start}}
7068 !align=center {{table_header_cells}}
7069 |-
7070 |align=center {{table_cells}}
7071 {{tbl-end}}
7072 !! html/php
7073 <table>
7074 <tr>
7075 <th align="center" style="color:red;">Foo</th>
7076 <th style="color:red;"><i>Bar</i></th>
7077 <th style="color:brown;"><i>Foo</i> and Baz
7078 </th></tr>
7079 <tr>
7080 <td align="center" style="color:red;">Foo</td>
7081 <td style="color:red;"><i>Bar</i></td>
7082 <td style="color:brown;"><i>Foo</i> and Baz
7083 </td></tr></table>
7084
7085 !! html/parsoid
7086 <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}}]}'>
7087 <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>
7088 <tr>
7089 <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>
7090 </tbody></table>
7091 !! end
7092
7093 ## Edge case fix to prevent future regressions
7094 !! test
7095 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7096 !! wikitext
7097 {|
7098 |{{table_attribs_7}}
7099 |}
7100 <references />
7101 !! html/parsoid
7102 <table>
7103 <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>
7104 </tbody></table>
7105 <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>
7106 !! end
7107
7108 !! test
7109 Table with row followed by newlines and table heading
7110 !! options
7111 parsoid=wt2html,html2html
7112 !! wikitext
7113 {|
7114 |-
7115
7116 !foo
7117 |}
7118 !! html/*
7119 <table>
7120
7121
7122 <tr>
7123 <th>foo
7124 </th></tr></table>
7125
7126 !! end
7127
7128 !! test
7129 Table with empty line following the start tag
7130 !! options
7131 parsoid=wt2html,html2html
7132 !! wikitext
7133 {|
7134
7135 |-
7136 |foo
7137 |}
7138 !! html/*
7139 <table>
7140
7141
7142 <tr>
7143 <td>foo
7144 </td></tr></table>
7145
7146 !! end
7147
7148 !! test
7149 Table attributes with empty value
7150 !! options
7151 parsoid=wt2html,html2html
7152 !! wikitext
7153 {|
7154 | style=|hello
7155 |}
7156 !! html/php
7157 <table>
7158 <tr>
7159 <td style="">hello
7160 </td></tr></table>
7161
7162 !! html/parsoid
7163 <table>
7164 <tbody><tr><td style="">hello</td></tr>
7165 </tbody></table>
7166 !! end
7167
7168 !! test
7169 Wikitext table with a lot of comments
7170 !! wikitext
7171 {|
7172 <!-- c0 -->
7173 |foo
7174 <!-- c1 -->
7175 |-<!-- c2 -->
7176 <!-- c3 -->
7177 |<!-- c4 -->
7178 <!-- c5 -->
7179 |}
7180 !! html
7181 <table>
7182 <tr>
7183 <td>foo
7184 </td></tr>
7185 <tr>
7186 <td>
7187 </td></tr></table>
7188
7189 !! end
7190
7191 !! test
7192 Wikitext table comments represented in parsoid dom
7193 !! wikitext
7194 {|<!--c1--><!--c2-->
7195 |-<!--c3-->
7196 |x
7197 |}
7198 !! html/php+tidy
7199 <table>
7200
7201 <tbody><tr>
7202 <td>x
7203 </td></tr></tbody></table>
7204 !! html/parsoid
7205 <table><!--c1--><!--c2-->
7206 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7207 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7208 </tbody></table>
7209 !! end
7210
7211 !! test
7212 Wikitext table with double-line table cell
7213 !! wikitext
7214 {|
7215 |a
7216 b
7217 |}
7218 !! html
7219 <table>
7220 <tr>
7221 <td>a
7222 <p>b
7223 </p>
7224 </td></tr></table>
7225
7226 !! end
7227
7228 !! test
7229 Table cell with a single comment
7230 !! wikitext
7231 {|
7232 |<!-- c1 -->
7233 |a
7234 |}
7235 !! html
7236 <table>
7237 <tr>
7238 <td>
7239 </td>
7240 <td>a
7241 </td></tr></table>
7242
7243 !! end
7244
7245 !! test
7246 Table-cell after a comment-only-empty-line
7247 !! wikitext
7248 {|
7249 |a
7250 <!--c1-->
7251 <!--c2-->|b
7252 |}
7253 !! html
7254 <table>
7255 <tr>
7256 <td>a
7257 </td>
7258 <td>b
7259 </td></tr></table>
7260
7261 !! html/parsoid
7262 <table>
7263 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7264 <!--c1-->
7265 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7266 </tbody></table>
7267
7268 !! end
7269
7270 !! test
7271 Build table with {{!}}
7272 !! wikitext
7273 {{{!}} class="wikitable"
7274 !header
7275 !second header
7276 {{!}}- style="color:red;"
7277 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7278 {{!}}}
7279 !! html
7280 <table class="wikitable">
7281 <tr>
7282 <th>header
7283 </th>
7284 <th>second header
7285 </th></tr>
7286 <tr style="color:red;">
7287 <td>data</td>
7288 <td style="color:red;">second data
7289 </td></tr></table>
7290
7291 !! end
7292
7293 !! test
7294 Build table with pipe as data
7295 !! wikitext
7296 {| class="wikitable"
7297 !header
7298 !second header
7299 |- style="color:red;"
7300 |data|| style="color:red;" |second data
7301 |-
7302 | style="color:red;" |data with | || style="color:red;" | second data with |
7303 |-
7304 ||data with | |||second data with |
7305 |}
7306 !! html
7307 <table class="wikitable">
7308 <tr>
7309 <th>header
7310 </th>
7311 <th>second header
7312 </th></tr>
7313 <tr style="color:red;">
7314 <td>data</td>
7315 <td style="color:red;">second data
7316 </td></tr>
7317 <tr>
7318 <td style="color:red;">data with |</td>
7319 <td style="color:red;">second data with |
7320 </td></tr>
7321 <tr>
7322 <td>data with |</td>
7323 <td>second data with |
7324 </td></tr></table>
7325
7326 !! end
7327
7328 !! test
7329 Build table with wikilink
7330 !! wikitext
7331 {| class="wikitable"
7332 !header||second header
7333 |- style="color:red;"
7334 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7335 |-
7336 |data||second data [[Main Page|link|text with pipe]]
7337 |}
7338 !! html
7339 <table class="wikitable">
7340 <tr>
7341 <th>header</th>
7342 <th>second header
7343 </th></tr>
7344 <tr style="color:red;">
7345 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7346 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7347 </td></tr>
7348 <tr>
7349 <td>data</td>
7350 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7351 </td></tr></table>
7352
7353 !! end
7354
7355 # The expected HTML structure in this test is debatable. The PHP parser does
7356 # not parse this kind of table at all. The main focus for Parsoid is on
7357 # round-tripping, so this output is ok for now. TODO: revisit!
7358 !! test
7359 Wikitext table with html-syntax row
7360 !! wikitext
7361 {|
7362 |-
7363 <td>foo</td>
7364 |}
7365 !! html/parsoid
7366 <table>
7367 <tbody>
7368 <tr>
7369 <td>foo</td></tr></tbody></table>
7370 !! end
7371
7372 ## Remex doesn't account for fostered content.
7373 !! test
7374 Fostered content in tables: Plain text
7375 !! options
7376 parsoid=wt2html
7377 !! wikitext
7378 {|
7379 |-
7380 a
7381 |}
7382 !! html/php
7383 <table>
7384
7385 a
7386 </table>
7387
7388 !! html/php+tidy
7389
7390
7391 a
7392 <table></table>
7393 !! html/parsoid
7394 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7395 a</p>
7396 <table>
7397 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7398 !! end
7399
7400 !! test
7401 Fostered content in tables: Lists
7402 !! options
7403 parsoid=wt2html,html2html
7404 !! wikitext
7405 {|
7406 |-
7407 *a
7408 |}
7409 !! html/php
7410 <table>
7411
7412 <ul><li>a</li></ul>
7413 </table>
7414
7415 !! html/php+tidy
7416 <ul><li>a</li></ul><table>
7417
7418
7419 </table>
7420 !! html/parsoid
7421 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7422 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7423
7424 </tr></tbody></table>
7425 !! end
7426
7427 !! test
7428 Template generated table cell with attributes
7429 !! wikitext
7430 {|
7431 |-
7432 {{table_attribs_4}} ||a||b
7433 |}
7434 !! html/php+tidy
7435 <table>
7436
7437 <tbody><tr>
7438 <td style="background-color:#DC241f;" width="10px"></td>
7439 <td>a</td>
7440 <td>b
7441 </td></tr></tbody></table>
7442 !! html/parsoid
7443 <table>
7444 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7445 <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>
7446 !! end
7447
7448 !! test
7449 Parsoid: Round-trip tables directly followed by content (T53219)
7450 !! options
7451 parsoid=wt2html,wt2wt
7452 !! wikitext
7453 {|
7454 |foo
7455 |} bar
7456
7457 {|
7458 |baz
7459 |}<b>quux</b>
7460 !! html+tidy
7461 <table>
7462 <tbody><tr>
7463 <td>foo
7464 </td></tr></tbody></table><p> bar
7465 </p><table>
7466 <tbody><tr>
7467 <td>baz
7468 </td></tr></tbody></table><p><b>quux</b>
7469 </p>
7470 !! end
7471
7472 !! test
7473 Parsoid: Default to a newline after tables in new content (T53219)
7474 !! options
7475 parsoid=html2wt
7476 !! html/parsoid
7477 <table><tbody>
7478 <tr><td>foo</td></tr></tbody></table> bar
7479 <table><tbody>
7480 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7481 !! wikitext
7482 {|
7483 |foo
7484 |}
7485 <nowiki> </nowiki>bar
7486 {|
7487 |baz
7488 |}
7489 '''quux'''
7490 !! end
7491
7492 !! test
7493 Parsoid: Row-syntax table headings followed by comment & table cells
7494 !! options
7495 parsoid=wt2html,wt2wt
7496 !! wikitext
7497 {|
7498 !foo||bar
7499 <!-- foo --> ||baz||quux
7500 |}
7501 !! html/php
7502 <table>
7503 <tr>
7504 <th>foo</th>
7505 <th>bar
7506 </th>
7507 <td>baz</td>
7508 <td>quux
7509 </td></tr></table>
7510
7511 !! html/parsoid
7512 <table>
7513 <tbody><tr><th>foo</th><th>bar
7514 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7515 </tbody></table>
7516 !! end
7517
7518 !!test
7519 Parsoid: Recover better from broken table attributes
7520 !!options
7521 parsoid=wt2html
7522 !!wikitext
7523 {| class="foo
7524 | class="bar" |
7525 foo
7526 |}
7527 !!html/php+tidy
7528 <table class="foo">
7529 <tbody><tr>
7530 <td class="bar">
7531 <p>foo
7532 </p>
7533 </td></tr></tbody></table>
7534 !!html/parsoid
7535 <table class="foo">
7536 <tr>
7537 <td class="bar">
7538 <p>foo</p></td></tr>
7539 </tbody></table>
7540 !!end
7541
7542 # Note: PHP parser omits empty rows
7543 !! test
7544 Tables: Digest broken attributes on table and tr tag
7545 !! options
7546 parsoid=wt2html
7547 !! wikitext
7548 {| || |} ++
7549 |- || || ++ --
7550 |- > [
7551 |}
7552 !! html/php+tidy
7553 <table>
7554
7555
7556 </table>
7557 !! html/parsoid
7558 <table>
7559 <tbody>
7560 <tr class='mw-empty-elt'></tr>
7561 <tr class='mw-empty-elt'></tr>
7562 </tbody></table>
7563 !! end
7564
7565 !! test
7566 Table with missing opening <tr> tag
7567 !! options
7568 parsoid=wt2html,wt2wt
7569 !! wikitext
7570 <table>
7571 <td>foo</td>
7572 </tr>
7573 </table>
7574 !! html+tidy
7575 <table>
7576 <tbody><tr><td>foo</td>
7577 </tr>
7578 </tbody></table>
7579 !! end
7580
7581 # T137406: Whitespace in the HTML
7582 !! test
7583 1. Generate correct wikitext for tables with thead/tbody/tfoot
7584 !! options
7585 parsoid=html2wt
7586 !! html/parsoid
7587 <table>
7588 <caption>Test</caption>
7589 <thead>
7590 <tr>
7591 <th>Month</th>
7592 <th>Savings</th>
7593 </tr>
7594 </thead>
7595 <tbody>
7596 <tr>
7597 <td>January</td>
7598 <td>$100</td>
7599 </tr>
7600 <tr>
7601 <td>February</td>
7602 <td>$80</td>
7603 </tr>
7604 </tbody>
7605 <tfoot>
7606 <tr>
7607 <td>Sum</td>
7608 <td>$180</td>
7609 </tr>
7610 </tfoot>
7611 </table>
7612 !! wikitext
7613 {|
7614 |+Test
7615 !Month
7616 !Savings
7617 |-
7618 |January
7619 |$100
7620 |-
7621 |February
7622 |$80
7623 |-
7624 |Sum
7625 |$180
7626 |}
7627 !! html/php+tidy
7628 <table>
7629 <caption>Test
7630 </caption>
7631 <tbody><tr>
7632 <th>Month
7633 </th>
7634 <th>Savings
7635 </th></tr>
7636 <tr>
7637 <td>January
7638 </td>
7639 <td>$100
7640 </td></tr>
7641 <tr>
7642 <td>February
7643 </td>
7644 <td>$80
7645 </td></tr>
7646 <tr>
7647 <td>Sum
7648 </td>
7649 <td>$180
7650 </td></tr></tbody></table>
7651 !! end
7652
7653 # T137406: No whitespace in the HTML
7654 !! test
7655 2. Generate correct wikitext for tables with thead/tbody/tfoot
7656 !! options
7657 parsoid=html2wt
7658 !! html/parsoid
7659 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7660 !! wikitext
7661 {|
7662 !heading
7663 |-
7664 |foo
7665 |}
7666 !! end
7667
7668 !! test
7669 Wikitext tables can be nested inside HTML tables
7670 !! options
7671 parsoid=html2wt
7672 !! html/parsoid
7673 <table data-parsoid='{"stx":"html"}'>
7674 <tr><td>
7675 <table>
7676 <tr><td>foo</td></tr>
7677 </table>
7678 </td></tr>
7679 </table>
7680 !! wikitext
7681 <table>
7682 <tr><td>
7683 {|
7684 |foo
7685 |}
7686 </td></tr>
7687 </table>
7688 !! html/php+tidy
7689 <table>
7690 <tbody><tr><td>
7691 <table>
7692 <tbody><tr>
7693 <td>foo
7694 </td></tr></tbody></table>
7695 </td></tr>
7696 </tbody></table>
7697 !! end
7698
7699 ###
7700 ### Internal links
7701 ###
7702 !! test
7703 Plain link, capitalized
7704 !! wikitext
7705 [[Main Page]]
7706 !! html
7707 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Plain link, uncapitalized
7713 !! wikitext
7714 [[main Page]]
7715 !! html
7716 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7717 </p>
7718 !! end
7719
7720 !! test
7721 Piped link
7722 !! wikitext
7723 [[Main Page|The Main Page]]
7724 !! html
7725 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Piped link with comment in link text
7731 !! wikitext
7732 [[Main Page|The Main<!--front--> Page]]
7733 !! html
7734 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7735 </p>
7736 !! end
7737
7738 !! test
7739 Piped link with multiple pipe characters in link text
7740 !! wikitext
7741 [[Main Page||The|Main|Page|]]
7742 !! html/php
7743 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7744 </p>
7745 !! html/parsoid
7746 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7747 !! end
7748
7749 !! test
7750 Piped link with no link text
7751 !! wikitext
7752 [[Thomas Bek (bishop of St David's)|]]
7753 !! html/php
7754 <p>[[Thomas Bek (bishop of St David's)|]]
7755 </p>
7756 !! html/parsoid
7757 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7758 !! end
7759
7760 !! test
7761 Piped link with empty link text
7762 !! wikitext
7763 [[Main Page|<nowiki/>]] - empty nowiki
7764 [[Main Page| ]] - empty space
7765 [[Main Page|&nbsp;]] - empty non breaking space
7766 !! html/php
7767 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7768 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7769 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7770 </p>
7771 !! html/parsoid
7772 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7773 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7774 <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>
7775 !! end
7776
7777 !! test
7778 Broken link
7779 !! wikitext
7780 [[Zigzagzogzagzig]]
7781 !! html
7782 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7783 </p>
7784 !! end
7785
7786 !! test
7787 Broken link with fragment
7788 !! wikitext
7789 [[Zigzagzogzagzig#zug]]
7790 !! html
7791 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7792 </p>
7793 !! end
7794
7795 !! test
7796 Special page link with fragment
7797 !! wikitext
7798 [[Special:Version#anchor]]
7799 !! html
7800 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7801 </p>
7802 !! end
7803
7804 !! test
7805 Nonexistent special page link with fragment
7806 !! wikitext
7807 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7808 !! html
7809 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7810 </p>
7811 !! end
7812
7813 !! test
7814 Link with prefix
7815 !! wikitext
7816 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7817 !! html
7818 <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>
7819 </p>
7820 !! end
7821
7822 !! test
7823 Link with suffix
7824 !! wikitext
7825 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7826 !! html
7827 <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>!!!
7828 </p>
7829 !! end
7830
7831 !! article
7832 prefixed article
7833 !! text
7834 Some text
7835 !! endarticle
7836
7837 !! test
7838 T45661: Piped links with identical prefixes
7839 !! wikitext
7840 [[prefixed article|prefixed articles with spaces]]
7841
7842 [[prefixed article|prefixed articlesaoeu]]
7843
7844 [[Main Page|Main Page test]]
7845 !! html
7846 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7847 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7848 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7849 </p>
7850 !! end
7851
7852
7853 !! test
7854 Link with HTML entity in suffix / tail
7855 !! wikitext
7856 [[Main Page]]&quot;, [[Main Page]]&#97;
7857 !! html/php
7858 <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;
7859 </p>
7860 !! html/parsoid
7861 <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>
7862 !! end
7863
7864 !! test
7865 Link with 3 brackets
7866 !! wikitext
7867 [[[Main Page]]]
7868 Foo [[[Main Page]]]
7869 !! html
7870 <p>[[[Main Page]]]
7871 Foo [[[Main Page]]]
7872 </p>
7873 !! end
7874
7875 !! test
7876 Link with 4 brackets
7877 !! wikitext
7878 [[[[Main Page]]]]
7879 !! html
7880 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7881 </p>
7882 !! end
7883
7884 !! test
7885 Piped link with 3 brackets
7886 !! wikitext
7887 [[[main page|the main page]]]
7888 !! html
7889 <p>[[[main page|the main page]]]
7890 </p>
7891 !! end
7892
7893 !! test
7894 Piped link with extlink-like text
7895 !! wikitext
7896 [[Main Page|[bar]]]
7897 [[Main Page|This is a [bar]]]
7898 [[Main Page|[bar]]
7899 !! html/php
7900 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7901 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7902 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7903 </p>
7904 !! html/parsoid
7905 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7906 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7907 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7908 !! end
7909
7910 !! test
7911 Link with multiple pipes
7912 !! wikitext
7913 [[Main Page|The|Main|Page]]
7914 !! html
7915 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7916 </p>
7917 !! end
7918
7919 !! test
7920 Anchor containing a #. (T65430)
7921 !! config
7922 wgFragmentMode=[ 'html5', 'legacy' ]
7923 !! wikitext
7924 [[Main Page#And#Link]]
7925 !! html/php
7926 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7927 </p>
7928 !! html/parsoid
7929 <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>
7930 !! end
7931
7932 !! test
7933 Link to namespaces
7934 !! wikitext
7935 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7936 !! html
7937 <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>
7938 </p>
7939 !! end
7940
7941 !! test
7942 Link with space in namespace
7943 !! wikitext
7944 [[User talk:Foo bar]]
7945 !! html
7946 <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>
7947 </p>
7948 !! end
7949
7950 !! article
7951 MemoryAlpha:AlphaTest
7952 !! text
7953 This is an article in the MemoryAlpha namespace
7954 (which shadows the memoryalpha interwiki link).
7955 !! endarticle
7956
7957 !! test
7958 Namespace takes precedence over interwiki link (T53680)
7959 !! wikitext
7960 [[MemoryAlpha:AlphaTest]]
7961 !! html
7962 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7963 </p>
7964 !! end
7965
7966 # The previous test doesn't work correctly in html2*, due to not recognizing the
7967 # link as an internal one. This one checks for the correct behavior.
7968 !! test
7969 Link to namespace preferred over interwiki with correct rel attribute
7970 !! options
7971 parsoid=html2wt,html2html
7972 !! html/parsoid
7973 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7974 !! wikitext
7975 [[MemoryAlpha:AlphaTest]]
7976 !! end
7977
7978 !! test
7979 Piped link to namespace
7980 !! wikitext
7981 [[Meta:Disclaimers|The disclaimers]]
7982 !! html
7983 <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>
7984 </p>
7985 !! end
7986
7987 !! test
7988 Link containing }
7989 !! wikitext
7990 [[Usually caused by a typo (oops}]]
7991 !! html
7992 <p>[[Usually caused by a typo (oops}]]
7993 </p>
7994 !! end
7995
7996 !! article
7997 7% Solution
7998 !! text
7999 Just a test of an article title containing a percent.
8000 !! endarticle
8001
8002 !! test
8003 Link containing % (not as a hex sequence)
8004 !! wikitext
8005 [[7% Solution]]
8006 [[7% Solution|7%25 Solution]]
8007 !! html/php
8008 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
8009 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
8010 </p>
8011 !! html/parsoid
8012 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
8013 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
8014 !! end
8015
8016 # note that the parsoid HTML is identical to the previous test output,
8017 # so the previous test ensures that the html2wt mode will generate the
8018 # "not as a hex sequence" wikitext.
8019 !! test
8020 Link containing % as a single hex sequence interpreted to char
8021 !! options
8022 parsoid=wt2wt,wt2html,html2html
8023 !! wikitext
8024 [[7%25 Solution]]
8025 [[7%25 Solution|7%25 Solution]]
8026 !! html/php
8027 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
8028 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
8029 </p>
8030 !! html/parsoid
8031 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
8032 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
8033 !!end
8034
8035 !! test
8036 Link containing % as a double hex sequence interpreted to hex sequence
8037 !! wikitext
8038 [[7%2525 Solution]]
8039 !! html
8040 <p>[[7%2525 Solution]]
8041 </p>
8042 !!end
8043
8044 ## Example for such a section: == < ==
8045 !! test
8046 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
8047 !! config
8048 wgFragmentMode=[ 'html5', 'legacy' ]
8049 !! wikitext
8050 [[%23%3c]][[%23%3e]]
8051 !! html/php
8052 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
8053 </p>
8054 !! html/parsoid
8055 <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>
8056 !! end
8057
8058 ## Example for such a section: == < ==
8059 !! test
8060 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
8061 !! config
8062 wgFragmentMode=[ 'legacy' ]
8063 !! wikitext
8064 [[%23%3c]][[%23%3e]]
8065 !! html/php
8066 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8067 </p>
8068 !! end
8069
8070 !! test
8071 Link containing "<#" and ">#" as a hex sequences
8072 !! wikitext
8073 [[%3c%23]][[%3e%23]]
8074 !! html
8075 <p>[[%3c%23]][[%3e%23]]
8076 </p>
8077 !! end
8078
8079 !! test
8080 Link containing an equals sign
8081 !! wikitext
8082 [[Special:BookSources/isbn=4-00-026157-6]]
8083 !! html/php
8084 <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>
8085 </p>
8086 !! html/parsoid
8087 <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>
8088 !! end
8089
8090 !! article
8091 Foo & bar
8092 !! text
8093 Just a test of an article title containing an ampersand
8094 !! endarticle
8095
8096 !! test
8097 Link containing an ampersand
8098 !! wikitext
8099 [[Foo & bar]]
8100
8101 [[Foo &amp; bar]]
8102
8103 [[Foo &amp;amp; bar]]
8104 !! html/php+tidy
8105 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8106 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8107 </p><p>[[Foo &amp;amp; bar]]
8108 </p>
8109 !! html/parsoid
8110 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
8111 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar" data-parsoid='{"stx":"simple","a":{"href":"./Foo_&amp;_bar"},"sa":{"href":"Foo &amp;amp; bar"}}'>Foo &amp; bar</a></p>
8112 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
8113 !! end
8114
8115 !! article
8116 Foo~bar
8117 !! text
8118 Just a test of an article title containing a tilde.
8119 !! endarticle
8120
8121 # note that links containing signatures, like [[Foo~~~~]], are
8122 # massaged by the pre-save transform (PST) and so the tildes are never
8123 # seen by the parser.
8124 !! test
8125 Link containing a tilde
8126 !! wikitext
8127 [[Foo~bar]]
8128 !! html/php
8129 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8130 </p>
8131 !! html/parsoid
8132 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8133 !! end
8134
8135 !! test
8136 Link containing double-single-quotes '' (T6598)
8137 !! wikitext
8138 [[Lista d''e paise d''o munno]]
8139 !! html/php
8140 <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>
8141 </p>
8142 !! html/parsoid
8143 <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>
8144 !! end
8145
8146 !! test
8147 Link containing double quotes and spaces
8148 !! wikitext
8149 [[Cool "Gator"]]
8150 !! html/php
8151 <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>
8152 </p>
8153 !! html/parsoid
8154 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8155 !! end
8156
8157 !! test
8158 File containing double quotes and spaces
8159 !! wikitext
8160 [[File:Cool "Gator".png]]
8161 !! html/parsoid
8162 <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>
8163 !! end
8164
8165 !! test
8166 Redirect containing double quotes and spaces
8167 !! wikitext
8168 #REDIRECT [[Cool "Gator"]]
8169 !! html/parsoid
8170 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8171 !! end
8172
8173 !! test
8174 Link containing double-single-quotes '' in text (T6598 sanity check)
8175 !! wikitext
8176 Some [[Link|pretty ''italics'' and stuff]]!
8177 !! html/php
8178 <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>!
8179 </p>
8180 !! html/parsoid
8181 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8182 !! end
8183
8184 !! test
8185 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8186 !! wikitext
8187 ''Some [[Link|pretty ''italics'' and stuff]]!''
8188 !! html
8189 <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>
8190 </p>
8191 !! end
8192
8193 !! test
8194 Link with double quotes in title part (literal) and alternate part (interpreted)
8195 !! wikitext
8196 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8197
8198 [[''Pentecoste'']]
8199
8200 [[''Pentecoste''|Pentecoste]]
8201
8202 [[''Pentecoste''|''Pentecoste'']]
8203 !! html/php
8204 <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>
8205 </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>
8206 </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>
8207 </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>
8208 </p>
8209 !! html/parsoid
8210 <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>
8211 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8212 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8213 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8214 !! end
8215
8216 !! test
8217 Broken image links with HTML captions (T41700)
8218 !! wikitext
8219 [[File:Nonexistent|<script></script>]]
8220 [[File:Nonexistent|100x100px|<script></script>]]
8221 [[File:Nonexistent|&lt;]]
8222 [[File:Nonexistent|a<i>b</i>c]]
8223 !! html/php
8224 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8225 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8226 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8227 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8228 </p>
8229 !! html/parsoid
8230 <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>
8231 <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>
8232 <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>
8233 <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>
8234 !! end
8235
8236 !! test
8237 Plain link to URL
8238 !! wikitext
8239 [[http://www.example.com]]
8240 !! html/php
8241 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8242 </p>
8243 !! html/parsoid
8244 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8245 !! end
8246
8247 !! test
8248 Plain link to URL with link text
8249 !! wikitext
8250 [[http://www.example.com Link text]]
8251 !! html
8252 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8253 </p>
8254 !! end
8255
8256 !! test
8257 Plain link to protocol-relative URL
8258 !! wikitext
8259 [[//www.example.com]]
8260 !! html/php
8261 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8262 </p>
8263 !! html/parsoid
8264 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8265 !! end
8266
8267 !! test
8268 Plain link to protocol-relative URL with link text
8269 !! wikitext
8270 [[//www.example.com Link text]]
8271 !! html
8272 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8273 </p>
8274 !! end
8275
8276 !! test
8277 Plain link to page with question mark in title
8278 !! wikitext
8279 [[A?b]]
8280
8281 [[A?b|Baz]]
8282 !! html
8283 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8284 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8285 </p>
8286 !! end
8287
8288 # I'm fairly sure the expected result here is wrong.
8289 # We want these to be URL links, not pseudo-pages with URLs for titles....
8290 # However the current output is also pretty screwy.
8291 #
8292 # ----
8293 # I'm changing it to match the current output--it arguably makes more
8294 # sense in the light of the test above. Old expected result was:
8295 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8296 #</p>
8297 # But I think this test is bordering on "garbage in, garbage out" anyway.
8298 # -- wtm
8299 !! test
8300 Piped link to URL
8301 !! wikitext
8302 Piped link to URL: [[http://www.example.com|an example URL]]
8303 !! html/php
8304 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8305 </p>
8306 !! html/parsoid
8307 <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>
8308 !! end
8309
8310 !! test
8311 Plain link in template argument
8312 !! options
8313 parsoid=wt2html
8314 !! wikitext
8315 {{echo|[http://www.example.com |123]}}
8316
8317 {{echo|[[http://www.example.com |123]]}}
8318
8319 {{echo|[[http://www.example.com |123]}}
8320
8321 {{echo|[http://www.example.com |123]]}}
8322 !! html/php
8323 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8324 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8325 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8326 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8327 </p>
8328 !! html/parsoid
8329 <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>
8330
8331 <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>
8332
8333 <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>
8334
8335 <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>
8336 !! end
8337
8338 !! test
8339 T2002: [[page|http://url/]] should link to page, not http://url/
8340 !! wikitext
8341 [[Main Page|http://url/]]
8342 !! html/php
8343 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8344 </p>
8345 !! html/parsoid
8346 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8347 !! end
8348
8349 # Parsoid does not mark self-links, by design.
8350 !! test
8351 T2337: Escaped self-links should be bold
8352 !! options
8353 title=[[Bug462]]
8354 !! wikitext
8355 [[Bu&#103;462]] [[Bug462]]
8356 !! html/php+tidy
8357 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8358 </p>
8359 !! html/parsoid
8360 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8361 !! end
8362
8363 !! test
8364 Self-link to section should not be bold
8365 !! options
8366 title=[[Main Page]]
8367 !! wikitext
8368 [[Main Page#section]]
8369 !! html
8370 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8371 </p>
8372 !! end
8373
8374 !! article
8375 00
8376 !! text
8377 This is 00.
8378 !! endarticle
8379
8380 !!test
8381 Self-link to numeric title
8382 !!options
8383 title=[[0]]
8384 !! wikitext
8385 [[0]]
8386 !! html
8387 <p><a class="mw-selflink selflink">0</a>
8388 </p>
8389 !!end
8390
8391 !!test
8392 Link to numeric-equivalent title
8393 !!options
8394 title=[[0]]
8395 !! wikitext
8396 [[00]]
8397 !! html
8398 <p><a href="/wiki/00" title="00">00</a>
8399 </p>
8400 !!end
8401
8402 !! test
8403 <nowiki> inside a link
8404 !! wikitext
8405 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8406 !! html
8407 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Non-breaking spaces in title
8413 !! wikitext
8414 [[&nbsp; Main &nbsp; Page &nbsp;]]
8415 !! html
8416 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8417 </p>
8418 !!end
8419
8420 # Add new article for the test below so that it doesn't red-link
8421 !! article
8422 Foo bar baz
8423 !! text
8424 boo
8425 !! endarticle
8426
8427 !! test
8428 Multiple spaces in titles should normalize to a single underscore
8429 !! options
8430 parsoid=wt2html,wt2wt
8431 !! wikitext
8432 [[Foo bar baz|x]]
8433 [[Foo bar baz|x]]
8434 [[Foo bar baz|x]]
8435 !! html/php
8436 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8437 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8438 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8439 </p>
8440 !! html/parsoid
8441 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8442 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8443 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8444 </p>
8445 !! end
8446
8447 !! test
8448 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8449 !! options
8450 language=ca
8451 !! wikitext
8452 '''[[Main Page]]'''
8453 !! html
8454 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8455 </p>
8456 !! end
8457
8458 !! test
8459 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8460 !! options
8461 language=ca
8462 !! wikitext
8463 ''[[Main Page]]''
8464 !! html
8465 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8466 </p>
8467 !! end
8468
8469 !! test
8470 Internal link with en linktrail: no apostrophes (T29473)
8471 !! options
8472 language=en
8473 !! wikitext
8474 [[Something]]'nice
8475 !! html
8476 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8477 </p>
8478 !! end
8479
8480 !! test
8481 Internal link with ca linktrail with apostrophes (T29473)
8482 !! options
8483 language=ca
8484 !! wikitext
8485 [[Something]]'nice
8486 !! html
8487 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8488 </p>
8489 !! end
8490
8491 !! test
8492 Internal link with kaa linktrail with apostrophes (T29473)
8493 !! options
8494 language=kaa
8495 !! wikitext
8496 [[Something]]'nice
8497 !! html
8498 <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>
8499 </p>
8500 !! end
8501
8502 !! test
8503 Link with multiple ":" in a subpage-supporting namespace (T65636)
8504 !! wikitext
8505 [[User:Foo/Test/63636:Bar|Test]]
8506 !! html/php
8507 <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>
8508 </p>
8509 !! html/parsoid
8510 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8511 !! end
8512
8513 ## Mainly a sanity check for Parsoid
8514 !! test
8515 Handle title parsing for subpages
8516 !! options
8517 title=[[/123123]]
8518 subpage
8519 !! wikitext
8520 123
8521 !! html/php
8522 <p>123
8523 </p>
8524 !! html/parsoid
8525 <p>123</p>
8526 !! end
8527
8528 !! article
8529 User:Test/123
8530 !! text
8531 test 123
8532 !! endarticle
8533
8534 !! test
8535 Link to a subpage from a namespace other than main
8536 !! options
8537 title=[[User:Test]]
8538 subpage
8539 !! wikitext
8540 [[/123]]
8541 !! html/php
8542 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8543 </p>
8544 !! html/parsoid
8545 <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>
8546 !! end
8547
8548 !! test
8549 Ensure that transclusion titles are not url-decoded
8550 !! options
8551 subpage title=[[Test]]
8552 parsoid=wt2html
8553 !! wikitext
8554 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8555 !! html/php
8556 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8557 </p>
8558 !! html/parsoid
8559 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8560 !! end
8561
8562 !! test
8563 Purely hash wikilink
8564 !! options
8565 title=[[User:Test/123]]
8566 subpage
8567 !! wikitext
8568 [[#a|b]]
8569 !! html/php
8570 <p><a href="#a">b</a>
8571 </p>
8572 !! html/parsoid
8573 <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>
8574 !! end
8575
8576 !! test
8577 Serialization of purely hash wikilink
8578 !! options
8579 title=[[User:Test/123]]
8580 subpage
8581 parsoid=html2wt
8582 !! html/parsoid
8583 <p><a href="#a">[[</a></p>
8584 !! wikitext
8585 [[#a|<nowiki>[[</nowiki>]]
8586 !! html/php
8587 <p><a href="#a">[[</a>
8588 </p>
8589 !! end
8590
8591 !! test
8592 1. Interaction of linktrail and template encapsulation
8593 !! wikitext
8594 {{echo|[[Foo]]}}l
8595 !! html/php+tidy
8596 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8597 </p>
8598 !! html/parsoid
8599 <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>
8600 !! end
8601
8602 !! test
8603 2. Interaction of linktrail and template encapsulation
8604 !! wikitext
8605 {{echo|Some [[Fool]]}}s
8606 !! html/php+tidy
8607 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8608 </p>
8609 !! html/parsoid
8610 <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>
8611 !! end
8612
8613 !! test
8614 3. Interaction of linktrail and template encapsulation
8615 !! wikitext
8616 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8617 !! html/php+tidy
8618 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a> are <b>bold and foolish</b>
8619 </p>
8620 !! html/parsoid
8621 <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>
8622 !! end
8623
8624 !! article
8625 Söfnuður
8626 !! text
8627 Test.
8628 !! endarticle
8629
8630 !! test
8631 Internal link with is link prefix
8632 !! options
8633 language=is
8634 !! wikitext
8635 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8636 !! html
8637 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8638 </p>
8639 !! end
8640
8641 !! article
8642 Mótmælendatrú
8643 !! text
8644 Test.
8645 !! endarticle
8646
8647 !! test
8648 Internal link with is link trail and link prefix
8649 !! options
8650 language=is
8651 !! wikitext
8652 [[mótmælendatrú|xxx]]ar
8653 [[mótmælendatrú]]ar
8654 mótmælenda[[söfnuður]]
8655 mótmælenda[[söfnuður|söfnuðir]]
8656 mótmælenda[[söfnuður|söfnuðir]]xxx
8657 !! html
8658 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8659 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8660 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8661 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8662 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8663 </p>
8664 !! end
8665
8666 !! test
8667 Parsoid link trail escaping
8668 !! options
8669 parsoid=html2wt,html2html
8670 !! html/parsoid
8671 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8672 !! wikitext
8673 [[apple]]<nowiki/>s
8674 !! end
8675
8676 !! test
8677 Parsoid link prefix escaping
8678 !! options
8679 language=is
8680 parsoid=html2wt,html2html
8681 !! html/parsoid
8682 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8683 !! wikitext
8684 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8685 !! end
8686
8687 !! test
8688 Parsoid link bracket escaping
8689 !! options
8690 parsoid=html2wt,html2html
8691 !! html/parsoid
8692 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8693 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8694 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8695 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8696 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8697 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8698 !! wikitext
8699 [[Test]]
8700
8701 [<nowiki/>[[Test]]]
8702
8703 [[[[Test]]]]
8704
8705 [[[<nowiki/>[[Test]]]]]
8706
8707 [[[[[[Test]]]]]]
8708
8709 [[[[[<nowiki/>[[Test]]]]]]]
8710 !! end
8711
8712 !! test
8713 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8714 !! wikitext
8715 [[Foo| bar]]
8716
8717 [[Foo| ''bar'']]
8718
8719 [http://wp.org foo]
8720
8721 [http://wp.org ''foo'']
8722 !! html
8723 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8724 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8725 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8726 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8727 </p>
8728 !! end
8729
8730 !! test
8731 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8732 !! wikitext
8733 [[Foo|{{echo|a}} b {{echo|c}}]]
8734 !! html/parsoid
8735 <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>
8736 !! end
8737
8738 !! test
8739 Link with angle bracket after anchor
8740 !! config
8741 wgFragmentMode=[ 'html5', 'legacy' ]
8742 !! wikitext
8743 [[Foo#<bar>]]
8744 !! html/php
8745 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8746 </p>
8747 !! html/parsoid
8748 <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>
8749 !! end
8750
8751 !! test
8752 Link with angle bracket after anchor (legacy)
8753 !! config
8754 wgFragmentMode=[ 'legacy' ]
8755 !! wikitext
8756 [[Foo#<bar>]]
8757 !! html/php
8758 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8759 </p>
8760 !! end
8761
8762 ###
8763 ### Interwiki links (see maintenance/interwiki.sql)
8764 ###
8765
8766 !! test
8767 Inline interwiki link
8768 !! options
8769 parsoid=wt2html,wt2wt,html2html
8770 !! wikitext
8771 [[MeatBall:SoftSecurity]]
8772 !! html/php
8773 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8774 </p>
8775 !! html/parsoid
8776 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8777 !! end
8778
8779 !! test
8780 Inline interwiki link with empty title (T4372)
8781 !! options
8782 parsoid=wt2html,wt2wt,html2html
8783 !! wikitext
8784 [[MeatBall:]]
8785 !! html/php
8786 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8787 </p>
8788 !! html/parsoid
8789 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8790 !! end
8791
8792 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8793 !! test
8794 Interwiki link encoding conversion (T3636)
8795 !! options
8796 parsoid=wt2html,wt2wt
8797 !! wikitext
8798 *[[Wikipedia:ro:Olteni&#0355;a]]
8799 *[[Wikipedia:ro:Olteni&#355;a]]
8800 !! html/php
8801 <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>
8802 <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>
8803
8804 !! html/php+tidy
8805 <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>
8806 <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>
8807 !! html/parsoid
8808 <ul>
8809 <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>
8810 <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>
8811 </ul>
8812 !! end
8813
8814 !! test
8815 Interwiki link with fragment (T4130)
8816 !! wikitext
8817 [[MeatBall:SoftSecurity#foo]]
8818 !! html
8819 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8820 </p>
8821 !! end
8822
8823 !! test
8824 Link scenarios with escaped fragments
8825 !! config
8826 wgFragmentMode=[ 'html5', 'legacy' ]
8827 !! wikitext
8828 [[#Is this great?]]
8829 [[Foo#Is this great?]]
8830 [[meatball:Foo#Is this great?]]
8831 !! html/php
8832 <p><a href="#Is_this_great?">#Is this great?</a>
8833 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8834 <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>
8835 </p>
8836 !! html/parsoid
8837 <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>
8838 <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>
8839 <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>
8840 !! end
8841
8842 !! test
8843 Link scenarios with escaped fragments (legacy)
8844 !! config
8845 wgFragmentMode=[ 'legacy' ]
8846 !! wikitext
8847 [[#Is this great?]]
8848 [[Foo#Is this great?]]
8849 [[meatball:Foo#Is this great?]]
8850 !! html/php
8851 <p><a href="#Is_this_great.3F">#Is this great?</a>
8852 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8853 <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>
8854 </p>
8855 !! end
8856
8857 # Ideally the wikipedia: prefix here should be proto-relative too
8858 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8859 # define the 'en' prefix, and originally the test used 'wikipedia',
8860 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8861 # article.
8862 !! test
8863 Different interwiki prefixes mapping to the same URL
8864 !! wikitext
8865 [[:en:Foo]]
8866
8867 [[:en:Foo|Foo]]
8868
8869 [[wikipedia:Foo]]
8870
8871 [[:wikipedia:Foo|Foo]]
8872
8873 [[wikipedia:en:Foo]]
8874
8875 [[:wikipedia:en:Foo]]
8876
8877 [[ wikiPEdia :Foo]]
8878 !! html/parsoid
8879 <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>
8880
8881 <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>
8882
8883 <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>
8884
8885 <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>
8886
8887 <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>
8888
8889 <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>
8890
8891 <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>
8892 !! end
8893
8894 !! test
8895 Interwiki links that cannot be represented in wiki syntax
8896 !! wikitext
8897 [[meatball:ok]]
8898 [[meatball:ok#foo|ok with fragment]]
8899 [[meatball:ok_as_well?|ok ending with ? mark]]
8900 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8901 [http://de.wikipedia.org/wiki/#foo is just fragment]
8902
8903 !! html/php
8904 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8905 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8906 <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>
8907 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8908 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8909 </p>
8910 !! html/parsoid
8911 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8912 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8913 <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>
8914 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8915 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8916 !! end
8917
8918 !! test
8919 Interwiki links: trail
8920 !! wikitext
8921 [[wikipedia:Foo|Ba]]r
8922 !! html/php
8923 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8924 </p>
8925 !! html/parsoid
8926 <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>
8927 !! end
8928
8929 !! test
8930 Local interwiki link
8931 !! options
8932 parsoid=wt2html,wt2wt,html2html
8933 !! wikitext
8934 [[local:Template:Foo]]
8935 !! html/php
8936 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8937 </p>
8938 !! html/parsoid
8939 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8940 !! end
8941
8942 # Parsoid does not mark self-links, by design.
8943 !! test
8944 Local interwiki link: self-link to current page
8945 !! options
8946 title=[[Main Page]]
8947 parsoid=wt2html,wt2wt,html2html
8948 !! wikitext
8949 [[local:Main Page]]
8950 !! html/php
8951 <p><a class="mw-selflink selflink">local:Main Page</a>
8952 </p>
8953 !! html/parsoid
8954 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8955 !! end
8956
8957 !! test
8958 Local interwiki link: prefix only (T66167)
8959 !! options
8960 parsoid=wt2html,wt2wt,html2html
8961 !! wikitext
8962 [[local:]]
8963 !! html/php
8964 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8965 </p>
8966 !! html/parsoid
8967 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8968 !! end
8969
8970 !! test
8971 Local interwiki link: with additional interwiki prefix (T63357)
8972 !! options
8973 parsoid=wt2html,wt2wt,html2html
8974 !! wikitext
8975 [[local:meatball:Hello]]
8976 !! html/php
8977 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8978 </p>
8979 !! html/parsoid
8980 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8981 !! end
8982
8983 !! test
8984 Multiple local interwiki link prefixes
8985 !! wikitext
8986 [[local:local:local:local:mi:local:Foo]]
8987 !! options
8988 parsoid=wt2html,wt2wt,html2html
8989 !! html/php
8990 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8991 </p>
8992 !! html/parsoid
8993 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8994 !! end
8995
8996 !! test
8997 Interwiki link with percent encoded target
8998 !! wikitext
8999 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
9000 !! html/php
9001 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
9002 </p>
9003 !! html/parsoid
9004 <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>
9005 !! end
9006
9007 ###
9008 ### Interlanguage links
9009 ### Language links (so that searching for '### language' matches..)
9010 ###
9011
9012 !! test
9013 Interlanguage link
9014 !! wikitext
9015 Blah blah blah
9016 [[zh:Chinese]]
9017 !! html/php
9018 <p>Blah blah blah
9019 </p>
9020 !! html/parsoid
9021 <p>Blah blah blah</p>
9022 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9023 !! end
9024
9025 ## parsoid html2wt will lose the space variations
9026 !! test
9027 Interlanguage link with spacing
9028 !! options
9029 parsoid=wt2html,wt2wt,html2html
9030 !! wikitext
9031 Blah blah blah
9032 [[ zh : Chinese ]]
9033 !! html/php
9034 <p>Blah blah blah
9035 </p>
9036 !! html/parsoid
9037 <p>Blah blah blah</p>
9038 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9039 !! end
9040
9041 !! test
9042 Double interlanguage link
9043 !! wikitext
9044 Blah blah blah
9045 [[es:Spanish]]
9046 [[zh:Chinese]]
9047 !! html/php
9048 <p>Blah blah blah
9049 </p>
9050 !! html/parsoid
9051 <p>Blah blah blah</p>
9052 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9053 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9054 !! end
9055
9056 ## parsoid html2wt will lose the space variations
9057 !! test
9058 Interlanguage link variations
9059 !! options
9060 parsoid=wt2html,wt2wt,html2html
9061 !! wikitext
9062 Blah blah blah
9063 [[ es :Spanish]]
9064 [[ ZH :Chinese]]
9065 [[es:Foo_bar]]
9066 !! html/php
9067 <p>Blah blah blah
9068 </p>
9069 !! html/parsoid
9070 <p>Blah blah blah</p>
9071 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9072 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9073 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9074 !! end
9075
9076 !! test
9077 Escaping of interlanguage links (T129218, T156308)
9078 !! wikitext
9079 Blah blah blah
9080 [[:es:Spanish]]
9081 [[ : zh : Chinese ]]
9082 !! html/php
9083 <p>Blah blah blah
9084 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9085 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9086 </p>
9087 !! html/parsoid
9088 <p>Blah blah blah
9089 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9090 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9091 !! end
9092
9093 !! test
9094 Multiple colons escaping interlanguage links
9095 !! options
9096 parsoid=wt2html
9097 !! wikitext
9098 [[:es:Spanish]]
9099 [[::es:Spanish]]
9100 [[:::es:Spanish]]
9101 !! html/php
9102 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9103 [[::es:Spanish]]
9104 [[:::es:Spanish]]
9105 </p>
9106 !! html/parsoid
9107 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9108 [[::es:Spanish]]
9109 [[:::es:Spanish]]</p>
9110 !! end
9111
9112 ## parsoid html2wt will normalize the space to _
9113 !! test
9114 Space and question mark encoding in interlanguage links (T95473)
9115 !! options
9116 parsoid=wt2html,wt2wt,html2html
9117 !! wikitext
9118 Blah blah blah
9119 [[es:Foo bar?]]
9120 !! html/php
9121 <p>Blah blah blah
9122 </p>
9123 !! html/parsoid
9124 <p>Blah blah blah</p>
9125 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9126 !! end
9127
9128 !! test
9129 Interlanguage link, with prefix links
9130 !! options
9131 language=ln
9132 !! wikitext
9133 Blah blah blah
9134 [[zh:Chinese]]
9135 !! html/php
9136 <p>Blah blah blah
9137 </p>
9138 !! html/parsoid
9139 <p>Blah blah blah</p>
9140 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9141 !! end
9142
9143 !! test
9144 Double interlanguage link, with prefix links (T10897)
9145 !! options
9146 language=ln
9147 !! wikitext
9148 Blah blah blah
9149 [[es:Spanish]]
9150 [[zh:Chinese]]
9151 !! html/php
9152 <p>Blah blah blah
9153 </p>
9154 !! html/parsoid
9155 <p>Blah blah blah</p>
9156 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9157 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9158 !! end
9159
9160 !! test
9161 "Extra" interlanguage links (T34189 / gerrit 111390)
9162 !! wikitext
9163 Blah blah blah
9164 [[mul:Article]]
9165 !! html/php
9166 <p>Blah blah blah
9167 </p>
9168 !! html/parsoid
9169 <p>Blah blah blah</p>
9170 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9171 !! end
9172
9173 ## PHP parser tests script needs an update
9174 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9175 !! test
9176 Language links render as inline links if $wgInterwikiMagic=false
9177 !! options
9178 wgInterwikiMagic=false
9179 parsoid=wt2html,wt2wt,html2html
9180 !! wikitext
9181 Blah blah blah
9182 [[zh:Chinese]]
9183 !! html/parsoid
9184 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9185 !! end
9186
9187 ## PHP parser tests script needs an update
9188 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9189 !! test
9190 Language links render as inline links in the Talk namespace
9191 !! options
9192 title=Talk:Foo
9193 parsoid=wt2html,wt2wt,html2html
9194 !! wikitext
9195 Blah blah blah
9196 [[zh:Chinese]]
9197 !! html/parsoid
9198 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9199 !! end
9200
9201 !! test
9202 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9203 !! options
9204 language=ln
9205 !! wikitext
9206 [[WW&nbsp;II]]
9207 !! html
9208 <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>
9209 </p>
9210 !! end
9211
9212 !! test
9213 Parsoid T55221: Wikilinks should be properly entity-escaped
9214 !! options
9215 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9216 !! html/parsoid
9217 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9218 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9219 !! wikitext
9220 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9221
9222 He&amp;nbsp;llo He&amp;nbsp;llo
9223 !! html/php
9224 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9225 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9226 </p>
9227 !! end
9228
9229 # html2wt will fail because of title normalization without data-parsoid
9230 !! test
9231 Parsoid: handle constructor well
9232 !! options
9233 parsoid=wt2html,wt2wt
9234 !! wikitext
9235 [[constructor]]
9236
9237 [[constructor:foo]]
9238 !! html/php
9239 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9240 </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>
9241 </p>
9242 !! html/parsoid
9243 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9244
9245 <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>
9246 !! end
9247
9248 !! test
9249 Template parameter named "constructor"
9250 !! wikitext
9251 {{echo| constructor = |hi}}
9252 !! html/parsoid
9253 <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>
9254 !! end
9255
9256 !! article
9257 ko:
9258 !! text
9259 Test.
9260 !! endarticle
9261
9262 # Note that `ko` isn't a known interlanguage prefix
9263 !! test
9264 Parsoid: recognize interlanguage links without a target page
9265 !! options
9266 ill
9267 !! wikitext
9268 [[es:]]
9269
9270 [[ko:]]
9271 !! html/php
9272 es:
9273 !! html/parsoid
9274 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9275
9276 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9277 !! end
9278
9279 # Note that `ko` isn't a known interwiki prefix
9280 !! test
9281 Parsoid: recognize interwiki links without a target page
9282 !! options
9283 parsoid=wt2html,wt2wt,html2html
9284 !! wikitext
9285 [[:es:]]
9286
9287 [[:ko:]]
9288 !! html/php
9289 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9290 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9291 </p>
9292 !! html/parsoid
9293 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9294 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9295 !! end
9296
9297 !! test
9298 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9299 !! wikitext
9300 [[mi:Foo]]
9301 !! html/php
9302 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9303 </p>
9304 !! html/parsoid
9305 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9306 !! end
9307
9308 !! test
9309 Interlanguage link with preceding local interwiki link (T70085)
9310 !! options
9311 parsoid=wt2html,wt2wt,html2html
9312 !! wikitext
9313 Blah blah blah
9314 [[local:es:Spanish]]
9315 !! html/php
9316 <p>Blah blah blah
9317 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9318 </p>
9319 !! html/parsoid
9320 <p>Blah blah blah
9321 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9322 !! end
9323
9324 !! test
9325 Looks like an interlanguage link, but is actually a local interwiki
9326 !! options
9327 parsoid=wt2html,wt2wt,html2html
9328 !! wikitext
9329 Blah blah blah
9330 [[mi:Template:Foo]]
9331 !! html/php
9332 <p>Blah blah blah
9333 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9334 </p>
9335 !! html/parsoid
9336 <p>Blah blah blah
9337 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9338 !! end
9339
9340 ###
9341 ### Redirects, Parsoid-only
9342 ###
9343
9344 !! test
9345 1. Simple redirect to page
9346 !! wikitext
9347 #REDIRECT [[Main Page]]
9348 !! html/parsoid
9349 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9350 !! end
9351
9352 !! test
9353 2. Other redirect variants
9354 !! wikitext
9355 #REDIRECT [[Main_Page]]
9356 !! html/parsoid
9357 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9358 !! end
9359
9360 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9361 # This tests the Parsoid bail-out code.
9362 !! test
9363 3. Other redirect variants
9364 !! options
9365 parsoid=wt2html
9366 !! wikitext
9367 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9368 !! html/parsoid
9369 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9370 !! end
9371
9372 !! test
9373 4. Redirect to a templated destination
9374 !! wikitext
9375 #REDIRECT [[{{echo|Foo}}bar]]
9376 !! html/parsoid
9377 <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"}]]}'/>
9378 !! end
9379
9380 !! test
9381 Empty redirect
9382 !! options
9383 parsoid=wt2html,wt2wt
9384 !! wikitext
9385 #REDIRECT [[]]
9386 !! html/parsoid
9387 <ol>
9388 <li>REDIRECT [[]]</li></ol>
9389 !! end
9390
9391 !! test
9392 Optional colon in #REDIRECT
9393 !! options
9394 # the colon is archaic syntax. we support it for wt2html, but we
9395 # don't care that it roundtrips back to the modern syntax.
9396 parsoid=wt2html,html2html
9397 !! wikitext
9398 #REDIRECT:[[Main Page]]
9399 !! html/parsoid
9400 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9401 !! end
9402
9403 !! test
9404 Whitespace in #REDIRECT with optional colon
9405 !! options
9406 # the colon and gratuitous whitespace is archaic syntax. we support
9407 # it for wt2html, but we don't care that it roundtrips back to the
9408 # modern syntax (without extra whitespace)
9409 parsoid=wt2html,html2html
9410 !! wikitext
9411
9412 #REDIRECT
9413 :
9414 [[Main Page]]
9415 !! html/parsoid
9416 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9417 !! end
9418
9419 !! test
9420 Piped link in #REDIRECT
9421 !! options
9422 # content after piped link is ignored. we support this syntax,
9423 # but don't care that the piped link is lost when we roundtrip this.
9424 parsoid=wt2html
9425 !! wikitext
9426 #REDIRECT [[Main Page|bar]]
9427 !! html/parsoid
9428 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9429 !! end
9430
9431 !! test
9432 Redirect to category (T104502)
9433 !! options
9434 parsoid=wt2html,wt2wt
9435 !! wikitext
9436 #REDIRECT [[Category:Foo]]
9437 !! html/parsoid
9438 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9439 !! end
9440
9441 !! test
9442 Redirect to category with URL encoding (T104502)
9443 !! options
9444 parsoid=wt2html
9445 !! wikitext
9446 #REDIRECT [[Category%3AFoo]]
9447 !! html/parsoid
9448 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9449 !! end
9450
9451 !! test
9452 Redirect to category page
9453 !! wikitext
9454 #REDIRECT [[:Category:Foo]]
9455 !! html/parsoid
9456 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9457 !! end
9458
9459 !! test
9460 Redirect to image page (1)
9461 !! wikitext
9462 #REDIRECT [[File:Wiki.png]]
9463 !! html/parsoid
9464 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9465 !! end
9466
9467 !! test
9468 Redirect to image page (2)
9469 !! wikitext
9470 #REDIRECT [[Image:Wiki.png]]
9471 !! html/parsoid
9472 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9473 !! end
9474
9475 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9476 # Next test confirms this.
9477 !! test
9478 Redirect to language (1) (T104918)
9479 !! options
9480 parsoid=wt2html,wt2wt,html2html
9481 !! wikitext
9482 #REDIRECT [[en:File:Wiki.png]]
9483 !! html/parsoid
9484 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9485 !! end
9486
9487 !! test
9488 Redirect to language (2) (T104918)
9489 !! wikitext
9490 #REDIRECT [[:en:File:Wiki.png]]
9491 !! html/parsoid
9492 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9493 !! end
9494
9495 !! test
9496 Redirect to interwiki (T104918)
9497 !! wikitext
9498 #REDIRECT [[meatball:File:Wiki.png]]
9499 !! html/parsoid
9500 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9501 !! end
9502
9503 !! test
9504 Non-English #REDIRECT
9505 !! options
9506 language=is
9507 !! wikitext
9508 #TILVÍSUN [[Main Page]]
9509 !! html/parsoid
9510 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9511 !! end
9512
9513 !! test
9514 Redirect syntax under text isn't considered a redirect
9515 !! wikitext
9516 some text
9517
9518 #redirect [[Main Page]]
9519 !! html/parsoid
9520 <p>some text</p>
9521 <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>
9522 !! end
9523
9524 !! test
9525 New redirect
9526 !! options
9527 parsoid=html2wt
9528 !! html/parsoid
9529 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9530 !! wikitext
9531 #REDIRECT [[Foo]]
9532 Foo
9533 !! end
9534
9535 !! test
9536 Redirect followed by block on the same line
9537 !! options
9538 parsoid=wt2html
9539 !! wikitext
9540 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9541 !! html/parsoid
9542 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9543 !! end
9544
9545 !! test
9546 Redirect followed by a newline
9547 !! wikitext
9548 #REDIRECT [[Main Page]]
9549 A newline
9550 !! html/parsoid
9551 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9552 <p>A newline</p>
9553 !! end
9554
9555 !! test
9556 Redirect followed by multiple newlines
9557 !! wikitext
9558 #REDIRECT [[Main Page]]
9559
9560
9561 A newline
9562 !! html/parsoid
9563 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9564
9565 <p><br/>
9566 A newline</p>
9567 !! end
9568
9569 !! test
9570 Drop duplicate redirects
9571 !! options
9572 parsoid=html2wt
9573 !! html/parsoid
9574 <link rel="mw:PageProp/redirect" href="./Foo"/>
9575 <link rel="mw:PageProp/redirect" href="./Bar"/>
9576 <link rel="mw:PageProp/redirect" href="./Baz"/>
9577 !! wikitext
9578 #REDIRECT [[Foo]]
9579 !! end
9580
9581 ##
9582 ## XHTML tidiness
9583 ###
9584
9585 !! test
9586 <br> to <br />
9587 !! wikitext
9588 1<br>2<br />3
9589 !! html
9590 <p>1<br />2<br />3
9591 </p>
9592 !! end
9593
9594 !! test
9595 Broken br tag sanitization
9596 !! wikitext
9597 </br>
9598 !! html/php
9599 <p>&lt;/br&gt;
9600 </p>
9601 !! end
9602
9603 # TODO: Fix html2html mode (T53055)!
9604 !! test
9605 Parsoid: Broken br tag recognition
9606 !! options
9607 parsoid=wt2html
9608 !! wikitext
9609 </br>
9610
9611 <br/ >
9612 !! html+tidy
9613 <p><br />
9614 </p><p><br />
9615 </p>
9616 !! end
9617
9618 !! test
9619 Incorrecly removing closing slashes from correctly formed XHTML
9620 !! wikitext
9621 <br style="clear:both;" />
9622 !! html
9623 <p><br style="clear:both;" />
9624 </p>
9625 !! end
9626
9627 !! test
9628 Failing to transform badly formed HTML into correct XHTML
9629 !! wikitext
9630 <br style="clear: left;">
9631 <br style="clear: right;">
9632 <br style="clear: both;">
9633 !! html
9634 <p><br style="clear: left;" />
9635 <br style="clear: right;" />
9636 <br style="clear: both;" />
9637 </p>
9638 !!end
9639
9640 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9641 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9642 !! test
9643 Handling html with a div self-closing tag
9644 !! wikitext
9645 <div title />
9646 <div title/>
9647 <div title/ >
9648 <div title=bar />
9649 <div title=bar/>
9650 <div title=bar/ >
9651 !! html/php
9652 <p>&lt;div title /&gt;
9653 &lt;div title/&gt;
9654 </p>
9655 <div>
9656 <p>&lt;div title=bar /&gt;
9657 &lt;div title=bar/&gt;
9658 </p>
9659 <div title="bar/"></div>
9660 </div>
9661
9662 !! html/parsoid
9663 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9664 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9665 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9666 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9667 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9668 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9669 !! end
9670
9671 !! test
9672 Elements with solidus in various attribute positions
9673 !! options
9674 parsoid=wt2html,html2html
9675 !! wikitext
9676 <div cla/ss="123">ha</div>
9677
9678 <div / class="123">ha</div>
9679
9680 <div class= / "123">ha</div>
9681 !! html/php+tidy
9682 <div>ha</div>
9683 <div class="123">ha</div>
9684 <div class="/">ha</div>
9685 !! html/parsoid
9686 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9687
9688 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9689
9690 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9691 !! end
9692
9693 !! test
9694 Handling html with a br self-closing tag
9695 !! wikitext
9696 <br title />
9697 <br title/>
9698 <br title/ >
9699 <br title=bar />
9700 <br title=bar/>
9701 <br title=bar/ >
9702 !! html/php
9703 <p><br title="" />
9704 <br title="" />
9705 <br />
9706 <br title="bar" />
9707 <br title="bar" />
9708 <br title="bar/" />
9709 </p>
9710 !! html/parsoid
9711 <p><br title="" />
9712 <br title="" />
9713 <br title="" />
9714 <br title="bar" />
9715 <br title="bar" />
9716 <br title="bar/" />
9717 </p>
9718 !! end
9719
9720 !! test
9721 Horizontal ruler (should it add that extra space?)
9722 !! wikitext
9723 <hr>
9724 <hr >
9725 foo <hr
9726 > bar
9727 !! html+tidy
9728 <hr />
9729 <hr /><p>
9730 foo </p><hr /><p> bar
9731 </p>
9732 !! end
9733
9734 !! test
9735 Horizontal ruler -- 4+ dashes render hr
9736 !! wikitext
9737 ----
9738 !! html
9739 <hr />
9740
9741 !! end
9742
9743 !! test
9744 Horizontal ruler -- eats additional dashes on the same line
9745 !! wikitext
9746 ---------
9747 !! html
9748 <hr />
9749
9750 !! end
9751
9752 !! test
9753 Horizontal ruler -- does not collapse dashes on consecutive lines
9754 !! wikitext
9755 ----
9756 ----
9757 !! html
9758 <hr />
9759 <hr />
9760
9761 !! end
9762
9763 !! test
9764 Horizontal ruler -- <4 dashes render as plain text
9765 !! wikitext
9766 ---
9767 !! html
9768 <p>---
9769 </p>
9770 !! end
9771
9772 !! test
9773 Horizontal ruler -- Supports content following dashes on same line
9774 !! wikitext
9775 ---- Foo
9776 !! html
9777 <hr /> Foo
9778
9779 !! html+tidy
9780 <hr /><p> Foo
9781 </p>
9782 !! end
9783
9784 ###
9785 ### Block-level elements
9786 ###
9787 !! test
9788 Common list
9789 !! wikitext
9790 *Common list
9791 *item 2
9792 *item 3
9793 !! html
9794 <ul><li>Common list</li>
9795 <li>item 2</li>
9796 <li>item 3</li></ul>
9797
9798 !! end
9799
9800 !! test
9801 Numbered list
9802 !! wikitext
9803 #Numbered list
9804 #item 2
9805 #item 3
9806 !! html
9807 <ol><li>Numbered list</li>
9808 <li>item 2</li>
9809 <li>item 3</li></ol>
9810
9811 !! end
9812
9813 # the switch from level 3 to ordered should not introduce a newline between
9814 !! test
9815 Mixed list
9816 !! wikitext
9817 *Mixed list
9818 *#with numbers
9819 **and bullets
9820 *#and numbers
9821 *bullets again
9822 **bullet level 2
9823 ***bullet level 3
9824 ***#Number on level 4
9825 **bullet level 2
9826 **#Number on level 3
9827 **#Number on level 3
9828 *#number level 2
9829 *Level 1
9830 ***Level 3
9831 #**Level 3, but ordered
9832 !! html
9833 <ul><li>Mixed list
9834 <ol><li>with numbers</li></ol>
9835 <ul><li>and bullets</li></ul>
9836 <ol><li>and numbers</li></ol></li>
9837 <li>bullets again
9838 <ul><li>bullet level 2
9839 <ul><li>bullet level 3
9840 <ol><li>Number on level 4</li></ol></li></ul></li>
9841 <li>bullet level 2
9842 <ol><li>Number on level 3</li>
9843 <li>Number on level 3</li></ol></li></ul>
9844 <ol><li>number level 2</li></ol></li>
9845 <li>Level 1
9846 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9847 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9848
9849 !! end
9850
9851 !! test
9852 1. Nested mixed wikitext and html list
9853 !! wikitext
9854 *hi
9855 *<ul><li>ho</li></ul>
9856 *hi
9857 **ho
9858 !! html/php
9859 <ul><li>hi</li>
9860 <li><ul><li>ho</li></ul></li>
9861 <li>hi
9862 <ul><li>ho</li></ul></li></ul>
9863
9864 !! html/parsoid
9865 <ul><li>hi</li>
9866 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9867 <li>hi
9868 <ul><li>ho</li></ul></li></ul>
9869 !! end
9870
9871 !! test
9872 2. Nested mixed wikitext and html list (incompatible)
9873 !! wikitext
9874 ;hi
9875 :{{echo|<li>ho</li>}}
9876 !! html/php
9877 <dl><dt>hi</dt>
9878 <dd><li>ho</li></dd></dl>
9879
9880 !! html/parsoid
9881 <dl><dt>hi</dt>
9882 <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>
9883 !! end
9884
9885 !! test
9886 Nested lists 1
9887 !! wikitext
9888 *foo
9889 **bar
9890 !! html
9891 <ul><li>foo
9892 <ul><li>bar</li></ul></li></ul>
9893
9894 !! end
9895
9896 !! test
9897 Nested lists 2
9898 !! wikitext
9899 **foo
9900 *bar
9901 !! html
9902 <ul><li><ul><li>foo</li></ul></li>
9903 <li>bar</li></ul>
9904
9905 !! end
9906
9907 !! test
9908 Nested lists 3 (first element empty)
9909 !! wikitext
9910 *
9911 **bar
9912 !! html
9913 <ul><li>
9914 <ul><li>bar</li></ul></li></ul>
9915
9916 !! end
9917
9918 !! test
9919 Nested lists 4 (first element empty)
9920 !! wikitext
9921 **
9922 *bar
9923 !! html
9924 <ul><li><ul><li></li></ul></li>
9925 <li>bar</li></ul>
9926
9927 !! end
9928
9929 !! test
9930 Nested lists 5 (both elements empty)
9931 !! wikitext
9932 **
9933 *
9934 !! html
9935 <ul><li><ul><li></li></ul></li>
9936 <li></li></ul>
9937
9938 !! end
9939
9940 !! test
9941 Nested lists 6 (both elements empty)
9942 !! wikitext
9943 *
9944 **
9945 !! html
9946 <ul><li>
9947 <ul><li></li></ul></li></ul>
9948
9949 !! end
9950
9951 !! test
9952 Nested lists 7 (skip initial nesting levels)
9953 !! wikitext
9954 ***foo
9955 !! html
9956 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9957
9958 !! end
9959
9960 !! test
9961 Nested lists 8 (multiple nesting transitions)
9962 !! wikitext
9963 *foo
9964 ***bar
9965 **baz
9966 *boo
9967 !! html
9968 <ul><li>foo
9969 <ul><li><ul><li>bar</li></ul></li>
9970 <li>baz</li></ul></li>
9971 <li>boo</li></ul>
9972
9973 !! end
9974
9975 # XXX this test should be moved to citeParserTests, since it depends
9976 # on the Cite extension, which is "built in" to Parsoid.
9977 !! test
9978 Nested lists 9 (extension interaction)
9979 !! wikitext
9980 *<references />
9981 !! html/php+tidy-DISABLED
9982 <ul><li class="mw-empty-elt"></li></ul>
9983 !! html/parsoid
9984 <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>
9985 !! end
9986
9987 !! test
9988 1. Lists with start-of-line-transparent tokens before bullets: Comments
9989 !! wikitext
9990 *foo
9991 *<!--cmt-->bar
9992 <!--cmt-->*baz
9993 !! html
9994 <ul><li>foo</li>
9995 <li>bar</li>
9996 <li>baz</li></ul>
9997
9998 !! end
9999
10000 !! test
10001 Nested lists 10 (list and span siblings: wt2wt regression)
10002 !! wikitext
10003 *a <span>x</span>
10004 **b <span>y</span>
10005 !! html/parsoid
10006 <ul><li>a <span>x</span>
10007 <ul><li>b <span>y</span></li></ul></li></ul>
10008 !! end
10009
10010 !! test
10011 2. Lists with start-of-line-transparent tokens before bullets: Template close
10012 !! wikitext
10013 *foo {{echo|bar
10014 }}*baz
10015 !! html
10016 <ul><li>foo bar</li>
10017 <li>baz</li></ul>
10018
10019 !! end
10020
10021 !! test
10022 List items are not parsed correctly following a <pre> block (T2785)
10023 !! wikitext
10024 *<pre>foo</pre>
10025 *<pre>bar</pre>
10026 *zar
10027 !! html/php
10028 <ul><li><pre>foo</pre></li>
10029 <li><pre>bar</pre></li>
10030 <li>zar</li></ul>
10031
10032 !! html/parsoid
10033 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
10034 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
10035 <li>zar</li></ul>
10036 !! end
10037
10038 # FIXME: Might benefit from a html/parsoid since this has a template
10039 !! test
10040 List items from template
10041 !! wikitext
10042
10043 {{inner list}}
10044 *item 2
10045
10046 *item 0
10047 {{inner list}}
10048 *item 2
10049
10050 *item 0
10051 *notSOL{{inner list}}
10052 *item 2
10053 !! html
10054 <ul><li>item 1</li>
10055 <li>item 2</li></ul>
10056 <ul><li>item 0</li>
10057 <li>item 1</li>
10058 <li>item 2</li></ul>
10059 <ul><li>item 0</li>
10060 <li>notSOL</li>
10061 <li>item 1</li>
10062 <li>item 2</li></ul>
10063
10064 !! end
10065
10066 !! test
10067 List interrupted by empty line or heading
10068 !! wikitext
10069 *foo
10070
10071 **bar
10072 ==A heading==
10073 *Another list item
10074 !! html
10075 <ul><li>foo</li></ul>
10076 <ul><li><ul><li>bar</li></ul></li></ul>
10077 <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>
10078 <ul><li>Another list item</li></ul>
10079
10080 !!end
10081
10082 !! test
10083 Multiple list tags generated by templates
10084 !! wikitext
10085 {{echo|<li>}}a
10086 {{echo|<li>}}b
10087 {{echo|<li>}}c
10088 !! html
10089 <li>a
10090 <li>b
10091 <li>c</li>
10092 </li>
10093 </li>
10094
10095
10096 !! html+tidy
10097 <li>a
10098 </li><li>b
10099 </li><li>c
10100 </li>
10101 !! html/parsoid
10102 <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>
10103 <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>
10104 <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>
10105 !! end
10106
10107 !! test
10108 Multiple newlines in between HTML list items don't induce paragraph wrapping
10109 !! wikitext
10110 <ul>
10111 <li>hi</li>
10112
10113
10114
10115
10116 <li>ho</li>
10117 </ul>
10118
10119 <dl>
10120 <dt>hi</dt>
10121 <dd>ho<div>123</div>
10122 </dd>
10123
10124
10125 </dl>
10126 !! html/php+tidy
10127 <ul>
10128 <li>hi</li>
10129
10130
10131
10132
10133 <li>ho</li>
10134 </ul>
10135 <dl>
10136 <dt>hi</dt>
10137 <dd>ho<div>123</div>
10138 </dd>
10139
10140
10141 </dl>
10142 !! end
10143
10144 !!test
10145 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10146 !! wikitext
10147 *a
10148 <!--This line will NOT split the list-->
10149 *b
10150 <!--This line will NOT split the list either-->
10151 *c
10152 <!--foo--> <!----> <!--This line NOT split the list either-->
10153 *d
10154 !! html
10155 <ul><li>a</li>
10156 <li>b</li>
10157 <li>c</li>
10158 <li>d</li></ul>
10159
10160 !!end
10161
10162 !!test
10163 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10164 !! wikitext
10165 *a
10166 <!--This line will NOT split the list-->
10167 *b
10168 <!--This line will NOT split the list either-->
10169 *c
10170 <!--foo--> <!----> <!--This line NOT split the list
10171 either-->
10172 *d
10173 !! html
10174 <ul><li>a</li>
10175 <li>b</li>
10176 <li>c</li>
10177 <li>d</li></ul>
10178
10179 !!end
10180
10181 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10182 # That pass could possibly be removed.
10183 !!test
10184 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10185 !!options
10186 parsoid=wt2html,wt2wt
10187 !! wikitext
10188 *foo
10189 *<li>li-hack
10190 *{{echo|<li>templated li-hack}}
10191 *<!--foo--><li> unsupported li-hack with preceding comments
10192
10193 <ul>
10194 <li><li>not a li-hack
10195 </li>
10196 </ul>
10197 !! html+tidy
10198 <ul><li>foo</li>
10199 <li class="mw-empty-elt"></li><li>li-hack</li>
10200 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10201 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10202 <ul>
10203 <li class="mw-empty-elt"></li><li>not a li-hack
10204 </li>
10205 </ul>
10206 !! html/parsoid
10207 <ul><li> foo</li>
10208 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10209 <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>
10210 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10211
10212 <ul data-parsoid='{"stx":"html"}'>
10213 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10214 </li>
10215 </ul>
10216
10217 !!end
10218
10219 !! test
10220 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10221 !! wikitext
10222 #foo
10223 ##bar
10224
10225 *foo
10226 **bar
10227
10228 :foo
10229 ::bar
10230 !! html/php+tidy
10231 <ol><li>foo
10232 <ol><li>bar</li></ol></li></ol>
10233 <ul><li>foo
10234 <ul><li>bar</li></ul></li></ul>
10235 <dl><dd>foo
10236 <dl><dd>bar</dd></dl></dd></dl>
10237 !! html/parsoid
10238 <ol>
10239 <li>foo<ol>
10240 <li>bar</li>
10241 </ol></li>
10242 </ol><ul>
10243 <li>foo<ul>
10244 <li>bar</li>
10245 </ul></li>
10246 </ul><dl>
10247 <dd>foo<dl>
10248 <dd>bar</dd>
10249 </dl></dd>
10250 </dl>
10251 !! end
10252
10253 !! test
10254 Parsoid: Test of whitespace serialization with Templated bullets
10255 !! options
10256 parsoid=wt2html
10257 !! wikitext
10258 * {{bullet}}
10259 !! html/parsoid
10260 <ul>
10261 <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>
10262 </ul>
10263 !! end
10264
10265 # ------------------------------------------------------------------------
10266 # The next set of tests are about Parsoid's ability to handle badly nested
10267 # tags (parse, minimize scope of fixup, and roundtrip back)
10268 # ------------------------------------------------------------------------
10269
10270 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10271 # Parsoid's list handling is more aware of block structure.
10272 !! test
10273 Unbalanced closing block tags break a list
10274 !! wikitext
10275 <div>
10276 *a</div><div>
10277 *b</div>
10278 !! html+tidy
10279 <div>
10280 <ul><li>a</li></ul></div><div>
10281 <li>b</li></div>
10282 !! html/parsoid
10283 <div><ul>
10284 <li>a</li>
10285 </ul></div>
10286 <div><ul>
10287 <li>b</li>
10288 </ul></div>
10289 !! end
10290
10291 !! test
10292 Unbalanced closing non-block tags don't break a list
10293 !! options
10294 parsoid=wt2html,html2html
10295 !! wikitext
10296 <span>
10297 *a</span><span>
10298 *b</span>
10299 !! html/php+tidy
10300 <p><span>
10301 </span></p>
10302 <ul><li>a<span></span></li>
10303 <li>b</li></ul>
10304 !! html/parsoid
10305 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10306 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10307 <li>b</li></ul>
10308 !! end
10309
10310 # Parsoid does some post-dom-building cleanup
10311 # which is why its output differs from Remex.
10312 !! test
10313 Unclosed formatting tags that straddle lists are closed and reopened
10314 !! options
10315 parsoid=wt2html,wt2wt,html2html
10316 !! wikitext
10317 #<s> a
10318 #b </s>
10319 !! html/php+tidy
10320 <ol><li><s> a</s></li><s>
10321 </s><li><s>b </s></li></ol>
10322 !! html/parsoid
10323 <ol><li><s> a</s></li>
10324 <li><s>b </s></li></ol>
10325 !! end
10326
10327 # Output is ugly because of all the misnested tag fixups.
10328 !! test
10329 1. List embedded in a formatting tag
10330 !! wikitext
10331 <small>
10332 *foo
10333 </small>
10334 !! html/php+tidy
10335 <p><small>
10336 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10337 </p>
10338 !! html/parsoid
10339 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10340 <ul><li data-parsoid='{}'>foo</li></ul></small>
10341 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10342 !! end
10343
10344 # Output is ugly because of all the misnested tag fixups.
10345 !! test
10346 2. List embedded in a formatting tag in a misnested way
10347 !! wikitext
10348 <small>
10349 *a
10350 *b</small>
10351 !! html/php+tidy
10352 <p><small>
10353 </small></p><small></small><ul><small><li>a</li>
10354 </small><li><small>b</small></li></ul>
10355 !! html/parsoid
10356 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10357 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10358 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10359 !! end
10360
10361 # Output is ugly because of all the misnested tag fixups.
10362 !! test
10363 3. List embedded in a formatting tag in a misnested way
10364 !! wikitext
10365 <small>
10366
10367 ** 123</small>
10368 !! html/php+tidy
10369 <p><small>
10370 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10371 !! html/parsoid
10372 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10373
10374 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10375 !! end
10376
10377 ###
10378 ### Magic Words
10379 ###
10380
10381 # Note that the current date is hard-coded as
10382 # 1970-01-01T00:02:03Z (a Thursday)
10383 # when running parser tests. The timezone is also fixed to GMT, so
10384 # local date will be identical to current date.
10385
10386 !! test
10387 Magic Word: {{CURRENTDAY}}
10388 !! wikitext
10389 {{CURRENTDAY}}
10390 !! html
10391 <p>1
10392 </p>
10393 !! end
10394
10395 !! test
10396 Magic Word: {{CURRENTDAY2}}
10397 !! wikitext
10398 {{CURRENTDAY2}}
10399 !! html
10400 <p>01
10401 </p>
10402 !! end
10403
10404 !! test
10405 Magic Word: {{CURRENTDAYNAME}}
10406 !! wikitext
10407 {{CURRENTDAYNAME}}
10408 !! html
10409 <p>Thursday
10410 </p>
10411 !! end
10412
10413 !! test
10414 Magic Word: {{CURRENTDOW}}
10415 !! wikitext
10416 {{CURRENTDOW}}
10417 !! html
10418 <p>4
10419 </p>
10420 !! end
10421
10422 !! test
10423 Magic Word: {{CURRENTMONTH}}
10424 !! wikitext
10425 {{CURRENTMONTH}}
10426 !! html
10427 <p>01
10428 </p>
10429 !! end
10430
10431 !! test
10432 Magic Word: {{CURRENTMONTH1}}
10433 !! wikitext
10434 {{CURRENTMONTH1}}
10435 !! html
10436 <p>1
10437 </p>
10438 !! end
10439
10440 !! test
10441 Magic Word: {{CURRENTMONTHABBREV}}
10442 !! wikitext
10443 {{CURRENTMONTHABBREV}}
10444 !! html
10445 <p>Jan
10446 </p>
10447 !! end
10448
10449 !! test
10450 Magic Word: {{CURRENTMONTHNAME}}
10451 !! wikitext
10452 {{CURRENTMONTHNAME}}
10453 !! html
10454 <p>January
10455 </p>
10456 !! end
10457
10458 !! test
10459 Magic Word: {{CURRENTMONTHNAMEGEN}}
10460 !! wikitext
10461 {{CURRENTMONTHNAMEGEN}}
10462 !! html
10463 <p>January
10464 </p>
10465 !! end
10466
10467 !! test
10468 Magic Word: {{CURRENTTIME}}
10469 !! wikitext
10470 {{CURRENTTIME}}
10471 !! html
10472 <p>00:02
10473 </p>
10474 !! end
10475
10476 !! test
10477 Magic Word: {{CURRENTHOUR}}
10478 !! wikitext
10479 {{CURRENTHOUR}}
10480 !! html
10481 <p>00
10482 </p>
10483 !! end
10484
10485 !! test
10486 Magic Word: {{CURRENTWEEK}} (T6594)
10487 !! wikitext
10488 {{CURRENTWEEK}}
10489 !! html
10490 <p>1
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{CURRENTYEAR}}
10496 !! wikitext
10497 {{CURRENTYEAR}}
10498 !! html
10499 <p>1970
10500 </p>
10501 !! end
10502
10503 !! test
10504 Magic Word: {{CURRENTTIMESTAMP}}
10505 !! wikitext
10506 {{CURRENTTIMESTAMP}}
10507 !! html
10508 <p>19700101000203
10509 </p>
10510 !! end
10511
10512 !! test
10513 Magic Words LOCAL (UTC)
10514 !! wikitext
10515 *{{LOCALMONTH}}
10516 *{{LOCALMONTH1}}
10517 *{{LOCALMONTHNAME}}
10518 *{{LOCALMONTHNAMEGEN}}
10519 *{{LOCALMONTHABBREV}}
10520 *{{LOCALDAY}}
10521 *{{LOCALDAY2}}
10522 *{{LOCALDAYNAME}}
10523 *{{LOCALYEAR}}
10524 *{{LOCALTIME}}
10525 *{{LOCALHOUR}}
10526 *{{LOCALWEEK}}
10527 *{{LOCALDOW}}
10528 *{{LOCALTIMESTAMP}}
10529 !! html
10530 <ul><li>01</li>
10531 <li>1</li>
10532 <li>January</li>
10533 <li>January</li>
10534 <li>Jan</li>
10535 <li>1</li>
10536 <li>01</li>
10537 <li>Thursday</li>
10538 <li>1970</li>
10539 <li>00:02</li>
10540 <li>00</li>
10541 <li>1</li>
10542 <li>4</li>
10543 <li>19700101000203</li></ul>
10544
10545 !! end
10546
10547 !! test
10548 Magic Word: {{FULLPAGENAME}}
10549 !! options
10550 title=[[User:Ævar Arnfjörð Bjarmason]]
10551 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10552 !! wikitext
10553 {{FULLPAGENAME}}
10554 !! html/*
10555 <p>User:Ævar Arnfjörð Bjarmason
10556 </p>
10557 !! end
10558
10559 !! test
10560 Magic Word: {{FULLPAGENAMEE}}
10561 !! options
10562 title=[[User:Ævar Arnfjörð Bjarmason]]
10563 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10564 !! wikitext
10565 {{FULLPAGENAMEE}}
10566 !! html/*
10567 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10568 </p>
10569 !! end
10570
10571 !! test
10572 Magic Word: {{TALKSPACE}}
10573 !! options
10574 title=[[User:Ævar Arnfjörð Bjarmason]]
10575 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10576 !! wikitext
10577 {{TALKSPACE}}
10578 !! html/*
10579 <p>User talk
10580 </p>
10581 !! end
10582
10583 !! test
10584 Magic Word: {{TALKSPACE}}, same namespace
10585 !! options
10586 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10587 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10588 !! wikitext
10589 {{TALKSPACE}}
10590 !! html/*
10591 <p>User talk
10592 </p>
10593 !! end
10594
10595 !! test
10596 Magic Word: {{TALKSPACE}}, main namespace
10597 !! options
10598 title=[[Parser Test]]
10599 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10600 !! wikitext
10601 {{TALKSPACE}}
10602 !! html/*
10603 <p>Talk
10604 </p>
10605 !! end
10606
10607 !! test
10608 Magic Word: {{TALKSPACEE}}
10609 !! options
10610 title=[[User:Ævar Arnfjörð Bjarmason]]
10611 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10612 !! wikitext
10613 {{TALKSPACEE}}
10614 !! html/*
10615 <p>User_talk
10616 </p>
10617 !! end
10618
10619 !! test
10620 Magic Word: {{SUBJECTSPACE}}
10621 !! options
10622 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10623 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10624 !! wikitext
10625 {{SUBJECTSPACE}}
10626 !! html/*
10627 <p>User
10628 </p>
10629 !! end
10630
10631 !! test
10632 Magic Word: {{SUBJECTSPACE}}, same namespace
10633 !! options
10634 title=[[User:Ævar Arnfjörð Bjarmason]]
10635 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10636 !! wikitext
10637 {{SUBJECTSPACE}}
10638 !! html/*
10639 <p>User
10640 </p>
10641 !! end
10642
10643 !! test
10644 Magic Word: {{SUBJECTSPACE}}, main namespace
10645 !! options
10646 title=[[Parser Test]]
10647 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10648 !! wikitext
10649 {{SUBJECTSPACE}}
10650 !! html/*
10651
10652 !! end
10653
10654 !! test
10655 Magic Word: {{SUBJECTSPACEE}}
10656 !! options
10657 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10658 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10659 !! wikitext
10660 {{SUBJECTSPACEE}}
10661 !! html/*
10662 <p>User
10663 </p>
10664 !! end
10665
10666 !! test
10667 Magic Word: {{NAMESPACE}}
10668 !! options
10669 title=[[User:Ævar Arnfjörð Bjarmason]]
10670 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10671 !! wikitext
10672 {{NAMESPACE}}
10673 !! html/*
10674 <p>User
10675 </p>
10676 !! end
10677
10678 !! test
10679 Magic Word: {{NAMESPACEE}}
10680 !! options
10681 title=[[User:Ævar Arnfjörð Bjarmason]]
10682 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10683 !! wikitext
10684 {{NAMESPACEE}}
10685 !! html/*
10686 <p>User
10687 </p>
10688 !! end
10689
10690 !! test
10691 Magic Word: {{NAMESPACENUMBER}}
10692 !! options
10693 title=[[User:Ævar Arnfjörð Bjarmason]]
10694 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10695 !! wikitext
10696 {{NAMESPACENUMBER}}
10697 !! html/*
10698 <p>2
10699 </p>
10700 !! end
10701
10702 !! test
10703 Magic Word: {{SUBPAGENAME}}
10704 !! options
10705 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10706 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10707 !! wikitext
10708 {{SUBPAGENAME}}
10709 !! html/*
10710 <p>sub ö
10711 </p>
10712 !! end
10713
10714 !! test
10715 Magic Word: {{SUBPAGENAMEE}}
10716 !! options
10717 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10718 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10719 !! wikitext
10720 {{SUBPAGENAMEE}}
10721 !! html/*
10722 <p>sub_%C3%B6
10723 </p>
10724 !! end
10725
10726 !! test
10727 Magic Word: {{ROOTPAGENAME}}
10728 !! options
10729 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10730 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10731 !! wikitext
10732 {{ROOTPAGENAME}}
10733 !! html/*
10734 <p>Ævar Arnfjörð Bjarmason
10735 </p>
10736 !! end
10737
10738 !! test
10739 Magic Word: {{ROOTPAGENAMEE}}
10740 !! options
10741 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10742 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10743 !! wikitext
10744 {{ROOTPAGENAMEE}}
10745 !! html/*
10746 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10747 </p>
10748 !! end
10749
10750 !! test
10751 Magic Word: {{BASEPAGENAME}}
10752 !! options
10753 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10754 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10755 !! wikitext
10756 {{BASEPAGENAME}}
10757 !! html/*
10758 <p>Ævar Arnfjörð Bjarmason
10759 </p>
10760 !! end
10761
10762 !! test
10763 Magic Word: {{BASEPAGENAMEE}}
10764 !! options
10765 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10766 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10767 !! wikitext
10768 {{BASEPAGENAMEE}}
10769 !! html/*
10770 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10771 </p>
10772 !! end
10773
10774 !! test
10775 Magic Word: {{TALKPAGENAME}}
10776 !! options
10777 title=[[User:Ævar Arnfjörð Bjarmason]]
10778 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10779 !! wikitext
10780 {{TALKPAGENAME}}
10781 !! html/*
10782 <p>User talk:Ævar Arnfjörð Bjarmason
10783 </p>
10784 !! end
10785
10786 !! test
10787 Magic Word: {{TALKPAGENAMEE}}
10788 !! options
10789 title=[[User:Ævar Arnfjörð Bjarmason]]
10790 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10791 !! wikitext
10792 {{TALKPAGENAMEE}}
10793 !! html/*
10794 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10795 </p>
10796 !! end
10797
10798 !! test
10799 Magic Word: {{SUBJECTPAGENAME}}
10800 !! options
10801 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10802 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10803 !! wikitext
10804 {{SUBJECTPAGENAME}}
10805 !! html/*
10806 <p>User:Ævar Arnfjörð Bjarmason
10807 </p>
10808 !! end
10809
10810 !! test
10811 Magic Word: {{SUBJECTPAGENAMEE}}
10812 !! options
10813 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10814 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10815 !! wikitext
10816 {{SUBJECTPAGENAMEE}}
10817 !! html/*
10818 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10819 </p>
10820 !! end
10821
10822 !! test
10823 Magic Word: {{NUMBEROFFILES}}
10824 !! options
10825 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10826 !! wikitext
10827 {{NUMBEROFFILES}}
10828 !! html/*
10829 <p>7
10830 </p>
10831 !! end
10832
10833 !! test
10834 Magic Word: {{PAGENAME}}
10835 !! options
10836 title=[[User:Ævar Arnfjörð Bjarmason]]
10837 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10838 !! wikitext
10839 {{PAGENAME}}
10840 !! html/*
10841 <p>Ævar Arnfjörð Bjarmason
10842 </p>
10843 !! end
10844
10845 !! test
10846 Magic Word: {{PAGENAME}} with metacharacters
10847 !! options
10848 title=[['foo & bar = baz']]
10849 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10850 !! wikitext
10851 ''{{PAGENAME}}''
10852 !! html+tidy
10853 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10854 </p>
10855 !! end
10856
10857 !! test
10858 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10859 !! options
10860 title=[[*RFC 1234 http://example.com/]]
10861 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10862 !! wikitext
10863 {{PAGENAME}}
10864 !! html+tidy
10865 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10866 </p>
10867 !! end
10868
10869 !! test
10870 Magic Word: {{PAGENAMEE}}
10871 !! options
10872 title=[[User:Ævar Arnfjörð Bjarmason]]
10873 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10874 !! wikitext
10875 {{PAGENAMEE}}
10876 !! html/*
10877 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10878 </p>
10879 !! end
10880
10881 !! test
10882 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10883 !! options
10884 title=[[*RFC 1234 http://example.com/]]
10885 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10886 !! wikitext
10887 {{PAGENAMEE}}
10888 !! html+tidy
10889 <p>&#42;RFC_1234_http&#58;//example.com/
10890 </p>
10891 !! end
10892
10893 !! test
10894 Magic Word: {{REVISIONID}}
10895 !! options
10896 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10897 showflags
10898 !! wikitext
10899 {{REVISIONID}}
10900 !! html/*
10901 <p>1337
10902 </p>
10903 flags=vary-revision-id
10904 !! end
10905
10906 !! test
10907 Magic Word: {{SCRIPTPATH}}
10908 !! options
10909 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10910 !! wikitext
10911 {{SCRIPTPATH}}
10912 !! html/*
10913
10914 !! end
10915
10916 !! test
10917 Magic Word: {{STYLEPATH}}
10918 !! options
10919 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10920 !! wikitext
10921 {{STYLEPATH}}
10922 !! html/*
10923 <p>/skins
10924 </p>
10925 !! end
10926
10927 !! test
10928 Magic Word: {{SERVER}}
10929 !! options
10930 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10931 !! wikitext
10932 {{SERVER}}
10933 !! html/*
10934 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10935 </p>
10936 !! end
10937
10938 !! test
10939 Magic Word: {{SERVERNAME}}
10940 !! options
10941 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10942 !! wikitext
10943 {{SERVERNAME}}
10944 !! html/*
10945 <p>example.org
10946 </p>
10947 !! end
10948
10949 !! test
10950 Magic Word: {{SITENAME}}
10951 !! options
10952 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10953 !! wikitext
10954 {{SITENAME}}
10955 !! html/*
10956 <p>MediaWiki
10957 </p>
10958 !! end
10959
10960 !! test
10961 Magic Word: {{PAGELANGUAGE}}
10962 !! options
10963 language=fr
10964 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10965 !! wikitext
10966 {{PAGELANGUAGE}}
10967 !! html/*
10968 <p>fr
10969 </p>
10970 !! end
10971
10972 !! test
10973 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10974 !! options
10975 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10976 !! wikitext
10977 {{PAGELANGUAGE}}
10978 !! html/*
10979 <p>en
10980 </p>
10981 !! end
10982
10983 !! test
10984 Case-sensitive magic words, when cased differently, should just be template transclusions
10985 !! wikitext
10986 {{CurrentMonth}}
10987 {{currentday}}
10988 {{cURreNTweEK}}
10989 {{currentHour}}
10990 !! html
10991 <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>
10992 <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>
10993 <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>
10994 <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>
10995 </p>
10996 !! end
10997
10998 !! test
10999 Case-insensitive magic words should still work with weird casing.
11000 !! wikitext
11001 {{sErVeRNaMe}}
11002 {{LCFirst:AOEU}}
11003 {{ucFIRST:aoeu}}
11004 {{SERver}}
11005 !! html
11006 <p>example.org
11007 aOEU
11008 Aoeu
11009 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11010 </p>
11011 !! end
11012
11013 # From plwiki:PLOS_ONE
11014 !! test
11015 Parsoid: Page property magic word with magic word contents
11016 !! options
11017 showtitle
11018 !! config
11019 wgAllowDisplayTitle=true
11020 wgRestrictDisplayTitle=false
11021 !! wikitext
11022 {{DISPLAYTITLE:''{{PAGENAME}}''}}
11023 !! html/php+tidy
11024 <i>Parser test</i>
11025
11026 !! html/parsoid
11027 <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>"}]]}'/>
11028 !! end
11029
11030 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
11031 # But, this is a limitation of our representation and is documented in
11032 # TemplateHandler.js in processSpecialMagicWord
11033 !! test
11034 Parsoid: Template-generated DISPLAYTITLE
11035 !! wikitext
11036 {{{{echo|DISPLAYTITLE}}:Foo}}
11037 !! options
11038 showtitle
11039 !! config
11040 wgAllowDisplayTitle=true
11041 wgRestrictDisplayTitle=false
11042 !! html/php
11043 Foo
11044
11045 !! html/parsoid
11046 <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"}]]}'/>
11047 !! end
11048
11049 !! test
11050 Namespace 1 {{ns:1}}
11051 !! wikitext
11052 {{ns:1}}
11053 !! html
11054 <p>Talk
11055 </p>
11056 !! end
11057
11058 !! test
11059 Namespace 1 {{ns:01}}
11060 !! wikitext
11061 {{ns:01}}
11062 !! html
11063 <p>Talk
11064 </p>
11065 !! end
11066
11067 !! test
11068 Namespace 0 {{ns:0}} (T6783)
11069 !! wikitext
11070 {{ns:0}}
11071 !! html
11072
11073 !! end
11074
11075 !! test
11076 Namespace 0 {{ns:00}} (T6783)
11077 !! wikitext
11078 {{ns:00}}
11079 !! html
11080
11081 !! end
11082
11083 !! test
11084 Namespace -1 {{ns:-1}}
11085 !! wikitext
11086 {{ns:-1}}
11087 !! html
11088 <p>Special
11089 </p>
11090 !! end
11091
11092 !! test
11093 Namespace User {{ns:User}}
11094 !! wikitext
11095 {{ns:User}}
11096 !! html
11097 <p>User
11098 </p>
11099 !! end
11100
11101 !! test
11102 Namespace User talk {{ns:User_talk}}
11103 !! wikitext
11104 {{ns:User_talk}}
11105 !! html
11106 <p>User talk
11107 </p>
11108 !! end
11109
11110 !! test
11111 Namespace User talk {{ns:uSeR tAlK}}
11112 !! wikitext
11113 {{ns:uSeR tAlK}}
11114 !! html
11115 <p>User talk
11116 </p>
11117 !! end
11118
11119 !! test
11120 Namespace File {{ns:File}}
11121 !! wikitext
11122 {{ns:File}}
11123 !! html
11124 <p>File
11125 </p>
11126 !! end
11127
11128 !! test
11129 Namespace File {{ns:Image}}
11130 !! wikitext
11131 {{ns:Image}}
11132 !! html
11133 <p>File
11134 </p>
11135 !! end
11136
11137 !! test
11138 Namespace (lang=de) Benutzer {{ns:User}}
11139 !! options
11140 language=de
11141 !! wikitext
11142 {{ns:User}}
11143 !! html
11144 <p>Benutzer
11145 </p>
11146 !! end
11147
11148 !! test
11149 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11150 !! options
11151 language=de
11152 !! wikitext
11153 {{ns:3}}
11154 !! html
11155 <p>Benutzer Diskussion
11156 </p>
11157 !! end
11158
11159 !! test
11160 Urlencode
11161 !! wikitext
11162 {{urlencode:hi world?!}}
11163 {{urlencode:hi world?!|WIKI}}
11164 {{urlencode:hi world?!|PATH}}
11165 {{urlencode:hi world?!|QUERY}}
11166 !! html/php
11167 <p>hi+world%3F%21
11168 hi_world%3F!
11169 hi%20world%3F%21
11170 hi+world%3F%21
11171 </p>
11172 !! end
11173
11174 !! test
11175 Magic Word: prioritize type info over data-parsoid
11176 !! options
11177 parsoid=html2wt
11178 !! html/parsoid
11179 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11180 !! wikitext
11181 __FORCETOC__
11182 !! end
11183
11184 !! test
11185 Magic Word: serialize on separate line (parsoid)
11186 !! options
11187 parsoid=wt2wt,html2wt
11188 !! wikitext
11189 foo
11190 __NOTOC__
11191 bar
11192 !! html/parsoid
11193 foo<meta property="mw:PageProp/notoc"/>bar
11194 !! end
11195
11196 !! test
11197 Magic Word: rt non-english wikis
11198 !! options
11199 parsoid=wt2wt
11200 language=de
11201 !! wikitext
11202 __NOEDITSECTION__
11203 !! html/parsoid
11204 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11205 !! end
11206
11207 !!test
11208 __proto__ is treated as normal wikitext (T105997)
11209 !!wikitext
11210 __proto__
11211 !!html
11212 <p>__proto__
11213 </p>
11214 !!end
11215
11216 ###
11217 ### Magic links
11218 ###
11219 !! test
11220 Magic links: internal link to RFC (T2479)
11221 !! wikitext
11222 [[RFC 123]]
11223 !! html/php
11224 <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>
11225 </p>
11226 !! html/parsoid
11227 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11228 !! end
11229
11230 !! test
11231 Magic links: RFC (T2479)
11232 !! wikitext
11233 RFC 822
11234 !! html/php
11235 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11236 </p>
11237 !! html/parsoid
11238 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11239 !! end
11240
11241 !! test
11242 Magic links: RFC (T67278)
11243 !! wikitext
11244 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11245 !! html/php
11246 <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.
11247 </p>
11248 !! html/parsoid
11249 <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>
11250 !! end
11251
11252 !! test
11253 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11254 !! wikitext
11255 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11256 RFC
11257 822
11258 !! html/php
11259 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11260 RFC
11261 822
11262 </p>
11263 !! html/parsoid
11264 <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>
11265 RFC
11266 822</p>
11267 !! end
11268
11269 !! test
11270 Magic links: ISBN (T3937)
11271 !! wikitext
11272 ISBN 0-306-40615-2
11273 !! html/php
11274 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11275 </p>
11276 !! html/parsoid
11277 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11278 !! end
11279
11280 !! test
11281 Magic links: ISBN (T67278)
11282 !! wikitext
11283 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11284 !! html/php
11285 <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.
11286 </p>
11287 !! html/parsoid
11288 <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>
11289 !! end
11290
11291 !! test
11292 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11293 !! wikitext
11294 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11295 ISBN
11296 9780316098113
11297 ISBN 978
11298 0316098113
11299 !! html/php
11300 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11301 ISBN
11302 9780316098113
11303 ISBN 978
11304 0316098113
11305 </p>
11306 !! html/parsoid
11307 <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>
11308 ISBN
11309 9780316098113
11310 ISBN 978
11311 0316098113</p>
11312 !! end
11313
11314 !! test
11315 Magic links: PMID incorrectly converts space to underscore
11316 !! wikitext
11317 PMID 1234
11318 !! html/php
11319 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11320 </p>
11321 !! html/parsoid
11322 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11323 !! end
11324
11325 !! test
11326 Magic links: PMID (T67278)
11327 !! wikitext
11328 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11329 !! html/php
11330 <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.
11331 </p>
11332 !! html/parsoid
11333 <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>
11334 !! end
11335
11336 !! test
11337 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11338 !! wikitext
11339 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11340 PMID
11341 1234
11342 !! html/php
11343 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11344 PMID
11345 1234
11346 </p>
11347 !! html/parsoid
11348 <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>
11349 PMID
11350 1234</p>
11351 !! end
11352
11353 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11354 # since these are ExtLinkText, not MagicLinkText
11355 !! test
11356 Magic links: use appropriate serialization for "almost" magic links.
11357 !! wikitext
11358 X[[Special:BookSources/0978739256|foo]]
11359
11360 X[https://tools.ietf.org/html/rfc1234 foo]
11361 !! html/php
11362 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11363 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11364 </p>
11365 !! html/parsoid
11366 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11367 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11368 !! end
11369
11370 !! test
11371 Magic links: All disabled (T47942)
11372 !! options
11373 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11374 !! wikitext
11375 ISBN 0-306-40615-2
11376 PMID 1234
11377 RFC 4321
11378 !! html/php
11379 <p>ISBN 0-306-40615-2
11380 PMID 1234
11381 RFC 4321
11382 </p>
11383 !! end
11384
11385 ###
11386 ### Templates
11387 ####
11388
11389 !! test
11390 Nonexistent template
11391 !! wikitext
11392 {{thistemplatedoesnotexist}}
11393 !! html
11394 <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>
11395 </p>
11396 !! end
11397
11398 !! test
11399 Template with invalid target containing tags
11400 !! wikitext
11401 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11402 !! html
11403 <p>{{a<b>b</b>|foo|a=b|a = b}}
11404 </p>
11405 !! end
11406
11407 !! test
11408 Template with invalid target containing unclosed tag
11409 !! wikitext
11410 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11411 !! html
11412 <p>{{a<b>|foo|a=b|a = b}}</b>
11413 </p>
11414 !! end
11415
11416 !! test
11417 Template with invalid target containing wikilink
11418 !! wikitext
11419 {{[[Main Page]]}}
11420 !! html/php
11421 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11422 </p>
11423 !! html/parsoid
11424 <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>
11425 !! end
11426
11427 !! test
11428 Template with just whitespace in it, T70421
11429 !! wikitext
11430 {{echo|{{ }}}}
11431 !! html/parsoid
11432 <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>
11433 !! end
11434
11435 !! article
11436 Template:test
11437 !! text
11438 This is a test template
11439 !! endarticle
11440
11441 !! test
11442 Simple template
11443 !! wikitext
11444 {{test}}
11445 !! html
11446 <p>This is a test template
11447 </p>
11448 !! end
11449
11450 !! test
11451 Template with explicit namespace
11452 !! wikitext
11453 {{Template:test}}
11454 !! html
11455 <p>This is a test template
11456 </p>
11457 !! end
11458
11459
11460 !! article
11461 Template:paramtest
11462 !! text
11463 This is a test template with parameter {{{param}}}
11464 !! endarticle
11465
11466 !! test
11467 Template parameter
11468 !! wikitext
11469 {{paramtest|param=foo}}
11470 !! html
11471 <p>This is a test template with parameter foo
11472 </p>
11473 !! end
11474
11475 !! article
11476 Template:paramtestnum
11477 !! text
11478 [[{{{1}}}|{{{2}}}]]
11479 !! endarticle
11480
11481 !! test
11482 Template unnamed parameter
11483 !! wikitext
11484 {{paramtestnum|Main Page|the main page}}
11485 !! html
11486 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11487 </p>
11488 !! end
11489
11490 !! article
11491 Template:templatesimple
11492 !! text
11493 (test)
11494 !! endarticle
11495
11496 !! article
11497 Template:templateredirect
11498 !! text
11499 #redirect [[Template:templatesimple]]
11500 !! endarticle
11501
11502 !! article
11503 Template:templateasargtestnum
11504 !! text
11505 {{{{{1}}}}}
11506 !! endarticle
11507
11508 !! article
11509 Template:templateasargtest
11510 !! text
11511 {{template{{{templ}}}}}
11512 !! endarticle
11513
11514 !! article
11515 Template:templateasargtest2
11516 !! text
11517 {{{{{templ}}}}}
11518 !! endarticle
11519
11520 !! test
11521 Template with template name as unnamed argument
11522 !! wikitext
11523 {{templateasargtestnum|templatesimple}}
11524 !! html
11525 <p>(test)
11526 </p>
11527 !! end
11528
11529 !! test
11530 Template with template name as argument
11531 !! wikitext
11532 {{templateasargtest|templ=simple}}
11533 !! html
11534 <p>(test)
11535 </p>
11536 !! end
11537
11538 !! test
11539 Template with template name as argument (2)
11540 !! wikitext
11541 {{templateasargtest2|templ=templatesimple}}
11542 !! html
11543 <p>(test)
11544 </p>
11545 !! end
11546
11547 !! article
11548 Template:templateasargtestdefault
11549 !! text
11550 {{{{{templ|templatesimple}}}}}
11551 !! endarticle
11552
11553 !! article
11554 Template:templa
11555 !! text
11556 '''templ'''
11557 !! endarticle
11558
11559 !! test
11560 Template with default value
11561 !! wikitext
11562 {{templateasargtestdefault}}
11563 !! html
11564 <p>(test)
11565 </p>
11566 !! end
11567
11568 !! test
11569 Template with default value (value set)
11570 !! wikitext
11571 {{templateasargtestdefault|templ=templa}}
11572 !! html
11573 <p><b>templ</b>
11574 </p>
11575 !! end
11576
11577 !! test
11578 Template redirect
11579 !! wikitext
11580 {{templateredirect}}
11581 !! html/php
11582 <p>(test)
11583 </p>
11584 !! html/parsoid
11585 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11586 !! end
11587
11588 !! test
11589 Template with argument in separate line
11590 !! wikitext
11591 {{ templateasargtest |
11592 templ = simple }}
11593 !! html
11594 <p>(test)
11595 </p>
11596 !! end
11597
11598 !! test
11599 Template with complex template as argument
11600 !! wikitext
11601 {{paramtest|
11602 param ={{ templateasargtest |
11603 templ = simple }}}}
11604 !! html
11605 <p>This is a test template with parameter (test)
11606 </p>
11607 !! end
11608
11609 !! test
11610 Templates with templated name
11611 !! wikitext
11612 {{{{echo|echo}}|foo}}
11613 {{{{echo|inner list}} }}
11614 !! html
11615 <p>foo
11616 </p>
11617 <ul><li>item 1</li></ul>
11618
11619 !! html/parsoid
11620 <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>
11621 <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>
11622 !! end
11623
11624 ## Regression test; the output here isn't really that interesting.
11625 !! test
11626 Templates with templated name and top level template args
11627 !! wikitext
11628 {{1{{2{{{3}}}|4=5}}}}
11629 !! html/parsoid
11630 <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>
11631 !! end
11632
11633 # Parsoid markup is deliberate "broken". This is an edge case.
11634 # See long comment in TemplateHandler.js:convertAttribsToString.
11635 !! test
11636 Templates with invalid templated targets
11637 !! wikitext
11638 {{echo
11639 {{echo|foo}}
11640 }}
11641 !! html/php
11642 <p>{{echo
11643 foo
11644 }}
11645 </p>
11646 !! html/parsoid
11647 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11648 foo }}</p>
11649 !! end
11650
11651 !! test
11652 Template with thumb image (with link in description)
11653 !! wikitext
11654 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11655 !! html/php
11656 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>
11657
11658 !! html+tidy
11659 <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>
11660 !! html/parsoid
11661 <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>
11662 !! end
11663
11664 !! article
11665 Template:complextemplate
11666 !! text
11667 {{{1}}} {{paramtest|
11668 param ={{{param}}}}}
11669 !! endarticle
11670
11671 !! test
11672 Template with complex arguments
11673 !! wikitext
11674 {{complextemplate|
11675 param ={{ templateasargtest |
11676 templ = simple }}|[[Template:complextemplate|link]]}}
11677 !! html
11678 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11679 </p>
11680 !! end
11681
11682 !! test
11683 T2553: link with two variables in a piped link
11684 !! wikitext
11685 {|
11686 |[[{{{1}}}|{{{2}}}]]
11687 |}
11688 !! html/php
11689 <table>
11690 <tr>
11691 <td>[[{{{1}}}|{{{2}}}]]
11692 </td></tr></table>
11693
11694 !! html/parsoid
11695 <table>
11696 <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>
11697 </tbody></table>
11698 !! end
11699
11700 # See: T2553
11701 !! test
11702 Abort table cell attribute parsing on wikilink
11703 !! wikitext
11704 {|
11705 |testing [[one|two]] |three||four
11706 |testing one two |three||four
11707 |testing="[[one|two]]" |three||four
11708 |}
11709 !! html/php
11710 <table>
11711 <tr>
11712 <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>
11713 <td>four
11714 </td>
11715 <td>three</td>
11716 <td>four
11717 </td>
11718 <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>
11719 <td>four
11720 </td></tr></table>
11721
11722 !! html/parsoid
11723 <table>
11724 <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>
11725 <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>
11726 <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>
11727 </tbody></table>
11728 !! end
11729
11730 !! test
11731 Don't abort table cell attribute parsing if wikilink is found in template arg
11732 !! wikitext
11733 {|
11734 |Test {{#tag:ref|One two "[[three]]" four}}
11735 |}
11736 !! html/parsoid
11737 <table>
11738 <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>
11739 </tbody></table>
11740 !! end
11741
11742 !! test
11743 Magic variable as template parameter
11744 !! wikitext
11745 {{paramtest|param={{SITENAME}}}}
11746 !! html
11747 <p>This is a test template with parameter MediaWiki
11748 </p>
11749 !! end
11750
11751 !! article
11752 Template:linktest
11753 !! text
11754 [[{{{param}}}|link]]
11755 !! endarticle
11756
11757 !! test
11758 Template parameter as link source
11759 !! wikitext
11760 {{linktest|param=Main Page}}
11761 !! html
11762 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11763 </p>
11764 !! end
11765
11766 !!article
11767 Template:paramtest2
11768 !! text
11769 including another template, {{paramtest|param={{{arg}}}}}
11770 !! endarticle
11771
11772 !! test
11773 Template passing argument to another template
11774 !! wikitext
11775 {{paramtest2|arg='hmm'}}
11776 !! html
11777 <p>including another template, This is a test template with parameter 'hmm'
11778 </p>
11779 !! end
11780
11781 !! article
11782 Template:Linktest2
11783 !! text
11784 Main Page
11785 !! endarticle
11786
11787 !! test
11788 Template as link source
11789 !! wikitext
11790 [[{{linktest2}}]]
11791
11792 [[{{linktest2}}|Main Page]]
11793
11794 [[{{linktest2}}]]Page
11795 !! html
11796 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11797 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11798 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11799 </p>
11800 !! end
11801
11802
11803 !! article
11804 Template:loop1
11805 !! text
11806 {{loop2}}
11807 !! endarticle
11808
11809 !! article
11810 Template:loop2
11811 !! text
11812 {{loop1}}
11813 !! endarticle
11814
11815 !! test
11816 Template infinite loop
11817 !! wikitext
11818 {{loop1}}
11819 !! html
11820 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11821 </p>
11822 !! end
11823
11824 !! test
11825 Template from main namespace
11826 !! wikitext
11827 {{:Main Page}}
11828 !! html
11829 <p>blah blah
11830 </p>
11831 !! end
11832
11833 !! test
11834 Template from non-includable namespace
11835 !! options
11836 wgNonincludableNamespaces=10
11837 !! wikitext
11838 {{echo|uh oh!}}
11839 !! html
11840 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11841 </p>
11842 !! end
11843
11844 !! article
11845 Template:table
11846 !! text
11847 {|
11848 | 1 || 2
11849 |-
11850 | 3 || 4
11851 |}
11852 !! endarticle
11853
11854 !! test
11855 T2529: Template with table, not included at beginning of line
11856 !! wikitext
11857 foo {{table}}
11858 !! html
11859 <p>foo
11860 </p>
11861 <table>
11862 <tr>
11863 <td>1</td>
11864 <td>2
11865 </td></tr>
11866 <tr>
11867 <td>3</td>
11868 <td>4
11869 </td></tr></table>
11870
11871 !! end
11872
11873 !! test
11874 T2523: Template shouldn't eat newline (or add an extra one before table)
11875 !! wikitext
11876 foo
11877 {{table}}
11878 !! html
11879 <p>foo
11880 </p>
11881 <table>
11882 <tr>
11883 <td>1</td>
11884 <td>2
11885 </td></tr>
11886 <tr>
11887 <td>3</td>
11888 <td>4
11889 </td></tr></table>
11890
11891 !! end
11892
11893 !! test
11894 T2041: Template parameters shown as broken links
11895 !! wikitext
11896 {{{parameter}}}
11897 !! html
11898 <p>{{{parameter}}}
11899 </p>
11900 !! end
11901
11902 !! test
11903 Template with targets containing wikilinks
11904 !! options
11905 parsoid=wt2html
11906 !! wikitext
11907 {{[[foo]]}}
11908
11909 {{[[{{echo|foo}}]]}}
11910
11911 {{{{echo|[[foo}}]]}}
11912 !! html/php
11913 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11914 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11915 </p><p>{{[[foo}}]]
11916 </p>
11917 !! html/parsoid
11918 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11919 <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>
11920 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11921 !! end
11922
11923 !! article
11924 Template:''
11925 !! text
11926 bar
11927 !! endarticle
11928
11929 !! test
11930 Templates: Double quotes as template target
11931 !! wikitext
11932 foo {{''}} baz
11933 !! html/php
11934 <p>foo bar baz
11935 </p>
11936 !! html/parsoid
11937 <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
11938 </p>
11939 !! end
11940
11941 ## This test is about making sure Parsoid's data-mw is well formed in the
11942 ## face of multiple templates with intersecting and overlapping ranges. The
11943 ## wikitext itself is wretched.
11944 !! test
11945 Templates with intersecting and overlapping ranges
11946 !! wikitext
11947 {|{{echo|
11948 <p>ha</p>}}
11949 {|{{echo|
11950 <p>ho</p>}}
11951 {{echo|{{!}}hi}}
11952 |}
11953 !! html/php+tidy
11954 <p>ha</p><table>
11955
11956 </table><p>ho</p><table>
11957
11958 <tbody><tr>
11959 <td>hi
11960 </td></tr></tbody></table>
11961 !! html/parsoid
11962 <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":""}]]}'>
11963
11964 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11965
11966 <tbody><tr><td>hi</td></tr>
11967 </tbody></table>
11968 !! end
11969
11970 !! article
11971 Template:MSGNW test
11972 !! text
11973 ''None'' of '''this''' should be
11974 * interpreted
11975 but rather passed unmodified
11976 {{test}}
11977 <gallery>
11978 File:Foobar.jpg
11979 </gallery>
11980 <!-- comment -->
11981 !! endarticle
11982
11983 # hmm, fix this or just deprecate msgnw and document its behavior?
11984 !! test
11985 msgnw keyword
11986 !! wikitext
11987 {{msgnw:MSGNW test}}
11988 !! html/php
11989 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11990 &#42; interpreted
11991 &#32;but rather passed unmodified
11992 &#123;&#123;test&#125;&#125;
11993 &#60;gallery&#62;
11994 File:Foobar.jpg
11995 &#60;/gallery&#62;
11996 &#60;!-- comment --&#62;
11997 </p>
11998 !! end
11999
12000 !! test
12001 int keyword
12002 !! wikitext
12003 {{int:youhavenewmessages|lots of money|not!}}
12004 !! html
12005 <p>You have lots of money (not!).
12006 </p>
12007 !! end
12008
12009 !! test
12010 int keyword - non-existing message
12011 !! wikitext
12012 {{int:var}}
12013 !! html
12014 <p>⧼var⧽
12015 </p>
12016 !! end
12017
12018 !! article
12019 Template:Includes
12020 !! text
12021 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12022 !! endarticle
12023
12024 !! test
12025 <includeonly> and <noinclude> being included
12026 !! wikitext
12027 {{Includes}}
12028 !! html
12029 <p>Foobar
12030 </p>
12031 !! end
12032
12033 !! article
12034 Template:Includes2
12035 !! text
12036 <onlyinclude>Foo</onlyinclude>bar
12037 !! endarticle
12038
12039 !! test
12040 <onlyinclude> being included
12041 !! wikitext
12042 {{Includes2}}
12043 !! html
12044 <p>Foo
12045 </p>
12046 !! end
12047
12048
12049 !! article
12050 Template:Includes3
12051 !! text
12052 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
12053 !! endarticle
12054
12055 !! test
12056 <onlyinclude> and <includeonly> being included
12057 !! wikitext
12058 {{Includes3}}
12059 !! html
12060 <p>Foo
12061 </p>
12062 !! end
12063
12064 !! test
12065 <includeonly> and <noinclude> on a page
12066 !! wikitext
12067 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12068 !! html
12069 <p>Foozar
12070 </p>
12071 !! end
12072
12073 !! test
12074 Un-closed <noinclude>
12075 !! wikitext
12076 <noinclude>
12077 !! html
12078 !! end
12079
12080 !! test
12081 <onlyinclude> on a page
12082 !! wikitext
12083 <onlyinclude>Foo</onlyinclude>bar
12084 !! html
12085 <p>Foobar
12086 </p>
12087 !! end
12088
12089 !! test
12090 Un-closed <onlyinclude>
12091 !! wikitext
12092 <onlyinclude>
12093 !! html
12094 !! end
12095
12096 !!test
12097 Self-closed noinclude, includeonly, onlyinclude tags
12098 !! wikitext
12099 <noinclude />
12100 <includeonly />
12101 <onlyinclude />
12102 !! html
12103 <p><br />
12104 </p>
12105 !!end
12106
12107 !!test
12108 Unbalanced includeonly and noinclude tags
12109 !! wikitext
12110 {|
12111 |a</noinclude>
12112 |b</noinclude></noinclude>
12113 |c</noinclude></includeonly>
12114 |d</includeonly></includeonly>
12115 |}
12116 !! html
12117 <table>
12118 <tr>
12119 <td>a
12120 </td>
12121 <td>b
12122 </td>
12123 <td>c&lt;/includeonly&gt;
12124 </td>
12125 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12126 </td></tr></table>
12127
12128 !!end
12129
12130 !! article
12131 Template:Includeonly section
12132 !! text
12133 <includeonly>
12134 ==Includeonly section==
12135 </includeonly>
12136 ==Section T-1==
12137 !!endarticle
12138
12139 !! test
12140 T8563: Edit link generation for section shown by <includeonly>
12141 !! wikitext
12142 {{includeonly section}}
12143 !! html
12144 <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>
12145 <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>
12146
12147 !! end
12148
12149 # Uses same input as the contents of [[Template:Includeonly section]]
12150 !! test
12151 T8563: Section extraction for section shown by <includeonly>
12152 !! options
12153 section=T-2
12154 !! wikitext
12155 <includeonly>
12156 ==Includeonly section==
12157 </includeonly>
12158 ==Section T-2==
12159 !! html
12160 ==Section T-2==
12161 !! end
12162
12163 !! test
12164 T8563: Edit link generation for section suppressed by <includeonly>
12165 !! wikitext
12166 <includeonly>
12167 ==Includeonly section==
12168 </includeonly>
12169 ==Section 1==
12170 !! html
12171 <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>
12172
12173 !! end
12174
12175 !! test
12176 T8563: Section extraction for section suppressed by <includeonly>
12177 !! options
12178 section=1
12179 !! wikitext
12180 <includeonly>
12181 ==Includeonly section==
12182 </includeonly>
12183 ==Section 1==
12184 !! html
12185 ==Section 1==
12186 !! end
12187
12188 !! test
12189 Un-closed <includeonly>
12190 !! wikitext
12191 <includeonly>
12192 !! html/php
12193 !! html/parsoid
12194 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12195 !! end
12196
12197 ## We used to, but no longer wt2wt this test since the default serializer
12198 ## will normalize the include directives to serialize on their own line.
12199 ## Selser will take care of preserving formatting in scenarios where they
12200 ## intermingled with other wikitext.
12201 !! test
12202 Includes and comments at SOL
12203 !! options
12204 parsoid=wt2html,html2html
12205 !! wikitext
12206 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12207
12208 <noinclude>
12209 some
12210 </noinclude>*stuff
12211 *here
12212
12213 <noinclude>
12214 some</noinclude>* stuff
12215 * here
12216
12217 <includeonly>can have stuff</includeonly>===here===
12218
12219 !! html/php
12220 <h2><span class="mw-headline" id="hu">hu</span></h2>
12221 <p>some
12222 </p>
12223 <ul><li>stuff</li>
12224 <li>here</li></ul>
12225 <p><br />
12226 some* stuff
12227 </p>
12228 <ul><li>here</li></ul>
12229 <h3><span class="mw-headline" id="here">here</span></h3>
12230
12231 !! html/parsoid
12232 <!-- 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>
12233
12234 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12235 <p>some</p>
12236 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12237 <li>here</li></ul>
12238
12239 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12240 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12241 <ul><li>here</li></ul>
12242
12243 <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>
12244
12245 !! end
12246
12247 # TODO: test with DOM fragment reuse!
12248 !! test
12249 Parsoid: DOM fragment reuse
12250 !! options
12251 parsoid=wt2wt,wt2html
12252 !! wikitext
12253 a{{echo|b<table></table>c}}d
12254
12255 a{{echo|b
12256 <table></table>
12257 c}}d
12258
12259 {{echo|a
12260
12261 <table></table>
12262
12263 b}}
12264 !! html/php+tidy
12265 <p>ab</p><table></table><p>cd
12266 </p><p>ab
12267 </p>
12268 <table></table>
12269 <p>cd
12270 </p><p>a
12271 </p>
12272 <table></table>
12273 <p>b
12274 </p>
12275 !! html/parsoid
12276 <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>
12277
12278 <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">
12279 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12280 </span><p about="#mwt2">cd</p>
12281
12282 <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">
12283
12284 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12285
12286 </span><p about="#mwt3">b</p>
12287 !! end
12288
12289 !! test
12290 Parsoid: Merge double tds (T52603)
12291 !! wikitext
12292 {|
12293 |{{echo|{{!}} foo}}
12294 |}
12295 !! html/php+tidy
12296 <table>
12297 <tbody><tr>
12298 <td>foo
12299 </td></tr></tbody></table>
12300 !! html/parsoid
12301 <table><tbody>
12302 <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>
12303 </tbody></table>
12304 !! end
12305
12306 !! test
12307 Parsoid: Merge double tds in nested transclusion content (T52603)
12308 !! wikitext
12309 {{echo|<div>}}
12310 {|
12311 |{{echo|{{!}} foo}}
12312 |}
12313 {{echo|</div>}}
12314 !! html/php+tidy
12315 <div>
12316 <table>
12317 <tbody><tr>
12318 <td>foo
12319 </td></tr></tbody></table>
12320 </div>
12321 !! html/parsoid
12322 <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}}]}'>
12323 <table><tbody>
12324 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12325 </tbody></table>
12326 </div>
12327 !! end
12328
12329 ###
12330 ### <includeonly> and <noinclude> in attributes
12331 ###
12332 !!test
12333 0. includeonly around the entire attribute
12334 !! wikitext
12335 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12336 !! html
12337 <p><span id="v2">bar</span>
12338 </p>
12339 !!end
12340
12341 !!test
12342 1. includeonly in html attr key
12343 !! wikitext
12344 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12345 !! html
12346 <p><span id="foo">bar</span>
12347 </p>
12348 !!end
12349
12350 !!test
12351 2. includeonly in html attr value
12352 !! wikitext
12353 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12354 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12355 !! html
12356 <p><span id="v1">bar</span>
12357 <span id="v1">bar</span>
12358 </p>
12359 !!end
12360
12361 !!test
12362 3. includeonly in part of an attr value
12363 !! wikitext
12364 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12365 !! html
12366 <p><span style="color:red;">bar</span>
12367 </p>
12368 !!end
12369
12370 !!test
12371 4. includeonly in table attributes
12372 !! wikitext
12373 {|
12374 |- <noinclude>
12375 |-
12376 |a
12377 </noinclude>
12378 |- <includeonly>
12379 |-
12380 |b
12381 </includeonly>
12382 |}
12383 !! html
12384 <table>
12385
12386
12387 <tr>
12388 <td>a
12389 </td></tr>
12390 </table>
12391
12392 !!end
12393
12394 ###
12395 ### Preprocessor precedence tests
12396 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12397 ###
12398 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12399 !! test
12400 Preprocessor precedence 1: link is rightmost opening
12401 !! options
12402 parsoid=wt2html
12403 !! wikitext
12404 {{[[Foo|bar}}]]
12405
12406 But close-brace is not a valid character in a link title:
12407 {{[[Foo}}|bar]]
12408
12409 However, we can still tell this was handled as a link in the preprocessor:
12410 {{echo|[[Foo}}|bar]]|bat}}
12411 !! html/php
12412 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12413 </p><p>But close-brace is not a valid character in a link title:
12414 {{[[Foo}}|bar]]
12415 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12416 [[Foo}}|bar]]
12417 </p>
12418 !! html/parsoid
12419 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12420 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12421 <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>
12422 !! end
12423
12424 !! test
12425 Preprocessor precedence 2: template is rightmost opening
12426 !! options
12427 language=zh
12428 !! wikitext
12429 -{{echo|foo}-}}-
12430 !! html/php
12431 <p>-foo}--
12432 </p>
12433 !! html/parsoid
12434 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12435 !! end
12436
12437 !! test
12438 Preprocessor precedence 3: language converter is rightmost opening
12439 !! options
12440 language=zh
12441 parsoid=wt2html
12442 !! wikitext
12443 {{echo|hi}}
12444
12445 {{-{R|echo|hi}}}-
12446
12447 [[-{R|raw]]}-
12448 !! html/php
12449 <p>hi
12450 </p><p>{{echo|hi}}
12451 </p><p>[[raw]]
12452 </p>
12453 !! html/parsoid
12454 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12455 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12456 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12457 !! end
12458
12459 !! test
12460 Preprocessor precedence 4: left-most angle bracket
12461 !! options
12462 language=zh
12463 !! wikitext
12464 <!--{raw}-->
12465 !! html/php
12466 !! html/parsoid
12467 <!--{raw}-->
12468 !! end
12469
12470 !! article
12471 Template:Precedence5
12472 !! text
12473 {{{{{1}}}}}
12474 !! endarticle
12475
12476 !! test
12477 Preprocessor precedence 5: tplarg takes precedence over template
12478 !! wikitext
12479 {{Precedence5|Bullet}}
12480 !! html/php
12481 <ul><li>Bar</li></ul>
12482
12483 !! html/parsoid
12484 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12485 !! end
12486
12487 !! test
12488 Preprocessor precedence 6: broken link is rightmost opening
12489 !! options
12490 parsoid=wt2html
12491 !! wikitext
12492 {{echo|[[Foo}}
12493
12494 {{echo|[[Foo|bar|bat=baz}}
12495 !! html/php
12496 <p>{{echo|[[Foo}}
12497 </p><p>{{echo|[[Foo|bar|bat=baz}}
12498 </p>
12499 !! html/parsoid
12500 <p>{{echo|[[Foo}}</p>
12501 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12502 !! end
12503
12504 # This next test exposes a difference between PHP and Parsoid:
12505 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12506 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12507 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12508 # outer `[[Foo` extends until the `y]]`
12509 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12510 # intermediate result (after template expansion), and link processing
12511 # happens on this intermediate result, which moves the wikilink
12512 # boundary leftward to `[[Foo|Bar]]`
12513 # 2b) Parsoid works in a single step, so it's going to keep the
12514 # wikilink as extending to the `y]]`
12515 # 3a) Then PHP does linktrail processing which slurps up the trailing
12516 # `xy` inside the link.
12517 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12518 # `z` inside the link.
12519 # This is "correct" behavior. Parsoid's basic worldview is that the
12520 # `]]` inside the template shouldn't be allowed to leak out to affect
12521 # the surrounding wikilink. PHP may match Parsoid (in the future)
12522 # if you use {{#balance}} (T114445).
12523
12524 !! test
12525 Preprocessor precedence 7: broken template is rightmost opening
12526 !! options
12527 parsoid=wt2html
12528 !! wikitext
12529 [[Foo|{{echo|Bar]]
12530
12531 [[Foo|{{echo|Bar]]-x}}-y]]-z
12532
12533 Careful: linktrails can move the end of the wikilink:
12534 [[Foo|{{echo|y']]a}}l]]l
12535 !! html/php
12536 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12537 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12538 </p><p>Careful: linktrails can move the end of the wikilink:
12539 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12540 </p>
12541 !! html/parsoid
12542 <p>[[Foo|{{echo|Bar]]</p>
12543 <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>
12544 <p>Careful: linktrails can move the end of the wikilink:
12545 <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>
12546 !! end
12547
12548 !! test
12549 Preprocessor precedence 8: broken language converter is rightmost opening
12550 !! options
12551 language=zh
12552 !! wikitext
12553 [[Foo-{R|raw]]
12554 !! html
12555 <p>[[Foo-{R|raw]]
12556 </p>
12557 !! end
12558
12559 !! article
12560 Template:Preprocessor_precedence_9
12561 !! text
12562 ;4: {{{{1}}}}
12563 ;5: {{{{{2}}}}}
12564 ;6: {{{{{{3}}}}}}
12565 ;7: {{{{{{{4}}}}}}}
12566 !! endarticle
12567
12568 !! test
12569 Preprocessor precedence 9: groups of braces
12570 !! wikitext
12571 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12572 !! html/php
12573 <dl><dt>4</dt>
12574 <dd>{Four}</dd>
12575 <dt>5</dt>
12576 <dd></dd></dl>
12577 <ul><li>Bar</li></ul>
12578 <dl><dt>6</dt>
12579 <dd>Four</dd>
12580 <dt>7</dt>
12581 <dd>{Bullet}</dd></dl>
12582
12583 !! html/parsoid
12584 <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}}]}'>
12585 <dt>4</dt>
12586 <dd>{Four}</dd>
12587 <dt>5</dt>
12588 <dd></dd>
12589 </dl><ul about="#mwt1">
12590 <li>Bar</li>
12591 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12592 <dt>6</dt>
12593 <dd>Four</dd>
12594 <dt>7</dt>
12595 <dd>{Bullet}</dd>
12596 </dl>
12597 !! end
12598
12599 !! article
12600 Template:Preprocessor_precedence_10
12601 !! text
12602 ;1: -{R|raw}-
12603 ;2: -{{Bullet}}-
12604 ;3: -{{{1}}}-
12605 ;4: -{{{{2}}}}-
12606 ;5: -{{{{{3}}}}}-
12607 ;6: -{{{{{{4}}}}}}-
12608 ;7: -{{{{{{{5}}}}}}}-
12609 !! endarticle
12610
12611 !! test
12612 Preprocessor precedence 10: groups of braces with leading dash
12613 !! options
12614 language=zh
12615 !! wikitext
12616 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12617 !! html/php
12618 <dl><dt>1</dt>
12619 <dd>raw</dd>
12620 <dt>2</dt>
12621 <dd>-</dd></dl>
12622 <ul><li>Bar-</li></ul>
12623 <dl><dt>3</dt>
12624 <dd>-Three-</dd>
12625 <dt>4</dt>
12626 <dd>raw2</dd>
12627 <dt>5</dt>
12628 <dd>-</dd></dl>
12629 <ul><li>Bar-</li></ul>
12630 <dl><dt>6</dt>
12631 <dd>-Three-</dd>
12632 <dt>7</dt>
12633 <dd>raw2</dd></dl>
12634
12635 !! html/parsoid
12636 <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}}]}'>
12637 <dt>1</dt>
12638 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12639 <dt>2</dt>
12640 <dd>-</dd>
12641 </dl><ul about="#mwt1">
12642 <li>Bar-</li>
12643 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12644 <dt>3</dt>
12645 <dd>-Three-</dd>
12646 <dt>4</dt>
12647 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12648 <dt>5</dt>
12649 <dd>-</dd>
12650 </dl><ul about="#mwt1">
12651 <li>Bar-</li>
12652 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12653 <dt>6</dt>
12654 <dd>-Three-</dd>
12655 <dt>7</dt>
12656 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12657 </dl>
12658 !! end
12659
12660 !! test
12661 Preprocessor precedence 11: found during visual diff testing
12662 !! wikitext
12663 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12664
12665 {{echo|-{{echo|-{{echo|x}}}}}}
12666
12667 {{echo|-{{echo|x}}}}
12668 !! html/php
12669 <p><span>-<span>-x</span></span>
12670 </p><p>--x
12671 </p><p>-x
12672 </p>
12673 !! html/parsoid
12674 <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>
12675
12676 <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>
12677
12678 <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>
12679 !! end
12680
12681 !! test
12682 Preprocessor precedence 12: broken language converter closed by brace.
12683 !! options
12684 parsoid=wt2html
12685 !! wikitext
12686 This form breaks the template, which is unfortunate:
12687 *{{echo|foo-{bar}bat}}
12688
12689 But if the broken language converter markup is inside an extension
12690 tag, nothing bad happens:
12691 *<nowiki>foo-{bar}bat</nowiki>
12692 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12693 *<pre>foo-{bar}bat</pre>
12694 *{{echo|<pre>foo-{bar}bat</pre>}}
12695
12696 <tag>foo-{bar}bat</tag>
12697 {{echo|<tag>foo-{bar}bat</tag>}}
12698
12699 !! html/php+tidy
12700 <p>This form breaks the template, which is unfortunate:
12701 </p>
12702 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12703 <p>But if the broken language converter markup is inside an extension
12704 tag, nothing bad happens:
12705 </p>
12706 <ul><li>foo-&#123;bar}bat</li>
12707 <li>foo-&#123;bar}bat</li>
12708 <li><pre>foo-{bar}bat</pre></li>
12709 <li><pre>foo-{bar}bat</pre></li></ul>
12710 <pre>'foo-{bar}bat'
12711 array (
12712 )
12713 </pre>
12714 <pre>'foo-{bar}bat'
12715 array (
12716 )
12717 </pre>
12718 !! html/parsoid
12719 <p>This form breaks the template, which is unfortunate:</p>
12720 <ul>
12721 <li>{{echo|foo-{bar}bat}}</li>
12722 </ul>
12723 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12724 <ul>
12725 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12726 <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>
12727 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12728 <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>
12729 </ul>
12730 <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>
12731 !! end
12732
12733 !! test
12734 Preprocessor precedence 13: broken language converter in external link
12735 !! options
12736 parsoid=wt2html
12737 !! wikitext
12738 *[http://example.com/-{foo Example in URL]
12739 *[http://example.com Example in -{link} description]
12740 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12741 !! html/php+tidy
12742 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12743 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12744 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12745 !! html/parsoid
12746 <ul>
12747 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12748 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12749 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12750 </ul>
12751 !! end
12752
12753 !! test
12754 Preprocessor precedence 14: broken language converter in comment
12755 !! wikitext
12756 *<!--{{foo}}-->...should be ok
12757 *<!---{{foo}}-->...extra dashes
12758 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12759 !! html/php+tidy
12760 <ul><li>...should be ok</li>
12761 <li>...extra dashes</li>
12762 <li>foobat...should be ok</li></ul>
12763 !! html/parsoid
12764 <ul>
12765 <li><!--{{foo}}-->...should be ok</li>
12766 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12767 <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>
12768 </ul>
12769 !! end
12770
12771 !! test
12772 Preprocessor precedence 15: broken brace markup in headings
12773 !! config
12774 wgFragmentMode=[ 'html5', 'legacy' ]
12775 !! options
12776 parsoid=wt2html
12777 !! wikitext
12778 __NOTOC__ __NOEDITSECTION__
12779 ===1 foo[bar 1===
12780 1
12781 ===2 foo[[bar 2===
12782 2
12783 ===3 foo{bar 3===
12784 3
12785 ===4 foo{{bar 4===
12786 4
12787 ===5 foo{{{bar 5===
12788 5
12789 ===6 foo-{bar 6===
12790 6
12791 !! html/php+tidy
12792 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12793 <p>1
12794 </p>
12795 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12796 <p>2
12797 </p>
12798 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12799 <p>3
12800 </p>
12801 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12802 <p>4
12803 </p>
12804 <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>
12805 <p>5
12806 </p>
12807 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12808 <p>6
12809 </p>
12810 !! html/parsoid
12811 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12812 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12813 <p>1</p>
12814 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12815 <p>2</p>
12816 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12817 <p>3</p>
12818 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12819 <p>4</p>
12820 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12821 <p>5</p>
12822 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12823 <p>6</p>
12824 !! end
12825
12826 !! test
12827 Preprocessor precedence 16: matching closing braces to opening braces
12828 !! options
12829 language=zh
12830 parsoid=wt2html
12831 !! wikitext
12832 -{{{echo|foo}}bar}-
12833 !! html/php
12834 <p>foobar
12835 </p>
12836 !! html/parsoid
12837 <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>
12838 !! end
12839
12840 !! test
12841 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12842 !! options
12843 parsoid=wt2html
12844 !! wikitext
12845 {{echo|hi {{}}}}
12846 !! html/php
12847 <p>hi {{}}
12848 </p>
12849 !! html/parsoid
12850 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12851 !! end
12852
12853 # Ensure we're using a language without variants for this test; even
12854 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12855 !! test
12856 Preprocessor precedence 18: another rightmost wins scenario
12857 !! options
12858 parsoid=wt2html
12859 language=de
12860 !! wikitext
12861 {{ -{{{{1|tplarg}}} }} }-
12862 !! html/php
12863 <p>{{ -{tplarg }} }-
12864 </p>
12865 !! html/parsoid
12866 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12867 !! end
12868
12869 !! test
12870 Preprocessor precedence 19: break syntax
12871 !! options
12872 parsoid=wt2html
12873 !! wikitext
12874 -{{
12875 !! html/php
12876 <p>-{{
12877 </p>
12878 !! html/parsoid
12879 <p>-{{</p>
12880 !! end
12881
12882 ###
12883 ### Token Stream Patcher tests
12884 ###
12885 ### These tests won't always pass wt2wt and other modes because
12886 ### on serialization, the table will be output on a new line.
12887 ### For now, we are blacklisting them, and using this to test selser.
12888 ###
12889
12890 !!test
12891 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12892 !!options
12893 parsoid=wt2html,wt2wt
12894 !!wikitext
12895 {{echo|}}{| width = '100%'
12896 |foo
12897 |}
12898 !!html/parsoid
12899 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12900 <tbody><tr><td>foo</td></tr>
12901 </tbody></table>
12902 !!end
12903
12904 ## We used to, but no longer wt2wt this test since the default serializer
12905 ## will normalize the include directives to serialize on their own line.
12906 ## Selser will take care of preserving formatting in scenarios where they
12907 ## intermingled with other wikitext.
12908 !!test
12909 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12910 !!options
12911 parsoid=wt2html
12912 !!wikitext
12913 <includeonly>a</includeonly>{| {{{b}}}
12914 |c
12915 |}
12916 !!html/parsoid
12917 <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":""}]]}'>
12918 <tbody><tr><td>c</td></tr>
12919 </tbody></table>
12920 !!end
12921
12922 !! test
12923 Table wikitext syntax outside wiki-tables
12924 !! wikitext
12925 a
12926 |+ not a caption
12927 ! not a table heading
12928 |- not a table row
12929 | not a table cell
12930 | class="foo bar" | baz
12931 b
12932 |}
12933 |-
12934 c
12935 !! html
12936 <p>a
12937 |+ not a caption
12938 ! not a table heading
12939 |- not a table row
12940 | not a table cell
12941 | class="foo bar" | baz
12942 b
12943 |}
12944 |-
12945 c
12946 </p>
12947 !! end
12948
12949 ###
12950 ### Testing parsing of templates where a template arg
12951 ### has the same name as the template itself.
12952 ###
12953
12954 !! article
12955 Template:quote
12956 !! text
12957 {{{quote|{{{1}}}}}}
12958 !! endarticle
12959
12960 !!test
12961 Templates: Template Name/Arg clash: 1. Use of positional param
12962 !! wikitext
12963 {{quote|foo}}
12964 !! html
12965 <p>foo
12966 </p>
12967 !!end
12968
12969 !!test
12970 Templates: Template Name/Arg clash: 2. Use of named param
12971 !! wikitext
12972 {{quote|quote=foo}}
12973 !! html
12974 <p>foo
12975 </p>
12976 !!end
12977
12978 !!test
12979 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12980 !! wikitext
12981 {{quote|quote}}
12982 !! html
12983 <p>quote
12984 </p>
12985 !!end
12986
12987 ###
12988 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12989 ###
12990
12991 !!test
12992 Templates: 1. Simple use
12993 !! wikitext
12994 {{echo|Foo}}
12995 !! html
12996 <p>Foo
12997 </p>
12998 !!end
12999
13000 !!test
13001 Templates: 2. Inside a block tag
13002 !! wikitext
13003 <div>{{echo|Foo}}</div>
13004 <blockquote>{{echo|Foo}}</blockquote>
13005 !! html
13006 <div>Foo</div>
13007 <blockquote>Foo</blockquote>
13008
13009 !! html+tidy
13010 <div>Foo</div>
13011 <blockquote><p>Foo</p></blockquote>
13012 !!end
13013
13014 !!test
13015 Templates: P-wrapping: 1a. Templates on consecutive lines
13016 !! wikitext
13017 {{echo|Foo}}
13018 {{echo|bar}}
13019 !! html
13020 <p>Foo
13021 bar
13022 </p>
13023 !!end
13024
13025 !!test
13026 Templates: P-wrapping: 1b. Templates on consecutive lines
13027 !! wikitext
13028 Foo
13029
13030 {{echo|bar}}
13031 {{echo|baz}}
13032 !! html
13033 <p>Foo
13034 </p><p>bar
13035 baz
13036 </p>
13037 !!end
13038
13039 !!test
13040 Templates: P-wrapping: 1c. Templates on consecutive lines
13041 !! wikitext
13042 {{echo|Foo}}
13043 {{echo|bar}} <div>baz</div>
13044 !! html
13045 <p>Foo
13046 </p>
13047 bar <div>baz</div>
13048
13049 !! html+tidy
13050 <p>Foo
13051 </p><p>
13052 bar </p><div>baz</div>
13053 !! end
13054
13055 !! test
13056 Templates: P-wrapping: 1d. Template preceded by comment-only line
13057 !! wikitext
13058 <!-- foo -->
13059 {{echo|Bar}}
13060 !! html/php+tidy
13061 <p>Bar
13062 </p>
13063 !! html/parsoid
13064 <!-- foo -->
13065
13066 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
13067 !!end
13068
13069 !! test
13070 Templates: Scopes should not be expanded unnecessarily
13071 !! options
13072 parsoid=wt2html,wt2wt
13073 !! wikitext
13074 {{echo|<div>a</div>}}b{{echo|
13075 <div>c</div>}}
13076 !! html/php+tidy
13077 <div>a</div><p>b
13078 </p><div>c</div>
13079 !! html/parsoid
13080 <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}}]}'>
13081 </span><div about="#mwt2">c</div>
13082 !! end
13083
13084 !!test
13085 Templates: Inline Text: 1. Multiple template uses
13086 !! wikitext
13087 {{echo|Foo}}bar{{echo|baz}}
13088 !! html
13089 <p>Foobarbaz
13090 </p>
13091 !!end
13092
13093 !!test
13094 Templates: Inline Text: 2. Back-to-back template uses
13095 !! wikitext
13096 {{echo|Foo}}{{echo|bar}}
13097 !! html
13098 <p>Foobar
13099 </p>
13100 !!end
13101
13102 !!test
13103 Templates: Block Tags: 1. Multiple template uses
13104 !! wikitext
13105 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13106 !! html
13107 <div>Foo</div><div>bar</div><div>baz</div>
13108
13109 !!end
13110
13111 !!test
13112 Templates: Block Tags: 2. Back-to-back template uses
13113 !! wikitext
13114 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13115 !! html
13116 <div>Foo</div><div>bar</div>
13117
13118 !!end
13119
13120 ## Parsoid drops empty elements in templates.
13121 !! test
13122 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13123 !! wikitext
13124 {{echo|a
13125 b</p>}}
13126 !! html/php+tidy
13127 <p>a
13128 </p><p>
13129 b</p><p class="mw-empty-elt"></p>
13130 !! html/parsoid
13131 <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">
13132 </span><p about="#mwt1">b</p>
13133 !! end
13134
13135 !!test
13136 Templates: Links: 1. Simple example
13137 !! wikitext
13138 {{echo|[[Foo|bar]]}}
13139 !! html
13140 <p><a href="/wiki/Foo" title="Foo">bar</a>
13141 </p>
13142 !!end
13143
13144 !!test
13145 Templates: Links: 2. Generation of link href
13146 !! wikitext
13147 [[{{echo|Foo}}|bar]]
13148 !! html
13149 <p><a href="/wiki/Foo" title="Foo">bar</a>
13150 </p>
13151 !!end
13152
13153 !!test
13154 Templates: Links: 3. Generation of part of a link href
13155 !! wikitext
13156 [[Fo{{echo|o}}|bar]]
13157
13158 [[Foo{{echo|bar}}]]
13159
13160 [[Foo{{echo|bar}}baz]]
13161
13162 [[Foo{{echo|bar}}|bar]]
13163
13164 [[:Foo{{echo|bar}}]]
13165
13166 [[:Foo{{echo|bar}}|bar]]
13167 !! html
13168 <p><a href="/wiki/Foo" title="Foo">bar</a>
13169 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13170 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13171 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13172 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13173 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13174 </p>
13175 !!end
13176
13177 !!test
13178 Templates: Links: 4. Multiple templates generating link href
13179 !! wikitext
13180 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13181 !! html
13182 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13183 </p>
13184 !!end
13185
13186 !!test
13187 Templates: Links: 5. Generation of link text
13188 !! wikitext
13189 [[Foo|{{echo|bar}}]]
13190 !! html
13191 <p><a href="/wiki/Foo" title="Foo">bar</a>
13192 </p>
13193 !!end
13194
13195 !!test
13196 Templates: Links: 5. Nested templates (only outermost template should be marked)
13197 !! wikitext
13198 {{echo|[[{{echo|Foo}}|bar]]}}
13199 !! html
13200 <p><a href="/wiki/Foo" title="Foo">bar</a>
13201 </p>
13202 !!end
13203
13204 !!test
13205 Templates: HTML Tag: 1. Generation of HTML attr. key
13206 !! wikitext
13207 <div {{echo|style}}="color:red;">foo</div>
13208 !! html
13209 <div style="color:red;">foo</div>
13210
13211 !!end
13212
13213 !!test
13214 Templates: HTML Tag: 2. Generation of HTML attr. value
13215 !! wikitext
13216 <div style={{echo|'color:red;'}}>foo</div>
13217 !! html
13218 <div style="color:red;">foo</div>
13219
13220 !!end
13221
13222 !!test
13223 Templates: HTML Tag: 3. Generation of HTML attr key and value
13224 !! wikitext
13225 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13226 !! html
13227 <div style="color:red;">foo</div>
13228
13229 !!end
13230
13231 !!test
13232 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13233 !! wikitext
13234 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13235 !! html
13236 <div title="This is a long title with just one piece templated">foo</div>
13237
13238 !!end
13239
13240 !!test
13241 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13242 !! wikitext
13243 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13244 !! html
13245 <div title="This is a long title with just one piece templated">foo</div>
13246
13247 !!end
13248
13249 !!test
13250 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13251 !! wikitext
13252 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13253 !! html
13254 <div title="This is a long title with just one piece templated">foo</div>
13255
13256 !!end
13257
13258 # SSS FIXME: While it is great we added support for all this,
13259 # do we want to make this part of the spec? Maybe we want to
13260 # deprecate this kind of usage in the future?
13261 !!test
13262 Templates: HTML Tag: 7. Generation of partial attribute key string
13263 !! wikitext
13264 <div st{{echo|yle}}="color:red;">foo</div>
13265 !! html
13266 <div style="color:red;">foo</div>
13267
13268 !!end
13269
13270 !! test
13271 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13272 !! wikitext
13273 <div {{echo|1=id="v1"}}>bar</div>
13274 !! html
13275 <div id="v1">bar</div>
13276
13277 !!end
13278
13279 !! test
13280 Templates: HTML Tag: 9. Multiple template-generated attributes
13281 !! wikitext
13282 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13283 !! html
13284 <div id="v1" title="foo">bar</div>
13285
13286 !!end
13287
13288 !! test
13289 Templates: Support for templates generating attributes and content
13290 !! wikitext
13291 {| {{mixed_attr_content_template}}
13292 |-
13293 |bar
13294 |}
13295 !! html/php
13296 <table style="color:red;" title="T48811">
13297
13298 <tr>
13299 <td>foo
13300 </td></tr>
13301 <tr>
13302 <td>bar
13303 </td></tr></table>
13304
13305 !! html/parsoid
13306 <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|}"]}'>
13307 <tbody><tr>
13308 <td>foo</td></tr>
13309 <tr>
13310 <td>bar</td></tr>
13311 </tbody></table>
13312 !!end
13313
13314 !! article
13315 Template:attribute_from_template
13316 !! text
13317 class="123"
13318 !! endarticle
13319
13320 !! test
13321 Table cell with attribute before expanded attribute
13322 !! wikitext
13323 {|
13324 | align="center" {{attribute_from_template}} |456
13325 |}
13326 !! html/parsoid
13327 <table>
13328 <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>
13329 </tbody></table>
13330 !! end
13331
13332 !! test
13333 1. Entities and nowikis inside templated attributes should be handled correctly
13334 !! wikitext
13335 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13336 !! html/php
13337 <div style="background:#f9f9f9;">foo</div>
13338
13339 !! html/parsoid
13340 <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>
13341 !! end
13342
13343 !! test
13344 2. Entities and nowikis inside templated attributes should be handled correctly
13345 !! wikitext
13346 {|
13347 |{{table_attribs_3}}
13348 |}
13349 !! html/php
13350 <table>
13351 <tr>
13352 <td style="background:#f9f9f9;">Foo
13353 </td></tr></table>
13354
13355 !! html/parsoid
13356 <table>
13357 <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>
13358 </tbody></table>
13359 !! end
13360
13361 !! test
13362 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13363 !! wikitext
13364 {{tbl-start}}
13365 |{{table_attribs_3}}
13366 {{tbl-end}}
13367 !! html/php
13368 <table>
13369 <tr>
13370 <td style="background:#f9f9f9;">Foo
13371 </td></tr></table>
13372
13373 !! html/parsoid
13374 <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}}]}'>
13375 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13376 </tbody></table>
13377 !! end
13378
13379 # T107622
13380 !! test
13381 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13382 !! wikitext
13383 {|
13384 |{{table_attribs_6}} hi
13385 |}
13386 !! html/php
13387 <table>
13388 <tr>
13389 <td style="background: red;">hi
13390 </td></tr></table>
13391
13392 !! html/parsoid
13393 <table>
13394 <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>
13395 </tbody></table>
13396 !! end
13397
13398 !!test
13399 Templates: HTML Tables: 1. Generating start of a HTML table
13400 !! wikitext
13401 {{echo|<table><tr><td>foo</td>}}</tr></table>
13402 !! html
13403 <table><tr><td>foo</td></tr></table>
13404
13405 !!end
13406
13407 !!test
13408 Templates: HTML Tables: 2a. Generating middle of a HTML table
13409 !! wikitext
13410 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13411 !! html
13412 <table><tr><td>foo</td></tr></table>
13413
13414 !!end
13415
13416 !!test
13417 Templates: HTML Tables: 2b. Generating middle of a HTML table
13418 !! wikitext
13419 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13420 !! html
13421 <table><tr><td>foo</td></tr></table>
13422
13423 !!end
13424
13425 !!test
13426 Templates: HTML Tables: 3. Generating end of a HTML table
13427 !! wikitext
13428 <table><tr>{{echo|<td>foo</td></tr></table>}}
13429 !! html
13430 <table><tr><td>foo</td></tr></table>
13431
13432 !!end
13433
13434 !!test
13435 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13436 !! wikitext
13437 {{echo|<table>}}<tr><td>foo</td></tr></table>
13438 !! html
13439 <table><tr><td>foo</td></tr></table>
13440
13441 !!end
13442
13443 !!test
13444 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13445 !! wikitext
13446 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13447 !! html
13448 <table><tr><td>foo</td></tr></table>
13449
13450 !!end
13451
13452 !!test
13453 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13454 !! wikitext
13455 <table><tr>{{echo|<td>}}foo</td></tr></table>
13456 !! html
13457 <table><tr><td>foo</td></tr></table>
13458
13459 !!end
13460
13461 !!test
13462 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13463 !! wikitext
13464 <table><tr><td>foo{{echo|</td>}}</tr></table>
13465 !! html
13466 <table><tr><td>foo</td></tr></table>
13467
13468 !!end
13469
13470 !!test
13471 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13472 !! wikitext
13473 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13474 !! html
13475 <table><tr><td>foo</td></tr></table>
13476
13477 !!end
13478
13479 !!test
13480 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13481 !! wikitext
13482 <table><tr><td>foo</td></tr>{{echo|</table>}}
13483 !! html
13484 <table><tr><td>foo</td></tr></table>
13485
13486 !!end
13487
13488 !!test
13489 Templates: HTML Tables: 5. Proper fostering of categories from inside
13490 !!options
13491 parsoid=wt2html,wt2wt
13492 !! wikitext
13493 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13494 <!--Two categories (T52330)-->
13495 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13496 !! html/php+tidy
13497 <table><tbody><tr><td>foo</td></tr></tbody></table>
13498 <table><tbody><tr><td>foo</td></tr></tbody></table>
13499 !! html/parsoid
13500 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13501 <!--Two categories (T52330)-->
13502 <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>
13503 !!end
13504
13505 ## Remex doesn't account for fostered content.
13506 !! test
13507 Templates: Wiki Tables: 1a. Fostering of entire template content
13508 !! wikitext
13509 {|
13510 {{echo|a}}
13511 |}
13512 !! html/php
13513 <table>
13514 a
13515 <tr><td></td></tr></table>
13516
13517 !! html/php+tidy
13518
13519 a
13520 <table><tbody><tr><td></td></tr></tbody></table>
13521 !! html/parsoid
13522 <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">
13523
13524 </table>
13525 !! end
13526
13527 !!test
13528 Templates: Wiki Tables: 1b. Fostering of entire template content
13529 !! wikitext
13530 {|
13531 {{echo|<div>}}
13532 foo
13533 {{echo|</div>}}
13534 |}
13535 !! html
13536 <table>
13537 <div>
13538 <p>foo
13539 </p>
13540 </div>
13541 <tr><td></td></tr></table>
13542
13543 !! html/php+tidy
13544 <div>
13545 <p>foo
13546 </p>
13547 </div><table>
13548
13549 <tbody><tr><td></td></tr></tbody></table>
13550 !! html/parsoid
13551 <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|}"]}'>
13552 <p>foo</p>
13553 </div><table about="#mwt3">
13554
13555 </table>
13556 !! end
13557
13558 ## Remex doesn't account for fostered content.
13559 !! test
13560 Templates: Wiki Tables: 2. Fostering of partial template content
13561 !! wikitext
13562 {|
13563 {{echo|a
13564 <div>b</div>}}
13565 |}
13566 !! html/php
13567 <table>
13568 a
13569 <div>b</div>
13570 <tr><td></td></tr></table>
13571
13572 !! html/php+tidy
13573
13574 a
13575 <div>b</div><table>
13576 <tbody><tr><td></td></tr></tbody></table>
13577 !! html/parsoid
13578 <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">
13579
13580
13581 </table>
13582 !! end
13583
13584 !!test
13585 Templates: Wiki Tables: 3. td-content via multiple templates
13586 !! wikitext
13587 {|
13588 {{echo|{{pipe}}a}}{{echo|b}}
13589 |}
13590 !! html
13591 <table>
13592 <tr>
13593 <td>ab
13594 </td></tr></table>
13595
13596 !!end
13597
13598 !!test
13599 Templates: Wiki Tables: 4. Templated tags, no content
13600 !! wikitext
13601 {{tbl-start}}
13602 {{tbl-end}}
13603 !! html
13604 <table>
13605 <tr><td></td></tr></table>
13606
13607 !!end
13608
13609 !!test
13610 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13611 !! wikitext
13612 {{tbl-start}}
13613 |foo
13614 {{tbl-end}}
13615 !! html
13616 <table>
13617 <tr>
13618 <td>foo
13619 </td></tr></table>
13620
13621 !!end
13622
13623 !!test
13624 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13625 !! wikitext
13626 {{tbl-start}}
13627 {{!}}foo
13628 {{tbl-end}}
13629 !! html
13630 <table>
13631 <tr>
13632 <td>foo
13633 </td></tr></table>
13634
13635 !!end
13636
13637 ## This test case is very specific to Parsoid's internals
13638 ## and is hence only tested for Parsoid's code. Parsoid uses
13639 ## a <meta> marker tag for <ref> tags and they are expanded
13640 ## much later. We are verifying that this <meta> tag usage
13641 ## doesn't prevent foster parenting.
13642 !! test
13643 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13644 !! wikitext
13645 {{PartialTable}}<ref>foo</ref>
13646 |}
13647
13648 <references />
13649 !! html/parsoid
13650 <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">
13651 <tbody>
13652 </tbody></table>
13653
13654 <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>
13655 !! end
13656
13657 !! test
13658 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13659 !! wikitext
13660 {{echo|
13661 {{{!}}
13662 {{!}}-}}
13663 <onlyinclude>
13664 |foo
13665 </onlyinclude>
13666 {{!}}}
13667 !! html/parsoid
13668 <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{{!}}}"]}'>
13669 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13670 <tbody><tr>
13671
13672 <td>foo
13673 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13674 </tbody></table>
13675 !! end
13676
13677 !!test
13678 Templates: Lists: Multi-line list-items via templates
13679 !! wikitext
13680 *{{echo|a {{nonexistent|
13681 unused}}}}
13682 *{{echo|b {{nonexistent|
13683 unused}}}}
13684 !! html
13685 <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>
13686 <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>
13687
13688 !!end
13689
13690 !!test
13691 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13692 !! wikitext
13693 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13694 !! html
13695 <p><i>ab</i>c<i>d</i>e
13696 </p>
13697 !!end
13698
13699 !!test
13700 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13701 (PHP parser generates misnested html)
13702 !! wikitext
13703 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13704 !! html/parsoid
13705 <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>
13706 !!end
13707
13708 !!test
13709 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13710 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13711 !! options
13712 parsoid=wt2html,wt2wt
13713 !! wikitext
13714 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13715 !! html/php+tidy
13716 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13717 !! html/parsoid
13718 <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>
13719 <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>
13720 <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>
13721 !!end
13722
13723 !!test
13724 Templates: Ugly nesting: 4. Divs opened/closed across templates
13725 !! wikitext
13726 a<div>b{{echo|c</div>d}}e
13727 !! html
13728 a<div>bc</div>de
13729
13730 !! html+tidy
13731 <p>a</p><div>bc</div><p>de
13732 </p>
13733 !! end
13734
13735 !! test
13736 Templates: Ugly templates: 3. newline-only template parameter
13737 !! wikitext
13738 foo {{echo|
13739 }}
13740 !! html
13741 <p>foo
13742 </p>
13743 !! end
13744
13745 # This looks like a bug: a single newline triggers p/br for some reason.
13746 !! test
13747 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13748 !! wikitext
13749 {{echo|
13750 }}
13751 !! html
13752 <p><br />
13753 </p>
13754 !! end
13755
13756 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13757 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13758 !! test
13759 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13760 !! wikitext
13761 {{echo|<table>}}
13762 {{echo|<div>foo}}
13763 {{echo|</table>}}
13764 !! html/parsoid
13765 <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">
13766 </span><table about="#mwt1">
13767 </table>
13768 !! end
13769
13770 # T66017 -- ugly wikitext with fostered content generates two template ranges
13771 # that are "identical" and generate nesting cycles in the algorithm
13772 !! test
13773 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13774 !! wikitext
13775 {{echo|<table><tr><td><table>}}
13776 {{echo|<div>}}
13777 {{echo|</div>}}
13778 !! html/parsoid
13779 <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"}'>
13780 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13781 </table></td></tr></tbody></table>
13782 !! end
13783
13784 !! test
13785 Templates: Parameters substituted at the top-level
13786 !! wikitext
13787 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13788
13789 {{{foo|bar|baz}}}
13790 !! html/php
13791 <p><i>who</i> me? <b>never!</b>
13792 </p><p>bar
13793 </p>
13794 !! html/parsoid
13795 <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>
13796
13797 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13798 !! end
13799
13800 !! test
13801 Templates: Param with empty arg in the final position
13802 !! wikitext
13803 {{{hi|}}}
13804 !! html/parsoid
13805 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13806 !! end
13807
13808 !!test
13809 Parser Functions: 1. Simple example
13810 !! wikitext
13811 {{uc:foo}}
13812 !! html
13813 <p>FOO
13814 </p>
13815 !!end
13816
13817 !!test
13818 Parser Functions: 2. Nested use (only outermost should be marked up)
13819 !! wikitext
13820 {{uc:{{lc:FOO}}}}
13821 !! html
13822 <p>FOO
13823 </p>
13824 !!end
13825
13826 ## Note that the templates inside the references are not wrapped
13827 !! test
13828 Template nested in extension tag in template
13829 !! options
13830 language=zh
13831 !! wikitext
13832 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13833 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13834 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13835 <references />
13836 !! html/parsoid
13837 <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>
13838 <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>
13839 <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>
13840 <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>
13841 !! end
13842
13843 ###
13844 ### Pre-save transform tests
13845 ###
13846
13847 !! test
13848 pre-save transform: subst:
13849 !! options
13850 pst
13851 !! wikitext
13852 {{subst:test}}
13853 !! html/php
13854 This is a test template
13855 !! end
13856
13857 !! test
13858 pre-save transform: normal template
13859 !! options
13860 pst
13861 !! wikitext
13862 {{test}}
13863 !! html/php
13864 {{test}}
13865 !! end
13866
13867 !! test
13868 pre-save transform: nonexistent template
13869 !! options
13870 pst
13871 !! wikitext
13872 {{thistemplatedoesnotexist}}
13873 !! html/php
13874 {{thistemplatedoesnotexist}}
13875 !! end
13876
13877 !! test
13878 pre-save transform: subst magic variables
13879 !! options
13880 pst
13881 !! wikitext
13882 {{subst:SITENAME}}
13883 !! html/php
13884 MediaWiki
13885 !! end
13886
13887 # This is T2089, which I fixed. -- wtm
13888 !! test
13889 pre-save transform: subst: templates with parameters
13890 !! options
13891 pst
13892 !! wikitext
13893 {{subst:paramtest|param="something else"}}
13894 !! html/php
13895 This is a test template with parameter "something else"
13896 !! end
13897
13898 !! article
13899 Template:nowikitest
13900 !! text
13901 <nowiki>'''not wiki'''</nowiki>
13902 !! endarticle
13903
13904 !! test
13905 pre-save transform: nowiki in subst (T3188)
13906 !! options
13907 pst
13908 !! wikitext
13909 {{subst:nowikitest}}
13910 !! html/php
13911 <nowiki>'''not wiki'''</nowiki>
13912 !! end
13913
13914 !! article
13915 Template:commenttest
13916 !! text
13917 This template has <!-- a comment --> in it.
13918 !! endarticle
13919
13920 !! test
13921 pre-save transform: comment in subst (T3936)
13922 !! options
13923 pst
13924 !! wikitext
13925 {{subst:commenttest}}
13926 !! html/php
13927 This template has <!-- a comment --> in it.
13928 !! end
13929
13930 !! test
13931 pre-save transform: unclosed tag
13932 !! options
13933 pst
13934 !! wikitext
13935 <nowiki>'''not wiki'''
13936 !! html/php
13937 <nowiki>'''not wiki'''
13938 !! end
13939
13940 !! test
13941 pre-save transform: mixed tag case
13942 !! options
13943 pst
13944 !! wikitext
13945 <NOwiki>'''not wiki'''</noWIKI>
13946 !! html/php
13947 <NOwiki>'''not wiki'''</noWIKI>
13948 !! end
13949
13950 !! test
13951 pre-save transform: unclosed comment in <nowiki>
13952 !! options
13953 pst
13954 !! wikitext
13955 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13956 !! html/php
13957 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13958 !!end
13959
13960 # Leading @ in this template definition works around a limitation
13961 # in parsoid's parserTests which otherwise strips the <span> from the
13962 # result (confusing it for a template wrapper)
13963 !! article
13964 Template:dangerous
13965 !!text
13966 @<span onmouseover="alert('crap')">Oh no</span>
13967 !!endarticle
13968
13969 !!test
13970 (confirming safety of fix for subst T3936)
13971 !! wikitext
13972 {{Template:dangerous}}
13973 !! html
13974 <p>@<span>Oh no</span>
13975 </p>
13976 !! end
13977
13978 !! test
13979 pre-save transform: comment containing gallery (T7024)
13980 !! options
13981 pst
13982 !! wikitext
13983 <!-- <gallery>data</gallery> -->
13984 !! html/php
13985 <!-- <gallery>data</gallery> -->
13986 !!end
13987
13988 !! test
13989 pre-save transform: comment containing extension
13990 !! options
13991 pst
13992 !! wikitext
13993 <!-- <tag>data</tag> -->
13994 !! html/php
13995 <!-- <tag>data</tag> -->
13996 !!end
13997
13998 !! test
13999 pre-save transform: comment containing nowiki
14000 !! options
14001 pst
14002 !! wikitext
14003 <!-- <nowiki>data</nowiki> -->
14004 !! html/php
14005 <!-- <nowiki>data</nowiki> -->
14006 !!end
14007
14008 !! test
14009 pre-save transform: <noinclude> in subst (T5298)
14010 !! options
14011 pst
14012 !! wikitext
14013 {{subst:Includes}}
14014 !! html/php
14015 Foobar
14016 !! end
14017
14018 !! test
14019 pre-save transform: <onlyinclude> in subst (T5298)
14020 !! options
14021 pst
14022 !! wikitext
14023 {{subst:Includes2}}
14024 !! html/php
14025 Foo
14026 !! end
14027
14028 !! article
14029 Template:SubstTest
14030 !!text
14031 {{<includeonly>subst:</includeonly>Includes}}
14032 !! endarticle
14033
14034 !! article
14035 Template:SafeSubstTest
14036 !! text
14037 {{<includeonly>safesubst:</includeonly>Includes}}
14038 !! endarticle
14039
14040 !! test
14041 T24297: safesubst: works during PST
14042 !! options
14043 pst
14044 !! wikitext
14045 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
14046 !! html/php
14047 FoobarFoobar
14048 !! end
14049
14050 !! test
14051 T24297: safesubst: works during normal parse
14052 !! wikitext
14053 {{SafeSubstTest}}
14054 !! html
14055 <p>Foobar
14056 </p>
14057 !! end
14058
14059 !! test
14060 subst: does not work during normal parse
14061 !! wikitext
14062 {{SubstTest}}
14063 !! html
14064 <p>{{subst:Includes}}
14065 </p>
14066 !! end
14067
14068 !! test
14069 pre-save transform: context links ("pipe trick")
14070 !! options
14071 pst
14072 !! wikitext
14073 [[Article (context)|]]
14074 [[Bar:Article|]]
14075 [[:Bar:Article|]]
14076 [[Bar:Article (context)|]]
14077 [[:Bar:Article (context)|]]
14078 [[|Article]]
14079 [[|Article (context)]]
14080 [[Bar:X (Y) Z|]]
14081 [[:Bar:X (Y) Z|]]
14082 !! html/php
14083 [[Article (context)|Article]]
14084 [[Bar:Article|Article]]
14085 [[:Bar:Article|Article]]
14086 [[Bar:Article (context)|Article]]
14087 [[:Bar:Article (context)|Article]]
14088 [[Article]]
14089 [[Article (context)]]
14090 [[Bar:X (Y) Z|X (Y) Z]]
14091 [[:Bar:X (Y) Z|X (Y) Z]]
14092 !! end
14093
14094 !! test
14095 pre-save transform: context links ("pipe trick") with interwiki prefix
14096 !! options
14097 pst
14098 !! wikitext
14099 [[interwiki:Article|]]
14100 [[:interwiki:Article|]]
14101 [[interwiki:Bar:Article|]]
14102 [[:interwiki:Bar:Article|]]
14103 !! html/php
14104 [[interwiki:Article|Article]]
14105 [[:interwiki:Article|Article]]
14106 [[interwiki:Bar:Article|Bar:Article]]
14107 [[:interwiki:Bar:Article|Bar:Article]]
14108 !! end
14109
14110 !! test
14111 pre-save transform: context links ("pipe trick") with parens in title
14112 !! options
14113 pst title=[[Somearticle (context)]]
14114 !! wikitext
14115 [[|Article]]
14116 !! html/php
14117 [[Article (context)|Article]]
14118 !! end
14119
14120 !! test
14121 pre-save transform: context links ("pipe trick") with comma in title
14122 !! options
14123 pst title=[[Someplace, Somewhere]]
14124 !! wikitext
14125 [[|Otherplace]]
14126 [[Otherplace, Elsewhere|]]
14127 [[Otherplace, Elsewhere, Anywhere|]]
14128 !! html/php
14129 [[Otherplace, Somewhere|Otherplace]]
14130 [[Otherplace, Elsewhere|Otherplace]]
14131 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14132 !! end
14133
14134 !! test
14135 pre-save transform: context links ("pipe trick") with parens and comma
14136 !! options
14137 pst title=[[Someplace (IGNORED), Somewhere]]
14138 !! wikitext
14139 [[|Otherplace]]
14140 [[Otherplace (place), Elsewhere|]]
14141 !! html/php
14142 [[Otherplace, Somewhere|Otherplace]]
14143 [[Otherplace (place), Elsewhere|Otherplace]]
14144 !! end
14145
14146 !! test
14147 pre-save transform: context links ("pipe trick") with comma and parens
14148 !! options
14149 pst title=[[Who, me? (context)]]
14150 !! wikitext
14151 [[|Yes, you.]]
14152 [[Me, Myself, and I (1937 song)|]]
14153 !! html/php
14154 [[Yes, you. (context)|Yes, you.]]
14155 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14156 !! end
14157
14158 !! test
14159 pre-save transform: context links ("pipe trick") with namespace
14160 !! options
14161 pst title=[[Ns:Somearticle]]
14162 !! wikitext
14163 [[|Article]]
14164 !! html/php
14165 [[Ns:Article|Article]]
14166 !! end
14167
14168 !! test
14169 pre-save transform: context links ("pipe trick") with namespace and parens
14170 !! options
14171 pst title=[[Ns:Somearticle (context)]]
14172 !! wikitext
14173 [[|Article]]
14174 !! html/php
14175 [[Ns:Article (context)|Article]]
14176 !! end
14177
14178 !! test
14179 pre-save transform: context links ("pipe trick") with namespace and comma
14180 !! options
14181 pst title=[[Ns:Somearticle, Context, Whatever]]
14182 !! wikitext
14183 [[|Article]]
14184 !! html/php
14185 [[Ns:Article, Context, Whatever|Article]]
14186 !! end
14187
14188 !! test
14189 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14190 !! options
14191 pst title=[[Ns:Somearticle, Context (context)]]
14192 !! wikitext
14193 [[|Article]]
14194 !! html/php
14195 [[Ns:Article (context)|Article]]
14196 !! end
14197
14198 !! test
14199 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14200 !! options
14201 pst title=[[Ns:Somearticle (IGNORED), Context]]
14202 !! wikitext
14203 [[|Article]]
14204 !! html/php
14205 [[Ns:Article, Context|Article]]
14206 !! end
14207
14208 !! test
14209 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14210 !! options
14211 pst
14212 !! wikitext
14213 [[Article(context)|]]
14214 [[Bar:Article(context)|]]
14215 [[:Bar:Article(context)|]]
14216 [[|Article(context)]]
14217 [[Bar:X(Y)Z|]]
14218 [[:Bar:X(Y)Z|]]
14219 !! html/php
14220 [[Article(context)|Article]]
14221 [[Bar:Article(context)|Article]]
14222 [[:Bar:Article(context)|Article]]
14223 [[Article(context)]]
14224 [[Bar:X(Y)Z|X(Y)Z]]
14225 [[:Bar:X(Y)Z|X(Y)Z]]
14226 !! end
14227
14228 !! test
14229 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14230 !! options
14231 pst
14232 !! wikitext
14233 [[Article (context)|]]
14234 [[Bar:Article (context)|]]
14235 [[:Bar:Article (context)|]]
14236 [[|Article (context)]]
14237 [[Bar:X (Y) Z|]]
14238 [[:Bar:X (Y) Z|]]
14239 !! html/php
14240 [[Article (context)|Article]]
14241 [[Bar:Article (context)|Article]]
14242 [[:Bar:Article (context)|Article]]
14243 [[Article (context)]]
14244 [[Bar:X (Y) Z|X (Y) Z]]
14245 [[:Bar:X (Y) Z|X (Y) Z]]
14246 !! end
14247
14248 !! test
14249 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14250 !! options
14251 pst
14252 !! wikitext
14253 [[Article(context)|]]
14254 [[Bar:Article(context)|]]
14255 [[:Bar:Article(context)|]]
14256 [[|Article(context)]]
14257 [[Bar:X(Y)Z|]]
14258 [[:Bar:X(Y)Z|]]
14259 !! html/php
14260 [[Article(context)|Article]]
14261 [[Bar:Article(context)|Article]]
14262 [[:Bar:Article(context)|Article]]
14263 [[Article(context)]]
14264 [[Bar:X(Y)Z|X(Y)Z]]
14265 [[:Bar:X(Y)Z|X(Y)Z]]
14266 !! end
14267
14268 !! test
14269 pre-save transform: context links ("pipe trick") with commas (T23660)
14270 !! options
14271 pst
14272 !! wikitext
14273 [[Article (context), context|]]
14274 [[Article (context),context|]]
14275 [[Bar:Article (context), context|]]
14276 [[Bar:Article (context),context|]]
14277 [[:Bar:Article (context), context|]]
14278 [[:Bar:Article (context),context|]]
14279 !! html/php
14280 [[Article (context), context|Article]]
14281 [[Article (context),context|Article]]
14282 [[Bar:Article (context), context|Article]]
14283 [[Bar:Article (context),context|Article]]
14284 [[:Bar:Article (context), context|Article]]
14285 [[:Bar:Article (context),context|Article]]
14286 !! end
14287
14288 !! test
14289 Parsoid: backwards pipe trick
14290 !! wikitext
14291 [[|'''bar''']]
14292 !! html/php
14293 <p>[[|<b>bar</b>]]
14294 </p>
14295 !! html/parsoid
14296 <p>[[|<b>bar</b>]]</p>
14297 !! end
14298
14299 !! test
14300 pre-save transform: trim trailing empty lines
14301 !! options
14302 pst
14303 !! wikitext
14304 Empty lines are trimmed
14305
14306
14307
14308
14309 !! html/php
14310 Empty lines are trimmed
14311 !! end
14312
14313 !! test
14314 pre-save transform: Signature expansion
14315 !! options
14316 pst
14317 !! wikitext
14318 * ~~~
14319 * ~~~~
14320 * ~~~~~
14321 * <noinclude>~~~</noinclude>
14322 * <includeonly>~~~</includeonly>
14323 * <onlyinclude>~~~</onlyinclude>
14324 !! html/php
14325 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14326 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14327 * 00:02, 1 January 1970 (UTC)
14328 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14329 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14330 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14331 !! end
14332
14333
14334 !! test
14335 ParserOutput flags from signature expansion (T84843)
14336 !! options
14337 pst
14338 showflags
14339 !! wikitext
14340 ~~~~
14341 !! html/php
14342 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14343 flags=user-signature
14344 !! end
14345
14346
14347 !! test
14348 pre-save transform: Signature expansion in nowiki tags (T2093)
14349 !! options
14350 pst disabled
14351 !! wikitext
14352 Shall not expand:
14353
14354 <nowiki>~~~~</nowiki>
14355
14356 <includeonly><nowiki>~~~~</nowiki></includeonly>
14357
14358 <noinclude><nowiki>~~~~</nowiki></noinclude>
14359
14360 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14361
14362 {{subst:Foo}} shall be converted to FOO
14363
14364 As well as inside noinclude/onlyinclude
14365 <noinclude>{{subst:Foo}}</noinclude>
14366 <onlyinclude>{{subst:Foo}}</onlyinclude>
14367
14368 But not inside includeonly
14369 <includeonly>{{subst:Foo}}</includeonly>
14370 !! html/php
14371 Shall not expand:
14372
14373 <nowiki>~~~~</nowiki>
14374
14375 <includeonly><nowiki>~~~~</nowiki></includeonly>
14376
14377 <noinclude><nowiki>~~~~</nowiki></noinclude>
14378
14379 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14380
14381 FOO shall be converted to FOO
14382
14383 As well as inside noinclude/onlyinclude
14384 <noinclude>FOO</noinclude>
14385 <onlyinclude>FOO</onlyinclude>
14386
14387 But not inside includeonly
14388 <includeonly>{{subst:Foo}}</includeonly>
14389 !! end
14390
14391 !! test
14392 Parsoid: Recognize nowiki with trailing space in tags
14393 !! options
14394 parsoid=wt2html
14395 !! wikitext
14396 <nowiki ><div>[[foo]]</nowiki >
14397
14398 a<nowiki / >b
14399
14400 c<nowiki />d
14401
14402 e<nowiki/ >f
14403 !! html/php+tidy
14404 <p>&lt;div&gt;[[foo]]
14405 </p><p>a&lt;nowiki / &gt;b
14406 </p><p>cd
14407 </p><p>e&lt;nowiki/ &gt;f
14408 </p>
14409 !! html/parsoid
14410 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14411
14412 <p>a&lt;nowiki / >b</p>
14413
14414 <p>c<span typeof="mw:Nowiki"></span>d</p>
14415
14416 <p>e&lt;nowiki/ >f</p>
14417 !! end
14418
14419 !! test
14420 Parsoid: Recognize nowiki with odd capitalization
14421 !! options
14422 parsoid=wt2html
14423 !! wikitext
14424 <noWikI ><div>[[foo]]</Nowiki >
14425 !! html/php+tidy
14426 <p>&lt;div&gt;[[foo]]
14427 </p>
14428 !! html/parsoid
14429 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14430 !! end
14431
14432
14433 !! test
14434 Parsoid: Escape nowiki with trailing space in tags
14435 !! options
14436 parsoid=html2wt
14437 !! html/parsoid
14438 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14439 <p>a&lt;nowiki /&gt;b</p>
14440 <p>c&lt;nowiki/ &gt;d</p>
14441 !! wikitext
14442 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14443
14444 a&lt;nowiki /&gt;b
14445
14446 c&lt;nowiki/ &gt;d
14447 !! end
14448
14449 !! test
14450 Parsoid: Escape weird noWikI capitalizations
14451 !! options
14452 parsoid=html2wt
14453 !! html/parsoid
14454 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14455 !! wikitext
14456 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14457 !! end
14458
14459 ###
14460 ### Message transform tests
14461 ###
14462 !! test
14463 message transform: magic variables
14464 !! options
14465 msg
14466 !! wikitext
14467 {{SITENAME}}
14468 !! html
14469 MediaWiki
14470 !! end
14471
14472 !! test
14473 message transform: should not transform wiki markup
14474 !! options
14475 msg
14476 !! wikitext
14477 ''test''
14478 !! html
14479 ''test''
14480 !! end
14481
14482 !! test
14483 message transform: <noinclude> in transcluded template (T6926)
14484 !! options
14485 msg
14486 !! wikitext
14487 {{Includes}}
14488 !! html
14489 Foobar
14490 !! end
14491
14492 !! test
14493 message transform: <onlyinclude> in transcluded template (T6926)
14494 !! options
14495 msg
14496 !! wikitext
14497 {{Includes2}}
14498 !! html
14499 Foo
14500 !! end
14501
14502 !! test
14503 {{#special:}} page name, known
14504 !! options
14505 msg
14506 !! wikitext
14507 {{#special:Recentchanges}}
14508 !! html
14509 Special:RecentChanges
14510 !! end
14511
14512 !! test
14513 {{#special:}} page name with subpage, known
14514 !! options
14515 msg
14516 !! wikitext
14517 {{#special:Recentchanges/param}}
14518 !! html
14519 Special:RecentChanges/param
14520 !! end
14521
14522 !! test
14523 {{#special:}} page name, unknown
14524 !! options
14525 msg
14526 !! wikitext
14527 {{#special:foobar nonexistent}}
14528 !! html
14529 Special:Foobar nonexistent
14530 !! end
14531
14532 !! test
14533 {{#speciale:}} page name, known
14534 !! options
14535 msg
14536 !! wikitext
14537 {{#speciale:Recentchanges}}
14538 !! html
14539 Special:RecentChanges
14540 !! end
14541
14542 !! test
14543 {{#speciale:}} page name with subpage, known
14544 !! options
14545 msg
14546 !! wikitext
14547 {{#speciale:Recentchanges/param}}
14548 !! html
14549 Special:RecentChanges/param
14550 !! end
14551
14552 !! test
14553 {{#speciale:}} page name, unknown
14554 !! options
14555 msg
14556 !! wikitext
14557 {{#speciale:foobar nonexistent}}
14558 !! html
14559 Special:Foobar_nonexistent
14560 !! end
14561
14562 ###
14563 ### Images
14564 ###
14565 ### For Parsoid-specific tests, see
14566 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14567
14568 !! test
14569 Simple image
14570 !! options
14571 parsoid=wt2html,wt2wt,html2html
14572 !! wikitext
14573 [[Image:foobar.jpg]]
14574 !! html/php
14575 <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>
14576 </p>
14577 !! html/parsoid
14578 <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>
14579 !! end
14580
14581 !! test
14582 Serialize simple image with span wrapper
14583 !! options
14584 parsoid=html2wt
14585 !! html/parsoid
14586 <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>
14587 !! wikitext
14588 [[File:Foobar.jpg]]
14589 !! end
14590
14591 !! test
14592 Simple image (using File: namespace, now canonical)
14593 !! wikitext
14594 [[File:Foobar.jpg]]
14595 !! html/php
14596 <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>
14597 </p>
14598 !! html/parsoid
14599 <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>
14600 !! end
14601
14602 !! test
14603 Right-aligned image
14604 !! wikitext
14605 [[File:Foobar.jpg|right]]
14606 !! html/php
14607 <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>
14608
14609 !! html/parsoid
14610 <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>
14611 !! end
14612
14613 !! test
14614 Image with caption
14615 !! wikitext
14616 [[File:Foobar.jpg|right|Caption text]]
14617 !! html/php
14618 <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>
14619
14620 !! html/parsoid
14621 <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>
14622 !! end
14623
14624 !! test
14625 Image with caption, T55312 #1
14626 !! wikitext
14627 [[File:Foobar.jpg|right|Caption page stuff]]
14628 !! html/php
14629 <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>
14630
14631 !! html/parsoid
14632 <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>
14633 !! end
14634
14635 !! test
14636 Image with caption, T55312 #2
14637 !! wikitext
14638 [[File:Foobar.jpg|right|Caption page=]]
14639 !! html/php
14640 <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>
14641
14642 !! html/parsoid
14643 <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>
14644 !! end
14645
14646 !! test
14647 Image with caption, T55312 #3
14648 !! wikitext
14649 [[File:Foobar.jpg|right|Caption page=stuff]]
14650 !! html/php
14651 <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>
14652
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Image caption with pipe entity
14659 !! wikitext
14660 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14661 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14662 !! html/php
14663 <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>
14664 <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>
14665
14666 !! html/parsoid
14667 <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>
14668 <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>
14669 !! end
14670
14671 !! test
14672 Allow empty links in image captions (T62753)
14673 !! options
14674 thumbsize=220
14675 !! wikitext
14676 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14677 [[]]
14678 [[Link2]]
14679 ]]
14680 !! html/php
14681 <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>
14682
14683 !! html/parsoid
14684 <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>
14685 [[]]
14686 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14687 </figcaption></figure>
14688 !! end
14689
14690 !! test
14691 Titles in unlinked images (T23454)
14692 !! wikitext
14693 [[File:Foobar.jpg|link=|stuff]]
14694 !! html/php
14695 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14696 </p>
14697 !! html/parsoid
14698 <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>
14699 !! end
14700
14701 !! test
14702 Link with empty target
14703 !! wikitext
14704 [[]]
14705 !! html
14706 <p>[[]]
14707 </p>
14708 !! end
14709
14710 !! test
14711 Image with link trail
14712 !! wikitext
14713 Linktrails should not work for images: [[File:Foobar.jpg]]s
14714 !! html/php
14715 <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
14716 </p>
14717 !! html/parsoid
14718 <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>
14719 !! end
14720
14721 !! test
14722 Image with empty attribute
14723 !! options
14724 parsoid=wt2html,wt2wt,html2html
14725 !! wikitext
14726 [[File:Foobar.jpg|right||Caption text]]
14727 !! html/php
14728 <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>
14729
14730 !! html/parsoid
14731 <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>
14732 !! end
14733
14734 !! test
14735 1. Block image with individual attributes from templates
14736 !! wikitext
14737 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14738 !! html/php
14739 <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>
14740
14741 !! html/parsoid
14742 <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>
14743 !! end
14744
14745 !! test
14746 2. Block Image with individual attributes from templates
14747 !! wikitext
14748 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14749 !! html/php
14750 <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>
14751
14752 !! html/parsoid
14753 <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>
14754 !! end
14755
14756 !! test
14757 3. Inline image with individual attributes from templates
14758 !! wikitext
14759 [[File:Foobar.jpg|{{echo|50px}}]]
14760 !! html/php
14761 <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>
14762 </p>
14763 !! html/parsoid
14764 <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>
14765 !! end
14766
14767 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14768 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14769 !! test
14770 Image with multiple attributes from the same template
14771 !! wikitext
14772 [[File:Foobar.jpg|{{image_attribs}}]]
14773 !! html/php
14774 <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>
14775
14776 !! html/parsoid
14777 <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>
14778 !! end
14779
14780 !! test
14781 Image with link tails
14782 !! options
14783 thumbsize=220
14784 !! wikitext
14785 123[[File:Foobar.jpg]]456
14786 123[[File:Foobar.jpg|right]]456
14787 123[[File:Foobar.jpg|thumb]]456
14788 !! html/php
14789 <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
14790 </p>
14791 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
14792 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
14793
14794 !! html/php+tidy
14795 <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
14796 </p><p>
14797 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
14798 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
14799 </p>
14800 !! html/parsoid
14801 <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>
14802 <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
14803 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>
14804 !! end
14805
14806 !! test
14807 Image with multiple captions -- only last one is accepted
14808 !! wikitext
14809 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14810 !! html/php
14811 <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>
14812
14813 !! html/parsoid
14814 <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>
14815 !! end
14816
14817 !! test
14818 Image with multiple widths -- use last
14819 !! wikitext
14820 [[File:Foobar.jpg|200px|300px|caption]]
14821 !! html/php
14822 <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>
14823 </p>
14824 !! html/parsoid
14825 <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>
14826 !! end
14827
14828 !! test
14829 Image with multiple alignments -- use first (T50664)
14830 !! options
14831 thumbsize=220
14832 !! wikitext
14833 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14834
14835 [[File:Foobar.jpg|middle|text-top|caption]]
14836 !! html/php
14837 <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>
14838 <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>
14839 </p>
14840 !! html/parsoid
14841 <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>
14842 <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>
14843 !! end
14844
14845 !! test
14846 Image with width attribute at different positions
14847 !! wikitext
14848 [[File:Foobar.jpg|200px|right|Caption]]
14849 [[File:Foobar.jpg|right|200px|Caption]]
14850 [[File:Foobar.jpg|right|Caption|200px]]
14851 !! html/php
14852 <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>
14853 <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>
14854 <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>
14855
14856 !! html/parsoid
14857 <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>
14858 <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>
14859 <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>
14860 !! end
14861
14862 # a sad bit of backward-compatibility
14863 !! test
14864 Image with size specified with pxpx (T15500, T53628)
14865 !! options
14866 parsoid=wt2html,wt2wt,html2html
14867 !! wikitext
14868 [[File:Foobar.jpg|20pxpx]]
14869 [[File:Foobar.jpg|200x20pxpx]]
14870 !! html/php
14871 <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>
14872 <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>
14873 </p>
14874 !! html/parsoid
14875 <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>
14876 !! end
14877
14878 !! test
14879 Image with link parameter, wiki target
14880 !! wikitext
14881 [[File:Foobar.jpg|link=Main Page]]
14882 !! html/php
14883 <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>
14884 </p>
14885 !! html/parsoid
14886 <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>
14887 !! end
14888
14889 # parsoid T51293 (part 1)
14890 !! test
14891 Image with link parameter, URL target
14892 !! wikitext
14893 [[File:Foobar.jpg|link=http://example.com/]]
14894 !! html/php
14895 <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>
14896 </p>
14897 !! html/parsoid
14898 <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>
14899 !! end
14900
14901 # parsoid T51293 (part 2)
14902 !! test
14903 Image with link parameter, protocol-less URL target
14904 !! wikitext
14905 [[File:Foobar.jpg|link=//example.com/]]
14906 !! html/php
14907 <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>
14908 </p>
14909 !! html/parsoid
14910 <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>
14911 !! end
14912
14913 !! test
14914 Escaping non-block captions (T107435)
14915 !! options
14916 parsoid={
14917 "modes": ["wt2wt"],
14918 "changes": [
14919 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14920 ]
14921 }
14922 !! wikitext
14923 [[Image:Foobar.jpg|caption]]
14924 !! wikitext/edited
14925 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14926 !! end
14927
14928 # wgExternalLinkTarget not supported by Parsoid
14929 !! test
14930 Image with link parameter, wgExternalLinkTarget
14931 !! wikitext
14932 [[Image:foobar.jpg|link=http://example.com/]]
14933 !! config
14934 wgExternalLinkTarget='foobar'
14935 !! html/php
14936 <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>
14937 </p>
14938 !! end
14939
14940 !! test
14941 Image with link parameter, wgNoFollowLinks set to false
14942 !! wikitext
14943 [[Image:foobar.jpg|link=http://example.com/]]
14944 !! config
14945 wgNoFollowLinks=false
14946 !! html/php
14947 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14948 </p>
14949 !! end
14950
14951 !! test
14952 Image with link parameter, wgNoFollowDomainExceptions
14953 !! wikitext
14954 [[Image:foobar.jpg|link=http://example.com/]]
14955 !! config
14956 wgNoFollowDomainExceptions='example.com'
14957 !! html/php
14958 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14959 </p>
14960 !! end
14961
14962 # wgExternalLinkTarget not supported by Parsoid
14963 !! test
14964 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14965 !! wikitext
14966 [[Image:foobar.jpg|link=http://example.com/|Title]]
14967 !! config
14968 wgExternalLinkTarget='foobar'
14969 !! html/php
14970 <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>
14971 </p>
14972 !! end
14973
14974 !! test
14975 Image with empty link parameter
14976 !! wikitext
14977 [[File:Foobar.jpg|link=]]
14978 !! html/php
14979 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14980 </p>
14981 !! html/parsoid
14982 <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>
14983 !! end
14984
14985 !! test
14986 Image with link parameter (wiki target) and unnamed parameter
14987 !! wikitext
14988 [[File:Foobar.jpg|link=Main_Page|Title]]
14989 !! html/php
14990 <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>
14991 </p>
14992 !! html/parsoid
14993 <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>
14994 !! end
14995
14996 !! test
14997 Image with link parameter (URL target) and unnamed parameter
14998 !! wikitext
14999 [[File:Foobar.jpg|link=http://example.com/|Title]]
15000 !! html/php
15001 <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>
15002 </p>
15003 !! html/parsoid
15004 <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>
15005 !! end
15006
15007 !! test
15008 Thumbnail image with link parameter
15009 !! options
15010 thumbsize=220
15011 parsoid=wt2html,wt2wt,html2html
15012 !! wikitext
15013 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
15014 !! html/php
15015 <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>
15016
15017 !! html/parsoid
15018 <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>
15019 !! end
15020
15021 !! test
15022 Manually-specified thumbnail image
15023 !! options
15024 thumbsize=220
15025 !! wikitext
15026 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15027 !! html/php
15028 <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>
15029
15030 !! html/parsoid
15031 <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>
15032 !! end
15033
15034 !! test
15035 Manually-specified thumbnail image with explicit link to wiki page
15036 !! options
15037 thumbsize=220
15038 parsoid=wt2html,wt2wt,html2html
15039 !! wikitext
15040 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
15041 !! html/php
15042 <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>
15043
15044 !! html/parsoid
15045 <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>
15046 !! end
15047
15048 !! test
15049 Manually-specified thumbnail image with explicit link to url
15050 !! options
15051 thumbsize=220
15052 parsoid=wt2html,wt2wt,html2html
15053 !! wikitext
15054 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
15055 !! html/php
15056 <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>
15057
15058 !! html/parsoid
15059 <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>
15060 !! end
15061
15062 !! test
15063 Manually-specified thumbnail image with explicit no link
15064 !! options
15065 thumbsize=220
15066 parsoid=wt2html,wt2wt,html2html
15067 !! wikitext
15068 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
15069 !! html/php
15070 <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>
15071
15072 !! html/parsoid
15073 <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>
15074 !! end
15075
15076 !! test
15077 Manually-specified thumbnail image with explicit link and alt text
15078 !! options
15079 thumbsize=220
15080 parsoid=wt2html,wt2wt,html2html
15081 !! wikitext
15082 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
15083 !! html/php
15084 <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>
15085
15086 !! html/parsoid
15087 <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>
15088 !! end
15089
15090 !! test
15091 Image with frame and link
15092 !! options
15093 parsoid=wt2html,wt2wt,html2html
15094 !! wikitext
15095 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
15096 !! html/php
15097 <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>
15098
15099 !! html/parsoid
15100 <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>
15101 !! end
15102
15103 !! test
15104 Image with frame and link and explicit alt
15105 !! options
15106 parsoid=wt2html,wt2wt,html2html
15107 !! wikitext
15108 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15109 !! html/php
15110 <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>
15111
15112 !! html/parsoid
15113 <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>
15114 !! end
15115
15116 !! test
15117 Image with wiki markup in implicit alt
15118 !! wikitext
15119 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15120
15121 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15122 !! html/php
15123 <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>
15124 </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>
15125 </p>
15126 !! html/parsoid
15127 <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>
15128
15129 <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>
15130 !! end
15131
15132 !! test
15133 Alt image option should handle most kinds of wikitext without barfing
15134 !! wikitext
15135 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15136 !! html/php
15137 <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>
15138
15139 !! html/parsoid
15140 <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>
15141 !! end
15142
15143 !! test
15144 Ampersand in alt attribute (T206940)
15145 !! wikitext
15146 [[File:Foobar.jpg|alt=&amp;amp;]]
15147
15148 <!-- consistency with gallery extension -->
15149 <gallery>
15150 File:Foobar.jpg|alt=&amp;amp;
15151 </gallery>
15152 !! html/php+tidy
15153 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&amp;amp;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15154 </p>
15155 <ul class="gallery mw-gallery-traditional">
15156 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15157 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&amp;amp;" 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>
15158 <div class="gallerytext">
15159 </div>
15160 </div></li>
15161 </ul>
15162 !! html/parsoid
15163 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="&amp;amp;" resource="./File:Foobar.jpg" 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>
15164
15165 <!-- consistency with gallery extension -->
15166 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15167 <li class="gallerybox">
15168 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="&amp;amp;" 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>
15169 <div class="gallerytext"></div>
15170 </li>
15171 </ul>
15172 !! end
15173
15174 !! test
15175 Italics markup in alt attribute (T206940)
15176 !! wikitext
15177 [[File:Foobar.jpg|alt=''x''|caption]]
15178
15179 <!-- consistency with gallery extension -->
15180 <gallery>
15181 File:Foobar.jpg|alt=''x''|caption
15182 </gallery>
15183 !! html/php+tidy
15184 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="x" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15185 </p>
15186 <ul class="gallery mw-gallery-traditional">
15187 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15188 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="x" 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>
15189 <div class="gallerytext">
15190 <p>caption
15191 </p>
15192 </div>
15193 </div></li>
15194 </ul>
15195 !! html/parsoid
15196 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&apos;&apos;x&apos;&apos;"},{"ck":"caption","ak":"caption"}]}' data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="x" resource="./File:Foobar.jpg" 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":"x","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=&apos;&apos;x&apos;&apos;","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15197
15198 <!-- consistency with gallery extension -->
15199 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&apos;&apos;x&apos;&apos;|caption\n"}}'>
15200 <li class="gallerybox">
15201 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="x" 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>
15202 <div class="gallerytext">caption</div>
15203 </li>
15204 </ul>
15205 !! end
15206
15207 !! test
15208 Nowiki markup in alt attribute (T206940)
15209 !! wikitext
15210 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15211
15212 <!-- consistency with gallery extension -->
15213 <gallery>
15214 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15215 </gallery>
15216 !! html/php+tidy
15217 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="&#39;&#39;x&#39;&#39;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15218 </p>
15219 <ul class="gallery mw-gallery-traditional">
15220 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15221 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&#39;&#39;x&#39;&#39;" 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>
15222 <div class="gallerytext">
15223 <p>caption
15224 </p>
15225 </div>
15226 </div></li>
15227 </ul>
15228 !! html/parsoid
15229 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>"},{"ck":"caption","ak":"caption"}],"dsr":[0,71,null,null]}' data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" 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":"&apos;&apos;x&apos;&apos;","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15230
15231 <!-- consistency with gallery extension -->
15232 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>|caption\n"}}'>
15233 <li class="gallerybox">
15234 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="''x''" 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>
15235 <div class="gallerytext">caption</div>
15236 </li>
15237 </ul>
15238 !! end
15239
15240 !! test
15241 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15242 !! wikitext
15243 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15244
15245 <!-- consistency with gallery extension -->
15246 <gallery>
15247 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15248 </gallery>
15249 !! html/php+tidy
15250 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="&#39;&#39;x&#39;&#39;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15251 </p>
15252 <ul class="gallery mw-gallery-traditional">
15253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15254 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&#39;&#39;x&#39;&#39;" 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>
15255 <div class="gallerytext">
15256 <p>caption
15257 </p>
15258 </div>
15259 </div></li>
15260 </ul>
15261 !! html/parsoid
15262 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" 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>
15263
15264 <!-- consistency with gallery extension -->
15265 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15266 <li class="gallerybox">
15267 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="''x''" 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>
15268 <div class="gallerytext">caption</div>
15269 </li>
15270 </ul>
15271 !! end
15272
15273 !! test
15274 Ampersand in link attribute (T206940)
15275 !! wikitext
15276 [[File:Foobar.jpg|link=Foo &amp; bar]]
15277
15278 <!-- consistency with gallery extension -->
15279 <gallery>
15280 File:Foobar.jpg|link=Foo &amp; bar
15281 </gallery>
15282 !! html/php+tidy
15283 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15284 </p>
15285 <ul class="gallery mw-gallery-traditional">
15286 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15287 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo_%26_bar"><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>
15288 <div class="gallerytext">
15289 </div>
15290 </div></li>
15291 </ul>
15292 !! html/parsoid
15293 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=Foo &amp;amp; bar"}]}'><a href="./Foo_&amp;_bar" data-parsoid='{"a":{"href":"./Foo_&amp;_bar"},"sa":{"href":"link=Foo &amp;amp; bar"}}'><img resource="./File:Foobar.jpg" 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>
15294
15295 <!-- consistency with gallery extension -->
15296 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo &amp;amp; bar\n"}}'>
15297 <li class="gallerybox">
15298 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo_&amp;_bar"><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>
15299 <div class="gallerytext"></div>
15300 </li>
15301 </ul>
15302 !! end
15303
15304 !! test
15305 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15306 !! wikitext
15307 [[File:Foobar.jpg|link=Foo_&_bar]]
15308
15309 <!-- consistency with gallery extension -->
15310 <gallery>
15311 File:Foobar.jpg|link=Foo_&_bar
15312 </gallery>
15313 !! html/php+tidy
15314 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15315 </p>
15316 <ul class="gallery mw-gallery-traditional">
15317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15318 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo_%26_bar"><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>
15319 <div class="gallerytext">
15320 </div>
15321 </div></li>
15322 </ul>
15323 !! html/parsoid
15324 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Foo_&amp;_bar"><img resource="./File:Foobar.jpg" 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>
15325
15326 <!-- consistency with gallery extension -->
15327 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15328 <li class="gallerybox">
15329 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo_&amp;_bar"><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>
15330 <div class="gallerytext"></div>
15331 </li>
15332 </ul>
15333 !! end
15334
15335 !! test
15336 Italics markup in link attribute (T206940)
15337 !! wikitext
15338 [[Foo''s bar''s]]
15339
15340 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15341 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15342
15343 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15344
15345 <!-- consistency with gallery extension -->
15346 <gallery>
15347 File:Foobar.jpg|link=Foo''s bar''s|caption1
15348 File:Foobar.jpg|link=''Main Page''|caption2
15349 </gallery>
15350 !! html/php+tidy
15351 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15352 </p><p><a href="/wiki/Foos_bars" title="caption1"><img alt="caption1" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15353 </p><p><a href="/wiki/Main_Page" title="caption2"><img alt="caption2" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15354 </p>
15355 <ul class="gallery mw-gallery-traditional">
15356 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15357 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foos_bars"><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>
15358 <div class="gallerytext">
15359 <p>caption1
15360 </p>
15361 </div>
15362 </div></li>
15363 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15364 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><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>
15365 <div class="gallerytext">
15366 <p>caption2
15367 </p>
15368 </div>
15369 </div></li>
15370 </ul>
15371 !! html/parsoid
15372 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15373
15374 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15375 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=Foo&apos;&apos;s bar&apos;&apos;s"},{"ck":"caption","ak":"caption1"}]}' data-mw='{"caption":"caption1"}'><a href="./Foos_bars" data-parsoid='{"a":{"href":"./Foos_bars"},"sa":{"href":"link=Foo&apos;&apos;s bar&apos;&apos;s"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15376
15377 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&apos;&apos;Main Page&apos;&apos;"},{"ck":"caption","ak":"caption2"}]}' data-mw='{"caption":"caption2"}'><a href="./Main_Page" data-parsoid='{"a":{"href":"./Main_Page"},"sa":{"href":"link=&apos;&apos;Main Page&apos;&apos;"}}'><img resource="./File:Foobar.jpg" 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>
15378
15379 <!-- consistency with gallery extension -->
15380 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo&apos;&apos;s bar&apos;&apos;s|caption1\nFile:Foobar.jpg|link=&apos;&apos;Main Page&apos;&apos;|caption2\n"}}'>
15381 <li class="gallerybox">
15382 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foos_bars"><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>
15383 <div class="gallerytext">caption1</div>
15384 </li>
15385 <li class="gallerybox">
15386 <div class="thumb"><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>
15387 <div class="gallerytext">caption2</div>
15388 </li>
15389 </ul>
15390 !! end
15391
15392 !! test
15393 Nowiki markup in link attribute (T206940)
15394 !! wikitext
15395 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15396
15397 <!-- consistency with gallery extension -->
15398 <gallery>
15399 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15400 </gallery>
15401 !! html/php+tidy
15402 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15403 </p>
15404 <ul class="gallery mw-gallery-traditional">
15405 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15406 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo%27%27s_bar%27%27s"><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>
15407 <div class="gallerytext">
15408 <p>caption
15409 </p>
15410 </div>
15411 </div></li>
15412 </ul>
15413 !! html/parsoid
15414 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=Foo&lt;nowiki>&apos;&apos;&lt;/nowiki>s_bar&lt;nowiki>&apos;&apos;&lt;/nowiki>s"},{"ck":"caption","ak":"caption"}]}' data-mw='{"caption":"caption"}'><a href="./Foo''s_bar''s" data-parsoid='{"a":{"href":"./Foo&apos;&apos;s_bar&apos;&apos;s"},"sa":{"href":"link=Foo&lt;nowiki>&apos;&apos;&lt;/nowiki>s_bar&lt;nowiki>&apos;&apos;&lt;/nowiki>s"}}'><img resource="./File:Foobar.jpg" 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>
15415
15416 <!-- consistency with gallery extension -->
15417 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo&lt;nowiki>&apos;&apos;&lt;/nowiki>s_bar&lt;nowiki>&apos;&apos;&lt;/nowiki>s|caption\n"}}'>
15418 <li class="gallerybox">
15419 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo''s_bar''s"><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>
15420 <div class="gallerytext">caption</div>
15421 </li>
15422 </ul>
15423 !! end
15424
15425 !! test
15426 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15427 !! wikitext
15428 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15429
15430 <!-- consistency with gallery extension -->
15431 <gallery>
15432 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15433 </gallery>
15434 !! html/php+tidy
15435 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15436 </p>
15437 <ul class="gallery mw-gallery-traditional">
15438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15439 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo%27%27s_bar%27%27s"><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>
15440 <div class="gallerytext">
15441 <p>caption
15442 </p>
15443 </div>
15444 </div></li>
15445 </ul>
15446 !! html/parsoid
15447 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./Foo''s_bar''s"><img resource="./File:Foobar.jpg" 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>
15448
15449 <!-- consistency with gallery extension -->
15450 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15451 <li class="gallerybox">
15452 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo''s_bar''s"><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>
15453 <div class="gallerytext">caption</div>
15454 </li>
15455 </ul>
15456 !! end
15457
15458 !! test
15459 Image with table with attributes in caption
15460 !! options
15461 parsoid=wt2html,html2html
15462 !! wikitext
15463 [[File:Foobar.jpg|thumb|
15464 {| class="123" |
15465 |- class="456" |
15466 | ha
15467 |}
15468 ]]
15469 !! html/parsoid
15470 <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>
15471 <table class="123">
15472 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15473 <td> ha</td></tr>
15474 </tbody></table>
15475 </figcaption></figure>
15476 !! end
15477
15478 !! test
15479 Image with table with rows from templates in caption
15480 !! wikitext
15481 [[File:Foobar.jpg|thumb|
15482 {|
15483 {{echo|{{!}} hi}}
15484 |}
15485 ]]
15486 !! html/parsoid
15487 <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>
15488 <table>
15489 <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>
15490 </tbody></table>
15491 </figcaption></figure>
15492 !! end
15493
15494 !! test
15495 Image with nested tables in caption
15496 !! wikitext
15497 [[File:Foobar.jpg|thumb|Foo<br />
15498 {|
15499 |
15500 {|
15501 |z
15502 |}
15503 |}
15504 ]]
15505 !! html/parsoid
15506 <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}'/>
15507 <table>
15508 <tbody><tr><td>
15509 <table>
15510 <tbody><tr><td>z</td></tr>
15511 </tbody></table></td></tr>
15512 </tbody></table>
15513 </figcaption></figure>
15514 !! end
15515
15516 !! test
15517 Image with heading and horizontal rule in caption
15518 !! wikitext
15519 [[File:Foobar.jpg|thumb|
15520 ===Testing===
15521 123
15522 --------------
15523 ]]
15524 !! html/php
15525 <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>
15526
15527 !! html/parsoid
15528 <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>
15529 <h3 id="Testing">Testing</h3>
15530 123
15531 <hr data-parsoid='{"extra_dashes":10}'/>
15532 </figcaption></figure>
15533 !! end
15534
15535 ###################
15536 # Conflicting image format options.
15537 # First option specified should 'win'.
15538 # All three cases in each test should be identical.
15539
15540 !! test
15541 Image with 'frameless' first.
15542 !! options
15543 parsoid=wt2html,wt2wt,html2html
15544 !! wikitext
15545 [[File:Foobar.jpg|frameless|caption]]
15546
15547 [[File:Foobar.jpg|frameless|frame|caption]]
15548
15549 [[File:Foobar.jpg|frameless|thumb|caption]]
15550 !! html/php
15551 <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>
15552 </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>
15553 </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>
15554 </p>
15555 !! html/parsoid
15556 <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>
15557 <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>
15558 <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>
15559 !! end
15560
15561 !! test
15562 Image with 'frame' first.
15563 !! options
15564 parsoid=wt2html,wt2wt,html2html
15565 !! wikitext
15566 [[File:Foobar.jpg|frame|caption]]
15567 [[File:Foobar.jpg|frame|frameless|caption]]
15568 [[File:Foobar.jpg|frame|thumb|caption]]
15569 !! html/php
15570 <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>
15571 <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>
15572 <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>
15573
15574 !! html/parsoid
15575 <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>
15576 <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>
15577 <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>
15578 !! end
15579
15580 !! test
15581 Image with 'thumb' first.
15582 !! options
15583 parsoid=wt2html,wt2wt,html2html
15584 !! wikitext
15585 [[File:Foobar.jpg|thumb|caption]]
15586 [[File:Foobar.jpg|thumb|frameless|caption]]
15587 [[File:Foobar.jpg|thumb|frame|caption]]
15588 !! html/php
15589 <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>
15590 <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>
15591 <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>
15592
15593 !! html/parsoid
15594 <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>
15595 <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>
15596 <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>
15597 !! end
15598
15599 ###################
15600 # Image sizing.
15601 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15602 # and https://phabricator.wikimedia.org/T64258
15603 # Foobar has actual size of 1941x220
15604 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15605 # a scalable format.
15606 # 2. Framed images always ignore size options; always render at default size.
15607 # 3. "Unspecified format" and border are the only types which can be
15608 # enlarged.
15609
15610 !! test
15611 Image: unspecified format and border enlarge
15612 !! options
15613 parsoid=wt2html,wt2wt,html2html
15614 !! wikitext
15615 [[File:Foobar.jpg|2000px]]
15616
15617 [[File:Foobar.jpg|border|2000px]]
15618 !! html/php
15619 <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>
15620 </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>
15621 </p>
15622 !! html/parsoid
15623 <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>
15624 <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>
15625 !! end
15626
15627 !! test
15628 Image: "unspecified format" and border reduce
15629 !! options
15630 parsoid=wt2html,wt2wt,html2html
15631 !! wikitext
15632 [[File:Foobar.jpg|1000px]]
15633
15634 [[File:Foobar.jpg|border|1000px]]
15635 !! html/php
15636 <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>
15637 </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>
15638 </p>
15639 !! html/parsoid
15640 <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>
15641 <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>
15642 !! end
15643
15644 !! test
15645 Image: thumbs reduce
15646 !! options
15647 parsoid=wt2html,wt2wt,html2html
15648 !! wikitext
15649 [[File:Foobar.jpg|thumb|50px]]
15650 !! html/php
15651 <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>
15652
15653 !! html/parsoid
15654 <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>
15655 !! end
15656
15657 !! test
15658 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15659 !! options
15660 parsoid=wt2html,wt2wt,html2html
15661 !! wikitext
15662 [[File:Foobar.jpg|thumb|2000px]]
15663
15664 [[File:Foobar.svg|thumb|2000px]]
15665 !! html/php
15666 <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>
15667 <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>
15668
15669 !! html/parsoid
15670 <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>
15671 <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>
15672 !! end
15673
15674 !! test
15675 Image: frameless can reduce in size
15676 !! options
15677 parsoid=wt2html,wt2wt,html2html
15678 !! wikitext
15679 [[File:Foobar.jpg|frameless|50px]]
15680 !! html/php
15681 <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>
15682 </p>
15683 !! html/parsoid
15684 <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>
15685 !! end
15686
15687 !! test
15688 Image: bitmap frameless can't be enlarged past original size, but vector can
15689 !! options
15690 parsoid=wt2html,wt2wt,html2html
15691 !! wikitext
15692 [[File:Foobar.jpg|frameless|2000px]]
15693
15694 [[File:Foobar.svg|frameless|2000px]]
15695 !! html/php
15696 <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>
15697 </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>
15698 </p>
15699 !! html/parsoid
15700 <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>
15701 <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>
15702 !! end
15703
15704 !! test
15705 Image: framed images are always unscaled.
15706 !! options
15707 parsoid=wt2html,wt2wt,html2html
15708 !! wikitext
15709 [[File:Foobar.jpg|frame]]
15710
15711 [[File:Foobar.jpg|frame|50px]]
15712
15713 [[File:Foobar.jpg|frame|50x50px]]
15714
15715 [[File:Foobar.jpg|frame|2000px]]
15716 !! html/php
15717 <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>
15718 <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>
15719 <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>
15720 <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>
15721
15722 !! html/parsoid
15723 <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>
15724 <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>
15725 <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>
15726 <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>
15727 !! end
15728
15729 ###################
15730
15731 !! test
15732 Link to image page- image page normally doesn't exists, hence edit link
15733 Add test with existing image page
15734 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15735 !! wikitext
15736 [[:Image:test]]
15737 !! html
15738 <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>
15739 </p>
15740 !! end
15741
15742 !! test
15743 T20784 Link to non-existent image page with caption should use caption as link text
15744 !! wikitext
15745 [[:Image:test|caption]]
15746 !! html
15747 <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>
15748 </p>
15749 !! end
15750
15751 !! test
15752 Frameless image caption with a free URL
15753 !! wikitext
15754 [[File:Foobar.jpg|http://example.com]]
15755 !! html/php
15756 <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>
15757 </p>
15758 !! html/parsoid
15759 <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>
15760 !! end
15761
15762 !! test
15763 Thumbnail image caption with a free URL
15764 !! options
15765 thumbsize=220
15766 !! wikitext
15767 [[File:Foobar.jpg|thumb|http://example.com]]
15768 !! html/php
15769 <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>
15770
15771 !! html/parsoid
15772 <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>
15773 !! end
15774
15775 !! test
15776 Thumbnail image caption with a free URL and explicit alt
15777 !! options
15778 thumbsize=220
15779 parsoid=wt2html,wt2wt,html2html
15780 !! wikitext
15781 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15782 !! html/php
15783 <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>
15784
15785 !! html/parsoid
15786 <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>
15787 !! end
15788
15789 !! test
15790 SVG thumbnails with no language set
15791 !! options
15792 !! wikitext
15793 [[File:Foobar.svg|thumb|caption]]
15794 !! html/php
15795 <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>
15796
15797 !! html/parsoid
15798 <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>
15799 !! end
15800
15801 !! test
15802 SVG thumbnails with language de
15803 !! options
15804 parsoid=wt2html,wt2wt,html2html
15805 !! wikitext
15806 [[File:Foobar.svg|thumb|caption|lang=de]]
15807 !! html/php
15808 <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>
15809
15810 !! html/parsoid
15811 <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>
15812 !! end
15813
15814 !! test
15815 SVG thumbnails with invalid language code
15816 !! options
15817 parsoid=wt2html,wt2wt,html2html
15818 !! wikitext
15819 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15820 !! html/php
15821 <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>
15822
15823 !! html/parsoid
15824 <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>
15825 !! end
15826
15827 !! test
15828 SVG thumbnails in page language
15829 !! options
15830 language=ru
15831 wgMediaInTargetLanguage = true
15832 !! wikitext
15833 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15834 !! html/php
15835 <p><a href="/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/langru-240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langru-360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langru-480px-Foobar.svg.png 2x" /></a> <a href="/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:Foobar.svg&amp;lang=en" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/480px-Foobar.svg.png 2x" /></a>
15836 </p>
15837 !! end
15838
15839 !! test
15840 SVG thumbnails in page language not present in the file
15841 !! options
15842 language=de
15843 wgMediaInTargetLanguage = true
15844 !! wikitext
15845 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15846 !! html/php
15847 <p><a href="/wiki/Datei:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/480px-Foobar.svg.png 2x" /></a> <a href="/index.php?title=Datei:Foobar.svg&amp;lang=ru" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/langru-240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langru-360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langru-480px-Foobar.svg.png 2x" /></a>
15848 </p>
15849 !! end
15850
15851 !! test
15852 T3887: A ISBN with a thumbnail
15853 !! wikitext
15854 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15855 !! html/php
15856 <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>
15857
15858 !! html/parsoid
15859 <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>
15860 !! end
15861
15862 !! test
15863 T3887: A RFC with a thumbnail
15864 !! wikitext
15865 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15866 !! html/php
15867 <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>
15868
15869 !! html/parsoid
15870 <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>
15871 !! end
15872
15873 !! test
15874 T3887: A mailto link with a thumbnail
15875 !! wikitext
15876 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15877 !! html/php
15878 <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>
15879
15880 !! html/parsoid
15881 <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>
15882 !! end
15883
15884 # Pending resolution to T2368
15885 !! test
15886 T2648: Frameless image caption with a link
15887 !! wikitext
15888 [[File:Foobar.jpg|text with a [[link]] in it]]
15889 !! html/php
15890 <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>
15891 </p>
15892 !! html/parsoid
15893 <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>
15894 !! end
15895
15896 !! test
15897 T2648: Frameless image caption with a link (suffix)
15898 !! wikitext
15899 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15900 !! html/php
15901 <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>
15902 </p>
15903 !! html/parsoid
15904 <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>
15905 !! end
15906
15907 !! test
15908 T2648: Frameless image caption with an interwiki link
15909 !! wikitext
15910 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15911 !! html/php
15912 <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>
15913 </p>
15914 !! html/parsoid
15915 <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>
15916 !! end
15917
15918 !! test
15919 T2648: Frameless image caption with a piped interwiki link
15920 !! wikitext
15921 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15922 !! html/php
15923 <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>
15924 </p>
15925 !! html/parsoid
15926 <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>
15927 !! end
15928
15929 !! test
15930 T107474: Frameless image caption with <nowiki>
15931 !! wikitext
15932 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15933 !! html/parsoid
15934 <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>
15935 !! end
15936
15937 !! test
15938 Escape HTML special chars in image alt text
15939 !! wikitext
15940 [[File:Foobar.jpg|& < > "]]
15941 !! html/php
15942 <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>
15943 </p>
15944 !! html/parsoid
15945 <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>
15946 !! end
15947
15948 !! test
15949 Escape HTML special chars in image alt text with LanguageConverter
15950 !! options
15951 language=zh
15952 !! wikitext
15953 [[File:Foobar.jpg|& < > "]]
15954 !! html/php
15955 <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>
15956 </p>
15957 !! html/parsoid
15958 <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>
15959 !! end
15960
15961 !! test
15962 Entities in file name and attributes
15963 !! wikitext
15964 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15965 !! html/php
15966 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15967 </p>
15968 !! html/parsoid
15969 <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>
15970 !! end
15971
15972 !! test
15973 T2499: Alt text should have &#1234;, not &amp;1234;
15974 !! wikitext
15975 [[File:Foobar.jpg|&#9792;]]
15976 !! html/php
15977 <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>
15978 </p>
15979 !! html/parsoid
15980 <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>
15981 !! end
15982
15983 !! test
15984 Broken image caption with link
15985 !! options
15986 parsoid=wt2html,wt2wt,html2html
15987 !! wikitext
15988 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15989 !! html/php
15990 <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.
15991 </p>
15992 !! html/parsoid
15993 <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>
15994 !! end
15995
15996 !! test
15997 Image caption containing another image
15998 !! wikitext
15999 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
16000 !! html/php
16001 <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>
16002
16003 !! html/parsoid
16004 <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>
16005 !! end
16006
16007 !! test
16008 Image: caption containing a newline
16009 !! wikitext
16010 [[File:Foobar.jpg|This
16011 *is some text]]
16012 !! html/php
16013 <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>
16014 </p>
16015 !! html/parsoid
16016 <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>
16017 !!end
16018
16019 !!test
16020 Image: caption containing leading space
16021 (The leading space should not trigger nowiki escaping in wt2wt mode)
16022 !! wikitext
16023 [[File:Foobar.jpg|thumb| bar]]
16024 !! html/php
16025 <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>
16026
16027 !! html/parsoid
16028 <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>
16029 !!end
16030
16031 # html/php output not have newlines after table, td, th, etc. because
16032 # Linker::makeThumbLink2() replaces the newlines with spaces since
16033 # the table is inside a caption.
16034 # FIXME: Verify if that circa 2004 fix is still required.
16035 !! test
16036 Image: caption containing a table
16037 !! options
16038 parsoid=wt2html,wt2wt,html2html
16039 !! wikitext
16040 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
16041 {|
16042 !Foo!!Bar
16043 |-
16044 |Foo1||Bar1
16045 |}
16046 and some more text.]]
16047 !! html/php
16048 <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>
16049
16050 !! html/parsoid
16051 <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
16052 <table>
16053 <tbody>
16054 <tr><th>Foo</th><th>Bar</th></tr>
16055 <tr>
16056 <td>Foo1</td>
16057 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
16058 !! end
16059
16060 !! test
16061 T5090: External links other than http: in image captions
16062 !! wikitext
16063 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
16064 !! html/php
16065 <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>
16066
16067 !! html/parsoid
16068 <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>
16069 !! end
16070
16071 !! test
16072 Custom class
16073 !! options
16074 parsoid=wt2html,wt2wt,html2html
16075 !! wikitext
16076 [[Image:foobar.jpg|a|class=b]]
16077 !! html/php
16078 <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>
16079 </p>
16080 !! html/parsoid
16081 <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>
16082 !! end
16083
16084 !! test
16085 Localized image handling (1).
16086 !! options
16087 parsoid=wt2html,wt2wt,html2html
16088 language=es
16089 !! wikitext
16090 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16091 !! html/php
16092 <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>
16093
16094 !! html/parsoid
16095 <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>
16096 !! end
16097
16098 !! test
16099 Localized image handling (2).
16100 !! options
16101 thumbsize=220
16102 parsoid=wt2html,wt2wt,html2html
16103 language=es
16104 !! wikitext
16105 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16106 !! html/php
16107 <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>
16108
16109 !! html/parsoid
16110 <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>
16111 !! end
16112
16113 !! test
16114 Localized image handling (3).
16115 !! options
16116 language=fa
16117 parsoid=html2wt
16118 !! html/parsoid
16119 <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>
16120 !! wikitext
16121 [[File:Foobar.jpg|بندانگشتی]]
16122 !! end
16123
16124 !! test
16125 "border", "frameless" and "class" attributes on an image.
16126 !! options
16127 thumbsize=220
16128 parsoid=wt2html,wt2wt,html2html
16129 !! wikitext
16130 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16131 !! html/php
16132 <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>
16133 </p>
16134 !! html/parsoid
16135 <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>
16136 !! end
16137
16138 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16139 !! test
16140 Invalid image attributes (T64500)
16141 !! options
16142 thumbsize=220
16143 parsoid=wt2html,wt2wt,html2html
16144 !! wikitext
16145 [[File:Foobar.jpg|thumb|float|left|caption]]
16146
16147 [[File:Foobar.jpg|thumb|righ|caption]]
16148
16149 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16150 !! html/php
16151 <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>
16152 <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>
16153 <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>
16154
16155 !! html/parsoid
16156 <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>
16157 <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>
16158 <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>
16159 !! end
16160
16161 !! article
16162 File:Barfoo.jpg
16163 !! text
16164 #REDIRECT [[File:Barfoo.jpg]]
16165 !! endarticle
16166
16167 # FIXME: Parsoid should run this test -- but we'd need to teach the
16168 # mockAPI about the redirected Barfoo.jpg image.
16169 !! test
16170 Redirected image
16171 !! wikitext
16172 [[Image:Barfoo.jpg]]
16173 !! html/php
16174 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16175 </p>
16176 !! end
16177
16178 !! test
16179 Missing image with uploads disabled
16180 !! options
16181 wgEnableUploads=0
16182 !! wikitext
16183 [[File:Foobaz.jpg]]
16184 !! html/php
16185 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16186 </p>
16187 !! html/parsoid
16188 <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>
16189 !! end
16190
16191 # Parsoid-specific testing for images
16192 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16193 # Currently imperfect due to a flaw in the Parsoid testrunner
16194 # Work in progress
16195 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16196 # image tests.
16197
16198 !! test
16199 Parsoid-specific image handling - simple image with size and middle alignment
16200 !! wikitext
16201 [[File:Foobar.jpg|middle|50px]]
16202 !! html/parsoid
16203 <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>
16204 !! end
16205
16206 !! test
16207 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16208 !! options
16209 parsoid=wt2wt,wt2html,html2html
16210 !! wikitext
16211 [[Image:Foobar.jpg|middle|50px]]
16212 !! html/parsoid
16213 <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>
16214 !! end
16215
16216 !! test
16217 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16218 !! wikitext
16219 [[File:Foobar.jpg|50px|middle]]
16220 !! html/parsoid
16221 <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>
16222 !! end
16223
16224 !! test
16225 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16226 !! options
16227 parsoid=wt2html,wt2wt,html2html
16228 !! wikitext
16229 [[Image:Foobar.jpg|50px|middle]]
16230 !! html/parsoid
16231 <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>
16232 !! end
16233
16234 !! test
16235 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16236 !! wikitext
16237 [[File:Foobar.jpg|500x10px|baseline|caption]]
16238 !! html/parsoid
16239 <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>
16240 !! end
16241
16242 !! test
16243 Parsoid-specific image handling - simple image with border and size spec
16244 !! wikitext
16245 [[File:Foobar.jpg|50px|border|caption]]
16246 !! html/parsoid
16247 <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>
16248 !! end
16249
16250 !! test
16251 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16252 !! options
16253 parsoid=wt2html,html2html
16254 !! wikitext
16255 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16256 !! html/parsoid
16257 <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>
16258 !! end
16259
16260 !! test
16261 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16262 !! options
16263 parsoid=wt2html,html2html
16264 !! wikitext
16265 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16266 !! html/parsoid
16267 <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>
16268 !! end
16269
16270 !! test
16271 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16272 !! options
16273 parsoid=wt2html,html2html
16274 !! wikitext
16275 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16276 !! html/parsoid
16277 <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>
16278 !! end
16279
16280 !! test
16281 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16282 !! options
16283 parsoid=wt2html,html2html
16284 !! wikitext
16285 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16286 !! html/parsoid
16287 <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>
16288 !! end
16289
16290 !! test
16291 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16292 !! options
16293 parsoid=wt2html,wt2wt,html2html
16294 !! wikitext
16295 [[File:Foobar.jpg|frame|500x50px|caption]]
16296 !! html/parsoid
16297 <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>
16298 !! end
16299
16300 !! test
16301 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16302 !! options
16303 parsoid=wt2html,html2html
16304 !! wikitext
16305 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16306 !! html/parsoid
16307 <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>
16308 !! end
16309
16310 !! test
16311 Parsoid-specific image handling - frameless image with specific size, border, and caption
16312 !! wikitext
16313 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16314 !! html/parsoid
16315 <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>
16316 !! end
16317
16318 !! test
16319 Parsoid-specific image handling - simple image with a formatted caption
16320 !! wikitext
16321 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16322 !! html/parsoid
16323 <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>
16324 !! end
16325
16326 !! test
16327 Parsoid-specific image handling - caption with a template in it
16328 !! wikitext
16329 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16330 !! html/parsoid
16331 <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>
16332 !! end
16333
16334 !! test
16335 Parsoid-specific image handling - caption with unbalanced tags in it
16336 !! options
16337 parsoid=wt2html,wt2wt,html2html
16338 !! wikitext
16339 foo
16340 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16341 bar
16342 !! html/parsoid
16343 <p>foo</p>
16344 <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>
16345 <p>bar</p>
16346 !! end
16347
16348 !! test
16349 Parsoid-specific image handling - empty caption (1)
16350 !! options
16351 parsoid=wt2html,wt2wt
16352 !! wikitext
16353 [[File:Foobar.jpg|thumb|]]
16354 !! html/parsoid
16355 <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>
16356 !! end
16357
16358 # empty captions don't get serialized unless we're in the "round trip" case
16359 !! test
16360 Parsoid-specific image handling - empty caption (2)
16361 !! options
16362 parsoid=html2wt
16363 !! html/parsoid
16364 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16365 <a href="./File:Foobar.jpg">
16366 <img resource="./File:Foobar.jpg"
16367 src="//example.com/images/3/3a/Foobar.jpg"
16368 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16369 height="25" width="220"/>
16370 </a>
16371 <figcaption></figcaption>
16372 </figure>
16373 !! wikitext
16374 [[File:Foobar.jpg|thumb]]
16375 !! end
16376
16377 !! test
16378 Parsoid-specific image handling - whitespace caption
16379 !! wikitext
16380 [[File:Foobar.jpg|thumb| ]]
16381 !! html/parsoid
16382 <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>
16383 !! end
16384
16385 !! test
16386 Parsoid-specific image handling - lang option
16387 !! wikitext
16388 foo
16389 [[File:Foobar.svg|lang=de|caption]]
16390 bar
16391 !! html/parsoid
16392 <p>foo
16393 <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>
16394 bar</p>
16395 !! end
16396
16397 ## Edge case bugs in Parsoid from T93580
16398 !! test
16399 T93580: 1. Templated <ref> inside block images
16400 !! wikitext
16401 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16402
16403 <references />
16404 !! html/parsoid
16405 <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>
16406
16407 <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>
16408 !! end
16409
16410 !! test
16411 T93580: 2. <ref> inside inline images
16412 !! wikitext
16413 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16414
16415 <references />
16416 !! html/parsoid
16417 <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>
16418
16419 <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>
16420 !! end
16421
16422 !! test
16423 T93580: 3. Templated <ref> inside inline images
16424 !! wikitext
16425 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16426
16427 <references />
16428 !! html/parsoid
16429 <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>
16430
16431 <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>
16432 !! end
16433
16434 ###
16435 ### Subpages
16436 ###
16437 !! article
16438 Subpage test/subpage
16439 !! text
16440 foo
16441 !! endarticle
16442
16443 !! test
16444 Subpage link
16445 !! options
16446 subpage title=[[Subpage test]]
16447 !! wikitext
16448 [[/subpage]]
16449 !! html
16450 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16451 </p>
16452 !! end
16453
16454 !! test
16455 Subpage noslash link
16456 !! options
16457 subpage title=[[Subpage test]]
16458 !! wikitext
16459 [[/subpage/]]
16460 !! html
16461 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16462 </p>
16463 !! end
16464
16465 !! article
16466 Subpage test/1/2/subpage
16467 !! text
16468 blah
16469 !! endarticle
16470
16471 !! test
16472 Relative subpage noslash link
16473 !! options
16474 parsoid=wt2wt,wt2html,html2html
16475 subpage title=[[Subpage test/1/2/3/4]]
16476 !! wikitext
16477 [[../../subpage/]]
16478
16479 [[../../subpage]]
16480 !! html/php
16481 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16482 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16483 </p>
16484 !! html/parsoid
16485 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16486 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16487 !! end
16488
16489 !! test
16490 Parsoid: dot-slash prefixed wikilinks
16491 !! wikitext
16492 [[./foo]]
16493
16494 [[././bar]]
16495
16496 [[././baz/]]
16497 !! html/php
16498 <p>[[./foo]]
16499 </p><p>[[././bar]]
16500 </p><p>[[././baz/]]
16501 </p>
16502 !! html/parsoid
16503 <p>[[./foo]]
16504 </p><p>[[././bar]]
16505 </p><p>[[././baz/]]
16506 </p>
16507 !! end
16508
16509 !! test
16510 Render invalid page names as plain text (T53090)
16511 !! wikitext
16512 [[./../foo|bar]]
16513 [[foo�|bar]]
16514 [[foo/.|bar]]
16515 [[foo/..|bar]]
16516 [[foo~~~bar]]
16517 [[foo>bar]]
16518 [[foo[bar]]
16519 [[.]]
16520 [[..]]
16521 [[foo././bar]]
16522 [[foo[http://example.com]xyz]]
16523
16524 [[{{echo|./../foo}}|bar]]
16525 [[{{echo|foo/.}}|bar]]
16526 [[{{echo|foo/..}}|bar]]
16527 [[{{echo|foo~~~~bar}}]]
16528 [[{{echo|foo>bar}}]]
16529 [[{{echo|foo././bar}}]]
16530 [[{{echo|foo{bar}}]]
16531 [[{{echo|foo}bar}}]]
16532 [[{{echo|foo[bar}}]]
16533 [[{{echo|foo]bar}}]]
16534 [[{{echo|foo<bar}}]]
16535 !!html/php
16536 <p>[[./../foo|bar]]
16537 [[foo�|bar]]
16538 [[foo/.|bar]]
16539 [[foo/..|bar]]
16540 [[foo~~~bar]]
16541 [[foo&gt;bar]]
16542 [[foo[bar]]
16543 [[.]]
16544 [[..]]
16545 [[foo././bar]]
16546 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16547 </p><p>[[./../foo|bar]]
16548 [[foo/.|bar]]
16549 [[foo/..|bar]]
16550 [[foo~~~~bar]]
16551 [[foo&gt;bar]]
16552 [[foo././bar]]
16553 [[foo{bar]]
16554 [[foo}bar]]
16555 [[foo[bar]]
16556 [[foo]bar]]
16557 [[foo&lt;bar]]
16558 </p>
16559 !!html/parsoid
16560 <p>[[./../foo|bar]]
16561 [[foo�|bar]]
16562 [[foo/.|bar]]
16563 [[foo/..|bar]]
16564 [[foo~~~bar]]
16565 [[foo>bar]]
16566 [[foo[bar]]
16567 [[.]]
16568 [[..]]
16569 [[foo././bar]]
16570 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16571
16572 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16573 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16574 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16575 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16576 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16577 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16578 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16579 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16580 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16581 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16582 [[<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>
16583 !!end
16584
16585 !! test
16586 Disabled subpages
16587 !! wikitext
16588 [[/subpage]]
16589 !! html
16590 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16591 </p>
16592 !! end
16593
16594 !! test
16595 T2561: {{/Subpage}}
16596 !! options
16597 subpage title=[[Page]]
16598 !! wikitext
16599 {{/Subpage}}
16600 !! html
16601 <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>
16602 </p>
16603 !! end
16604
16605 ###
16606 ### Categories
16607 ###
16608 !! article
16609 Category:MediaWiki User's Guide
16610 !! text
16611 blah
16612 !! endarticle
16613
16614 !! test
16615 Link to category
16616 !! wikitext
16617 [[:Category:MediaWiki User's Guide]]
16618 !! html
16619 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16620 </p>
16621 !! end
16622
16623 !! test
16624 Simple category
16625 !! options
16626 cat
16627 !! wikitext
16628 [[Category:MediaWiki User's Guide]]
16629 !! html/php
16630 cat=MediaWiki_User's_Guide sort=
16631 !! html/parsoid
16632 <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"}}'/>
16633 !! end
16634
16635 !! test
16636 PAGESINCATEGORY invalid title fatal (r33546 fix)
16637 !! wikitext
16638 {{PAGESINCATEGORY:<bogus>}}
16639 !! html
16640 <p>0
16641 </p>
16642 !! end
16643
16644 !! test
16645 Category with different sort key
16646 !! options
16647 cat
16648 !! wikitext
16649 [[Category:MediaWiki User's Guide|Foo]]
16650 !! html/php
16651 cat=MediaWiki_User's_Guide sort=Foo
16652 !! html/parsoid
16653 <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"}}'/>
16654 !! end
16655
16656 !! test
16657 Category with identical sort key
16658 !! options
16659 cat
16660 !! wikitext
16661 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16662 !! html/php
16663 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16664 !! html/parsoid
16665 <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"}}'/>
16666 !! end
16667
16668 !! test
16669 Category with empty sort key
16670 !! options
16671 cat
16672 pst
16673 !! wikitext
16674 [[Category:MediaWiki User's Guide|]]
16675 !! html/php
16676 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16677 !! end
16678
16679 !! test
16680 Category with empty sort key and parentheses
16681 !! options
16682 cat
16683 pst
16684 !! wikitext
16685 [[Category:Foo (bar)|]]
16686 !! html/php
16687 [[Category:Foo (bar)|Foo]]
16688 !! end
16689
16690 !! test
16691 Category with link tail
16692 !! options
16693 cat
16694 pst
16695 !! wikitext
16696 123[[Category:Foo]]456
16697 !! html/php
16698 123[[Category:Foo]]456
16699 !! end
16700
16701 !! test
16702 Category with template
16703 !! options
16704 cat
16705 pst
16706 !! wikitext
16707 [[Category:{{echo|Foo}}]]
16708 !! html/php
16709 [[Category:{{echo|Foo}}]]
16710 !! end
16711
16712 !! test
16713 Category with template in sort key
16714 !! options
16715 cat
16716 pst
16717 !! wikitext
16718 [[Category:Foo|{{echo|Bar}}]]
16719 !! html/php
16720 [[Category:Foo|{{echo|Bar}}]]
16721 !! end
16722
16723 !! test
16724 Category with template in sort key and title
16725 !! options
16726 cat
16727 pst
16728 !! wikitext
16729 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16730 !! html/php
16731 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16732 !! end
16733
16734 ## We used to, but no longer wt2wt this test since the default serializer
16735 ## will normalize all categories to serialize on their own line.
16736 ## This wikitext usage is going to be fairly uncommon in production and
16737 ## selser will take care of preserving formatting in those scenarios.
16738 !! test
16739 Category / paragraph interactions
16740 !! options
16741 parsoid=wt2html
16742 !! wikitext
16743 Foo [[Category:Baz]] Bar
16744
16745 Foo [[Category:Baz]]
16746 Bar
16747
16748 Foo
16749 [[Category:Baz]]
16750 Bar
16751
16752 Foo
16753 [[Category:Baz]] Bar
16754
16755 Foo
16756 [[Category:Baz]]
16757 [[Category:Baz]]
16758 [[Category:Baz]]
16759 Bar
16760
16761 [[Category:Baz]]
16762 [[Category:Baz]]
16763 [[Category:Baz]]
16764
16765 [[Category:Baz]]
16766 {{echo|[[Category:Baz]]}}
16767 [[Category:Baz]]
16768 !! html/php
16769 <p>Foo Bar
16770 </p><p>Foo
16771 Bar
16772 </p><p>Foo
16773 Bar
16774 </p><p>Foo Bar
16775 </p><p>Foo
16776 Bar
16777 </p>
16778 !! html/parsoid
16779 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16780 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16781 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16782 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16783 <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>
16784 <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}}]}'/>
16785 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16786 !! end
16787
16788 ## We used to, but no longer wt2wt this test since the default serializer
16789 ## will normalize all categories to serialize on their own line.
16790 ## This wikitext usage is going to be fairly uncommon in production and
16791 ## selser will take care of preserving formatting in those scenarios.
16792 ##
16793 ## The whitespace on the empty line is part of the test. Please do not delete
16794 !! test
16795 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16796 !! options
16797 parsoid=wt2html
16798 !! wikitext
16799 This
16800
16801 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16802
16803 {{echo|[[Category:Foo]] and so should this!}}
16804 !! html/php
16805 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16806 </p>
16807 !! html/parsoid
16808 <p>This
16809
16810 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16811
16812 <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>
16813 !! end
16814
16815 ## Parsoid will not try to wt2wt this while preserving newlines because
16816 ## it suppresses excess newlines within list items -- and we don't want to
16817 ## introduce a special case just for categories, which is, in reality somewhat
16818 ## odd behavior -- categories are unlikely to be used in list items like this
16819 ## in top-level pages and are only likely to show up in template-generated
16820 ## list items where this RT-ing is a non-issue.
16821 ##
16822 ## The whitespace on the empty line is part of the test. Please do not delete
16823 !! test
16824 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16825 !! options
16826 parsoid=wt2html
16827 !! wikitext
16828 * This
16829
16830 [[Category:Foo]] and this should be part of the same list item
16831 * So should this
16832
16833 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16834 !! html/php+tidy
16835 <ul><li>This and this should be part of the same list item</li>
16836 <li>So should this and this should be part of the same list item</li></ul>
16837 !! html/parsoid
16838 <ul>
16839 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16840 <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>
16841 </ul>
16842 !! end
16843
16844 ## Newlines and categories that follow the last item of a list
16845 ## are treated differently because this (list followed by categories)
16846 ## is an extremely common pattern on wikis.
16847 !! test
16848 3. Categories and newlines: newline suppression for last list item should RT properly
16849 !! wikitext
16850 *a
16851 *b
16852
16853 [[Category:Foo]]
16854
16855 [[Category:Bar]]
16856 [[Category:Baz]]
16857
16858 :c
16859
16860 [[Category:C]]
16861
16862 ;d
16863
16864 [[Category:D]]
16865 !! html/parsoid
16866 <ul><li>a</li>
16867 <li>b</li></ul>
16868
16869 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16870
16871 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16872 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16873
16874 <dl><dd>c</dd></dl>
16875
16876 <link rel="mw:PageProp/Category" href="./Category:C"/>
16877
16878 <dl><dt>d</dt></dl>
16879
16880 <link rel="mw:PageProp/Category" href="./Category:D"/>
16881 !! end
16882
16883 !! test
16884 4. Categories and newlines: newline suppression for last list item should RT properly
16885 !! wikitext
16886 *a
16887 ****b
16888
16889 [[Category:Foo]]
16890 !! html/parsoid
16891 <ul><li>a
16892 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16893
16894 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16895 !! end
16896
16897 ## only wt2html for this to make sure the algo only applies to the rightmost path
16898 !! test
16899 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16900 !! options
16901 parsoid=wt2html
16902 !! wikitext
16903 *a
16904 **b
16905 [[Category:Foo]]
16906 *c
16907 **d
16908 [[Category:Foo]]
16909 !! html/parsoid
16910 <ul><li>a
16911 <ul><li>b
16912 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16913 <li>c
16914 <ul><li>d</li></ul></li></ul>
16915 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16916 !! end
16917
16918 ## We used to, but no longer wt2wt this test since the default serializer
16919 ## will normalize all categories to serialize on their own line.
16920 ## This wikitext usage is going to be fairly uncommon in production and
16921 ## selser will take care of preserving formatting in those scenarios.
16922 !! test
16923 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16924 !! options
16925 parsoid=wt2html
16926 !! wikitext
16927 *a [[Category:Foo]]
16928 !! html/parsoid
16929 <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>
16930 !! end
16931
16932 # This test also demonstrates because of newline+category tunneling
16933 # through the list hander, template wrapping doesn't expand to the
16934 # containing list when the list item swallows the category.
16935 !! test
16936 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16937 !! wikitext
16938 *{{echo|a
16939 [[Category:Foo]]}}
16940 !! html/parsoid
16941 <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
16942 </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>
16943 !! end
16944
16945 !! test
16946 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16947 !! wikitext
16948 *a
16949
16950 {{echo|[[Category:Foo]]
16951 [[Category:Bar]]}}
16952 [[Category:Baz]]
16953 !! html/parsoid
16954 <ul><li>a</li></ul>
16955
16956 <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">
16957 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16958 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16959 !! end
16960
16961 !! test
16962 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16963 !! wikitext
16964 *a
16965
16966 [[Category:Bar]]<!--boo1--> <!--boo2-->
16967 [[Category:Baz]]<!--boo3--> <!--boo4-->
16968 !! html/parsoid
16969 <ul><li>a</li></ul>
16970
16971 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16972 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16973 !! end
16974
16975 !! test
16976 Categories and newlines: should behave properly with linkprefix (T87753)
16977 !! options
16978 language=ar
16979 !! wikitext
16980 foo bar
16981 foo bar
16982 [[تصنيف:Foo]]
16983 [[تصنيف:Bar]]
16984 !! html/php
16985 <p>foo bar
16986 foo bar
16987 </p>
16988 !! html/parsoid
16989 <p>foo bar
16990 foo bar</p>
16991 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16992 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16993 !! end
16994
16995 !! test
16996 No regressions on internal links following category (T174639)
16997 !! options
16998 parsoid=wt2html,html2html
16999 !! wikitext
17000 [[Category:Foo]]<div>a
17001
17002 [[Foo]]</div>
17003 !! html/php
17004 <div>a
17005 <a href="/wiki/Foo" title="Foo">Foo</a></div>
17006
17007 !! html/parsoid
17008 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
17009
17010 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
17011 !! end
17012
17013 # Note that Parsoid differs slightly from PHP due to T175421
17014 !! test
17015 11. Special case where only newlines separate links (T175416)
17016 !! options
17017 parsoid=wt2html,html2html
17018 !! wikitext
17019 [[Category:Foo]]
17020
17021 [[Foo]][[es:Alimento]]
17022
17023 [[Foo]]
17024 !! html/php
17025 <p><br />
17026 <a href="/wiki/Foo" title="Foo">Foo</a>
17027 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
17028 </p>
17029 !! html/parsoid
17030 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17031
17032 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17033
17034 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
17035 !! end
17036
17037 !! test
17038 Category links with multiple namespaces
17039 !! wikitext
17040 [[Category:Project:Foo]]
17041 !! html/parsoid
17042 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
17043 !! end
17044
17045 !! test
17046 Parsoid: Serialize link to category page with colon escape
17047 !! wikitext
17048
17049 [[:Category:Foo]]
17050 [[:Category:Foo|Bar]]
17051 !! html/php+tidy
17052 <p><a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Category:Foo</a>
17053 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
17054 </p>
17055 !! html/parsoid
17056 <p>
17057 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
17058 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
17059 </p>
17060 !! end
17061
17062 # We used to, but no longer wt2wt this test since the default serializer
17063 # will normalize all categories to serialize on their own line.
17064 # This wikitext usage is going to be fairly uncommon in production and
17065 # selser will take care of preventing whitespace insertion if this
17066 # occurs in an article.
17067 #
17068 # html2html disabled for the same reason (whitespace insertion between
17069 # x and y).
17070 #
17071 # html2wt disabled because it localizes the "Category" namespace.
17072 !! test
17073 Link prefix/suffixes aren't applied to category links
17074 !! options
17075 parsoid=wt2html
17076 language=is
17077 !! wikitext
17078 x[[Category:Foo]]y
17079 !! html/php
17080 <p>xy
17081 </p>
17082 !! html/parsoid
17083 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17084 !! end
17085
17086 !! test
17087 Link prefix/suffixes aren't applied to language links
17088 !! options
17089 parsoid=wt2html
17090 language=is
17091 !! wikitext
17092 x[[es:Foo]]y
17093 !! html/php
17094 <p>xy
17095 </p>
17096 !! html/parsoid
17097 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17098 !! end
17099
17100 !! test
17101 Parsoid: Serialize link to file page with colon escape
17102 !! wikitext
17103
17104 [[:File:Foo.png]]
17105 [[:File:Foo.png|Bar]]
17106 !! html/php+tidy
17107 <p><a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">File:Foo.png</a>
17108 <a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">Bar</a>
17109 </p>
17110 !! html/parsoid
17111 <p>
17112 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17113 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17114 </p>
17115 !! end
17116
17117 !! test
17118 Parsoid: Serialize a genuine category link without colon escape
17119 !! wikitext
17120 [[Category:Foo]]
17121 [[Category:Foo|Bar]]
17122 !! html/php+tidy
17123 !! html/parsoid
17124 <link rel="mw:PageProp/Category" href="./Category:Foo">
17125 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17126 !! end
17127
17128 !! test
17129 Normalize hrefs properly before testing for invalid link targets (T72894)
17130 !! options
17131 parsoid=html2wt
17132 !! html/parsoid
17133 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17134 !! wikitext
17135 [[Category:Toxine bactérienne]]
17136 !! end
17137
17138 !! test
17139 Parsoid: Defaultsort
17140 !! wikitext
17141 {{DEFAULTSORT:Foo}}
17142 !! html/parsoid
17143 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17144 !! end
17145
17146 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17147 # But, this is a limitation of our representation and is documented in
17148 # TemplateHandler.js in processSpecialMagicWord
17149 !! test
17150 Parsoid: Defaultsort (template-generated)
17151 !! wikitext
17152 {{{{echo|DEFAULTSORT}}:Foo}}
17153 !! html/parsoid
17154 <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"}]]}'/>
17155 !! end
17156
17157 ###
17158 ### Inter-language links
17159 ###
17160 !! test
17161 Interlanguage links
17162 !! options
17163 ill
17164 !! wikitext
17165 [[es:Alimento]]
17166 [[fr:Nourriture]]
17167 [[zh:食品]]
17168 !! html/php
17169 es:Alimento fr:Nourriture zh:食品
17170 !! html/parsoid
17171 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17172 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17173 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17174 !! end
17175
17176 !! test
17177 Duplicate interlanguage links (T26502)
17178 !! options
17179 ill
17180 !! wikitext
17181 [[es:1]]
17182 [[es:2]]
17183 [[fr:1]]
17184 [[fr:2]]
17185 !! html/php
17186 es:1 fr:1
17187 !! html/parsoid
17188 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17189 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17190 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17191 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17192 !! end
17193
17194 ###
17195 ### Sections
17196 ###
17197 !! test
17198 Basic section headings
17199 !! wikitext
17200 ==Headline 1==
17201 Some text
17202
17203 ==Headline 2==
17204 More
17205 ===Smaller headline===
17206 Blah blah
17207 !! html
17208 <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>
17209 <p>Some text
17210 </p>
17211 <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>
17212 <p>More
17213 </p>
17214 <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>
17215 <p>Blah blah
17216 </p>
17217 !! end
17218
17219 !! test
17220 Section headings with TOC
17221 !! wikitext
17222 ==Headline 1==
17223 ===Subheadline 1===
17224 =====Skipping a level=====
17225 ======Skipping a level======
17226
17227 ==Headline 2==
17228 Some text
17229 ===Another headline===
17230 !! html
17231 <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>
17232 <ul>
17233 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17234 <ul>
17235 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17236 <ul>
17237 <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>
17238 <ul>
17239 <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>
17240 </ul>
17241 </li>
17242 </ul>
17243 </li>
17244 </ul>
17245 </li>
17246 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17247 <ul>
17248 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17249 </ul>
17250 </li>
17251 </ul>
17252 </div>
17253
17254 <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>
17255 <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>
17256 <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>
17257 <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>
17258 <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>
17259 <p>Some text
17260 </p>
17261 <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>
17262
17263 !! end
17264
17265 !! test
17266 TOC anchors don't collide
17267 !! wikitext
17268 __FORCETOC__
17269 ==Headline 2==
17270 ==Headline==
17271 ==Headline 2==
17272 ==Headline==
17273 !! html/php
17274 <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>
17275 <ul>
17276 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17277 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17278 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17279 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17280 </ul>
17281 </div>
17282
17283 <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>
17284 <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>
17285 <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>
17286 <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>
17287
17288 !! end
17289
17290 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17291 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17292 !! test
17293 Handling of sections up to level 6 and beyond
17294 !! options
17295 parsoid=wt2html
17296 !! wikitext
17297 =Level 1 Heading=
17298 ==Level 2 Heading==
17299 ===Level 3 Heading===
17300 ====Level 4 Heading====
17301 =====Level 5 Heading=====
17302 ======Level 6 Heading======
17303 =======Level 7 Heading=======
17304 ========Level 8 Heading========
17305 =========Level 9 Heading=========
17306 ==========Level 10 Heading==========
17307 !! html/php
17308 <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>
17309 <ul>
17310 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17311 <ul>
17312 <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>
17313 <ul>
17314 <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>
17315 <ul>
17316 <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>
17317 <ul>
17318 <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>
17319 <ul>
17320 <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>
17321 <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>
17322 <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>
17323 <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>
17324 <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>
17325 </ul>
17326 </li>
17327 </ul>
17328 </li>
17329 </ul>
17330 </li>
17331 </ul>
17332 </li>
17333 </ul>
17334 </li>
17335 </ul>
17336 </div>
17337
17338 <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>
17339 <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>
17340 <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>
17341 <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>
17342 <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>
17343 <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>
17344 <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>
17345 <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>
17346 <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>
17347 <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>
17348
17349 !! html/parsoid
17350 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17351 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17352 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17353 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17354 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17355 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17356 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17357 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17358 <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>
17359 <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>
17360 !! end
17361
17362 !! test
17363 TOC regression (T11764)
17364 !! wikitext
17365 ==title 1==
17366 ===title 1.1===
17367 ====title 1.1.1====
17368 ===title 1.2===
17369 ==title 2==
17370 ===title 2.1===
17371 !! html
17372 <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>
17373 <ul>
17374 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17375 <ul>
17376 <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>
17377 <ul>
17378 <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>
17379 </ul>
17380 </li>
17381 <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>
17382 </ul>
17383 </li>
17384 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17385 <ul>
17386 <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>
17387 </ul>
17388 </li>
17389 </ul>
17390 </div>
17391
17392 <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>
17393 <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>
17394 <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>
17395 <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>
17396 <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>
17397 <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>
17398
17399 !! end
17400
17401 !! test
17402 TOC for heading containing <span id="..."></span> (T96153)
17403 !! wikitext
17404 __FORCETOC__
17405 ==<span id="old-anchor"></span>New title==
17406 !! html/php
17407 <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>
17408 <ul>
17409 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17410 </ul>
17411 </div>
17412
17413 <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>
17414
17415 !! end
17416
17417 !! test
17418 TOC with wgMaxTocLevel=3 (T8204)
17419 !! options
17420 wgMaxTocLevel=3
17421 !! wikitext
17422 ==title 1==
17423 ===title 1.1===
17424 ====title 1.1.1====
17425 ===title 1.2===
17426 ==title 2==
17427 ===title 2.1===
17428 !! html
17429 <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>
17430 <ul>
17431 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17432 <ul>
17433 <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>
17434 <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>
17435 </ul>
17436 </li>
17437 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17438 <ul>
17439 <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>
17440 </ul>
17441 </li>
17442 </ul>
17443 </div>
17444
17445 <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>
17446 <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>
17447 <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>
17448 <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>
17449 <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>
17450 <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>
17451
17452 !! end
17453
17454 !! test
17455 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17456 !! options
17457 wgMaxTocLevel=3
17458 !! wikitext
17459 ==Section 1==
17460 ===Section 1.1===
17461 ====Section 1.1.1====
17462 ====Section 1.1.1.1====
17463 ==Section 2==
17464 !! html
17465 <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>
17466 <ul>
17467 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17468 <ul>
17469 <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>
17470 </ul>
17471 </li>
17472 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17473 </ul>
17474 </div>
17475
17476 <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>
17477 <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>
17478 <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>
17479 <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>
17480 <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>
17481
17482 !! end
17483
17484
17485 !! test
17486 Resolving duplicate section names
17487 !! wikitext
17488 ==Foo bar==
17489 ==Foo bar==
17490 !! html
17491 <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>
17492 <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>
17493
17494 !! end
17495
17496 !! test
17497 Resolving duplicate section names with differing case (T12721)
17498 !! wikitext
17499 ==Foo bar==
17500 ==Foo Bar==
17501 !! html
17502 <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>
17503 <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>
17504
17505 !! end
17506
17507 !! article
17508 Template:sections
17509 !! text
17510 ===Section 1===
17511 ==Section 2==
17512 !! endarticle
17513
17514 !! test
17515 Template with sections, __NOTOC__
17516 !! wikitext
17517 __NOTOC__
17518 ==Section 0==
17519 {{sections}}
17520 ==Section 4==
17521 !! html
17522 <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>
17523 <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>
17524 <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>
17525 <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>
17526
17527 !! end
17528
17529 !! test
17530 __NOEDITSECTION__ keyword
17531 !! wikitext
17532 __NOEDITSECTION__
17533 ==Section 1==
17534 ==Section 2==
17535 !! html
17536 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17537 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17538
17539 !! end
17540
17541 !! test
17542 Link inside a section heading
17543 !! wikitext
17544 ==Section with a [[Main Page|link]] in it==
17545 !! html
17546 <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>
17547
17548 !! end
17549
17550 !! test
17551 TOC regression (T14077)
17552 !! wikitext
17553 __TOC__
17554 ==title 1==
17555 ===title 1.1===
17556 ==title 2==
17557 !! html
17558 <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>
17559 <ul>
17560 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17561 <ul>
17562 <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>
17563 </ul>
17564 </li>
17565 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17566 </ul>
17567 </div>
17568
17569 <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>
17570 <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>
17571 <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>
17572
17573 !! end
17574
17575 !! test
17576 T3219 URL next to image (good)
17577 !! wikitext
17578 http://example.com [[File:Foobar.jpg]]
17579 !! html/php
17580 <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>
17581 </p>
17582 !! html/parsoid
17583 <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>
17584 !!end
17585
17586 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17587 !! test
17588 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17589 !! options
17590 parsoid=wt2html,html2html
17591 !! wikitext
17592 ===
17593 The line above must have a trailing space!
17594 === <!--
17595 --> <!-- -->
17596 But just in case it doesn't...
17597 !! html/php
17598 <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>
17599 <p>The line above must have a trailing space!
17600 </p>
17601 <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>
17602 <p>But just in case it doesn't...
17603 </p>
17604 !! html/parsoid
17605 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17606 <p>The line above must have a trailing space!</p>
17607 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17608 --> <!-- -->
17609 <p>But just in case it doesn't...</p>
17610 !! end
17611
17612 !! test
17613 Header with special characters (T27462)
17614 !! wikitext
17615 The tooltips shall not show entities to the user (ie. be double escaped)
17616
17617 ==text > text==
17618 section 1
17619
17620 ==text < text==
17621 section 2
17622
17623 ==text & text==
17624 section 3
17625
17626 ==text ' text==
17627 section 4
17628
17629 ==text " text==
17630 section 5
17631 !! html/php
17632 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17633 </p>
17634 <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>
17635 <ul>
17636 <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>
17637 <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>
17638 <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>
17639 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17640 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17641 </ul>
17642 </div>
17643
17644 <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>
17645 <p>section 1
17646 </p>
17647 <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>
17648 <p>section 2
17649 </p>
17650 <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>
17651 <p>section 3
17652 </p>
17653 <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>
17654 <p>section 4
17655 </p>
17656 <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>
17657 <p>section 5
17658 </p>
17659 !! html/parsoid
17660 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17661
17662 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17663 <p>section 1</p>
17664
17665 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17666 <p>section 2</p>
17667
17668 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17669 <p>section 3</p>
17670
17671 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17672 <p>section 4</p>
17673
17674 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17675 <p>section 5</p>
17676 !! end
17677
17678 !! test
17679 Header with space, plus and underscore as entity
17680 !! wikitext
17681 Id should not contain + for spaces
17682
17683 ==Space between Text==
17684 section 1
17685
17686 ==Space-Entity&#32;between&#32;Text==
17687 section 2
17688
17689 ==Plus+between+Text==
17690 section 3
17691
17692 ==Plus-Entity&#43;between&#43;Text==
17693 section 4
17694
17695 ==Underscore_between_Text==
17696 section 5
17697
17698 ==Underscore-Entity&#95;between&#95;Text==
17699 section 6
17700
17701 [[#Space between Text]]
17702 [[#Space-Entity&#32;between&#32;Text]]
17703 [[#Plus+between+Text]]
17704 [[#Plus-Entity&#43;between&#43;Text]]
17705 [[#Underscore_between_Text]]
17706 [[#Underscore-Entity&#95;between&#95;Text]]
17707 !! html/php
17708 <p>Id should not contain + for spaces
17709 </p>
17710 <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>
17711 <ul>
17712 <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>
17713 <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>
17714 <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>
17715 <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>
17716 <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>
17717 <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>
17718 </ul>
17719 </div>
17720
17721 <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>
17722 <p>section 1
17723 </p>
17724 <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>
17725 <p>section 2
17726 </p>
17727 <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>
17728 <p>section 3
17729 </p>
17730 <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>
17731 <p>section 4
17732 </p>
17733 <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>
17734 <p>section 5
17735 </p>
17736 <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>
17737 <p>section 6
17738 </p><p><a href="#Space_between_Text">#Space between Text</a>
17739 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17740 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17741 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17742 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17743 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17744 </p>
17745 !! html/parsoid
17746 <p>Id should not contain + for spaces</p>
17747
17748 <h2 id="Space_between_Text">Space between Text</h2>
17749 <p>section 1</p>
17750
17751 <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>
17752 <p>section 2</p>
17753
17754 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17755 <p>section 3</p>
17756
17757 <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>
17758 <p>section 4</p>
17759
17760 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17761 <p>section 5</p>
17762
17763 <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>
17764 <p>section 6</p>
17765
17766 <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>
17767 <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>
17768 <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>
17769 <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>
17770 <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>
17771 <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>
17772 !! end
17773
17774 # Parsoid html2wt disabled because it adds padding spaces around =
17775 !! test
17776 Headers with excess '=' characters
17777 (Are similar tests necessary beyond the 1st level?)
17778 !! options
17779 parsoid=wt2html,wt2wt,html2html
17780 !! wikitext
17781 =foo==
17782 ==foo=
17783 =''italic'' heading==
17784 ==''italic'' heading=
17785 !! html/php
17786 <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>
17787 <ul>
17788 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17789 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17790 <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>
17791 <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>
17792 </ul>
17793 </div>
17794
17795 <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>
17796 <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>
17797 <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>
17798 <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>
17799
17800 !! html/parsoid
17801 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17802 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17803 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17804 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17805 !! end
17806
17807 !! test
17808 HTML headers vs TOC (T25393)
17809 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17810 !! wikitext
17811 <h1>Header 1</h1>
17812 ==Header 1.1==
17813 ==Header 1.2==
17814
17815 <h1>Header 2
17816 </h1>
17817 ==Header 2.1==
17818 ==Header 2.2==
17819 __NOEDITSECTION__
17820 !! html/php
17821 <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>
17822 <ul>
17823 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17824 <ul>
17825 <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>
17826 <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>
17827 </ul>
17828 </li>
17829 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17830 <ul>
17831 <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>
17832 <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>
17833 </ul>
17834 </li>
17835 </ul>
17836 </div>
17837
17838 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17839 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17840 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17841 <h1><span class="mw-headline" id="Header_2">Header 2
17842 </span></h1>
17843 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17844 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17845
17846 !! html/parsoid
17847 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17848 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17849 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17850
17851 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17852 </h1>
17853 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17854 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17855 <meta property="mw:PageProp/noeditsection"/>
17856 !! end
17857
17858 !! test
17859 Single-line or multiline-comments can follow headings
17860 !! options
17861 parsoid=wt2html,wt2wt
17862 !! wikitext
17863 ==foo==<!---->
17864 ==bar==<!--c1-->
17865 ==baz==<!--
17866 c2
17867 c3-->
17868 !! html/php
17869 <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>
17870 <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>
17871 <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>
17872
17873 !! html/parsoid
17874 <h2 id="foo">foo</h2><!---->
17875 <h2 id="bar">bar</h2><!--c1-->
17876 <h2 id="baz">baz</h2><!--
17877 c2
17878 c3-->
17879 !! end
17880
17881 !! test
17882 T3219 URL next to image (broken)
17883 !! wikitext
17884 http://example.com[[File:Foobar.jpg]]
17885 !! html/php
17886 <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>
17887 </p>
17888 !! html/parsoid
17889 <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>
17890 !!end
17891
17892 !! test
17893 T3186 news: in the middle of text
17894 !! wikitext
17895 http://en.wikinews.org/wiki/Wikinews:Workplace
17896 !! html
17897 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17898 </p>
17899 !!end
17900
17901
17902 !! test
17903 Namespaced link must have a title
17904 !! wikitext
17905 [[Project:]]
17906 !! html
17907 <p>[[Project:]]
17908 </p>
17909 !!end
17910
17911 !! test
17912 Namespaced link must have a title (bad fragment version)
17913 !! wikitext
17914 [[Project:#fragment]]
17915 !! html
17916 <p>[[Project:#fragment]]
17917 </p>
17918 !!end
17919
17920
17921 ###
17922 ### HTML tags and HTML attributes
17923 ###
17924
17925 !! test
17926 div with no attributes
17927 !! wikitext
17928 <div>HTML rocks</div>
17929 !! html
17930 <div>HTML rocks</div>
17931
17932 !! end
17933
17934 !! test
17935 div with double-quoted attribute
17936 !! wikitext
17937 <div id="rock">HTML rocks</div>
17938 !! html
17939 <div id="rock">HTML rocks</div>
17940
17941 !! end
17942
17943 !! test
17944 div with single-quoted attribute
17945 !! wikitext
17946 <div id='rock'>HTML rocks</div>
17947 !! html
17948 <div id="rock">HTML rocks</div>
17949
17950 !! end
17951
17952 !! test
17953 div with unquoted attribute
17954 !! wikitext
17955 <div id=rock>HTML rocks</div>
17956 !! html
17957 <div id="rock">HTML rocks</div>
17958
17959 !! end
17960
17961 !! test
17962 div with illegal double attributes
17963 !! wikitext
17964 <div id="a" id="b">HTML rocks</div>
17965 !! html
17966 <div id="b">HTML rocks</div>
17967
17968 !!end
17969
17970 !! test
17971 div with empty attribute value, space before equals
17972 !! options
17973 parsoid=wt2html,html2html
17974 !! wikitext
17975 <div class =>HTML rocks</div>
17976 !! html/php
17977 <div class="">HTML rocks</div>
17978
17979 !! html/parsoid
17980 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17981 !! end
17982
17983 !! test
17984 div with multiple empty attribute values
17985 !! config
17986 wgFragmentMode=[ 'html5', 'legacy' ]
17987 !! options
17988 parsoid=wt2html,html2html
17989 !! wikitext
17990 <div id= title=>HTML rocks</div>
17991 !! html/php
17992 <div id="title=">HTML rocks</div>
17993
17994 !! html/parsoid
17995 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17996 !! end
17997
17998 # FIXME Parsoid doesn't actually match PHP here.
17999 # Probably we should use the synthetic <foo /> or <indicator>
18000 # extensions for this test, which are enabled when running parser tests.
18001 !! test
18002 Extension tag in attribute value
18003 !! wikitext
18004 <span title="<translate>123</translate>">ok</span>
18005 !! html/php+disabled
18006 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
18007 </p>
18008 !! html/parsoid
18009 <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>
18010 !! end
18011
18012 !! test
18013 table with multiple empty attribute values
18014 !! options
18015 parsoid=wt2html,html2html
18016 !! wikitext
18017 {| title= id=
18018 |hi
18019 |}
18020 !! html/php
18021 <table title="id=">
18022 <tr>
18023 <td>hi
18024 </td></tr></table>
18025
18026 !! html/parsoid
18027 <table title="id=">
18028 <tbody><tr><td>hi</td></tr>
18029 </tbody></table>
18030 !! end
18031
18032 !! test
18033 div with braces in attribute value
18034 !! wikitext
18035 <div title="{}">Foo</div>
18036 !! html/php
18037 <div title="&#123;&#125;">Foo</div>
18038
18039 !! html/parsoid
18040 <div title="{}">Foo</div>
18041 !! end
18042
18043 !! test
18044 div with empty attribute value, no space before equals
18045 !! options
18046 parsoid=wt2html,html2html
18047 !! wikitext
18048 <div class=>HTML rocks</div>
18049 !! html/php
18050 <div class="">HTML rocks</div>
18051
18052 !! html/parsoid
18053 <div class="">HTML rocks</div>
18054 !! end
18055
18056 !! test
18057 HTML multiple attributes correction
18058 !! wikitext
18059 <p class="error" class="awesome">Awesome!</p>
18060 !! html
18061 <p class="awesome">Awesome!</p>
18062
18063 !!end
18064
18065 !! test
18066 Table multiple attributes correction
18067 !! wikitext
18068 {|
18069 !+ class="error" class="awesome"|status
18070 |}
18071 !! html
18072 <table>
18073 <tr>
18074 <th class="awesome">status
18075 </th></tr></table>
18076
18077 !!end
18078
18079 !! test
18080 DIV IN UPPERCASE
18081 !! wikitext
18082 <DIV ID="x">HTML ROCKS</DIV>
18083 !! html
18084 <div id="x">HTML ROCKS</div>
18085
18086 !!end
18087
18088 !! test
18089 Non-ASCII pseudo-tags are rendered as text
18090 !! wikitext
18091 <khyô>
18092 !! html
18093 <p>&lt;khyô&gt;
18094 </p>
18095 !! end
18096
18097 !! test
18098 Pseudo-tag with URL 'name' renders as url link
18099 !! wikitext
18100 <http://example.com/>
18101 !! html
18102 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
18103 </p>
18104 !! end
18105
18106 !! test
18107 text with amp in the middle of nowhere
18108 !! wikitext
18109 Remember AT&T?
18110 !! html
18111 <p>Remember AT&amp;T?
18112 </p>
18113 !! end
18114
18115 !! test
18116 text with character entity: eacute
18117 !! wikitext
18118 I always thought &eacute; was a cute letter.
18119 !! html+tidy
18120 <p>I always thought &#233; was a cute letter.
18121 </p>
18122 !! end
18123
18124 !! test
18125 text with entity-escaped character entity-like string: eacute
18126 !! wikitext
18127 I always thought &amp;eacute; was a cute letter.
18128 !! html
18129 <p>I always thought &amp;eacute; was a cute letter.
18130 </p>
18131 !! end
18132
18133 !! test
18134 text with undefined character entity: xacute
18135 !! wikitext
18136 I always thought &xacute; was a cute letter.
18137 !! html
18138 <p>I always thought &amp;xacute; was a cute letter.
18139 </p>
18140 !! end
18141
18142 !! test
18143 HTML5 tags
18144 !! wikitext
18145 <data value="5">five</data>
18146 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18147 <mark>This highlighted text</mark>
18148 !! html
18149 <p><data value="5">five</data>
18150 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18151 <mark>This highlighted text</mark>
18152 </p>
18153 !! end
18154
18155 !! test
18156 HTML tag with leading space is parsed as text
18157 !! wikitext
18158 < div>foo< /div>
18159 !! html
18160 <p>&lt; div&gt;foo&lt; /div&gt;
18161 </p>
18162 !! end
18163
18164 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
18165 ## the HTML5 parsing spec.
18166 !! test
18167 Element with broken attribute syntax
18168 !! options
18169 parsoid=wt2html
18170 !! wikitext
18171 <div style=" style="123">hi</div>
18172 <div =>ho</div>
18173 !! html/php
18174 <div style="123">hi</div>
18175 <div>ho</div>
18176
18177 !! html/parsoid
18178 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18179 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18180 !! end
18181
18182 ###
18183 ### Nesting tests (see T43545, T52604, T53081)
18184 ###
18185
18186 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18187 # Note that html2wt is considerably more difficult if we use <b> in
18188 # the test case, instead of <small>
18189 !! test
18190 Ensure that HTML adoption agency algorithm is properly implemented.
18191 !! wikitext
18192 <small>X<small>Y</small>Z</small>
18193 !! html
18194 <p><small>X<small>Y</small>Z</small>
18195 </p>
18196 !! end
18197
18198 # This was T43545 in the PHP parser.
18199 !! test
18200 Nesting of <kbd>
18201 !! wikitext
18202 <kbd>X<kbd>Y</kbd>Z</kbd>
18203 !! html+tidy
18204 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18205 </p>
18206 !! end
18207
18208 # The following cases were T53081 in the PHP parser.
18209 # Note that there are some other nestable tags (b, i, etc) which are
18210 # not covered; see T53081 for discussion.
18211
18212 !! test
18213 Nesting of <em>
18214 !! wikitext
18215 <em>X<em>Y</em>Z</em>
18216 !! html+tidy
18217 <p><em>X<em>Y</em>Z</em>
18218 </p>
18219 !! end
18220
18221 !! test
18222 Nesting of <strong>
18223 !! wikitext
18224 <strong>X<strong>Y</strong>Z</strong>
18225 !! html+tidy
18226 <p><strong>X<strong>Y</strong>Z</strong>
18227 </p>
18228 !! end
18229
18230 !! test
18231 Nesting of <q>
18232 !! wikitext
18233 <q>X<q>Y</q>Z</q>
18234 !! html+tidy
18235 <p><q>X<q>Y</q>Z</q>
18236 </p>
18237 !! end
18238
18239 !! test
18240 Nesting of <ruby>
18241 !! wikitext
18242 <ruby>X<ruby>Y</ruby>Z</ruby>
18243 !! html
18244 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18245 </p>
18246 !! end
18247
18248 !! test
18249 Nesting of <bdo>
18250 !! wikitext
18251 <bdo>X<bdo>Y</bdo>Z</bdo>
18252 !! html
18253 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18254 </p>
18255 !! end
18256
18257
18258 ###
18259 ### Media links
18260 ###
18261
18262 !! test
18263 Media link
18264 !! wikitext
18265 [[Media:Foobar.jpg]]
18266 [[Media:Video.ogv]]
18267 [[:Media:Video.ogv]]
18268 !! html/php
18269 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18270 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18271 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18272 </p>
18273 !! html/parsoid
18274 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18275 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18276 <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>
18277 !! end
18278
18279 !! test
18280 Media link with text
18281 !! wikitext
18282 [[Media:Foobar.jpg|A neat file to look at]]
18283 !! html/php
18284 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18285 </p>
18286 !! html/parsoid
18287 <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>
18288 !! end
18289
18290 !! test
18291 Localized media link
18292 !! options
18293 language=is
18294 !! wikitext
18295 [[Miðill:Foobar.jpg]]
18296
18297 [[Miðill:Foobar.jpg|Icelandic]]
18298 !! html/php
18299 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18300 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18301 </p>
18302 !! html/parsoid
18303 <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>
18304 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18305 !! end
18306
18307 # FIXME: this is still bad HTML tag nesting
18308 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18309 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18310 !! test
18311 Media link with nasty text
18312 !! options
18313 parsoid=wt2html,html2html
18314 !! wikitext
18315 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18316 !! html/php
18317 <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>
18318
18319 !! html/php+tidy
18320 <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>
18321 !! html/parsoid
18322 <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>
18323 !! end
18324
18325 !! test
18326 Media link from missing resource (parsoid-only)
18327 !! options
18328 parsoid=html2wt
18329 !! html/parsoid
18330 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18331 !! wikitext
18332 [[Media:Foobar.jpg|Bat!]]
18333 !! end
18334
18335 !! test
18336 Media link from missing resource, localized (parsoid-only)
18337 !! options
18338 parsoid=html2wt
18339 language=is
18340 !! html/parsoid
18341 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18342 !! wikitext
18343 [[Miðill:Foobar.jpg|Bat!]]
18344 !! end
18345
18346 # This is a sanity test to ensure we don't crash or choke when given
18347 # old cached 1.7.0 HTML for media links; we don't require that the
18348 # result be "valid" because wt2wt was completely broken in 1.7.0
18349 !! test
18350 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18351 !! options
18352 parsoid=html2wt
18353 !! html/parsoid
18354 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18355 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18356 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18357 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18358 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18359 !! wikitext
18360 This is what Parsoid would emit (and we still handle this HTML fine):
18361
18362 [[Media:Foobar.jpg|A neat file to look at]]
18363
18364 But VisualEditor would mangle the rel attribute, and give us back this:
18365
18366 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18367
18368 But at least we don't crash when trying to handle the mangled HTML!
18369 !! end
18370
18371 !! test
18372 Media link to nonexistent file (T3702)
18373 !! wikitext
18374 [[Media:No such.jpg]]
18375 [[Media:No_such file.jpg]]
18376 !! html/php
18377 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18378 <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>
18379 </p>
18380 !! html/parsoid
18381 <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>
18382 <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>
18383 !! end
18384
18385 !! test
18386 Image link to nonexistent file (T3850 - good)
18387 !! wikitext
18388 [[File:No_such.jpg]]
18389 !! html/php
18390 <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>
18391 </p>
18392 !! html/parsoid
18393 <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>
18394 !! end
18395
18396 !! test
18397 :Image link to nonexistent file (T3850 - bad)
18398 !! wikitext
18399 [[:Image:No such.jpg]]
18400 !! html/php
18401 <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>
18402 </p>
18403 !! html/parsoid
18404 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18405 !! end
18406
18407 !! test
18408 Character reference normalization in link text (T3938)
18409 !! wikitext
18410 [[Main Page|this&that]]
18411 !! html
18412 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18413 </p>
18414 !!end
18415
18416 !! article
18417 אַ
18418 !! text
18419 Test for unicode normalization
18420
18421 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18422 !! endarticle
18423
18424 !! test
18425 (T21451) Links should refer to the normalized form.
18426 !! wikitext
18427 [[&#xFB2E;]]
18428 [[&#x5d0;&#x5b7;]]
18429 [[&#x5d0;ַ]]
18430 [[א&#x5b7;]]
18431 [[אַ]]
18432 !! html
18433 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18434 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18435 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18436 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18437 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18438 </p>
18439 !! end
18440
18441 !! test
18442 Empty attribute crash test (T4067)
18443 !! wikitext
18444 <font color="">foo</font>
18445 !! html
18446 <p><font color="">foo</font>
18447 </p>
18448 !! end
18449
18450 !! test
18451 Empty attribute crash test single-quotes (T4067)
18452 !! wikitext
18453 <font color=''>foo</font>
18454 !! html
18455 <p><font color="">foo</font>
18456 </p>
18457 !! end
18458
18459 !! test
18460 Attribute test: equals, then nothing
18461 !! options
18462 parsoid=wt2html,html2html
18463 !! wikitext
18464 <font color=>foo</font>
18465 !! html/php
18466 <p><font color="">foo</font>
18467 </p>
18468 !! html/parsoid
18469 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18470 !! end
18471
18472 !! test
18473 Attribute test: unquoted value
18474 !! options
18475 parsoid=wt2html,html2html
18476 !! wikitext
18477 <font color=x>foo</font>
18478 !! html/php
18479 <p><font color="x">foo</font>
18480 </p>
18481 !! html/parsoid
18482 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18483 !! end
18484
18485 !! test
18486 Attribute test: unquoted but illegal value (hash)
18487 !! wikitext
18488 <font color=#x>foo</font>
18489 !! html
18490 <p><font color="#x">foo</font>
18491 </p>
18492 !! end
18493
18494 # Parsoid does not serialize to empty attribute syntax,
18495 # so wt2wt and html2wt cases are skipped
18496 !! test
18497 Attribute test: no value (T54330)
18498 !! options
18499 parsoid=wt2html,html2html
18500 !! wikitext
18501 <font color>foo</font>
18502 !! html/php
18503 <p><font color="">foo</font>
18504 </p>
18505 !! html/parsoid
18506 <p><font color="">foo</font></p>
18507 !! end
18508
18509 !! test
18510 T4095: link with three closing brackets
18511 !! wikitext
18512 [[Main Page]]]
18513 !! html/php
18514 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18515 </p>
18516 !! html/parsoid
18517 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18518 !! end
18519
18520 !! test
18521 T4095: link with pipe and three closing brackets
18522 !! wikitext
18523 [[Main Page|link]]]
18524 !! html/php
18525 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18526 </p>
18527 !! html/parsoid
18528 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18529 !! end
18530
18531 !! test
18532 T4095: link with pipe and three closing brackets, version 2
18533 !! wikitext
18534 [[Main Page|[http://example.com/]]]
18535 !! html/php
18536 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18537 </p>
18538 !! html/parsoid
18539 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18540 !! end
18541
18542
18543 ###
18544 ### Safety
18545 ###
18546
18547 !! article
18548 Template:Dangerous attribute
18549 !! text
18550 " onmouseover="alert(document.cookie)
18551 !! endarticle
18552
18553 !! article
18554 Template:Dangerous style attribute
18555 !! text
18556 border-size: expression(alert(document.cookie))
18557 !! endarticle
18558
18559 !! article
18560 Template:Div style
18561 !! text
18562 <div style="float: right; {{{1}}}">Magic div</div>
18563 !! endarticle
18564
18565 !! test
18566 T4304: HTML attribute safety (safe template; regression T4309)
18567 !! wikitext
18568 <div title="{{test}}"></div>
18569 !! html/php
18570 <div title="This is a test template"></div>
18571
18572 !! html/parsoid
18573 <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>
18574 !! end
18575
18576 # Parsoid has enough context to handle this case
18577 !! test
18578 T4304: HTML attribute safety (dangerous template; 2309)
18579 !! wikitext
18580 <div title="{{dangerous attribute}}"></div>
18581 !! html/php
18582 <div title=""></div>
18583
18584 !! html/parsoid
18585 <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>
18586 !! end
18587
18588 !! test
18589 T4304: HTML attribute safety (dangerous style template; 2309)
18590 !! wikitext
18591 <div style="{{dangerous style attribute}}"></div>
18592 !! html/php
18593 <div style="/* insecure input */"></div>
18594
18595 !! html/parsoid
18596 <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>
18597 !! end
18598
18599 !! test
18600 T4304: HTML attribute safety (safe parameter; 2309)
18601 !! wikitext
18602 {{div style|width: 200px}}
18603 !! html/php
18604 <div style="float: right; width: 200px">Magic div</div>
18605
18606 !! html/parsoid
18607 <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>
18608 !! end
18609
18610 !! test
18611 T4304: HTML attribute safety (unsafe parameter; 2309)
18612 !! wikitext
18613 {{div style|width: expression(alert(document.cookie))}}
18614 !! html/php
18615 <div style="/* insecure input */">Magic div</div>
18616
18617 !! html/parsoid
18618 <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>
18619 !! end
18620
18621 ## Parsoid output here differs; needs investigation.
18622 !! test
18623 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18624 !! wikitext
18625 {{div style|"><script>alert(document.cookie)</script>}}
18626 !! html
18627 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18628
18629 !! end
18630
18631 ## Parsoid output here differs; needs investigation.
18632 !! test
18633 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18634 !! wikitext
18635 {{div style|" ><script>alert(document.cookie)</script>}}
18636 !! html
18637 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18638
18639 !! end
18640
18641 !! test
18642 T4304: HTML attribute safety (link)
18643 !! wikitext
18644 <div title="[[Main Page]]"></div>
18645 !! html/php
18646 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18647
18648 !! html/parsoid
18649 <div title="[[Main Page]]"></div>
18650 !! end
18651
18652 !! test
18653 T4304: HTML attribute safety (italics)
18654 !! wikitext
18655 <div title="''foobar''"></div>
18656 !! html
18657 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18658
18659 !! end
18660
18661 !! test
18662 T4304: HTML attribute safety (bold)
18663 !! wikitext
18664 <div title="'''foobar'''"></div>
18665 !! html
18666 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18667
18668 !! end
18669
18670 !! test
18671 T4304: HTML attribute safety (ISBN)
18672 !! wikitext
18673 <div title="ISBN 1234567890"></div>
18674 !! html
18675 <div title="&#73;SBN 1234567890"></div>
18676
18677 !! end
18678
18679 !! test
18680 T4304: HTML attribute safety (RFC)
18681 !! wikitext
18682 <div title="RFC 1234"></div>
18683 !! html
18684 <div title="&#82;FC 1234"></div>
18685
18686 !! end
18687
18688 !! test
18689 T4304: HTML attribute safety (PMID)
18690 !! wikitext
18691 <div title="PMID 1234567890"></div>
18692 !! html
18693 <div title="&#80;MID 1234567890"></div>
18694
18695 !! end
18696
18697 !! test
18698 T4304: HTML attribute safety (web link)
18699 !! wikitext
18700 <div title="http://example.com/"></div>
18701 !! html
18702 <div title="http&#58;//example.com/"></div>
18703
18704 !! end
18705
18706 !! test
18707 T4304: HTML attribute safety (named web link)
18708 !! wikitext
18709 <div title="[http://example.com/ link]"></div>
18710 !! html/php
18711 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18712
18713 !! html/parsoid
18714 <div title="[http://example.com/ link]"></div>
18715 !! end
18716
18717 !! test
18718 T5244: HTML attribute safety (extension; safe)
18719 !! wikitext
18720 <div style="<nowiki>background:blue</nowiki>"></div>
18721 !! html/php
18722 <div style="background:blue"></div>
18723
18724 !! html/parsoid
18725 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18726 !! end
18727
18728 !! test
18729 T5244: HTML attribute safety (extension; unsafe)
18730 !! wikitext
18731 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18732 !! html/php
18733 <div style="/* insecure input */"></div>
18734
18735 !! html/parsoid
18736 <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>
18737 !! end
18738
18739 # More MSIE fun discovered by Tom Gilder
18740
18741 !! test
18742 MSIE CSS safety test: spurious slash
18743 !! wikitext
18744 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18745 !! html/php
18746 <div style="/* insecure input */">evil</div>
18747
18748 !! html/parsoid
18749 <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>
18750 !! end
18751
18752 !! test
18753 MSIE CSS safety test: hex code
18754 !! wikitext
18755 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18756 !! html/php
18757 <div style="/* insecure input */">evil</div>
18758
18759 !! html/parsoid
18760 <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>
18761 !! end
18762
18763 !! test
18764 MSIE CSS safety test: comment in url
18765 !! wikitext
18766 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18767 !! html/php
18768 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18769
18770 !! html/parsoid
18771 <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>
18772 !! end
18773
18774 !! test
18775 MSIE CSS safety test: comment in expression
18776 !! wikitext
18777 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18778 !! html/php
18779 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18780
18781 !! html/parsoid
18782 <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>
18783 !! end
18784
18785 !! test
18786 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18787 !! wikitext
18788 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18789 !! html/php
18790 <p style="/* invalid control char */">A</p>
18791
18792 !! html/parsoid
18793 <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>
18794 !! end
18795
18796 !! test
18797 MSIE 6 CSS safety test: Fullwidth (T57332)
18798 !! wikitext
18799 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18800 <div style="top:EXPRESSION(alert())">B</div>
18801 !! html/php
18802 <p style="/* insecure input */">A</p>
18803 <div style="/* insecure input */">B</div>
18804
18805 !! html/parsoid
18806 <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>
18807 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18808 !! end
18809
18810 !! test
18811 MSIE 6 CSS safety test: IPA extensions (T57332)
18812 !! wikitext
18813 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18814 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18815 !! html/php
18816 <div style="/* insecure input */">A</div>
18817 <p style="/* insecure input */">B</p>
18818
18819 !! html/parsoid
18820 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18821 <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>
18822 !! end
18823
18824 !! test
18825 MSIE 6 CSS safety test: sup/sub script (T57332)
18826 !! wikitext
18827 <div style="background-image:url⁽javascript:alert())">A</div>
18828 <div style="background-image:url₍javascript:alert())">B</div>
18829 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18830 !! html/php
18831 <div style="/* insecure input */">A</div>
18832 <div style="/* insecure input */">B</div>
18833 <p style="/* insecure input */">C</p>
18834
18835 !! html/parsoid
18836 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18837 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18838 <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>
18839 !! end
18840
18841 !! test
18842 Opera -o-link CSS
18843 !! options
18844 parsoid=wt2html,html2html
18845 !! wikitext
18846 <div
18847 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;"
18848 style="-o-link:attr(title);-o-link-source:current">X</div>
18849 !! html/php
18850 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18851
18852 !! html/parsoid
18853 <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>
18854 !! end
18855
18856 !! test
18857 MSIE 6 CSS safety test: Repetition markers (T57332)
18858 !! wikitext
18859 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18860 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18861 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18862 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18863 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18864 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18865 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18866 !! html/php
18867 <p style="/* insecure input */">A</p>
18868 <p style="/* insecure input */">B</p>
18869 <p style="/* insecure input */">C</p>
18870 <p style="/* insecure input */">D</p>
18871 <p style="/* insecure input */">E</p>
18872 <p style="/* insecure input */">F</p>
18873 <p style="/* insecure input */">G</p>
18874
18875 !! html/parsoid
18876 <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>
18877 <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>
18878 <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>
18879 <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>
18880 <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>
18881 <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>
18882 <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>
18883 !! end
18884
18885 !! test
18886 Table attribute legitimate extension
18887 !! wikitext
18888 {|
18889 !+ style="<nowiki>color:blue</nowiki>"|status
18890 |}
18891 !! html
18892 <table>
18893 <tr>
18894 <th style="color:blue">status
18895 </th></tr></table>
18896
18897 !!end
18898
18899 !! test
18900 Table attribute safety
18901 !! wikitext
18902 {|
18903 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18904 |}
18905 !! html
18906 <table>
18907 <tr>
18908 <th style="/* insecure input */">status
18909 </th></tr></table>
18910
18911 !! end
18912
18913 !! test
18914 CSS line continuation 1
18915 !! wikitext
18916 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18917 !! html
18918 <div style="/* insecure input */"></div>
18919
18920 !! end
18921
18922 !! test
18923 CSS line continuation 2
18924 !! wikitext
18925 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18926 !! html
18927 <div style="/* invalid control char */"></div>
18928
18929 !! end
18930
18931 !! article
18932 Template:Identity
18933 !! text
18934 {{{1}}}
18935 !! endarticle
18936
18937 !! test
18938 Expansion of multi-line templates in attribute values (T8255)
18939 !! wikitext
18940 <div style="background: {{identity|#00FF00}}">-</div>
18941 !! html
18942 <div style="background: #00FF00">-</div>
18943
18944 !! end
18945
18946 !! test
18947 Expansion of multi-line templates in attribute values (T8255 sanity check)
18948 !! wikitext
18949 <div style="background:
18950 #00FF00">-</div>
18951 !! html/php
18952 <div style="background: #00FF00">-</div>
18953
18954 !! html/parsoid
18955 <div style="background:
18956 #00FF00">-</div>
18957 !! end
18958
18959 !! test
18960 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18961 !! wikitext
18962 <div style="background: &#10;#00FF00">-</div>
18963 !! html
18964 <div style="background: &#10;#00FF00">-</div>
18965
18966 !! end
18967
18968 !! test
18969 Tags which are hidden from tidiers cannot pass through the Sanitizer
18970 !! wikitext
18971 <mw:toc><script>alert();</script></mw:toc>
18972 !! html+tidy
18973 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18974 </p>
18975 !! end
18976
18977 ###
18978 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18979 ###
18980
18981 !! test
18982 Parser hook: empty input
18983 !! wikitext
18984 <tag></tag>
18985 !! html/php
18986 <pre>
18987 ''
18988 array (
18989 )
18990 </pre>
18991
18992 !! html/parsoid
18993 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18994 !! end
18995
18996 ## Don't expect parsoid to rt this form.
18997 !! test
18998 Parser hook: empty input using terminated empty elements
18999 !! options
19000 parsoid=wt2html,html2html
19001 !! wikitext
19002 <tag/>
19003 !! html/php
19004 <pre>
19005 NULL
19006 array (
19007 )
19008 </pre>
19009
19010 !! html/parsoid
19011 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19012 !! end
19013
19014 !! test
19015 Parser hook: empty input using terminated empty elements (space before)
19016 !! wikitext
19017 <tag />
19018 !! html/php
19019 <pre>
19020 NULL
19021 array (
19022 )
19023 </pre>
19024
19025 !! html/parsoid
19026 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19027 !! end
19028
19029 !! test
19030 Parser hook: basic input
19031 !! wikitext
19032 <tag>input</tag>
19033 !! html/php
19034 <pre>
19035 'input'
19036 array (
19037 )
19038 </pre>
19039
19040 !! html/parsoid
19041 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19042 !! end
19043
19044 ## Don't expect parsoid to rt this form.
19045 !! test
19046 Parser hook: case insensitive
19047 !! options
19048 parsoid=wt2html,html2html
19049 !! wikitext
19050 <TAG>input</TAG>
19051 !! html/php
19052 <pre>
19053 'input'
19054 array (
19055 )
19056 </pre>
19057
19058 !! html/parsoid
19059 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19060 !! end
19061
19062 ## Don't expect parsoid to rt this form.
19063 !! test
19064 Parser hook: case insensitive, redux
19065 !! options
19066 parsoid=wt2html,html2html
19067 !! wikitext
19068 <TaG>input</TAg>
19069 !! html/php
19070 <pre>
19071 'input'
19072 array (
19073 )
19074 </pre>
19075
19076 !! html/parsoid
19077 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19078 !! end
19079
19080 !! test
19081 Parser hook: nested tags
19082 !! options
19083 parsoid=wt2html
19084 !! wikitext
19085 <tag><tag></tag></tag>
19086 !! html/php
19087 <pre>
19088 '<tag>'
19089 array (
19090 )
19091 </pre>&lt;/tag&gt;
19092
19093 !! html/php+tidy
19094 <pre>'<tag>'
19095 array (
19096 )
19097 </tag></pre><p>&lt;/tag&gt;
19098 </p>
19099 !! html/parsoid
19100 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
19101 !! end
19102
19103 !! test
19104 Parser hook: basic arguments
19105 !! wikitext
19106 <tag width="200" height="100" depth="50" square=""></tag>
19107 !! html/php
19108 <pre>
19109 ''
19110 array (
19111 'width' => '200',
19112 'height' => '100',
19113 'depth' => '50',
19114 'square' => '',
19115 )
19116 </pre>
19117
19118 !! html/parsoid
19119 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19120 !! end
19121
19122 ## Don't expect parsoid to rt this form.
19123 !! test
19124 Parser hook: basic arguments, variations
19125 !! options
19126 parsoid=wt2html,html2html
19127 !! wikitext
19128 <tag width=200 height = "100" depth = '50' square></tag>
19129 !! html/php
19130 <pre>
19131 ''
19132 array (
19133 'width' => '200',
19134 'height' => '100',
19135 'depth' => '50',
19136 'square' => '',
19137 )
19138 </pre>
19139
19140 !! html/parsoid
19141 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19142 !! end
19143
19144 !! test
19145 Parser hook: argument containing a forward slash (T7344)
19146 !! wikitext
19147 <tag filename="/tmp/bla"></tag>
19148 !! html/php
19149 <pre>
19150 ''
19151 array (
19152 'filename' => '/tmp/bla',
19153 )
19154 </pre>
19155
19156 !! html/parsoid
19157 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19158 !! end
19159
19160 ## Don't expect parsoid to rt this form.
19161 !! test
19162 Parser hook: empty input using terminated empty elements (T4374)
19163 !! options
19164 parsoid=wt2html,html2html
19165 !! wikitext
19166 <tag foo=bar/>text
19167 !! html/php
19168 <pre>
19169 NULL
19170 array (
19171 'foo' => 'bar',
19172 )
19173 </pre>text
19174
19175 !! html/parsoid
19176 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19177 !! end
19178
19179 ## </tag> should be output literally since there is no matching tag that begins it
19180 ## Don't expect parsoid to rt this form.
19181 !! test
19182 Parser hook: basic arguments using terminated empty elements (T4374)
19183 !! options
19184 parsoid=wt2html
19185 !! wikitext
19186 <tag width=200 height = "100" depth = '50' square/>
19187 other stuff
19188 </tag>
19189 !! html/php
19190 <pre>
19191 NULL
19192 array (
19193 'width' => '200',
19194 'height' => '100',
19195 'depth' => '50',
19196 'square' => '',
19197 )
19198 </pre>
19199 <p>other stuff
19200 &lt;/tag&gt;
19201 </p>
19202 !! html/parsoid
19203 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19204 &lt;/tag></p>
19205 !! end
19206
19207 ## Don't expect parsoid to rt this form.
19208 !! test
19209 Parser hook: Don't allow unclosed extension tags
19210 !! options
19211 parsoid=wt2html
19212 !! wikitext
19213 test <tag>123
19214
19215 this is a '''test'''
19216 !! html/php
19217 <p>test &lt;tag&gt;123
19218 </p><p>this is a <b>test</b>
19219 </p>
19220 !! html/parsoid
19221 <p>test &lt;tag>123</p>
19222
19223 <p>this is a <b>test</b></p>
19224 !! end
19225
19226 !! test
19227 Parser hook: horizontal rule inside extension tag that outputs <pre>
19228 !! wikitext
19229 <tag>
19230 Hello
19231 <hr/>
19232 Goodbye
19233 </tag>
19234 !! html/php
19235 <pre>
19236 '
19237 Hello
19238 <hr/>
19239 Goodbye
19240 '
19241 array (
19242 )
19243 </pre>
19244
19245 !! end
19246
19247 ###
19248 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
19249 ###
19250
19251 !! test
19252 Parser hook: static parser hook not inside a comment
19253 !! wikitext
19254 <statictag>hello, world</statictag>
19255
19256 <statictag action="flush" />
19257 !! html/php
19258 <p><br />
19259 hello, world
19260 </p>
19261 !! html/parsoid
19262 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
19263 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about="#mwt4">hello, world</p>
19264 !! end
19265
19266 !! test
19267 Parser hook: static parser hook inside a comment
19268 !! wikitext
19269 <!-- <statictag>hello, world</statictag> -->
19270 <statictag action="flush" />
19271 !! html/php
19272 <p><br />
19273 </p>
19274 !! html/parsoid
19275 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19276 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></p>
19277 !! end
19278
19279 # Nested template calls; this case was broken by Parser.php rev 1.506,
19280 # since reverted.
19281
19282 !! article
19283 Template:One-parameter
19284 !! text
19285 (My parameter is: {{{1}}})
19286 !! endarticle
19287
19288 !! article
19289 Template:Map-one-parameter
19290 !! text
19291 {{{{{1}}}|{{{2}}}}}
19292 !! endarticle
19293
19294 !! test
19295 Nested template calls
19296 !! wikitext
19297 {{Map-one-parameter|One-parameter|param}}
19298 !! html
19299 <p>(My parameter is: param)
19300 </p>
19301 !! end
19302
19303
19304 ###
19305 ### Sanitizer
19306 ###
19307
19308 !! test
19309 Sanitizer: Closing of open tags
19310 !! wikitext
19311 <s></s><table></table>
19312 !! html/php+tidy
19313 <p><s></s></p><table></table>
19314 !! html/parsoid
19315 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19316 !! end
19317
19318 !! test
19319 Sanitizer: Closing of open but not closed tags
19320 !! wikitext
19321 <s>foo
19322 !! html
19323 <p><s>foo</s>
19324 </p>
19325 !! end
19326
19327 !! test
19328 Sanitizer: Closing of closed but not open tags
19329 !! options
19330 parsoid=wt2html
19331 !! wikitext
19332 </s>
19333 !! html+tidy
19334 <p class="mw-empty-elt">
19335 </p>
19336 !! end
19337
19338 !! test
19339 Sanitizer: Closing of closed but not open table tags
19340 !! options
19341 parsoid=wt2html
19342 !! wikitext
19343 Table not started</td></tr></table>
19344 !! html+tidy
19345 <p>Table not started
19346 </p>
19347 !! end
19348
19349 !! test
19350 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19351 !! config
19352 wgFragmentMode=[ 'html5', 'legacy' ]
19353 !! wikitext
19354 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19355 !! html/php
19356 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19357 </p>
19358 !! html/parsoid
19359 <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>
19360 !! end
19361
19362 !! test
19363 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19364 !! config
19365 wgFragmentMode=[ 'legacy' ]
19366 !! wikitext
19367 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19368 !! html/php
19369 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19370 </p>
19371 !! end
19372
19373 # In HTML5, the restrictions are that id must contain at least one character,
19374 # and must not contain any space characters.
19375 !! test
19376 Sanitizer: Validating the contents of the id attribute (T6515)
19377 !! options
19378 disabled
19379 !! wikitext
19380 <br id="" /><br id="a space" />
19381 !! html
19382 Something ...
19383 !! end
19384
19385 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19386 !! test
19387 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19388 !! options
19389 disabled
19390 !! wikitext
19391 <br id="foo" /><br id="foo" />
19392 !! html
19393 Something need to be done. foo-2 ?
19394 !! end
19395
19396 !! test
19397 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19398 !! wikitext
19399 <div itemscope>
19400 <meta itemprop="hello" content="world">
19401 <meta http-equiv="refresh" content="5">
19402 <meta itemprop="hello" http-equiv="refresh" content="5">
19403 <link itemprop="hello" href="{{SERVER}}">
19404 <link rel="stylesheet" href="{{SERVER}}">
19405 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19406 </div>
19407 !! html
19408 <div itemscope="">
19409 <p> <meta itemprop="hello" content="world" />
19410 &lt;meta http-equiv="refresh" content="5"&gt;
19411 <meta itemprop="hello" content="5" />
19412 <link itemprop="hello" href="http&#58;//example.org" />
19413 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19414 <link itemprop="hello" href="http&#58;//example.org" />
19415 </p>
19416 </div>
19417
19418 !! end
19419
19420 !! test
19421 Sanitizer: Strip comments from CSS attributes
19422 !! options
19423 parsoid=wt2html,wt2wt
19424 !! wikitext
19425 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19426 !! html/php
19427 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19428 </p>
19429 !! html/parsoid
19430 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19431 !! end
19432
19433 !! test
19434 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19435 !! wikitext
19436 [[meatball:Soft"Security]]
19437 !! html/php
19438 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19439 </p>
19440 !! html/parsoid
19441 <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>
19442 !! end
19443
19444 !! test
19445 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19446 !! wikitext
19447 [[meatball:Foo<Bar]]
19448 [[meatball:Foo>Bar]]
19449 [[meatball:Foo&lt;bar]]
19450 [[meatball:Foo&gt;bar]]
19451 !! html/php
19452 <p>[[meatball:Foo&lt;Bar]]
19453 [[meatball:Foo&gt;Bar]]
19454 [[meatball:Foo&lt;bar]]
19455 [[meatball:Foo&gt;bar]]
19456 </p>
19457 !! html/parsoid
19458 <p>[[meatball:Foo&lt;Bar]]
19459 [[meatball:Foo>Bar]]
19460 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19461 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19462 !! end
19463
19464 !! test
19465 Language converter: output gets cut off unexpectedly (T7757)
19466 !! options
19467 language=zh
19468 !! wikitext
19469 this bit is safe: }-
19470
19471 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19472
19473 then we get cut off here: }-
19474
19475 all additional text is vanished
19476 !! html/php
19477 <p>this bit is safe: }-
19478 </p><p>but if we add a conversion instance: xxx
19479 </p><p>then we get cut off here: }-
19480 </p><p>all additional text is vanished
19481 </p>
19482 !! html/parsoid
19483 <p>this bit is safe: }-</p>
19484 <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>
19485 <p>then we get cut off here: }-</p>
19486 <p>all additional text is vanished</p>
19487 !! end
19488
19489 !! test
19490 Language converter glossary rules inside attributes (T119158)
19491 !! options
19492 language=sr variant=sr-el
19493 !! wikitext
19494 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19495
19496 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19497 !! html/php
19498 <p>
19499 </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>
19500 </p>
19501 !! html/parsoid
19502 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19503
19504 <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>
19505 !! end
19506
19507 !! test
19508 Self closed html pairs (T7487)
19509 !! wikitext
19510 <center><font id="bug" />Centered text</center>
19511 <div><font id="bug2" />In div text</div>
19512 !! html+tidy
19513 <center><font id="bug"></font>Centered text</center>
19514 <div><font id="bug2"></font>In div text</div>
19515 !! end
19516
19517 !! test
19518 Punctuation: nbsp before exclamation
19519 !! wikitext
19520 C'est grave !
19521 !! html
19522 <p>C'est grave&#160;!
19523 </p>
19524 !! end
19525
19526 !! test
19527 Punctuation: CSS !important (T13874)
19528 !! wikitext
19529 <div style="width:50% !important">important</div>
19530 !! html
19531 <div style="width:50% !important">important</div>
19532
19533 !!end
19534
19535 !! test
19536 Punctuation: CSS ! important (T13874; with space after)
19537 !! wikitext
19538 <div style="width:50% ! important">important</div>
19539 !! html
19540 <div style="width:50%&#32;! important">important</div>
19541
19542 !!end
19543
19544 !! test
19545 HTML bullet list, closed tags (T7497)
19546 !! wikitext
19547 <ul>
19548 <li>One</li>
19549 <li>Two</li>
19550 </ul>
19551 !! html/php
19552 <ul>
19553 <li>One</li>
19554 <li>Two</li>
19555 </ul>
19556
19557 !! html/parsoid
19558 <ul data-parsoid='{"stx":"html"}'>
19559 <li data-parsoid='{"stx":"html"}'>One</li>
19560 <li data-parsoid='{"stx":"html"}'>Two</li>
19561 </ul>
19562
19563 !! end
19564
19565 !! test
19566 HTML bullet list, unclosed tags (T7497)
19567 !! wikitext
19568 <ul>
19569 <li>One
19570 <li>Two
19571 </ul>
19572 !! html/php+tidy
19573 <ul>
19574 <li>One
19575 </li><li>Two
19576 </li></ul>
19577 !! html/parsoid
19578 <ul data-parsoid='{"stx":"html"}'>
19579 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19580 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19581 </ul>
19582
19583 !! end
19584
19585 !! test
19586 HTML ordered list, closed tags (T7497)
19587 !! wikitext
19588 <ol>
19589 <li>One</li>
19590 <li>Two</li>
19591 </ol>
19592 !! html/php
19593 <ol>
19594 <li>One</li>
19595 <li>Two</li>
19596 </ol>
19597
19598 !! html/parsoid
19599 <ol data-parsoid='{"stx":"html"}'>
19600 <li data-parsoid='{"stx":"html"}'>One</li>
19601 <li data-parsoid='{"stx":"html"}'>Two</li>
19602 </ol>
19603
19604 !! end
19605
19606 !! test
19607 HTML ordered list, unclosed tags (T7497)
19608 !! options
19609 !! wikitext
19610 <ol>
19611 <li>One
19612 <li>Two
19613 </ol>
19614 !! html/php+tidy
19615 <ol>
19616 <li>One
19617 </li><li>Two
19618 </li></ol>
19619 !! html/parsoid
19620 <ol data-parsoid='{"stx":"html"}'>
19621 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19622 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19623 </ol>
19624
19625 !! end
19626
19627 !! test
19628 HTML nested bullet list, closed tags (T7497)
19629 !! wikitext
19630 <ul>
19631 <li>One</li>
19632 <li>Two:
19633 <ul>
19634 <li>Sub-one</li>
19635 <li>Sub-two</li>
19636 </ul>
19637 </li>
19638 </ul>
19639 !! html/php
19640 <ul>
19641 <li>One</li>
19642 <li>Two:
19643 <ul>
19644 <li>Sub-one</li>
19645 <li>Sub-two</li>
19646 </ul>
19647 </li>
19648 </ul>
19649
19650 !! html/parsoid
19651 <ul data-parsoid='{"stx":"html"}'>
19652 <li data-parsoid='{"stx":"html"}'>One</li>
19653 <li data-parsoid='{"stx":"html"}'>Two:
19654 <ul data-parsoid='{"stx":"html"}'>
19655 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19656 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19657 </ul>
19658 </li>
19659 </ul>
19660 !! end
19661
19662 !! test
19663 HTML nested bullet list, open tags (T7497)
19664 !! wikitext
19665 <ul>
19666 <li>One
19667 <li>Two:
19668 <ul>
19669 <li>Sub-one
19670 <li>Sub-two
19671 </ul>
19672 </ul>
19673 !! html+tidy
19674 <ul>
19675 <li>One
19676 </li><li>Two:
19677 <ul>
19678 <li>Sub-one
19679 </li><li>Sub-two
19680 </li></ul>
19681 </li></ul>
19682 !! end
19683
19684 !! test
19685 HTML nested ordered list, closed tags (T7497)
19686 !! wikitext
19687 <ol>
19688 <li>One</li>
19689 <li>Two:
19690 <ol>
19691 <li>Sub-one</li>
19692 <li>Sub-two</li>
19693 </ol>
19694 </li>
19695 </ol>
19696 !! html
19697 <ol>
19698 <li>One</li>
19699 <li>Two:
19700 <ol>
19701 <li>Sub-one</li>
19702 <li>Sub-two</li>
19703 </ol>
19704 </li>
19705 </ol>
19706
19707 !! end
19708
19709 !! test
19710 HTML nested ordered list, open tags (T7497)
19711 !! wikitext
19712 <ol>
19713 <li>One
19714 <li>Two:
19715 <ol>
19716 <li>Sub-one
19717 <li>Sub-two
19718 </ol>
19719 </ol>
19720 !! html/php
19721 <ol>
19722 <li>One
19723 <li>Two:
19724 <ol>
19725 <li>Sub-one
19726 <li>Sub-two
19727 </ol>
19728 </ol>
19729
19730 !! html/parsoid
19731 <ol>
19732 <li>One
19733 </li>
19734 <li>Two:
19735 <ol>
19736 <li>Sub-one
19737 </li>
19738 <li>Sub-two
19739 </li>
19740 </ol>
19741 </li>
19742 </ol>
19743
19744 !! end
19745
19746 !! test
19747 HTML ordered list item with parameters oddity
19748 !! wikitext
19749 <ol><li id="fragment">One</li>
19750 </ol>
19751 !! html
19752 <ol><li id="fragment">One</li>
19753 </ol>
19754
19755 !! end
19756
19757 # parsoid doesn't explicitly mark autonumbered links, see T55505
19758 !!test
19759 T7918: autonumbering
19760 !! wikitext
19761 [http://first/] [http://second] [ftp://ftp]
19762
19763 ftp://inlineftp
19764
19765 [mailto:enclosed@mail.tld With target]
19766
19767 [mailto:enclosed@mail.tld]
19768
19769 mailto:inline@mail.tld
19770 !! html/php
19771 <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>
19772 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19773 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19774 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19775 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19776 </p>
19777 !! html/parsoid
19778 <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>
19779 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19780 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19781 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19782 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19783 !! end
19784
19785
19786 #
19787 # Security and HTML correctness
19788 # From Nick Jenkins' fuzz testing
19789 #
19790
19791 !! test
19792 Fuzz testing: Parser13
19793 !! wikitext
19794 {|
19795 | http://a|
19796 !! html
19797 <table>
19798 <tr>
19799 <td>
19800 </td>
19801 </tr>
19802 </table>
19803
19804 !! end
19805
19806 # Note that Parsoid output differs from the PHP parser here: the PHP
19807 # parser breaks the URL for the magic word, while in Parsoid the URL
19808 # production takes precedence.
19809 !! test
19810 Fuzz testing: Parser14
19811 !! wikitext
19812 ==onmouseover===
19813 http://__TOC__
19814 !! html/php
19815 <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>
19816 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>
19817 <ul>
19818 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19819 </ul>
19820 </div>
19821
19822
19823 !! html/php+tidy
19824 <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>
19825 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>
19826 <ul>
19827 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19828 </ul>
19829 </div>
19830 !! html/parsoid
19831 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19832 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19833 !! end
19834
19835 !! test
19836 Fuzz testing: Parser14-table
19837 !! options
19838 parsoid=wt2html,html2html
19839 !! wikitext
19840 ==a==
19841 {| STYLE=__TOC__
19842 !! html/php
19843 <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>
19844 <table style="&#95;_TOC&#95;_">
19845 <tr><td></td></tr>
19846 </table>
19847
19848 !! html/php+tidy
19849 <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>
19850 <table style="&#95;_TOC&#95;_">
19851 <tbody><tr><td></td></tr>
19852 </tbody></table>
19853 !! html/parsoid
19854 <h2 id="a">a</h2>
19855 <table style="__TOC__"></table>
19856 !! end
19857
19858 # Known to produce bogus xml (extra </td>)
19859 # Don't add the html/php section since it generates broken HTML
19860 !! test
19861 Fuzz testing: Parser16
19862 !! wikitext
19863 {|
19864 !https://||||||
19865 !! html+tidy
19866 <table>
19867 <tbody><tr>
19868 <th>https://</th>
19869 <th></th>
19870 <th></th>
19871 <th>
19872
19873 </th></tr>
19874 </tbody></table>
19875 !! end
19876
19877 !! test
19878 Fuzz testing: Parser21
19879 !! wikitext
19880 {|
19881 !irc://{{ftp://a" onmouseover="alert('hello world');"
19882 |
19883 !! html
19884 <table>
19885 <tr>
19886 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19887 </th>
19888 <td>
19889 </td>
19890 </tr>
19891 </table>
19892
19893 !! end
19894
19895 !! test
19896 Fuzz testing: Parser22
19897 !! wikitext
19898 http://===r:::https://b
19899
19900 {|
19901 !! html
19902 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19903 </p>
19904 <table>
19905 <tr><td></td></tr>
19906 </table>
19907
19908 !! end
19909
19910 ## Remex doesn't account for fostered content.
19911 ## Known to produce bad XML for now
19912 !! test
19913 Fuzz testing: Parser24
19914 !! options
19915 parsoid=wt2html
19916 !! wikitext
19917 {|
19918 {{{|
19919 <u CLASS=
19920 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19921 <br style="onmouseover='alert(document.cookie);' " />
19922
19923 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19924 |
19925 !! html/php
19926 <table>
19927 {{{|
19928 <u class="&#124;">}}}} &gt;
19929 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19930
19931 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19932 <tr>
19933 <td></u>
19934 </td>
19935 </tr>
19936 </table>
19937
19938 !! html/php+tidy
19939
19940 {{{|
19941 <u class="&#124;">}}}} &gt;
19942 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19943
19944 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19945 </u><table><tbody><tr>
19946 <td>
19947 </td>
19948 </tr>
19949 </tbody></table><p><u class="&#124;">
19950 </u></p>
19951 !! html/parsoid
19952 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19953 {{{|
19954 <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>"}'/>}}}} >
19955 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19956
19957 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19958 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19959 !! end
19960
19961 # Note: the current result listed for this is not what the original one was,
19962 # but the original bug was JavaScript injection, which is fixed in any case.
19963 # It's not clear that the original result listed was any more correct than the
19964 # current one. Original result:
19965 # <p>{{{|
19966 # </p>
19967 # <li class="&#124;&#124;">
19968 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19969 !!test
19970 Fuzz testing: Parser25 (T8055)
19971 !! wikitext
19972 {{{
19973 |
19974 <LI CLASS=||
19975 >
19976 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19977 !! html/php
19978 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19979 </p>
19980 !! html/parsoid
19981 <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"]}'>
19982 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19983 !! end
19984
19985 !!test
19986 Fuzz testing: URL adjacent extension (with space, clean)
19987 !! wikitext
19988 http://example.com <nowiki>junk</nowiki>
19989 !! html/php
19990 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19991 </p>
19992 !! html/parsoid
19993 <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>
19994 !! end
19995
19996 !!test
19997 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19998 !! wikitext
19999 http://example.com<nowiki>junk</nowiki>
20000 !! html/php
20001 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
20002 </p>
20003 !! html/parsoid
20004 <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>
20005 !! end
20006
20007 !! test
20008 Fuzz testing: URL adjacent extension (no space, dirty; pre)
20009 !! wikitext
20010 http://example.com<pre>junk</pre>
20011 !! html/php
20012 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
20013
20014 !! html/php+tidy
20015 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
20016 !! html/parsoid
20017 <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>
20018 !! end
20019
20020 !! test
20021 Fuzz testing: image with bogus manual thumbnail
20022 !! wikitext
20023 [[Image:foobar.jpg|thumbnail= ]]
20024 !! html/php
20025 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
20026
20027 !! html/parsoid
20028 <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>
20029 !! end
20030
20031 # Parsoid will emit the newline literally in wt2wt; see next test case.
20032 !! test
20033 Fuzz testing: encoded newline in generated HTML replacements (T8577)
20034 !! options
20035 parsoid=wt2html
20036 !! wikitext
20037 <pre dir="&#10;"></pre>
20038 !! html/php
20039 <pre dir="&#10;"></pre>
20040
20041 !! html/parsoid
20042 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20043 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20044 !! end
20045
20046 !! test
20047 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
20048 !! options
20049 parsoid=html2wt
20050 !! html/parsoid
20051 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20052 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20053 !! wikitext
20054 <pre dir="
20055 "></pre>
20056 !! html/php
20057 <pre dir=""></pre>
20058
20059 !! end
20060
20061 !! test
20062 Templates in extension attributes are not expanded
20063 !! wikitext
20064 <pre dir="{{echo|ltr}}"></pre>
20065 !! html/php
20066 <pre dir="{{echo|ltr}}"></pre>
20067
20068 !! html/parsoid
20069 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
20070 !! end
20071
20072 !! test
20073 Parsing optional HTML elements (T8171)
20074 !! options
20075 !! wikitext
20076 <table>
20077 <tr>
20078 <td> Some tabular data</td>
20079 <td> More tabular data ...
20080 <td> And yet som tabular data</td>
20081 </tr>
20082 </table>
20083 !! html
20084 <table>
20085 <tr>
20086 <td> Some tabular data</td>
20087 <td> More tabular data ...
20088 </td><td> And yet som tabular data</td>
20089 </tr>
20090 </table>
20091
20092 !! end
20093
20094 !! test
20095 Correct handling of <td>, <tr> (T8171)
20096 !! options
20097 !! wikitext
20098 <table>
20099 <tr>
20100 <td> Some tabular data</td>
20101 <td> More tabular data ...</td>
20102 <td> And yet som tabular data</td>
20103 </tr>
20104 </table>
20105 !! html
20106 <table>
20107 <tr>
20108 <td> Some tabular data</td>
20109 <td> More tabular data ...</td>
20110 <td> And yet som tabular data</td>
20111 </tr>
20112 </table>
20113
20114 !! end
20115
20116
20117 !! test
20118 Parsing crashing regression (fr:JavaScript)
20119 !! wikitext
20120 </body></x>
20121 !! html
20122 <p>&lt;/body&gt;&lt;/x&gt;
20123 </p>
20124 !! end
20125
20126 !! test
20127 Inline wiki vs wiki block nesting
20128 !! wikitext
20129 '''Bold paragraph
20130
20131 New wiki paragraph
20132 !! html
20133 <p><b>Bold paragraph</b>
20134 </p><p>New wiki paragraph
20135 </p>
20136 !! end
20137
20138 # FIXME: The current php output is documented
20139 # and desired output is the parsoid target.
20140 !! test
20141 Inline HTML vs wiki block nesting
20142 !! wikitext
20143 <b>Bold paragraph
20144
20145 New wiki paragraph
20146 !! html/php
20147 <p><b>Bold paragraph
20148 </p><p>New wiki paragraph</b>
20149 </p>
20150 !! html/php+tidy
20151 <p><b>Bold paragraph
20152 </b></p><p><b>New wiki paragraph
20153 </b></p>
20154 !! html/parsoid
20155 <p><b>Bold paragraph</b>
20156 </p><p>New wiki paragraph
20157 </p>
20158 !! end
20159
20160 # Original result was this:
20161 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20162 # </p>
20163 # While that might be marginally more intuitive, maybe, the six-apostrophe
20164 # construct is clearly pathological and the result stated here (which is what
20165 # the parser actually does) is about as reasonable as anything.
20166 !!test
20167 Mixing markup for italics and bold
20168 !! options
20169 !! wikitext
20170 '''bold''''''bold''bolditalics'''''
20171 !! html
20172 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20173 </p>
20174 !! end
20175
20176
20177 !! article
20178 Xyzzyx
20179 !! text
20180 Article for special page transclusion test
20181 !! endarticle
20182
20183 !! test
20184 Special page transclusion
20185 !! options
20186 !! wikitext
20187 {{Special:Prefixindex/Xyzzyx}}
20188 !! html
20189 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20190 </ul>
20191
20192 !! end
20193
20194 !! test
20195 Special page transclusion twice (T7021)
20196 !! options
20197 !! wikitext
20198 {{Special:Prefixindex/Xyzzyx}}
20199 {{Special:Prefixindex/Xyzzyx}}
20200 !! html
20201 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20202 </ul>
20203 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20204 </ul>
20205
20206 !! end
20207
20208 !! test
20209 Transclusion of default MediaWiki message
20210 !! wikitext
20211 {{MediaWiki:Mainpage}}
20212 !! html
20213 <p>Main Page
20214 </p>
20215 !! end
20216
20217 !! test
20218 Transclusion of nonexistent MediaWiki message
20219 !! wikitext
20220 {{MediaWiki:Mainpagexxx}}
20221 !! html
20222 <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>
20223 </p>
20224 !! end
20225
20226 !! test
20227 Transclusion of MediaWiki message with underscore
20228 !! wikitext
20229 {{MediaWiki:history_short}}
20230 !! html
20231 <p>History
20232 </p>
20233 !! end
20234
20235 !! test
20236 Transclusion of MediaWiki message with space
20237 !! wikitext
20238 {{MediaWiki:history short}}
20239 !! html
20240 <p>History
20241 </p>
20242 !! end
20243
20244 !! test
20245 Invalid header with following text
20246 !! wikitext
20247 = x = y
20248 !! html
20249 <p>= x = y
20250 </p>
20251 !! end
20252
20253
20254 !! test
20255 Section extraction test (section 0)
20256 !! options
20257 section=0
20258 !! wikitext
20259 start
20260 ==a==
20261 ===aa===
20262 ====aaa====
20263 ==b==
20264 ===ba===
20265 ===bb===
20266 ====bba====
20267 ===bc===
20268 ==c==
20269 ===ca===
20270 !! html/php
20271 start
20272 !! end
20273
20274 !! test
20275 Section extraction test (section 1)
20276 !! options
20277 section=1
20278 !! wikitext
20279 start
20280 ==a==
20281 ===aa===
20282 ====aaa====
20283 ==b==
20284 ===ba===
20285 ===bb===
20286 ====bba====
20287 ===bc===
20288 ==c==
20289 ===ca===
20290 !! html/php
20291 ==a==
20292 ===aa===
20293 ====aaa====
20294 !! end
20295
20296 !! test
20297 Section extraction test (section 2)
20298 !! options
20299 section=2
20300 !! wikitext
20301 start
20302 ==a==
20303 ===aa===
20304 ====aaa====
20305 ==b==
20306 ===ba===
20307 ===bb===
20308 ====bba====
20309 ===bc===
20310 ==c==
20311 ===ca===
20312 !! html/php
20313 ===aa===
20314 ====aaa====
20315 !! end
20316
20317 !! test
20318 Section extraction test (section 3)
20319 !! options
20320 section=3
20321 !! wikitext
20322 start
20323 ==a==
20324 ===aa===
20325 ====aaa====
20326 ==b==
20327 ===ba===
20328 ===bb===
20329 ====bba====
20330 ===bc===
20331 ==c==
20332 ===ca===
20333 !! html/php
20334 ====aaa====
20335 !! end
20336
20337 !! test
20338 Section extraction test (section 4)
20339 !! options
20340 section=4
20341 !! wikitext
20342 start
20343 ==a==
20344 ===aa===
20345 ====aaa====
20346 ==b==
20347 ===ba===
20348 ===bb===
20349 ====bba====
20350 ===bc===
20351 ==c==
20352 ===ca===
20353 !! html/php
20354 ==b==
20355 ===ba===
20356 ===bb===
20357 ====bba====
20358 ===bc===
20359 !! end
20360
20361 !! test
20362 Section extraction test (section 5)
20363 !! options
20364 section=5
20365 !! wikitext
20366 start
20367 ==a==
20368 ===aa===
20369 ====aaa====
20370 ==b==
20371 ===ba===
20372 ===bb===
20373 ====bba====
20374 ===bc===
20375 ==c==
20376 ===ca===
20377 !! html/php
20378 ===ba===
20379 !! end
20380
20381 !! test
20382 Section extraction test (section 6)
20383 !! options
20384 section=6
20385 !! wikitext
20386 start
20387 ==a==
20388 ===aa===
20389 ====aaa====
20390 ==b==
20391 ===ba===
20392 ===bb===
20393 ====bba====
20394 ===bc===
20395 ==c==
20396 ===ca===
20397 !! html/php
20398 ===bb===
20399 ====bba====
20400 !! end
20401
20402 !! test
20403 Section extraction test (section 7)
20404 !! options
20405 section=7
20406 !! wikitext
20407 start
20408 ==a==
20409 ===aa===
20410 ====aaa====
20411 ==b==
20412 ===ba===
20413 ===bb===
20414 ====bba====
20415 ===bc===
20416 ==c==
20417 ===ca===
20418 !! html/php
20419 ====bba====
20420 !! end
20421
20422 !! test
20423 Section extraction test (section 8)
20424 !! options
20425 section=8
20426 !! wikitext
20427 start
20428 ==a==
20429 ===aa===
20430 ====aaa====
20431 ==b==
20432 ===ba===
20433 ===bb===
20434 ====bba====
20435 ===bc===
20436 ==c==
20437 ===ca===
20438 !! html/php
20439 ===bc===
20440 !! end
20441
20442 !! test
20443 Section extraction test (section 9)
20444 !! options
20445 section=9
20446 !! wikitext
20447 start
20448 ==a==
20449 ===aa===
20450 ====aaa====
20451 ==b==
20452 ===ba===
20453 ===bb===
20454 ====bba====
20455 ===bc===
20456 ==c==
20457 ===ca===
20458 !! html/php
20459 ==c==
20460 ===ca===
20461 !! end
20462
20463 !! test
20464 Section extraction test (section 10)
20465 !! options
20466 section=10
20467 !! wikitext
20468 start
20469 ==a==
20470 ===aa===
20471 ====aaa====
20472 ==b==
20473 ===ba===
20474 ===bb===
20475 ====bba====
20476 ===bc===
20477 ==c==
20478 ===ca===
20479 !! html/php
20480 ===ca===
20481 !! end
20482
20483 !! test
20484 Section extraction test (nonexistent section 11)
20485 !! options
20486 section=11
20487 !! wikitext
20488 start
20489 ==a==
20490 ===aa===
20491 ====aaa====
20492 ==b==
20493 ===ba===
20494 ===bb===
20495 ====bba====
20496 ===bc===
20497 ==c==
20498 ===ca===
20499 !! html/php
20500 !! end
20501
20502 !! test
20503 Section extraction test with bogus heading (section 1)
20504 !! options
20505 section=1
20506 !! wikitext
20507 ==a==
20508 ==bogus== not a legal section
20509 ==b==
20510 !! html/php
20511 ==a==
20512 ==bogus== not a legal section
20513 !! end
20514
20515 !! test
20516 Section extraction test with bogus heading (section 2)
20517 !! options
20518 section=2
20519 !! wikitext
20520 ==a==
20521 ==bogus== not a legal section
20522 ==b==
20523 !! html/php
20524 ==b==
20525 !! end
20526
20527 !! test
20528 Section extraction test with comment after heading (section 1)
20529 !! options
20530 section=1
20531 !! wikitext
20532 ==a==
20533 ==b== <!-- -->
20534 ==c==
20535 !! html/php
20536 ==a==
20537 !! end
20538
20539 !! test
20540 Section extraction test with comment after heading (section 2)
20541 !! options
20542 section=2
20543 !! wikitext
20544 ==a==
20545 ==b== <!-- -->
20546 ==c==
20547 !! html/php
20548 ==b== <!-- -->
20549 !! end
20550
20551 !! test
20552 Section extraction test with bogus <nowiki> heading (section 1)
20553 !! options
20554 section=1
20555 !! wikitext
20556 ==a==
20557 ==bogus== <nowiki>not a legal section</nowiki>
20558 ==b==
20559 !! html/php
20560 ==a==
20561 ==bogus== <nowiki>not a legal section</nowiki>
20562 !! end
20563
20564 !! test
20565 Section extraction test with bogus <nowiki> heading (section 2)
20566 !! options
20567 section=2
20568 !! wikitext
20569 ==a==
20570 ==bogus== <nowiki>not a legal section</nowiki>
20571 ==b==
20572 !! html/php
20573 ==b==
20574 !! end
20575
20576 # Formerly testing for T4587, now resolved by the use of unmarked sections
20577 # instead of respecting commented sections
20578 !! test
20579 Section extraction prefixed by comment (section 1)
20580 !! options
20581 section=1
20582 !! wikitext
20583 <!-- -->==sec1==
20584 ==sec2==
20585 !! html/php
20586 ==sec2==
20587 !!end
20588
20589 !! test
20590 Section extraction prefixed by comment (section 2)
20591 !! options
20592 section=2
20593 !! wikitext
20594 <!-- -->==sec1==
20595 ==sec2==
20596 !! html/php
20597
20598 !!end
20599
20600 # Formerly testing for T4607, now resolved by the use of unmarked sections
20601 # instead of respecting HTML-style headings
20602 !! test
20603 Section extraction, mixed wiki and html (section 1)
20604 !! options
20605 section=1
20606 !! wikitext
20607 <h2>unmarked</h2>
20608 unmarked
20609 ==1==
20610 one
20611 ==2==
20612 two
20613 !! html/php
20614 ==1==
20615 one
20616 !! end
20617
20618 !! test
20619 Section extraction, mixed wiki and html (section 2)
20620 !! options
20621 section=2
20622 !! wikitext
20623 <h2>unmarked</h2>
20624 unmarked
20625 ==1==
20626 one
20627 ==2==
20628 two
20629 !! html/php
20630 ==2==
20631 two
20632 !! end
20633
20634
20635 # Formerly testing for T5342
20636 !! test
20637 Section extraction, heading surrounded by <noinclude>
20638 !! options
20639 section=1
20640 !! wikitext
20641 <noinclude>==unmarked==</noinclude>
20642 ==marked==
20643 !! html/php
20644 ==marked==
20645 !!end
20646
20647 # Test behavior of T21910
20648 !! test
20649 Sectiion with all-equals
20650 !! options
20651 section=2
20652 !! wikitext
20653 ===
20654 The line above must have a trailing space
20655 === <!--
20656 --> <!-- -->
20657 But just in case it doesn't...
20658 !! html/php
20659 === <!--
20660 --> <!-- -->
20661 But just in case it doesn't...
20662 !! end
20663
20664 !! test
20665 Section replacement test (section 0)
20666 !! options
20667 replace=0,"xxx"
20668 !! wikitext
20669 start
20670 ==a==
20671 ===aa===
20672 ====aaa====
20673 ==b==
20674 ===ba===
20675 ===bb===
20676 ====bba====
20677 ===bc===
20678 ==c==
20679 ===ca===
20680 !! html/php
20681 xxx
20682
20683 ==a==
20684 ===aa===
20685 ====aaa====
20686 ==b==
20687 ===ba===
20688 ===bb===
20689 ====bba====
20690 ===bc===
20691 ==c==
20692 ===ca===
20693 !! end
20694
20695 !! test
20696 Section replacement test (section 1)
20697 !! options
20698 replace=1,"xxx"
20699 !! wikitext
20700 start
20701 ==a==
20702 ===aa===
20703 ====aaa====
20704 ==b==
20705 ===ba===
20706 ===bb===
20707 ====bba====
20708 ===bc===
20709 ==c==
20710 ===ca===
20711 !! html/php
20712 start
20713 xxx
20714
20715 ==b==
20716 ===ba===
20717 ===bb===
20718 ====bba====
20719 ===bc===
20720 ==c==
20721 ===ca===
20722 !! end
20723
20724 !! test
20725 Section replacement test (section 2)
20726 !! options
20727 replace=2,"xxx"
20728 !! wikitext
20729 start
20730 ==a==
20731 ===aa===
20732 ====aaa====
20733 ==b==
20734 ===ba===
20735 ===bb===
20736 ====bba====
20737 ===bc===
20738 ==c==
20739 ===ca===
20740 !! html/php
20741 start
20742 ==a==
20743 xxx
20744
20745 ==b==
20746 ===ba===
20747 ===bb===
20748 ====bba====
20749 ===bc===
20750 ==c==
20751 ===ca===
20752 !! end
20753
20754 !! test
20755 Section replacement test (section 3)
20756 !! options
20757 replace=3,"xxx"
20758 !! wikitext
20759 start
20760 ==a==
20761 ===aa===
20762 ====aaa====
20763 ==b==
20764 ===ba===
20765 ===bb===
20766 ====bba====
20767 ===bc===
20768 ==c==
20769 ===ca===
20770 !! html/php
20771 start
20772 ==a==
20773 ===aa===
20774 xxx
20775
20776 ==b==
20777 ===ba===
20778 ===bb===
20779 ====bba====
20780 ===bc===
20781 ==c==
20782 ===ca===
20783 !! end
20784
20785 !! test
20786 Section replacement test (section 4)
20787 !! options
20788 replace=4,"xxx"
20789 !! wikitext
20790 start
20791 ==a==
20792 ===aa===
20793 ====aaa====
20794 ==b==
20795 ===ba===
20796 ===bb===
20797 ====bba====
20798 ===bc===
20799 ==c==
20800 ===ca===
20801 !! html/php
20802 start
20803 ==a==
20804 ===aa===
20805 ====aaa====
20806 xxx
20807
20808 ==c==
20809 ===ca===
20810 !! end
20811
20812 !! test
20813 Section replacement test (section 5)
20814 !! options
20815 replace=5,"xxx"
20816 !! wikitext
20817 start
20818 ==a==
20819 ===aa===
20820 ====aaa====
20821 ==b==
20822 ===ba===
20823 ===bb===
20824 ====bba====
20825 ===bc===
20826 ==c==
20827 ===ca===
20828 !! html/php
20829 start
20830 ==a==
20831 ===aa===
20832 ====aaa====
20833 ==b==
20834 xxx
20835
20836 ===bb===
20837 ====bba====
20838 ===bc===
20839 ==c==
20840 ===ca===
20841 !! end
20842
20843 !! test
20844 Section replacement test (section 6)
20845 !! options
20846 replace=6,"xxx"
20847 !! wikitext
20848 start
20849 ==a==
20850 ===aa===
20851 ====aaa====
20852 ==b==
20853 ===ba===
20854 ===bb===
20855 ====bba====
20856 ===bc===
20857 ==c==
20858 ===ca===
20859 !! html/php
20860 start
20861 ==a==
20862 ===aa===
20863 ====aaa====
20864 ==b==
20865 ===ba===
20866 xxx
20867
20868 ===bc===
20869 ==c==
20870 ===ca===
20871 !! end
20872
20873 !! test
20874 Section replacement test (section 7)
20875 !! options
20876 replace=7,"xxx"
20877 !! wikitext
20878 start
20879 ==a==
20880 ===aa===
20881 ====aaa====
20882 ==b==
20883 ===ba===
20884 ===bb===
20885 ====bba====
20886 ===bc===
20887 ==c==
20888 ===ca===
20889 !! html/php
20890 start
20891 ==a==
20892 ===aa===
20893 ====aaa====
20894 ==b==
20895 ===ba===
20896 ===bb===
20897 xxx
20898
20899 ===bc===
20900 ==c==
20901 ===ca===
20902 !! end
20903
20904 !! test
20905 Section replacement test (section 8)
20906 !! options
20907 replace=8,"xxx"
20908 !! wikitext
20909 start
20910 ==a==
20911 ===aa===
20912 ====aaa====
20913 ==b==
20914 ===ba===
20915 ===bb===
20916 ====bba====
20917 ===bc===
20918 ==c==
20919 ===ca===
20920 !! html/php
20921 start
20922 ==a==
20923 ===aa===
20924 ====aaa====
20925 ==b==
20926 ===ba===
20927 ===bb===
20928 ====bba====
20929 xxx
20930
20931 ==c==
20932 ===ca===
20933 !!end
20934
20935 !! test
20936 Section replacement test (section 9)
20937 !! options
20938 replace=9,"xxx"
20939 !! wikitext
20940 start
20941 ==a==
20942 ===aa===
20943 ====aaa====
20944 ==b==
20945 ===ba===
20946 ===bb===
20947 ====bba====
20948 ===bc===
20949 ==c==
20950 ===ca===
20951 !! html/php
20952 start
20953 ==a==
20954 ===aa===
20955 ====aaa====
20956 ==b==
20957 ===ba===
20958 ===bb===
20959 ====bba====
20960 ===bc===
20961 xxx
20962 !! end
20963
20964 !! test
20965 Section replacement test (section 10)
20966 !! options
20967 replace=10,"xxx"
20968 !! wikitext
20969 start
20970 ==a==
20971 ===aa===
20972 ====aaa====
20973 ==b==
20974 ===ba===
20975 ===bb===
20976 ====bba====
20977 ===bc===
20978 ==c==
20979 ===ca===
20980 !! html/php
20981 start
20982 ==a==
20983 ===aa===
20984 ====aaa====
20985 ==b==
20986 ===ba===
20987 ===bb===
20988 ====bba====
20989 ===bc===
20990 ==c==
20991 xxx
20992 !! end
20993
20994 !! test
20995 Section replacement test with initial whitespace (T15728)
20996 !! options
20997 replace=2,"xxx"
20998 !! wikitext
20999 Preformatted initial line
21000 ==a==
21001 ===a===
21002 !! html/php
21003 Preformatted initial line
21004 ==a==
21005 xxx
21006 !! end
21007
21008
21009 !! test
21010 Section extraction, heading followed by pre with 20 spaces (T8398)
21011 !! options
21012 section=1
21013 !! wikitext
21014 ==a==
21015 a
21016 !! html/php
21017 ==a==
21018 a
21019 !! end
21020
21021 !! test
21022 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
21023 !! options
21024 section=1
21025 !! wikitext
21026 ==a==
21027 a
21028 !! html/php
21029 ==a==
21030 a
21031 !! end
21032
21033
21034 !! test
21035 Section extraction, <pre> around bogus header (T12309)
21036 !! options
21037 section=2
21038 !! wikitext
21039 == Section One ==
21040 <pre>
21041 =======
21042 </pre>
21043
21044 == Section Two ==
21045 stuff
21046 !! html/php
21047 == Section Two ==
21048 stuff
21049 !! end
21050
21051 !! test
21052 Section replacement, <pre> around bogus header (T12309)
21053 !! options
21054 replace=2,"xxx"
21055 !! wikitext
21056 == Section One ==
21057 <pre>
21058 =======
21059 </pre>
21060
21061 == Section Two ==
21062 stuff
21063 !! html/php
21064 == Section One ==
21065 <pre>
21066 =======
21067 </pre>
21068
21069 xxx
21070 !! end
21071
21072 !! test
21073 Handling of &#x0A; in URLs
21074 !! wikitext
21075 *irc://&#x0A;a
21076 !! html/php
21077 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21078
21079 !! html/parsoid
21080 <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>
21081 !! end
21082
21083 !! test
21084 Handling of %0A in URLs
21085 !! wikitext
21086 *irc://%0Aa
21087 !! html/php
21088 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21089
21090 !! html/parsoid
21091 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21092 !! end
21093
21094 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
21095 !! test
21096 5 quotes, code coverage +1 line
21097 !! options
21098 parsoid=wt2html
21099 !! wikitext
21100 '''''
21101 !! html/php
21102 !! html/parsoid
21103 <p><b><i></i></b></p>
21104 !! end
21105
21106 # same html as previous, but wikitext adjusted to match parsoid html2wt
21107 # note that wt2html and html2html will put the <i> before the <b>
21108 !! test
21109 5 quotes, code coverage +1 line w/ nowiki (1)
21110 !! options
21111 parsoid=wt2wt,html2wt
21112 !! wikitext
21113 '''''<nowiki/>'''''
21114 !! html/php
21115 <p><i></i>
21116 </p>
21117 !! html/parsoid
21118 <p><b><i></i></b></p>
21119 !! end
21120
21121 # same as previous, just swapping the <i> and <b>
21122 !! test
21123 5 quotes, code coverage +1 line w/ nowiki (2)
21124 !! wikitext
21125 '''''<nowiki/>'''''
21126 !! html/php
21127 <p><i></i>
21128 </p>
21129 !! html/parsoid
21130 <p><i><b></b></i></p>
21131 !! end
21132
21133 !! test
21134 Special:Search page linking.
21135 !! wikitext
21136 {{Special:search}}
21137 !! html
21138 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21139 </p>
21140 !! end
21141
21142 !! test
21143 {{!}} is a magic word
21144 !! wikitext
21145 {{!}} is a magic word there and {{!}} is still a magic word here
21146 | is not a magic word here but {{!}} is still a magic word here
21147 !! html/php
21148 <p>| is a magic word there and | is still a magic word here
21149 | is not a magic word here but | is still a magic word here
21150 </p>
21151 !! html/parsoid
21152 <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
21153 | 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>
21154 !! end
21155
21156 !! test
21157 Say the magic word
21158 !! options
21159 title=[[Parser test]]
21160 !! wikitext
21161 *{{PAGENAME}}
21162 *{{PAGENAMEE}}
21163 *{{FULLPAGENAME}}
21164 *{{FULLPAGENAMEE}}
21165 *{{BASEPAGENAME}}
21166 *{{BASEPAGENAMEE}}
21167 *{{SUBPAGENAME}}
21168 *{{SUBPAGENAMEE}}
21169 *{{ROOTPAGENAME}}
21170 *{{ROOTPAGENAMEE}}
21171 *{{TALKPAGENAME}}
21172 *{{TALKPAGENAMEE}}
21173 *{{SUBJECTPAGENAME}}
21174 *{{SUBJECTPAGENAMEE}}
21175 *{{NAMESPACEE}}
21176 *{{NAMESPACE}}
21177 *{{NAMESPACENUMBER}}
21178 *{{TALKSPACE}}
21179 *{{TALKSPACEE}}
21180 *{{SUBJECTSPACE}}
21181 *{{SUBJECTSPACEE}}
21182 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21183 !! html
21184 <ul><li>Parser test</li>
21185 <li>Parser_test</li>
21186 <li>Parser test</li>
21187 <li>Parser_test</li>
21188 <li>Parser test</li>
21189 <li>Parser_test</li>
21190 <li>Parser test</li>
21191 <li>Parser_test</li>
21192 <li>Parser test</li>
21193 <li>Parser_test</li>
21194 <li>Talk:Parser test</li>
21195 <li>Talk:Parser_test</li>
21196 <li>Parser test</li>
21197 <li>Parser_test</li>
21198 <li></li>
21199 <li></li>
21200 <li>0</li>
21201 <li>Talk</li>
21202 <li>Talk</li>
21203 <li></li>
21204 <li></li>
21205 <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>
21206
21207 !! end
21208 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21209
21210 !! test
21211 Gallery with valid attributes
21212 !! wikitext
21213 <gallery type="123" summary="345">
21214 File:File:Foobar.jpg
21215 </gallery>
21216 !! html/php
21217 <ul class="gallery mw-gallery-traditional" type="123">
21218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21219 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21220 <div class="gallerytext">
21221 </div>
21222 </div></li>
21223 </ul>
21224
21225 !! html/parsoid
21226 <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"}}'>
21227 <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>
21228 </ul>
21229 !! end
21230
21231 ## Parsoid thinks the "centre" here is a property, not a caption.
21232 !! test
21233 Gallery
21234 !! options
21235 parsoid={
21236 "modes": ["wt2html"],
21237 "nativeGallery": true
21238 }
21239 !! wikitext
21240 <gallery>
21241 image1.png |
21242 image2.gif|||||
21243
21244 image3|
21245 image4 |300px| centre
21246 image5.svg| http://///////
21247 [[x|xx]]]]
21248 * image6
21249 </gallery>
21250 !! html/php
21251 <ul class="gallery mw-gallery-traditional">
21252 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21253 <div class="thumb" style="height: 150px;">Image1.png</div>
21254 <div class="gallerytext">
21255 </div>
21256 </div></li>
21257 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21258 <div class="thumb" style="height: 150px;">Image2.gif</div>
21259 <div class="gallerytext">
21260 </div>
21261 </div></li>
21262 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21263 <div class="thumb" style="height: 150px;">Image3</div>
21264 <div class="gallerytext">
21265 </div>
21266 </div></li>
21267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21268 <div class="thumb" style="height: 150px;">Image4</div>
21269 <div class="gallerytext">
21270 <pre>centre
21271 </pre>
21272 </div>
21273 </div></li>
21274 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21275 <div class="thumb" style="height: 150px;">Image5.svg</div>
21276 <div class="gallerytext">
21277 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21278 </p>
21279 </div>
21280 </div></li>
21281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21282 <div class="thumb" style="height: 150px;">* image6</div>
21283 <div class="gallerytext">
21284 </div>
21285 </div></li>
21286 </ul>
21287
21288 !! html/parsoid
21289 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21290 <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>
21291 <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>
21292 <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>
21293 <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>
21294 <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>
21295 <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>
21296 </ul>
21297 !! end
21298
21299 !! test
21300 Gallery (with options, html)
21301 !! options
21302 parsoid={
21303 "modes": ["wt2html", "html2html"],
21304 "nativeGallery": true
21305 }
21306 !! wikitext
21307 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21308 File:Nonexistent.jpg|caption
21309 File:Nonexistent.jpg
21310 image:foobar.jpg|some '''caption''' [[Main Page]]
21311 image:foobar.jpg
21312 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21313 </gallery>
21314 !! html/php
21315 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21316 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21317 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21318 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21319 <div class="gallerytext">
21320 <p>caption
21321 </p>
21322 </div>
21323 </div></li>
21324 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21325 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21326 <div class="gallerytext">
21327 </div>
21328 </div></li>
21329 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21330 <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>
21331 <div class="gallerytext">
21332 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21333 </p>
21334 </div>
21335 </div></li>
21336 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21337 <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>
21338 <div class="gallerytext">
21339 </div>
21340 </div></li>
21341 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21342 <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>
21343 <div class="gallerytext">
21344 <p>blabla.
21345 </p>
21346 </div>
21347 </div></li>
21348 </ul>
21349
21350 !! html/parsoid
21351 <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":{}}'>
21352 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21353 <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>
21354 <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>
21355 <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>
21356 <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>
21357 <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>
21358 </ul>
21359 !! end
21360
21361 !! test
21362 Gallery (with options, extsrc)
21363 !! options
21364 parsoid={
21365 "nativeGallery": false
21366 }
21367 !! wikitext
21368 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21369 File:Nonexistent.jpg|caption
21370 File:Nonexistent.jpg
21371 image:foobar.jpg|some '''caption''' [[Main Page]]
21372 image:foobar.jpg
21373 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21374 </gallery>
21375 !! html/php
21376 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21377 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21378 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21379 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21380 <div class="gallerytext">
21381 <p>caption
21382 </p>
21383 </div>
21384 </div></li>
21385 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21386 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21387 <div class="gallerytext">
21388 </div>
21389 </div></li>
21390 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21391 <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>
21392 <div class="gallerytext">
21393 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21394 </p>
21395 </div>
21396 </div></li>
21397 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21398 <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>
21399 <div class="gallerytext">
21400 </div>
21401 </div></li>
21402 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21403 <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>
21404 <div class="gallerytext">
21405 <p>blabla.
21406 </p>
21407 </div>
21408 </div></li>
21409 </ul>
21410
21411 !! html/parsoid
21412 <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"}}'>
21413 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21414 <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>
21415 <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>
21416 <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>
21417 <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>
21418 <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>
21419 </ul>
21420 !! end
21421
21422 !! test
21423 Gallery (without px units)
21424 !! wikitext
21425 <gallery widths="70" heights="40">
21426 File:Foobar.jpg
21427 </gallery>
21428 !! html/php
21429 <ul class="gallery mw-gallery-traditional">
21430 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21431 <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>
21432 <div class="gallerytext">
21433 </div>
21434 </div></li>
21435 </ul>
21436
21437 !! html/parsoid
21438 <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"}}'>
21439 <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>
21440 </ul>
21441 !! end
21442
21443 !! test
21444 Gallery (with invalid units)
21445 !! wikitext
21446 <gallery widths="70em" heights="40em">
21447 File:Foobar.jpg
21448 </gallery>
21449 !! html/php
21450 <ul class="gallery mw-gallery-traditional">
21451 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21452 <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>
21453 <div class="gallerytext">
21454 </div>
21455 </div></li>
21456 </ul>
21457
21458 !! html/parsoid
21459 <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"}}'>
21460 <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>
21461 </ul>
21462 !! end
21463
21464 !! test
21465 Gallery with link that has fragment
21466 !! options
21467 parsoid={
21468 "modes": ["wt2html", "html2html"],
21469 "nativeGallery": true
21470 }
21471 !! wikitext
21472 <gallery>
21473 image:foobar.jpg|link=Main_Page
21474 image:foobar.jpg|link=Main_Page#section
21475 image:foobar.jpg|link=Main Page#section|caption
21476 </gallery>
21477 !! html/php
21478 <ul class="gallery mw-gallery-traditional">
21479 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21480 <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>
21481 <div class="gallerytext">
21482 </div>
21483 </div></li>
21484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21485 <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>
21486 <div class="gallerytext">
21487 </div>
21488 </div></li>
21489 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21490 <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>
21491 <div class="gallerytext">
21492 <p>caption
21493 </p>
21494 </div>
21495 </div></li>
21496 </ul>
21497
21498 !! html/parsoid
21499 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21500 <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>
21501 <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>
21502 <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>
21503 </ul>
21504 !! end
21505
21506 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
21507 !! test
21508 Gallery with template inside caption
21509 !! options
21510 parsoid={
21511 "nativeGallery": true
21512 }
21513 !! wikitext
21514 <gallery caption="{{echo|hi}}">
21515 File:Foobar.jpg|{{echo|ho}}
21516 </gallery>
21517 !! html/php
21518 <ul class="gallery mw-gallery-traditional">
21519 <li class='gallerycaption'>{{echo|hi}}</li>
21520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21521 <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>
21522 <div class="gallerytext">
21523 <p>ho
21524 </p>
21525 </div>
21526 </div></li>
21527 </ul>
21528
21529 !! html/parsoid
21530 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21531 <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>
21532 <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>
21533 </ul>
21534 !! end
21535
21536 !! test
21537 Gallery with wikitext inside caption
21538 !! options
21539 parsoid={
21540 "nativeGallery": true
21541 }
21542 !! wikitext
21543 <gallery>
21544 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21545 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21546 </gallery>
21547 !! html/php
21548 <ul class="gallery mw-gallery-traditional">
21549 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21550 <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>
21551 <div class="gallerytext">
21552 <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>
21553 </p>
21554 </div>
21555 </div></li>
21556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21557 <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>
21558 <div class="gallerytext">
21559 <p>This is a test template
21560 </p>
21561 </div>
21562 </div></li>
21563 </ul>
21564
21565 !! html/parsoid
21566 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21567 <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>
21568 <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>
21569 </ul>
21570 !! end
21571
21572 !! test
21573 Gallery (with showfilename option)
21574 !! options
21575 parsoid={
21576 "nativeGallery": true
21577 }
21578 !! wikitext
21579 <gallery showfilename="">
21580 File:Nonexistent.jpg|caption
21581 File:Nonexistent.jpg
21582 File:Foobar.jpg|some '''caption''' [[Main Page]]
21583 File:Foobar.jpg
21584 </gallery>
21585 !! html/php
21586 <ul class="gallery mw-gallery-traditional">
21587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21588 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21589 <div class="gallerytext">
21590 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21591 caption
21592 </p>
21593 </div>
21594 </div></li>
21595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21596 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21597 <div class="gallerytext">
21598 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21599 </p>
21600 </div>
21601 </div></li>
21602 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21603 <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>
21604 <div class="gallerytext">
21605 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21606 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21607 </p>
21608 </div>
21609 </div></li>
21610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21611 <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>
21612 <div class="gallerytext">
21613 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21614 </p>
21615 </div>
21616 </div></li>
21617 </ul>
21618
21619 !! html/parsoid
21620 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21621 <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>
21622 <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>
21623 <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>
21624 <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>
21625 </ul>
21626 !! end
21627
21628 ## Should Parsoid be preserving these variations? See T151367
21629 !! test
21630 Gallery (with namespace-less filenames)
21631 !! options
21632 parsoid={
21633 "modes": ["wt2html", "html2html"],
21634 "nativeGallery": true
21635 }
21636 !! wikitext
21637 <gallery>
21638 File:Nonexistent.jpg
21639 Nonexistent.jpg
21640 image:foobar.jpg
21641 foobar.jpg
21642 </gallery>
21643 !! html/php
21644 <ul class="gallery mw-gallery-traditional">
21645 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21646 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21647 <div class="gallerytext">
21648 </div>
21649 </div></li>
21650 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21651 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21652 <div class="gallerytext">
21653 </div>
21654 </div></li>
21655 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21656 <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>
21657 <div class="gallerytext">
21658 </div>
21659 </div></li>
21660 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21661 <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>
21662 <div class="gallerytext">
21663 </div>
21664 </div></li>
21665 </ul>
21666
21667 !! html/parsoid
21668 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21669 <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>
21670 <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>
21671 <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>
21672 <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>
21673 </ul>
21674 !! end
21675
21676 !! test
21677 Gallery override link with wikilink (T36852)
21678 !! options
21679 parsoid={
21680 "nativeGallery": true
21681 }
21682 !! wikitext
21683 <gallery>
21684 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21685 </gallery>
21686 !! html/php
21687 <ul class="gallery mw-gallery-traditional">
21688 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21689 <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>
21690 <div class="gallerytext">
21691 </div>
21692 </div></li>
21693 </ul>
21694
21695 !! html/parsoid
21696 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21697 <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>
21698 </ul>
21699 !! end
21700
21701 !! test
21702 Gallery override link with absolute external link (T36852)
21703 !! options
21704 parsoid={
21705 "nativeGallery": true
21706 }
21707 !! wikitext
21708 <gallery>
21709 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21710 </gallery>
21711 !! html/php
21712 <ul class="gallery mw-gallery-traditional">
21713 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21714 <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>
21715 <div class="gallerytext">
21716 </div>
21717 </div></li>
21718 </ul>
21719
21720 !! html/parsoid
21721 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21722 <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>
21723 </ul>
21724 !! end
21725
21726 !! test
21727 Gallery override link with absolute external link with LanguageConverter
21728 !! options
21729 language=zh
21730 !! wikitext
21731 <gallery>
21732 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21733 </gallery>
21734 !! html/php
21735 <ul class="gallery mw-gallery-traditional">
21736 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21737 <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>
21738 <div class="gallerytext">
21739 <p>caption
21740 </p>
21741 </div>
21742 </div></li>
21743 </ul>
21744
21745 !! html/parsoid
21746 <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"}}'>
21747 <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>
21748 </ul>
21749 !! end
21750
21751 !! test
21752 Gallery override link with malicious javascript (T36852)
21753 !! options
21754 parsoid={
21755 "modes": ["wt2html", "html2html"],
21756 "nativeGallery": true
21757 }
21758 !! wikitext
21759 <gallery>
21760 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21761 </gallery>
21762 !! html/php
21763 <ul class="gallery mw-gallery-traditional">
21764 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21765 <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>
21766 <div class="gallerytext">
21767 </div>
21768 </div></li>
21769 </ul>
21770
21771 !! html/parsoid
21772 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21773 <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>
21774 </ul>
21775 !! end
21776
21777 # Note that parsoid uses the invalid link as a caption, PHP does not.
21778 !! test
21779 Gallery with invalid title as link (T45964)
21780 !! options
21781 parsoid={
21782 "modes": ["wt2html", "html2html"],
21783 "nativeGallery": true
21784 }
21785 !! wikitext
21786 <gallery>
21787 File:Foobar.jpg|link=<
21788 </gallery>
21789 !! html/php
21790 <ul class="gallery mw-gallery-traditional">
21791 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21792 <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>
21793 <div class="gallerytext">
21794 </div>
21795 </div></li>
21796 </ul>
21797
21798 !! html/parsoid
21799 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21800 <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>
21801 </ul>
21802 !! end
21803
21804 !! test
21805 Serialize gallery without attrs in data-mw
21806 !! options
21807 parsoid={
21808 "modes": ["html2wt"],
21809 "nativeGallery": true
21810 }
21811 !! html/parsoid
21812 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21813 <li class="gallerycaption">123</li>
21814 <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>
21815 </ul>
21816 !! wikitext
21817 <gallery caption="123">
21818 File:Test.png
21819 </gallery>
21820 !! end
21821
21822 !! test
21823 Gallery with class and style attributes
21824 !! options
21825 parsoid={
21826 "nativeGallery": true
21827 }
21828 !! wikitext
21829 <gallery class="center" style="text-align: center;">
21830 File:Foobar.jpg
21831 </gallery>
21832 !! html/php
21833 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21834 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21835 <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>
21836 <div class="gallerytext">
21837 </div>
21838 </div></li>
21839 </ul>
21840
21841 !! html/parsoid
21842 <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":{}}'>
21843 <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>
21844 </ul>
21845 !! end
21846
21847 !! test
21848 Gallery in slideshow mode
21849 !! options
21850 parsoid={
21851 "nativeGallery": true
21852 }
21853 !! wikitext
21854 <gallery mode="slideshow" showthumbnails="">
21855 File:Foobar.jpg
21856 </gallery>
21857 !! html/php
21858 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21860 <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>
21861 <div class="gallerytext">
21862 </div>
21863 </div></li>
21864 </ul>
21865
21866 !! html/parsoid
21867 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21868 <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>
21869 </ul>
21870 !! end
21871
21872 !! test
21873 Serialize gallery image captions on a line
21874 !! options
21875 parsoid={
21876 "modes": ["html2wt"],
21877 "nativeGallery": true
21878 }
21879 !! html/parsoid
21880 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21881 <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>
21882 <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>
21883 </ul>
21884 !! wikitext
21885 <gallery>
21886 File:Foobar.jpg| hi ho
21887 File:Foobar.jpg|hi<br />ho
21888 </gallery>
21889 !! end
21890
21891 !! test
21892 HTML Hex character encoding (spells the word "JavaScript")
21893 !! options
21894 parsoid=wt2html,wt2wt,html2html
21895 !! wikitext
21896 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21897 !! html/php
21898 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21899 </p>
21900 !! html/parsoid
21901 <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>
21902 !! end
21903
21904 !! test
21905 HTML Hex character encoding bogus encoding (T28437 regression check)
21906 !! wikitext
21907 &#xsee;&#XSEE;
21908 !! html
21909 <p>&amp;#xsee;&amp;#XSEE;
21910 </p>
21911 !! end
21912
21913 !! test
21914 HTML Hex character encoding mixed case
21915 !! options
21916 parsoid=wt2html,wt2wt,html2html
21917 !! wikitext
21918 &#xEE;&#Xee;
21919 !! html/php
21920 <p>&#xee;&#xee;
21921 </p>
21922 !! html/parsoid
21923 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21924 !! end
21925
21926 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21927 # Note that U+000C (form feed) is not a valid XML character, so
21928 # it is banned even though allowed in HTML5.
21929 !! test
21930 Illegal character references (T106578)
21931 !! wikitext
21932 ; Null: &#00;
21933 ; FF: &#xC;
21934 ; CR: &#xD;
21935 ; Control (low): &#8;
21936 ; Control (high): &#x7F; &#x9F;
21937 ; Surrogate: &#xD83D;&#xDCA9;
21938 ; This is an okay astral character: &#x1F4A9;
21939 !! html+tidy
21940 <dl><dt>Null</dt>
21941 <dd>&amp;#00;</dd>
21942 <dt>FF</dt>
21943 <dd>&amp;#xC;</dd>
21944 <dt>CR</dt>
21945 <dd>&amp;#xD;</dd>
21946 <dt>Control (low)</dt>
21947 <dd>&amp;#8;</dd>
21948 <dt>Control (high)</dt>
21949 <dd>&amp;#x7F; &amp;#x9F;</dd>
21950 <dt>Surrogate</dt>
21951 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21952 <dt>This is an okay astral character</dt>
21953 <dd>&#x1f4a9;</dd></dl>
21954 !! end
21955
21956 !! test
21957 __FORCETOC__ override
21958 !! wikitext
21959 __NEWSECTIONLINK__
21960 __FORCETOC__
21961 !! html/php
21962 <p><br />
21963 </p>
21964 !! end
21965
21966 !! test
21967 ISBN code coverage
21968 !! wikitext
21969 ISBN 978-0-1234-56&#x20;789
21970 !! html/php
21971 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21972 </p>
21973 !! html/parsoid
21974 <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>
21975 !! end
21976
21977 !! test
21978 ISBN followed by 5 spaces
21979 !! wikitext
21980 ISBN
21981 !! html
21982 <p>ISBN
21983 </p>
21984 !! end
21985
21986 !! test
21987 Double ISBN
21988 !! wikitext
21989 ISBN ISBN 1234567890
21990 !! html/php
21991 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21992 </p>
21993 !! html/parsoid
21994 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21995 !! end
21996
21997 # Uppercase X and lowercase x as well
21998 !! test
21999 ISBN with an X
22000 !! wikitext
22001 ISBN 3-462-04561-X
22002 ISBN 3-462-04561-x
22003 ISBN 080442957X
22004 ISBN 080442957x
22005 ISBN 978080442957X
22006 ISBN 978080442957x
22007 !! html/php
22008 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
22009 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
22010 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
22011 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
22012 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
22013 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
22014 </p>
22015 !! html/parsoid
22016 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
22017 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
22018 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
22019 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
22020 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
22021 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
22022 !! end
22023
22024 !! test
22025 ISBN with empty prefix (parsoid test)
22026 !! wikitext
22027 ISBN 1234567890
22028 !! html/php
22029 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22030 </p>
22031 !! html/parsoid
22032 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
22033 !! end
22034
22035 !! test
22036 T24905: <abbr> followed by ISBN followed by </a>
22037 !! wikitext
22038 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
22039 !! html/php
22040 <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>
22041 </p>
22042 !! html/parsoid
22043 <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>
22044 !! end
22045
22046 !! test
22047 Double RFC
22048 !! wikitext
22049 RFC RFC 1234
22050 !! html/php
22051 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
22052 </p>
22053 !! html/parsoid
22054 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
22055 !! end
22056
22057 !! test
22058 Double RFC with a wiki link
22059 !! wikitext
22060 RFC [[RFC 1234]]
22061 !! html/php
22062 <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>
22063 </p>
22064 !! html/parsoid
22065 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
22066 !! end
22067
22068 !! test
22069 RFC code coverage
22070 !! wikitext
22071 RFC 983&#x20;987
22072 !! html/php
22073 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
22074 </p>
22075 !! html/parsoid
22076 <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>
22077 !! end
22078
22079 !! test
22080 Centre-aligned image
22081 !! wikitext
22082 [[Image:foobar.jpg|centre]]
22083 !! html/php
22084 <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>
22085
22086 !! html/parsoid
22087 <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>
22088 !! end
22089
22090 !! test
22091 None-aligned image
22092 !! wikitext
22093 [[Image:foobar.jpg|none]]
22094 !! html/php
22095 <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>
22096
22097 !! html/parsoid
22098 <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>
22099 !! end
22100
22101 !! test
22102 Width + Height sized image (using px) (height is ignored)
22103 !! wikitext
22104 [[Image:foobar.jpg|640x480px]]
22105 !! html/php
22106 <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>
22107 </p>
22108 !! html/parsoid
22109 <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>
22110 !! end
22111
22112 !! test
22113 Width-sized image (using px, no following whitespace)
22114 !! wikitext
22115 [[Image:foobar.jpg|640px]]
22116 !! html/php
22117 <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>
22118 </p>
22119 !! html/parsoid
22120 <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>
22121 !! end
22122
22123 !! test
22124 Width-sized image (using px, with following whitespace - test regression from r39467)
22125 !! wikitext
22126 [[Image:foobar.jpg|640px ]]
22127 !! html/php
22128 <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>
22129 </p>
22130 !! html/parsoid
22131 <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>
22132 !!end
22133
22134 !! test
22135 Width-sized image (using px, with preceding whitespace - test regression from r39467)
22136 !! wikitext
22137 [[Image:foobar.jpg| 640px]]
22138 !! html/php
22139 <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>
22140 </p>
22141 !! html/parsoid
22142 <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>
22143 !! end
22144
22145 !! test
22146 Image with page parameter
22147 !! options
22148 djvu
22149 !! wikitext
22150 [[File:LoremIpsum.djvu|page=2]]
22151 !! html/php
22152 <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>
22153 </p>
22154 !! html/parsoid
22155 <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>
22156 !! end
22157
22158 !! test
22159 Another italics / bold test
22160 !! wikitext
22161 ''' ''x'
22162 !! html
22163 <pre>'<i> </i>x'
22164 </pre>
22165 !!end
22166
22167 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22168 !! test
22169 dt/dd/dl test
22170 !! wikitext
22171 :;;;::
22172 !! html/php
22173 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22174
22175 !! html/parsoid
22176 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22177
22178 !!end
22179
22180 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22181 !! test
22182 Images with the "|" character in the comment
22183 !! wikitext
22184 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22185 !! html/php
22186 <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>
22187
22188 !! html/parsoid
22189 <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>
22190 !! end
22191
22192 !! test
22193 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22194 !! wikitext
22195 <html><script>alert(1);</script></html>
22196 !! html
22197 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22198 </p>
22199 !! end
22200
22201 !! test
22202 HTML with raw HTML ($wgRawHtml==true)
22203 !! options
22204 wgRawHtml=1
22205 !! wikitext
22206 <html><script>alert(1);</script></html>
22207 !! html/php
22208 <p><script>alert(1);</script>
22209 </p>
22210 !! html/parsoid
22211 <p><script typeof="mw:Extension/html" about="#mwt3" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></p>
22212 !! end
22213
22214 !! test
22215 Parents of subpages, one level up
22216 !! options
22217 subpage title=[[Subpage test/L1/L2/L3]]
22218 !! wikitext
22219 [[../|L2]]
22220 !! html
22221 <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>
22222 </p>
22223 !! end
22224
22225
22226 !! test
22227 Parents of subpages, one level up, not named
22228 !! options
22229 subpage title=[[Subpage test/L1/L2/L3]]
22230 !! wikitext
22231 [[../]]
22232 !! html
22233 <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>
22234 </p>
22235 !! end
22236
22237
22238
22239 !! test
22240 Parents of subpages, two levels up
22241 !! options
22242 subpage title=[[Subpage test/L1/L2/L3]]
22243 !! wikitext
22244 [[../../|L1]]2
22245
22246 [[../../|L1]]l
22247 !! html
22248 <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
22249 </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>
22250 </p>
22251 !! end
22252
22253 !! test
22254 Parents of subpages, two levels up, without trailing slash or name.
22255 !! options
22256 subpage title=[[Subpage test/L1/L2/L3]]
22257 !! wikitext
22258 [[../..]]
22259 !! html
22260 <p>[[../..]]
22261 </p>
22262 !! end
22263
22264 !! test
22265 Parents of subpages, two levels up, with lots of extra trailing slashes.
22266 !! options
22267 subpage title=[[Subpage test/L1/L2/L3]]
22268 !! wikitext
22269 [[../../////]]
22270 !! html
22271 <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>
22272 </p>
22273 !! end
22274
22275 !! article
22276 Subpage test/L1/L2/L3Sibling
22277 !! text
22278 Sibling article
22279 !! endarticle
22280
22281 !! test
22282 Transclusion of a sibling page (one level up)
22283 !! options
22284 subpage title=[[Subpage test/L1/L2/L3]]
22285 !! wikitext
22286 {{../L3Sibling}}
22287 !! html
22288 <p>Sibling article
22289 </p>
22290 !! end
22291
22292 !! test
22293 Transclusion of a child page
22294 !! options
22295 subpage title=[[Subpage test/L1/L2]]
22296 !! wikitext
22297 {{/L3Sibling}}
22298 !! html
22299 <p>Sibling article
22300 </p>
22301 !! end
22302
22303 # This is wt2html only in Parsoid because we add <nowiki>
22304 # because of {{..}} and we don't expect to fix that to
22305 # eliminate the nowikis selective for {{..}} markup.
22306 !! test
22307 Non-transclusion because of too many up levels
22308 !! options
22309 subpage title=[[Subpage test/L1/L2/L3]]
22310 parsoid=wt2html
22311 !! wikitext
22312 {{../../../../More than parent}}
22313 !! html/php
22314 <p>{{../../../../More than parent}}
22315 </p>
22316 !! html/parsoid
22317 <p>{{../../../../More than parent}}</p>
22318 !! end
22319
22320 !! test
22321 Definition list code coverage
22322 !! wikitext
22323 ;title :def
22324 ;title :def
22325 ;title:def
22326 !! html/php
22327 <dl><dt>title</dt>
22328 <dd>def</dd>
22329 <dt>title</dt>
22330 <dd>def</dd>
22331 <dt>title</dt>
22332 <dd>def</dd></dl>
22333
22334 !! html/parsoid
22335 <dl><dt>title </dt><dd>def</dd>
22336 <dt>title </dt><dd>def</dd>
22337 <dt>title</dt><dd>def</dd></dl>
22338 !! end
22339
22340 !! test
22341 Don't fall for the self-closing div
22342 !! wikitext
22343 <div>hello world</div/>
22344 !! html
22345 <div>hello world</div>
22346
22347 !! end
22348
22349 !! test
22350 MSGNW magic word
22351 !! wikitext
22352 {{MSGNW:msg}}
22353 !! html/php
22354 <p>&#91;&#91;:Template:Msg&#93;&#93;
22355 </p>
22356 !! end
22357
22358 !! test
22359 RAW magic word
22360 !! wikitext
22361 {{RAW:QUERTY}}
22362 !! html
22363 <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>
22364 </p>
22365 !! end
22366
22367 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22368 !! test
22369 Always escape literal '>' in output, not just after '<'
22370 !! wikitext
22371 ><>
22372 !! html
22373 <p>&gt;&lt;&gt;
22374 </p>
22375 !! end
22376
22377 !! test
22378 Template caching
22379 !! wikitext
22380 {{Test}}
22381 {{Test}}
22382 !! html
22383 <p>This is a test template
22384 This is a test template
22385 </p>
22386 !! end
22387
22388
22389 !! article
22390 MediaWiki:Fake
22391 !! text
22392 ==header==
22393 !! endarticle
22394
22395 !! test
22396 Inclusion of !userCanEdit() content
22397 !! wikitext
22398 {{MediaWiki:Fake}}
22399 !! html
22400 <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>
22401
22402 !! end
22403
22404
22405 !! test
22406 Out-of-order TOC heading levels
22407 !! wikitext
22408 ==2==
22409 ======6======
22410 ===3===
22411 =1=
22412 =====5=====
22413 ==2==
22414 !! html
22415 <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>
22416 <ul>
22417 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22418 <ul>
22419 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22420 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22421 </ul>
22422 </li>
22423 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22424 <ul>
22425 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22426 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22427 </ul>
22428 </li>
22429 </ul>
22430 </div>
22431
22432 <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>
22433 <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>
22434 <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>
22435 <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>
22436 <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>
22437 <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>
22438
22439 !! end
22440
22441
22442 !! test
22443 ISBN with a dummy number
22444 !! wikitext
22445 ISBN ---
22446 !! html
22447 <p>ISBN ---
22448 </p>
22449 !! end
22450
22451
22452 !! test
22453 ISBN with space-delimited number
22454 !! wikitext
22455 ISBN 92 9017 032 8
22456 !! html/php
22457 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22458 </p>
22459 !! html/parsoid
22460 <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>
22461 !! end
22462
22463
22464 !! test
22465 ISBN with multiple spaces, no number
22466 !! wikitext
22467 ISBN foo
22468 !! html
22469 <p>ISBN foo
22470 </p>
22471 !! end
22472
22473
22474 !! test
22475 ISBN length
22476 !! wikitext
22477 ISBN 123456789
22478
22479 ISBN 1234567890
22480
22481 ISBN 12345678901
22482 !! html/php
22483 <p>ISBN 123456789
22484 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22485 </p><p>ISBN 12345678901
22486 </p>
22487 !! html/parsoid
22488 <p>ISBN 123456789</p>
22489
22490 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22491
22492 <p>ISBN 12345678901</p>
22493 !! end
22494
22495
22496 !! test
22497 ISBN with trailing year (T9110)
22498 !! wikitext
22499 ISBN 1-234-56789-0 - 2006
22500
22501 ISBN 1 234 56789 0 - 2006
22502 !! html/php
22503 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22504 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22505 </p>
22506 !! html/parsoid
22507 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22508
22509 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22510 !! end
22511
22512
22513 !! test
22514 anchorencode
22515 !! config
22516 wgFragmentMode=[ 'html5', 'legacy' ]
22517 !! wikitext
22518 {{anchorencode:foo bar©#%n}}
22519 !! html/php
22520 <p>foo_bar©#%n
22521 </p>
22522 !! html/parsoid
22523 <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>
22524 !! end
22525
22526 !! test
22527 anchorencode (legacy)
22528 !! config
22529 wgFragmentMode=[ 'legacy' ]
22530 !! wikitext
22531 {{anchorencode:foo bar©#%n}}
22532 !! html/php
22533 <p>foo_bar.C2.A9.23.25n
22534 </p>
22535 !! end
22536
22537 !! test
22538 anchorencode trims spaces
22539 !! config
22540 wgFragmentMode=[ 'html5', 'legacy' ]
22541 !! wikitext
22542 {{anchorencode: __pretty__please__}}
22543 !! html/php
22544 <p>pretty_please
22545 </p>
22546 !! html/parsoid
22547 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22548 !! end
22549
22550 !! test
22551 anchorencode deals with links
22552 !! config
22553 wgFragmentMode=[ 'html5', 'legacy' ]
22554 !! wikitext
22555 {{anchorencode: [[hello|world]] [[hi]]}}
22556 !! html/php
22557 <p>world_hi
22558 </p>
22559 !! html/parsoid
22560 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22561 !! end
22562
22563 !! test
22564 anchorencode deals with templates
22565 !! config
22566 wgFragmentMode=[ 'html5', 'legacy' ]
22567 !! wikitext
22568 {{anchorencode: {{Foo}} x}}
22569 !! html/php
22570 <p>FOO_x
22571 </p>
22572 !! html/parsoid
22573 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22574 !! end
22575
22576 !! test
22577 anchorencode encodes like the TOC generator: (T20431)
22578 !! config
22579 wgFragmentMode=[ 'html5', 'legacy' ]
22580 !! wikitext
22581 ===_ +:.3A%3A _ &&amp;]] x===
22582 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22583 __NOEDITSECTION__
22584 !! html/php
22585 <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>
22586 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22587 </p>
22588 !! html/parsoid
22589 <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>
22590 <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>
22591 <meta property="mw:PageProp/noeditsection"/>
22592 !! end
22593
22594 !! test
22595 anchorencode encodes like the TOC generator: (T20431) (legacy)
22596 !! config
22597 wgFragmentMode=[ 'legacy' ]
22598 !! wikitext
22599 ===_ +:.3A%3A&&amp;]]===
22600 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22601 __NOEDITSECTION__
22602 !! html/php
22603 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22604 <p>.2B:.3A.253A.26.26.5D.5D
22605 </p>
22606 !! end
22607
22608 !! test
22609 T8200: blockquotes and paragraph formatting
22610 !! wikitext
22611 <blockquote>
22612 foo
22613 </blockquote>
22614
22615 bar
22616
22617 baz
22618 !! html
22619 <blockquote>
22620 <p>foo
22621 </p>
22622 </blockquote>
22623 <p>bar
22624 </p>
22625 <pre>baz
22626 </pre>
22627 !! end
22628
22629 !! test
22630 T10293: Use of center tag ruins paragraph formatting
22631 !! wikitext
22632 <center>
22633 foo
22634 </center>
22635
22636 bar
22637
22638 baz
22639 !! html
22640 <center>
22641 <p>foo
22642 </p>
22643 </center>
22644 <p>bar
22645 </p>
22646 <pre>baz
22647 </pre>
22648 !! end
22649
22650 !!test
22651 Parsing of overlapping (improperly nested) inline html tags
22652 !! wikitext
22653 <span><s>x</span></s>
22654 !! html/php
22655 <p><span><s>x&lt;/span&gt;</s></span>
22656 </p>
22657 !! html/parsoid
22658 <p><span><s>x</s></span>
22659 </p>
22660 !!end
22661
22662 ###
22663 ### Language variants related tests
22664 ###
22665
22666 # Parsoid does not mark self-links.
22667 # Parsoid does not convert links; PHP will do any necessary redirects.
22668
22669 !! test
22670 Self-link in language variants
22671 !! options
22672 title=[[Dunav]] language=sr
22673 !! wikitext
22674 Both [[Dunav]] and [[Дунав]] are names for this river.
22675 !! html/php
22676 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22677 </p>
22678 !! html/parsoid
22679 <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>
22680 !! end
22681
22682 !! article
22683 Дуна
22684 !! text
22685 content
22686 !! endarticle
22687
22688 !! test
22689 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22690 !! options
22691 title=[[Duna]] language=sr
22692 !! wikitext
22693 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22694 !! html/php
22695 <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.
22696 </p>
22697 !! html/parsoid
22698 <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>
22699 !! end
22700
22701 !! test
22702 Link to a section of a variant of this title shouldn't be parsed as self-link
22703 !! options
22704 title=[[Duna]] language=sr
22705 !! wikitext
22706 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22707 !! html/php
22708 <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.
22709 </p>
22710 !! html/parsoid
22711 <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>
22712 !! end
22713
22714 !! test
22715 Link to pages in language variants
22716 !! options
22717 language=sr
22718 !! wikitext
22719 Main Page can be written as [[Маин Паге]]
22720 !! html/php
22721 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22722 </p>
22723 !! html/parsoid
22724 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22725 !! end
22726
22727
22728 !! test
22729 Multiple links to pages in language variants
22730 !! options
22731 language=sr
22732 !! wikitext
22733 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22734 !! html/php
22735 <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>.
22736 </p>
22737 !! html/parsoid
22738 <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>
22739 !! end
22740
22741
22742 !! test
22743 Simple template in language variants
22744 !! options
22745 language=sr
22746 !! wikitext
22747 {{тест}}
22748 !! html/php
22749 <p>This is a test template
22750 </p>
22751 !! end
22752
22753
22754 !! test
22755 Template with explicit namespace in language variants
22756 !! options
22757 language=sr
22758 !! wikitext
22759 {{Template:тест}}
22760 !! html/php
22761 <p>This is a test template
22762 </p>
22763 !! end
22764
22765
22766 !! test
22767 Basic test for template parameter in language variants
22768 !! options
22769 language=sr
22770 !! wikitext
22771 {{парамтест|param=foo}}
22772 !! html/php
22773 <p>This is a test template with parameter foo
22774 </p>
22775 !! end
22776
22777 !! test
22778 Simple category in language variants
22779 !! options
22780 language=sr cat
22781 !! wikitext
22782 [[Category:МедиаWики Усер'с Гуиде]]
22783 !! html/php
22784 cat=МедиаWики_Усер'с_Гуиде sort=
22785 !! html/parsoid
22786 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22787 !! end
22788
22789 !! article
22790 Category:分类
22791 !! text
22792 blah
22793 !! endarticle
22794
22795 !! article
22796 Category:分類
22797 !! text
22798 blah
22799 !! endarticle
22800
22801 ## We used to, but no longer wt2wt this test since the default serializer
22802 ## will normalize all categories to serialize on their own line.
22803 ## This wikitext usage is going to be fairly uncommon in production and
22804 ## selser will take care of preserving formatting in those scenarios.
22805 !! test
22806 Don't convert blue categorylinks to another variant (T35210)
22807 !! options
22808 cat
22809 language=zh
22810 parsoid=wt2html
22811 !! wikitext
22812 [[A]][[Category:分类]]
22813 !! html/php
22814 cat=分类 sort=
22815 !! html/parsoid
22816 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22817 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22818 !! end
22819
22820 !! test
22821 Stripping -{}- tags (language variants)
22822 !! options
22823 language=sr
22824 !! wikitext
22825 Latin proverb: -{Ne nuntium necare}-
22826 !! html/php
22827 <p>Latin proverb: Ne nuntium necare
22828 </p>
22829 !! html/parsoid
22830 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22831 !! end
22832
22833
22834 !! test
22835 Prevent conversion with -{}- tags (language variants)
22836 !! options
22837 language=sr variant=sr-ec
22838 !! wikitext
22839 Latinski: -{Ne nuntium necare}-
22840 !! html/php
22841 <p>Латински: Ne nuntium necare
22842 </p>
22843 !! html/parsoid
22844 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22845 !! end
22846
22847
22848 !! test
22849 Prevent conversion of text with -{}- tags (language variants)
22850 !! options
22851 language=sr variant=sr-ec
22852 !! wikitext
22853 Latinski: -{Ne nuntium necare}-
22854 !! html/php
22855 <p>Латински: Ne nuntium necare
22856 </p>
22857 !! html/parsoid
22858 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22859 !! end
22860
22861
22862 !! test
22863 Prevent conversion of links with -{}- tags (language variants)
22864 !! options
22865 language=sr variant=sr-ec
22866 !! wikitext
22867 -{[[Main Page]]}-
22868 !! html/php
22869 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22870 </p>
22871 !! html/parsoid
22872 <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>
22873 !! end
22874
22875
22876 !! test
22877 -{}- tags within headlines (within html for parserConvert())
22878 !! config
22879 wgFragmentMode=[ 'html5', 'legacy' ]
22880 !! options
22881 language=sr variant=sr-ec
22882 !! wikitext
22883 ==-{Naslov}-==
22884
22885 Note that even an unprotected headline ID is not affected by language
22886 conversion:
22887
22888 ==Latinski==
22889 !! html/php
22890 <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>
22891 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22892 цонверсион:
22893 </p>
22894 <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>
22895
22896 !! html/parsoid
22897 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22898
22899 <p>Note that even an unprotected headline ID is not affected by language
22900 conversion:</p>
22901
22902 <h2 id="Latinski">Latinski</h2>
22903 !! end
22904
22905 !! test
22906 Explicit definition of language variant alternatives
22907 !! options
22908 language=zh variant=zh-tw
22909 !! wikitext
22910 -{zh:China;zh-tw:Taiwan}-, not China
22911 !! html/php
22912 <p>Taiwan, not China
22913 </p>
22914 !! html/parsoid
22915 <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>
22916 !! end
22917
22918 !! test
22919 Filter syntax for language variants
22920 !! options
22921 language=zh variant=zh-tw
22922 !! wikitext
22923 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22924 !! html/php
22925 <p>fooblog, WEBJOURNAL, WEBLOGquux
22926 </p>
22927 !! html/parsoid
22928 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22929 !! end
22930
22931 # Note that Parsoid post-processing for language variants needs to
22932 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22933 !! test
22934 Conversion around HTML tags
22935 !! options
22936 language=sr variant=sr-ec
22937 !! wikitext
22938 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22939 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22940 !! html/php
22941 <p>
22942 <span title="ЛаCтин">ски</span>
22943 </p>
22944 !! html/parsoid
22945 <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"}]}'/>
22946 <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>
22947 !! end
22948
22949 !! test
22950 Explicit session-wise two-way language variant mapping (A flag and - flag)
22951 !! options
22952 language=zh variant=zh-tw
22953 !! wikitext
22954 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22955
22956 Taiwan is not China.
22957
22958 But -{A|zh:China; zh-tw:Taiwan}- is China,
22959
22960 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22961
22962 and -{China}- is China.
22963 !! html/php
22964 <p>This is Taiwan, but we'll forget that now.
22965 </p><p>Taiwan is not China.
22966 </p><p>But Taiwan is Taiwan,
22967 </p><p>(This should be stripped!)
22968 </p><p>and China is China.
22969 </p>
22970 !! html/parsoid
22971 <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>
22972 <p>Taiwan is not China.</p>
22973 <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>
22974 <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>
22975 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22976 !! end
22977
22978 !! test
22979 Explicit session-wise one-way language variant mapping (A flag and - flag)
22980 !! options
22981 language=zh variant=zh-tw
22982 !! wikitext
22983 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22984
22985 COUNTRY is China or Taiwan.
22986
22987 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22988
22989 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22990
22991 and -{COUNTRY}- is COUNTRY.
22992 !! html/php
22993 <p>This is Taiwan, but we'll forget that now.
22994 </p><p>COUNTRY is China or Taiwan.
22995 </p><p>But Taiwan is Taiwan,
22996 </p><p>(This should be stripped!)
22997 </p><p>and COUNTRY is COUNTRY.
22998 </p>
22999 !! html/parsoid
23000 <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>
23001 <p>COUNTRY is China or Taiwan.</p>
23002 <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>
23003 <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>
23004 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
23005 !! end
23006
23007 !! test
23008 Explicit session-wise two-way language variant mapping (H flag for hide)
23009 !! options
23010 language=zh variant=zh-tw
23011 !! wikitext
23012 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
23013
23014 Taiwan is China.
23015 !! html/php
23016 <p>(This should be stripped!)
23017 </p><p>Taiwan is Taiwan.
23018 </p>
23019 !! html/parsoid
23020 <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>
23021 <p>Taiwan is China.</p>
23022 !! end
23023
23024 !! test
23025 Explicit session-wise one-way language variant mapping (H flag for hide)
23026 !! options
23027 language=zh variant=zh-tw
23028 !! wikitext
23029 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23030
23031 COUNTRY is Taiwan or China.
23032 !! html/php
23033 <p>(This should be stripped!)
23034 </p><p>Taiwan is Taiwan or China.
23035 </p>
23036 !! html/parsoid
23037 <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>
23038 <p>COUNTRY is Taiwan or China.</p>
23039 !! end
23040
23041 ## Note that parsoid test runner does not support 'showtitle' option.
23042 !! test
23043 Adding explicit conversion rule for title (T flag)
23044 !! options
23045 language=zh variant=zh-tw showtitle
23046 !! wikitext
23047 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
23048
23049 Taiwan is China.
23050 !! html/php
23051 Taiwan
23052 <p>Should be stripped!
23053 </p><p>Taiwan is China.
23054 </p>
23055 !! html/parsoid
23056 <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>
23057 <p>Taiwan is China.</p>
23058 !! end
23059
23060 !! test
23061 Code coverage: T combined with H flag
23062 !! options
23063 language=zh variant=zh-tw showtitle
23064 !! wikitext
23065 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
23066
23067 Taiwan is China.
23068 !! html/php
23069 Taiwan
23070 <p>Should be stripped!
23071 </p><p>Taiwan is Taiwan.
23072 </p>
23073 !! html/parsoid
23074 <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>
23075 <p>Taiwan is China.</p>
23076 !! end
23077
23078 !! test
23079 Code coverage: T with no variants
23080 !! options
23081 language=zh variant=zh-tw showtitle
23082 !! wikitext
23083 -{H|zh:China; zh-tw:Taiwan}-
23084 Taiwan is China.-{T|Taiwan is China}-
23085 !! html/php
23086 Taiwan is China
23087 <p>
23088 Taiwan is Taiwan.
23089 </p>
23090 !! html/parsoid
23091 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23092 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
23093 !! end
23094
23095 !! test
23096 Code coverage: rules with no variants
23097 !! options
23098 language=zh variant=zh-tw
23099 !! wikitext
23100 -{H|zh:China; zh-tw:Taiwan}-
23101 Taiwan is China.
23102 -{H|China}-
23103 Taiwan is China.
23104 !! html/php
23105 <p>
23106 Taiwan is Taiwan.
23107
23108 Taiwan is China.
23109 </p>
23110 !! html/parsoid
23111 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23112 Taiwan is China.
23113 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23114 Taiwan is China.</p>
23115 !! end
23116
23117
23118 !! test
23119 Code coverage: D flag for conversion rule
23120 !! options
23121 language=zh variant=zh-tw
23122 !! wikitext
23123 -{D|zh-cn:XA; zh-tw:YA}-
23124 -{A;D|zh-cn:XB; zh-tw:YB}-
23125 -{D;H|zh-cn:XC; zh-tw:YC}-
23126
23127 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23128
23129 -{D|0=>zh-tw:1}-
23130 -{A;D|2=>zh-tw:3}-
23131 -{D;H|4=>zh-tw:5}-
23132
23133 XA XB XC YA YB YC FOO BAR BAT 012345
23134 !! html/php
23135 <p>大陆:XA;台灣:YA;
23136
23137 大陆:XC;台灣:YC;
23138 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23139 </p><p>0⇒台灣:1;
23140
23141 4⇒台灣:5;
23142 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23143 </p>
23144 !! html/parsoid
23145 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23146 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23147 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23148 <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>
23149 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23150 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23151 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23152 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23153 !! end
23154
23155 !! test
23156 Code coverage: N flag for conversion rule
23157 !! options
23158 language=zh variant=zh-cn
23159 !! wikitext
23160 -{N|zh-cn}-
23161
23162 -{N|zh-tw}-
23163
23164 -{N|sr-ec}-
23165 !! html/php
23166 <p>大陆
23167 </p><p>台灣
23168 </p><p>српски (ћирилица)‎
23169 </p>
23170 !! html/parsoid
23171 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23172 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23173 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23174 !! end
23175
23176 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23177 !! test
23178 Code coverage: N flag for conversion rule (wt2html only)
23179 !! options
23180 language=zh variant=zh-cn
23181 parsoid=wt2html,html2html
23182 !! wikitext
23183 -{D;N|en}-
23184 !! html/php
23185 <p>English
23186 </p>
23187 !! html/parsoid
23188 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23189 !! end
23190
23191 !! test
23192 Testing that changing the language variant here in the tests actually works
23193 !! options
23194 language=zh variant=zh showtitle
23195 !! wikitext
23196 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23197 !! html/php
23198 China
23199 <p>Should be stripped!
23200 </p>
23201 !! html/parsoid
23202 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23203 !! end
23204
23205 !! test
23206 Recursive conversion of alt and title attrs shouldn't clear converter state
23207 !! options
23208 language=zh variant=zh-cn
23209 showtitle
23210 !! wikitext
23211 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23212 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23213 !! html/php
23214 China
23215 <p>
23216 Should be stripped<span title="Exclamation">!</span>
23217 </p>
23218 !! html/parsoid
23219 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23220 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>
23221 !! end
23222
23223 !! test
23224 T26072: more test on conversion rule for title
23225 !! options
23226 language=zh variant=zh-tw showtitle
23227 !! wikitext
23228 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23229
23230 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23231 !! html/php
23232 Taiwan
23233 <p>This should be stripped!
23234 </p><p>This won't take interferes with the title rule.
23235 </p>
23236 !! html/parsoid
23237 <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>
23238 <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>
23239 !! end
23240
23241 !! test
23242 Partly disable title conversion if variant == main language code
23243 !! options
23244 language=zh variant=zh title=[[ZH]] showtitle
23245 !! wikitext
23246 -{T|zh-cn:CN;zh-tw:TW}-
23247 !! html/php
23248 ZH
23249 <p>
23250 </p>
23251 !! html/parsoid
23252 <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>
23253 !! end
23254
23255 !! test
23256 Partly disable title conversion if variant == main language code, more
23257 !! options
23258 language=zh variant=zh title=[[ZH]] showtitle
23259 !! wikitext
23260 -{T|TW}-
23261 !! html/php
23262 ZH
23263 <p>
23264 </p>
23265 !! html/parsoid
23266 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23267 !! end
23268
23269 !! test
23270 Raw output of variant escape tags (R flag)
23271 !! options
23272 language=zh variant=zh-tw
23273 !! wikitext
23274 Raw: -{R|zh:China;zh-tw:Taiwan}-
23275 !! html/php
23276 <p>Raw: zh:China;zh-tw:Taiwan
23277 </p>
23278 !! html/parsoid
23279 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23280 !! end
23281
23282 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23283 !! test
23284 Raw output of variant escape tags (R flag) (wt2html only)
23285 !! options
23286 language=zh variant=zh-tw
23287 parsoid=wt2html,html2html
23288 !! wikitext
23289 -{Variant}- -{D|syntax}- -{D;R|options}-
23290 !! html/php
23291 <p>Variant syntax options
23292 </p>
23293 !! html/parsoid
23294 <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>
23295 !! end
23296
23297 !! test
23298 Nested markup inside raw output of variant escape tags (R flag)
23299 !! options
23300 language=zh variant=zh-tw
23301 !! wikitext
23302 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23303 !! html/php
23304 <p>Nested raw: nested Taiwan nested
23305 </p>
23306 !! html/parsoid
23307 <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>
23308 !! end
23309
23310 !! test
23311 Nested markup and spaces inside raw output of variant escape tags (R flag)
23312 !! options
23313 language=zh variant=zh-tw
23314 !! wikitext
23315 X-{ outer -{ inner }- outer }-X
23316 !! html/php
23317 <p>X outer inner outer X
23318 </p>
23319 !! html/parsoid
23320 <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>
23321 !! end
23322
23323 !! test
23324 Templates inside raw output of variant escape tags (R flag)
23325 !! options
23326 language=zh variant=zh-tw
23327 !! wikitext
23328 Nested raw: -{R|nested {{echo|hi}} templates}-
23329 !! html/php
23330 <p>Nested raw: nested hi templates
23331 </p>
23332 !! html/parsoid
23333 <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>
23334 !! end
23335
23336 !! test
23337 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23338 !! options
23339 language=zh variant=zh-cn
23340 !! wikitext
23341 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23342 !! html/php
23343 <p>0
23344 </p>
23345 !! html/parsoid
23346 <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>
23347 !! end
23348
23349 !! test
23350 Conversion rules from [numeric-only string] to [something else] (T48634)
23351 !! options
23352 language=zh variant=zh-cn
23353 !! wikitext
23354 -{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
23355 !! html/php
23356 <p>D12345EE12345
23357 </p>
23358 !! html/parsoid
23359 <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>
23360 !! end
23361
23362 !! test
23363 Two-way converter rule entries with an empty value should be ignored (T53551)
23364 !! options
23365 language=zh variant=zh-cn
23366 !! wikitext
23367 -{H|zh-cn:foo;zh-tw:;}-foobar
23368 !! html/php
23369 <p>foobar
23370 </p>
23371 !! html/parsoid
23372 <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>
23373 !! end
23374
23375 !! test
23376 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23377 !! options
23378 language=zh variant=zh-cn
23379 !! wikitext
23380 -{H|=>zh-cn:foo;}-foobar
23381 !! html/php
23382 <p>foobar
23383 </p>
23384 !! html/parsoid
23385 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23386 !! end
23387
23388 !! test
23389 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23390 !! options
23391 language=zh variant=zh-cn
23392 !! wikitext
23393 -{H|}-foobar
23394 !! html/php
23395 <p>foobar
23396 </p>
23397 !! html/parsoid
23398 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23399 !! end
23400
23401 !! test
23402 Nested using of manual convert syntax
23403 !! options
23404 language=zh variant=zh-hk
23405 !! wikitext
23406 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23407 !! html/php
23408 <p>Nested: Hello Hong Kong!
23409 </p>
23410 !! html/parsoid
23411 <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>
23412 !! end
23413
23414 !! test
23415 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23416 !! options
23417 language=zh variant=zh-cn
23418 !! wikitext
23419 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23420 !! html/php
23421 <p><span title="X">A</span>
23422 </p>
23423 !! html/parsoid
23424 <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>
23425 !! end
23426
23427 !! test
23428 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23429 !! options
23430 language=zh variant=zh-cn
23431 !! wikitext
23432 -{<span title="-{X}-">A</span>}-
23433 !! html/php+disabled
23434 <p><span title="X">A</span>
23435 </p>
23436 !! html/parsoid
23437 <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>
23438 !! end
23439
23440 # Parsoid and PHP disagree on how to parse this example: Parsoid
23441 # insists that the content of a language converter element be a valid
23442 # DOM fragment or attribute string
23443 !! test
23444 Language converter markup with block content
23445 !! options
23446 language=zh variant=zh-cn
23447 !! wikitext
23448 <span>a-{b<div>c}-d
23449
23450 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23451
23452 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23453 !! html/php+tidy
23454 <span>ab<div>cd
23455 <span>ab<div>cd
23456 <span>ad
23457 </span></div></span></div></span>
23458 !! html/parsoid
23459 <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
23460
23461 <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
23462
23463 <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>
23464 !! end
23465
23466 !! test
23467 LanguageConverter selser (1)
23468 !! options
23469 language=zh variant=zh-cn
23470 parsoid={
23471 "modes": ["wt2wt", "selser"],
23472 "changes": [
23473 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23474 ]
23475 }
23476 !! wikitext
23477 -{raw}-
23478 !! wikitext/edited
23479 -{edited}-
23480 !! end
23481
23482 !! test
23483 LanguageConverter selser (2)
23484 !! options
23485 language=zh variant=zh-cn
23486 parsoid={
23487 "modes": ["wt2wt", "selser"],
23488 "changes": [
23489 ["span[class='x']", "contents", "text", "-{foo}-"],
23490 ["a", "contents", "text", "-{"],
23491 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23492 ]
23493 }
23494 !! wikitext
23495 <span class="x">TEXT1</span>
23496 [http://example.com TEXT2]
23497 [[Foo|TEXT3]]
23498 {{echo|TEXT4}}
23499 !! wikitext/edited
23500 <span class="x"><nowiki>-{foo}-</nowiki></span>
23501 [http://example.com -{]
23502 [[Foo|<nowiki>-{</nowiki>]]
23503 {{1x|<nowiki>-{</nowiki>}}
23504 !! end
23505
23506 # Tests LanguageVariantText in ConstrainedText
23507 !! test
23508 LanguageConverter selser (3)
23509 !! options
23510 language=zh variant=zh-cn
23511 parsoid={
23512 "modes": ["wt2wt", "selser"],
23513 "changes": [
23514 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23515 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23516 ]
23517 }
23518 !! wikitext
23519 {|
23520 |-
23521 |<span>Foo</span>
23522 |}
23523 !! wikitext/edited
23524 {|
23525 |-
23526 |<nowiki/>-{edited}-
23527 |}
23528 !! end
23529
23530 # Tests LanguageVariantText._fromSelSer
23531 !! test
23532 LanguageConverter selser (4)
23533 !! options
23534 language=zh variant=zh-cn
23535 parsoid={
23536 "modes": ["wt2wt", "selser"],
23537 "changes": [
23538 ["td > span.x", "remove"]
23539 ]
23540 }
23541 !! wikitext
23542 {|
23543 |-
23544 |<span class="x">Foo</span>-{Bar}-
23545 ||<span class="x">Foo</span>-{Bar}-
23546 |}
23547 !! wikitext/edited
23548 {|
23549 |-
23550 |<nowiki/>-{Bar}-
23551 ||-{Bar}-
23552 |}
23553 !! end
23554
23555 # Since Parsoid is starting to emit canonical wikitext for links,
23556 # [http://example.com http://example.com] will not RT back to that
23557 # form anymore.
23558 # Parsoid does not language-convert links (it is done in a
23559 # post-processing step)
23560 !! test
23561 Proper conversion of text in external links
23562 !! options
23563 language=sr variant=sr-ec
23564 parsoid=wt2html
23565 !! wikitext
23566 http://www.google.com
23567 gopher://www.google.com
23568 [http://www.google.com http://www.google.com]
23569 [gopher://www.google.com gopher://www.google.com]
23570 [https://www.google.com irc://www.google.com]
23571 [ftp://www.google.com www.google.com/ftp://dir]
23572 [//www.google.com www.google.com]
23573 !! html/php
23574 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23575 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23576 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23577 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23578 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23579 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23580 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23581 </p>
23582 !! html/parsoid
23583 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23584 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23585 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23586 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23587 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23588 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23589 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23590 !! end
23591
23592 !! test
23593 Do not convert roman numbers to language variants
23594 !! options
23595 language=sr variant=sr-ec
23596 !! wikitext
23597 Fridrih IV je car.
23598 !! html/php
23599 <p>Фридрих IV је цар.
23600 </p>
23601 !! html/parsoid
23602 <p>Fridrih IV je car.</p>
23603 !! end
23604
23605 !! test
23606 Unclosed language converter markup "-{"
23607 !! options
23608 language=sr
23609 !! wikitext
23610 -{T|hello
23611 !! html
23612 <p>-{T|hello
23613 </p>
23614 !! end
23615
23616 !! test
23617 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23618 !! options
23619 language=sr
23620 !! wikitext
23621 -{R|=&gt;}-
23622 !! html/php
23623 <p>=&gt;
23624 </p>
23625 !! html/parsoid
23626 <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>
23627 !!end
23628
23629 !! test
23630 Don't break link parsing if language converter markup is in the caption.
23631 !! options
23632 language=sr variant=sr-ec
23633 !! wikitext
23634 [[Main Page|-{R|main page}-]]
23635 !! html/php
23636 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23637 </p>
23638 !! html/parsoid
23639 <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>
23640 !! end
23641
23642 !! test
23643 T146304: Don't break template parsing if language converter markup is in the parameter.
23644 !! options
23645 language=sr variant=sr-ec
23646 !! wikitext
23647 {{echo|-{R|foo}-}}
23648 !! html/php
23649 <p>foo
23650 </p>
23651 !! html/parsoid
23652 <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>
23653 !! end
23654
23655 !! test
23656 T146305: Don't break image parsing if language converter markup is in the caption.
23657 !! options
23658 language=sr
23659 !! wikitext
23660 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23661 !! html/php
23662 <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>
23663
23664 !! html/parsoid
23665 <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>
23666 !! end
23667
23668 !! test
23669 T146305: Don't break image parsing if nested language converter markup is in the caption.
23670 !! options
23671 language=zh variant=zh-cn
23672 !! wikitext
23673 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23674 !! html/php
23675 <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>
23676
23677 !! html/parsoid
23678 <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>
23679 !! end
23680
23681 # XXX html2wt disabled because rich markup in alt is not preserved.
23682 !! test
23683 Don't break gallery if language converter markup is inside.
23684 !! options
23685 language=zh
23686 !! wikitext
23687 <gallery>
23688 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23689 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23690 </gallery>
23691 !! html/php
23692 <ul class="gallery mw-gallery-traditional">
23693 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23694 <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>
23695 <div class="gallerytext">
23696 <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>
23697 </p>
23698 </div>
23699 </div></li>
23700 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23701 <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>
23702 <div class="gallerytext">
23703 <p>This is a test template
23704 </p>
23705 </div>
23706 </div></li>
23707 </ul>
23708
23709 !! html/parsoid
23710 <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"}}'>
23711 <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>
23712 <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>
23713 </ul>
23714 !! end
23715
23716 !! test
23717 T153135: Don't break list handling if language converter markup is in the item.
23718 !! options
23719 language=zh variant=zh-cn
23720 !! wikitext
23721 ;-{zh-cn:AAA;zh-tw:BBB}-
23722 ;-{R|foo:bar}-
23723 !! html/php
23724 <dl><dt>AAA</dt>
23725 <dt>foo:bar</dt></dl>
23726
23727 !! html/parsoid
23728 <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>
23729 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23730 </dl>
23731 !! end
23732
23733 // Note that parsoid does not protect colons unless language converter
23734 // markup is properly nested, because it is a backtracking parser.
23735 !! test
23736 T153135: Unclosed markup in definition list (code coverage)
23737 !! options
23738 language=zh variant=zh-cn
23739 !! wikitext
23740 ;<b>foo:bar
23741 ;-{zh-cn:AAA
23742 !! html/php+tidy
23743 <dl><dt><b>foo:bar</b></dt><b>
23744 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23745 </b></p>
23746 !! html/parsoid
23747 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23748 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23749 !! end
23750
23751 !! test
23752 T153135: Nested language converter markup in definition list (code coverage)
23753 !! options
23754 language=zh variant=zh-cn
23755 !! wikitext
23756 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23757 !! html/php
23758 <dl><dt>AAA foo:bar bat:baz</dt>
23759 <dd>def</dd></dl>
23760
23761 !! html/parsoid
23762 <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>
23763 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23764 </dl>
23765 !! end
23766
23767 # html2wt mode disabled due to <nowiki> insertion.
23768 !! test
23769 T153140: Don't break table handling if language converter markup is in the cell.
23770 !! options
23771 language=sr variant=sr-ec
23772 parsoid=wt2html,wt2wt,html2html
23773 !! wikitext
23774 {|
23775 |-
23776 | -{R|B}-
23777 |}
23778 !! html/php
23779 <table>
23780
23781 <tr>
23782 <td>B
23783 </td></tr></table>
23784
23785 !! html/parsoid
23786 <table>
23787 <tbody>
23788 <tr>
23789 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23790 </tr>
23791 </tbody>
23792 </table>
23793 !! end
23794
23795 !! test
23796 Language converter tricky html2wt cases (1)
23797 !! options
23798 language=sr
23799 parsoid=html2wt,wt2wt
23800 !! html/parsoid
23801 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23802 !! wikitext
23803 -{<nowiki>}-</nowiki>}-
23804 !! html/php
23805 <p>&#125;-
23806 </p>
23807 !! end
23808
23809 !! test
23810 Language converter tricky html2wt cases (2)
23811 !! options
23812 language=sr
23813 parsoid=html2wt,wt2wt
23814 !! html/parsoid
23815 <p>-{foo}-</p>
23816 !! wikitext
23817 <nowiki>-{foo}-</nowiki>
23818 !! html/php
23819 <p>-&#123;foo&#125;-
23820 </p>
23821 !! end
23822
23823 !! test
23824 Language converter tricky html2wt cases (3)
23825 !! options
23826 language=sr
23827 parsoid=html2wt,wt2wt
23828 !! html/parsoid
23829 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23830 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23831 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23832 !! wikitext
23833 -{R||}-
23834
23835 -{R|R|raw}-
23836
23837 -{<nowiki>-{foo}-</nowiki>}-
23838 !! html/php
23839 <p>|
23840 </p><p>R|raw
23841 </p><p>-&#123;foo&#125;-
23842 </p>
23843 !! end
23844
23845 !! test
23846 Language converter tricky html2wt cases (4)
23847 !! options
23848 language=sr
23849 parsoid=html2wt,wt2wt
23850 !! html/parsoid
23851 <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>
23852 !! wikitext
23853 -{R|{{echo|hey}}}-
23854 !! html/php
23855 <p>hey
23856 </p>
23857 !! end
23858
23859 # Note that the <nowiki> escaping added by parsoid for source text,
23860 # destination text, and language names only works on the PHP side
23861 # for *destination text*. (HTML entity escaping wouldn't work
23862 # any better.) This is probably a bug, at least for source texts.
23863 # (For language names PHP uses a precise regexp based on the languages
23864 # it currently knows have variants, which is fragile since this set
23865 # can grow/shrink over time.)
23866 !! test
23867 Language converter tricky html2wt cases (5)
23868 !! options
23869 language=zh variant=zh-cn
23870 !! html/parsoid
23871 <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>
23872 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23873 <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>
23874 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23875 <p>a:b=>c xyz</p>
23876 !! wikitext
23877 -{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
23878
23879 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23880
23881 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23882
23883 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23884
23885 a:b=>c xyz
23886 !! html/php+disabled
23887 <p>foobat;xyz=&gt;zh-cn:abc
23888 </p><p>A
23889 </p><p>0;zh-tw:bar
23890 </p><p>abc
23891 </p><p>a:b=&gt;c 0;zh-tw:bar
23892 </p>
23893 !! end
23894
23895 !! test
23896 T179579: Nowiki and lc interaction
23897 !! options
23898 parsoid=wt2html
23899 language=sr
23900 !! wikitext
23901 -{</nowiki>123}-
23902
23903 -{123<nowiki>|</nowiki>456}-
23904 !! html/parsoid
23905 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23906
23907 <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>
23908 !! end
23909
23910 !! test
23911 T2529: Uncovered bullet
23912 !! wikitext
23913 *Foo {{bullet}}
23914 !! html
23915 <ul><li>Foo</li>
23916 <li>Bar</li></ul>
23917
23918 !! end
23919
23920 !! test
23921 T2529: Uncovered bullet in a deeply nested list
23922 !! wikitext
23923 *******Foo {{bullet}}
23924 !! html
23925 <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>
23926 <li>Bar</li></ul>
23927
23928 !! end
23929
23930 !! test
23931 T2529: Uncovered table already at line-start
23932 !! wikitext
23933 x
23934
23935 {{table}}
23936 y
23937 !! html
23938 <p>x
23939 </p>
23940 <table>
23941 <tr>
23942 <td>1</td>
23943 <td>2
23944 </td></tr>
23945 <tr>
23946 <td>3</td>
23947 <td>4
23948 </td></tr></table>
23949 <p>y
23950 </p>
23951 !! end
23952
23953 !! test
23954 T2529: Uncovered bullet in parser function result
23955 !! wikitext
23956 *Foo {{lc:{{bullet}} }}
23957 !! html
23958 <ul><li>Foo</li>
23959 <li>bar</li></ul>
23960
23961 !! end
23962
23963 !! test
23964 T7678: Double-parsed template argument
23965 !! wikitext
23966 {{lc:{{{1}}}|hello}}
23967 !! html
23968 <p>{{{1}}}
23969 </p>
23970 !! end
23971
23972 !! test
23973 T7678: Double-parsed template invocation
23974 !! wikitext
23975 {{lc:{{paramtest {{!}} param = hello }} }}
23976 !! html
23977 <p>{{paramtest | param = hello }}
23978 </p>
23979 !! end
23980
23981 !! test
23982 Case insensitivity of parser functions for non-ASCII characters (T10143)
23983 !! options
23984 language=cs
23985 title=[[Main Page]]
23986 !! wikitext
23987 {{PRVNÍVELKÉ:ěščř}}
23988 {{prvnívelké:ěščř}}
23989 {{PRVNÍMALÉ:ěščř}}
23990 {{prvnímalé:ěščř}}
23991 {{MALÁ:ěščř}}
23992 {{malá:ěščř}}
23993 {{VELKÁ:ěščř}}
23994 {{velká:ěščř}}
23995 !! html
23996 <p>Ěščř
23997 Ěščř
23998 ěščř
23999 ěščř
24000 ěščř
24001 ěščř
24002 ĚŠČŘ
24003 ĚŠČŘ
24004 </p>
24005 !! end
24006
24007 !! test
24008 Morwen/13: Unclosed link followed by heading
24009 !! wikitext
24010 [[link
24011 ==heading==
24012 !! html
24013 <p>[[link
24014 </p>
24015 <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>
24016
24017 !! end
24018
24019 !! test
24020 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
24021 !! wikitext
24022 {{foo|
24023 =heading=
24024 !! html
24025 <p>{{foo|
24026 </p>
24027 <h1><span class="mw-headline" id="heading">heading</span></h1>
24028
24029 !! end
24030
24031 !! test
24032 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
24033 !! wikitext
24034 {{foo|
24035 ==heading==
24036 !! html
24037 <p>{{foo|
24038 </p>
24039 <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>
24040
24041 !! end
24042
24043 !! test
24044 Tildes in comments
24045 !! options
24046 pst
24047 !! wikitext
24048 <!-- ~~~~ -->
24049 !! html/php
24050 <!-- ~~~~ -->
24051 !! end
24052
24053 !! test
24054 Paragraphs inside divs (no extra line breaks)
24055 !! wikitext
24056 <div>Line one
24057
24058 Line two</div>
24059 !! html
24060 <div>Line one
24061 Line two</div>
24062
24063 !! end
24064
24065 !! test
24066 Paragraphs inside divs (extra line break on open)
24067 !! wikitext
24068 <div>
24069 Line one
24070
24071 Line two</div>
24072 !! html
24073 <div>
24074 <p>Line one
24075 </p>
24076 Line two</div>
24077
24078 !! end
24079
24080 !! test
24081 Paragraphs inside divs (extra line break on close)
24082 !! wikitext
24083 <div>Line one
24084
24085 Line two
24086 </div>
24087 !! html
24088 <div>Line one
24089 <p>Line two
24090 </p>
24091 </div>
24092
24093 !! end
24094
24095 !! test
24096 Paragraphs inside divs (extra line break on open and close)
24097 !! wikitext
24098 <div>
24099 Line one
24100
24101 Line two
24102 </div>
24103 !! html
24104 <div>
24105 <p>Line one
24106 </p><p>Line two
24107 </p>
24108 </div>
24109
24110 !! end
24111
24112 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24113 !! test
24114 Nesting tags, paragraphs on lines which begin with <div>
24115 !! wikitext
24116 <div></div><strong>A
24117 B</strong>
24118 !! html/php+tidy
24119 <div></div><p><strong>A
24120 </strong></p><strong></strong><p><strong>B</strong>
24121 </p>
24122 !! html/parsoid
24123 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24124 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24125 !! end
24126
24127 # T8200: <blockquote> should behave like <div> with respect to line breaks
24128 !! test
24129 T8200: paragraphs inside blockquotes (no extra line breaks)
24130 !! wikitext
24131 <blockquote>Line one
24132
24133 Line two</blockquote>
24134 !! html
24135 <blockquote>Line one
24136 Line two</blockquote>
24137
24138 !! html+tidy
24139 <blockquote><p>Line one
24140 Line two</p></blockquote>
24141 !! end
24142
24143 !! test
24144 T8200: paragraphs inside blockquotes (extra line break on open)
24145 !! wikitext
24146 <blockquote>
24147 Line one
24148
24149 Line two</blockquote>
24150 !! html
24151 <blockquote>
24152 <p>Line one
24153 </p>
24154 Line two</blockquote>
24155
24156 !! html+tidy
24157 <blockquote>
24158 <p>Line one
24159 </p><p>
24160 Line two</p></blockquote>
24161 !! end
24162
24163 !! test
24164 T8200: paragraphs inside blockquotes (extra line break on close)
24165 !! wikitext
24166 <blockquote>Line one
24167
24168 Line two
24169 </blockquote>
24170 !! html
24171 <blockquote>Line one
24172 <p>Line two
24173 </p>
24174 </blockquote>
24175
24176 !! html+tidy
24177 <blockquote><p>Line one
24178 </p><p>Line two
24179 </p>
24180 </blockquote>
24181 !! end
24182
24183 !! test
24184 T8200: paragraphs inside blockquotes (extra line break on open and close)
24185 !! wikitext
24186 <blockquote>
24187 Line one
24188
24189 Line two
24190 </blockquote>
24191 !! html
24192 <blockquote>
24193 <p>Line one
24194 </p><p>Line two
24195 </p>
24196 </blockquote>
24197
24198 !! end
24199
24200 ## This is a corner case interaction between the paragraph wrapping in the
24201 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24202 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24203 ## of which "div" is one, but do p-wrapping inside them. These are referred
24204 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24205 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24206 !! test
24207 Paragraphs inside blockquotes/divs (no extra line breaks)
24208 !! wikitext
24209 <blockquote><div>Line one
24210
24211 Line two</div></blockquote>
24212 !! html
24213 <blockquote><div>Line one
24214 Line two</div></blockquote>
24215
24216 !! end
24217
24218 !! test
24219 Paragraphs inside blockquotes/divs (extra line break on open)
24220 !! wikitext
24221 <blockquote><div>
24222 Line one
24223
24224 Line two</div></blockquote>
24225 !! html
24226 <blockquote><div>
24227 <p>Line one
24228 </p>
24229 Line two</div></blockquote>
24230
24231 !! end
24232
24233 !! test
24234 Paragraphs inside blockquotes/divs (extra line break on close)
24235 !! wikitext
24236 <blockquote><div>Line one
24237
24238 Line two
24239 </div></blockquote>
24240 !! html
24241 <blockquote><div>Line one
24242 <p>Line two
24243 </p>
24244 </div></blockquote>
24245
24246 !! end
24247
24248 !! test
24249 Paragraphs inside blockquotes/divs (extra line break on open and close)
24250 !! wikitext
24251 <blockquote><div>
24252 Line one
24253
24254 Line two
24255 </div></blockquote>
24256 !! html
24257 <blockquote><div>
24258 <p>Line one
24259 </p><p>Line two
24260 </p>
24261 </div></blockquote>
24262
24263 !! end
24264
24265 !! test
24266 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24267 !! options
24268 wgLinkHolderBatchSize=0
24269 !! wikitext
24270 [[meatball:1]]
24271 [[meatball:2]]
24272 [[meatball:3]]
24273 !! html
24274 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24275 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24276 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24277 </p>
24278 !! end
24279
24280 !! test
24281 Free external link invading image caption
24282 !! wikitext
24283 [[Image:Foobar.jpg|thumb|http://x|hello]]
24284 !! html/php
24285 <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>
24286
24287 !! html/parsoid
24288 <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>
24289 !! end
24290
24291 !! test
24292 T17196: localised external link numbers
24293 !! options
24294 language=fa
24295 !! wikitext
24296 [http://en.wikipedia.org/]
24297 !! html/php
24298 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24299 </p>
24300 !! html/parsoid
24301 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24302 !! end
24303
24304 !! test
24305 Multibyte character in padleft
24306 !! wikitext
24307 {{padleft:-Hello|7|Æ}}
24308 !! html/php
24309 <p>Æ-Hello
24310 </p>
24311 !! html/parsoid
24312 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24313 !! end
24314
24315 !! test
24316 Multibyte character in padright
24317 !! wikitext
24318 {{padright:Hello-|7|Æ}}
24319 !! html/php
24320 <p>Hello-Æ
24321 </p>
24322 !! html/parsoid
24323 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24324 !! end
24325
24326 !!test
24327 formatdate parser function
24328 !! wikitext
24329 {{#formatdate:2009-03-24}}
24330 !! html
24331 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24332 </p>
24333 !! end
24334
24335 !!test
24336 formatdate parser function, with default format
24337 !! wikitext
24338 {{#formatdate:2009-03-24|mdy}}
24339 !! html
24340 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24341 </p>
24342 !! end
24343
24344 !! test
24345 Spacing of numbers in formatted dates
24346 !! wikitext
24347 {{#formatdate:January 15}}
24348 !! html
24349 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24350 </p>
24351 !! end
24352
24353 !! test
24354 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
24355 !! options
24356 language=nl title=[[MediaWiki:Common.css]]
24357 !! wikitext
24358 {{#formatdate:2009-03-24|dmy}}
24359 !! html
24360 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24361 </p>
24362 !! end
24363
24364 #
24365 #
24366 #
24367
24368 #
24369 # Edit comments
24370 #
24371
24372 !! test
24373 Edit comment with link
24374 !! options
24375 comment
24376 !! wikitext
24377 I like the [[Main Page]] a lot
24378 !! html/php
24379 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24380 !!end
24381
24382 !! test
24383 Edit comment with link and link text
24384 !! options
24385 comment
24386 !! wikitext
24387 I like the [[Main Page|best pages]] a lot
24388 !! html/php
24389 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24390 !!end
24391
24392 !! test
24393 Edit comment with link and link text with suffix
24394 !! options
24395 comment
24396 !! wikitext
24397 I like the [[Main Page|best page]]s a lot
24398 !! html/php
24399 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24400 !!end
24401
24402 !! test
24403 Edit comment with section link (non-local, eg in history list)
24404 !! options
24405 comment title=[[Main Page]]
24406 !! wikitext
24407 /* External links */ removed bogus entries
24408 !! html/php
24409 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24410 !!end
24411
24412 !! test
24413 Edit comment with section link and text before it (non-local, eg in history list)
24414 !! options
24415 comment title=[[Main Page]]
24416 !! wikitext
24417 pre-comment text /* External links */ removed bogus entries
24418 !! html/php
24419 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>
24420 !!end
24421
24422 !! test
24423 Edit comment with section link (local, eg in diff view)
24424 !! options
24425 comment local title=[[Main Page]]
24426 !! wikitext
24427 /* External links */ removed bogus entries
24428 !! html/php
24429 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
24430 !!end
24431
24432 !! test
24433 Edit comment with subpage link (T16080)
24434 !! options
24435 comment
24436 subpage
24437 title=[[Subpage test]]
24438 !! wikitext
24439 Poked at a [[/subpage]] here...
24440 !! html/php
24441 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24442 !!end
24443
24444 !! test
24445 Edit comment with subpage link and link text (T16080)
24446 !! options
24447 comment
24448 subpage
24449 title=[[Subpage test]]
24450 !! wikitext
24451 Poked at a [[/subpage|neat little page]] here...
24452 !! html/php
24453 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24454 !!end
24455
24456 !! test
24457 Edit comment with bogus subpage link in non-subpage NS (T16080)
24458 !! options
24459 comment
24460 title=[[Subpage test]]
24461 !! wikitext
24462 Poked at a [[/subpage]] here...
24463 !! html/php
24464 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...
24465 !!end
24466
24467 !! test
24468 Edit comment with bare anchor link (local, as on diff)
24469 !! options
24470 comment
24471 local
24472 title=[[Main Page]]
24473 !! wikitext
24474 [[#section]]
24475 !! html/php
24476 <a href="#section">#section</a>
24477 !! end
24478
24479 !! test
24480 Edit comment with bare anchor link (non-local, as on history)
24481 !! options
24482 comment
24483 title=[[Main Page]]
24484 !! wikitext
24485 [[#section]]
24486 !! html/php
24487 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24488 !! end
24489
24490 !! test
24491 Anchor starting with underscore
24492 !! options
24493 title=[[Foo]]
24494 !! wikitext
24495 [[#_ref|One]]
24496 !! html/php
24497 <p><a href="#_ref">One</a>
24498 </p>
24499 !! html/parsoid
24500 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24501 !! end
24502
24503 !! test
24504 Id starting with underscore
24505 !! wikitext
24506 <div id="_ref"></div>
24507 !! html/*
24508 <div id="_ref"></div>
24509
24510 !! end
24511
24512 !! test
24513 Edit comment with link with more than one pipe (T99346)
24514 !! options
24515 comment
24516 !! wikitext
24517 [[Main Page|Many|pipes]]
24518 !! html/php
24519 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24520 !! end
24521
24522 !! test
24523 Complex edit comment with link with more than one pipe (T99346)
24524 !! options
24525 comment
24526 !! wikitext
24527 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24528 !! html/php
24529 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;
24530 !! end
24531
24532 !! test
24533 Space normalisation on autocomment (T24784)
24534 !! options
24535 comment
24536 title=[[Main Page]]
24537 !! wikitext
24538 /* __hello__world__ */
24539 !! html/php
24540 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
24541 !! end
24542
24543 !! test
24544 percent-encoding and + signs in comments (T28410)
24545 !! options
24546 comment
24547 !! wikitext
24548 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24549 !! html/php
24550 <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>
24551 !! end
24552
24553 # Parsoid doesn't support this yet: see T75581
24554 # but it *should* omit the 'src' attribute if the image is bad.
24555 # PHP side of tests was disabled in
24556 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24557 # because of issues in the PHP parserTests infrastructure
24558 # (but the output below is indeed what the PHP side emits)
24559 !! test
24560 Bad images - basic functionality
24561 !! wikitext
24562 [[File:Bad.jpg]]
24563 !! html/php+disabled
24564 !! html/parsoid
24565 <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>
24566 !! end
24567
24568 !! test
24569 Bad images - T18039: text after bad image disappears
24570 !! wikitext
24571 Foo bar
24572 [[File:Bad.jpg]]
24573 Bar foo
24574 !! html/php+disabled
24575 <p>Foo bar
24576 </p><p>Bar foo
24577 </p>
24578 !! html/parsoid
24579 <p>Foo bar
24580 <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>
24581 Bar foo</p>
24582 !! end
24583
24584 !! test
24585 Verify that displaytitle works (T24501) no displaytitle
24586 !! options
24587 showtitle
24588 !! config
24589 wgAllowDisplayTitle=true
24590 wgRestrictDisplayTitle=false
24591 !! wikitext
24592 this is not the the title
24593 !! html/php
24594 Parser test
24595 <p>this is not the the title
24596 </p>
24597 !! end
24598
24599 !! test
24600 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24601 !! options
24602 showtitle
24603 title=[[Screen]]
24604 !! config
24605 wgAllowDisplayTitle=true
24606 wgRestrictDisplayTitle=false
24607 !! wikitext
24608 this is not the the title
24609 {{DISPLAYTITLE:whatever}}
24610 !! html/php
24611 whatever
24612 <p>this is not the the title
24613 </p>
24614 !! end
24615
24616 !! test
24617 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24618 !! options
24619 showtitle
24620 title=[[Screen]]
24621 !! config
24622 wgAllowDisplayTitle=true
24623 wgRestrictDisplayTitle=true
24624 !! wikitext
24625 this is not the the title
24626 {{DISPLAYTITLE:whatever}}
24627 !! html/php
24628 Screen
24629 <p>this is not the the title
24630 </p>
24631 !! end
24632
24633 !! test
24634 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24635 !! options
24636 showtitle
24637 title=[[Screen]]
24638 !! config
24639 wgAllowDisplayTitle=true
24640 wgRestrictDisplayTitle=true
24641 !! wikitext
24642 this is not the the title
24643 {{DISPLAYTITLE:screen}}
24644 !! html/php
24645 screen
24646 <p>this is not the the title
24647 </p>
24648 !! end
24649
24650 !! test
24651 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24652 !! options
24653 showtitle
24654 title=[[Screen]]
24655 !! config
24656 wgAllowDisplayTitle=false
24657 !! wikitext
24658 this is not the the title
24659 {{DISPLAYTITLE:screen}}
24660 !! html/php
24661 Screen
24662 <p>this is not the the title
24663 <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>
24664 </p>
24665 !! end
24666
24667 !! test
24668 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24669 !! options
24670 showtitle
24671 title=[[Screen]]
24672 !! config
24673 wgAllowDisplayTitle=false
24674 !! wikitext
24675 this is not the the title
24676 !! html/php
24677 Screen
24678 <p>this is not the the title
24679 </p>
24680 !! end
24681
24682 !! test
24683 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24684 !! options
24685 showtitle
24686 title=[[Screen]]
24687 !! config
24688 wgAllowDisplayTitle=true
24689 wgRestrictDisplayTitle=true
24690 !! wikitext
24691 this is not the the title
24692 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24693 !! html/php
24694 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24695 <p>this is not the the title
24696 </p>
24697 !! end
24698
24699 !! test
24700 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24701 !! options
24702 showtitle
24703 title=[[Screen]]
24704 !! config
24705 wgAllowDisplayTitle=true
24706 wgRestrictDisplayTitle=true
24707 !! wikitext
24708 this is not the the title
24709 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24710 !! html/php
24711 <span style="color: red;">s</span>creen
24712 <p>this is not the the title
24713 </p>
24714 !! end
24715
24716 !! test
24717 Page status indicators: Empty name is invalid
24718 !! options
24719 showindicators
24720 !! wikitext
24721 <indicator name=" "></indicator>
24722 <indicator></indicator>
24723 !! html/php
24724 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24725 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24726 </p>
24727 !! end
24728
24729 !! test
24730 Page status indicators: Weird syntaxes that are okay
24731 !! options
24732 showindicators
24733 !! wikitext
24734 <indicator name="empty" />
24735 <indicator name="name"></indicator>
24736 !! html/php
24737 empty=
24738 name=
24739 <p><br />
24740 </p>
24741 !! end
24742
24743 !! test
24744 Page status indicators: Torture test
24745 !! options
24746 showindicators
24747 !! wikitext
24748 <indicator name="01">hello world</indicator>
24749 <indicator name="02">[[Main Page]]</indicator>
24750 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24751 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24752 <indicator name="05">*foo
24753 *bar</indicator>
24754 <indicator name="06"><nowiki>foo</nowiki></indicator>
24755 <indicator name="07"> Preformatted</indicator>
24756 <indicator name="08"><div>Broken tag</indicator>
24757 <indicator name="09">{| class=wikitable
24758 |cell
24759 |}</indicator>
24760 <indicator name="10">Two
24761
24762 paragraphs</indicator>
24763 !! html/php
24764 01=hello world
24765 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24766 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" />
24767 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>
24768 05=<ul><li>foo</li>
24769 <li>bar</li></ul>
24770
24771 06=foo
24772 07=<pre>Preformatted
24773 </pre>
24774 08=<div>Broken tag</div>
24775
24776 09=<table class="wikitable">
24777 <tr>
24778 <td>cell
24779 </td></tr></table>
24780
24781 10=<p>Two
24782 </p><p>paragraphs
24783 </p>
24784 <p><br />
24785 </p><p><br />
24786 </p><p><br />
24787 </p><p><br />
24788 </p><p><br />
24789 </p>
24790 !! end
24791
24792 !! test
24793 preload: check <noinclude> and <includeonly>
24794 !! options
24795 preload
24796 !! wikitext
24797 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24798 !! html/php
24799 Hello kind world.
24800 !! end
24801
24802 !! test
24803 preload: check <onlyinclude>
24804 !! options
24805 preload
24806 !! wikitext
24807 Goodbye <onlyinclude>Hello world</onlyinclude>
24808 !! html/php
24809 Hello world
24810 !! end
24811
24812 !! test
24813 preload: can pass tags through if we want to
24814 !! options
24815 preload
24816 !! wikitext
24817 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24818 !! html/php
24819 <includeonly>Hello world</includeonly>
24820 !! end
24821
24822 !! test
24823 preload: check that it doesn't try to do tricks
24824 !! options
24825 preload
24826 !! wikitext
24827 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24828 !! html/php
24829 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24830 !! end
24831
24832 !! test
24833 Play a bit with r67090 and T5158
24834 !! wikitext
24835 <div style="width:50% !important">&nbsp;</div>
24836 <div style="width:50%&nbsp;!important">&nbsp;</div>
24837 <div style="width:50%&#160;!important">&nbsp;</div>
24838 <div style="border : solid;">&nbsp;</div>
24839 !! html/php
24840 <div style="width:50% !important">&#160;</div>
24841 <div style="width:50% !important">&#160;</div>
24842 <div style="width:50% !important">&#160;</div>
24843 <div style="border&#32;: solid;">&#160;</div>
24844
24845 !! html/parsoid
24846 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24847 <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>
24848 <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>
24849 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24850
24851 !! end
24852
24853 !! test
24854 French spaces in wikitext
24855 !! wikitext
24856 foo ! bar ? bat 50 % is less than 75 %.
24857
24858 Hello : this ; is « something ‹ else › again »
24859 !! html
24860 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24861 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24862 </p>
24863 !! end
24864
24865 # It would be reasonable for Parsoid and PHP to differ here.
24866 # The PHP behavior is arguably a bug.
24867 !! test
24868 Corner case: french spaces in definition list
24869 !! wikitext
24870 ;foo : bar
24871 !! html+tidy
24872 <dl><dt>foo&#160;</dt>
24873 <dd>bar</dd></dl>
24874 !! end
24875
24876 !! test
24877 T5158: Test for French spaces in attributes
24878 !! wikitext
24879 <br style=" clear : both ; " />
24880 !! html/php
24881 <p><br style="clear&#32;: both&#32;;" />
24882 </p>
24883 !! end
24884
24885 !! test
24886 HTML5 data attributes
24887 !! wikitext
24888 <span data-foo="bar">Baz</span>
24889 <p data-abc-def_hij="">Quuz</p>
24890 !! html/php
24891 <p><span data-foo="bar">Baz</span>
24892 </p>
24893 <p data-abc-def_hij="">Quuz</p>
24894
24895 !! html/parsoid
24896 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24897 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24898 !! end
24899
24900 !! test
24901 Strip reserved data attributes
24902 !! wikitext
24903 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24904 !! html/php
24905 <div data-ok="fred">d</div>
24906
24907 !! html/parsoid
24908 <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>
24909 !! end
24910
24911 !! test
24912 percent-encoding and + signs in internal links (T28410)
24913 !! wikitext
24914 [[User:+%]] [[Page+title%]]
24915 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24916 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24917 [[%33%45]] [[%33%45+]]
24918 !! html/php
24919 <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>
24920 <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>
24921 <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>
24922 <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>
24923 </p>
24924 !! html/parsoid
24925 <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>
24926 <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>
24927 <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>
24928 <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>
24929 !! end
24930
24931 !! test
24932 Special characters in embedded file links (T29679)
24933 !! wikitext
24934 [[File:Contains & ampersand.jpg]]
24935 [[File:Does not exist.jpg|Title with & ampersand]]
24936 !! html/php
24937 <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>
24938 <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>
24939 </p>
24940 !! html/parsoid
24941 <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>
24942 <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>
24943 !! end
24944
24945 !! test
24946 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24947 !! wikitext
24948 Text&apos;s been normalized?
24949 !! html
24950 <p>Text&#39;s been normalized?
24951 </p>
24952 !! end
24953
24954 !! test
24955 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24956 !! wikitext
24957 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24958 !! html
24959 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24960 </p>
24961 !! end
24962
24963 !! test
24964 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24965 !! wikitext
24966 [http://www.example.org/ ideograms]
24967 !! html
24968 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24969 </p>
24970 !! end
24971
24972 !! test
24973 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24974 !! wikitext
24975 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24976 !! html
24977 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24978 </p>
24979 !! end
24980
24981 !! article
24982 Mediawiki:loop1
24983 !! text
24984 {{Identical|A}}
24985 !! endarticle
24986
24987 !! article
24988 Mediawiki:loop2
24989 !! text
24990 {{Identical|B}}
24991 !! endarticle
24992
24993 !! article
24994 Template:Identical
24995 !! text
24996 {{int:loop1}}
24997 {{int:loop2}}
24998 !! endarticle
24999
25000 !! test
25001 T33098 Template which includes system messages which includes the template
25002 !! wikitext
25003 {{Identical}}
25004 !! html
25005 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25006 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25007 </p>
25008 !! end
25009
25010 !! test
25011 T33490 Turkish: ucfirst 'blah'
25012 !! options
25013 language=tr
25014 !! wikitext
25015 {{ucfirst:blah}}
25016 !! html
25017 <p>Blah
25018 </p>
25019 !! end
25020
25021 !! test
25022 T33490 Turkish: ucfirst 'ix'
25023 !! options
25024 language=tr
25025 !! wikitext
25026 {{ucfirst:ix}}
25027 !! html
25028 <p>İx
25029 </p>
25030 !! end
25031
25032 !! test
25033 T33490 Turkish: lcfirst 'BLAH'
25034 !! options
25035 language=tr
25036 !! wikitext
25037 {{lcfirst:BLAH}}
25038 !! html
25039 <p>bLAH
25040 </p>
25041 !! end
25042
25043 !! test
25044 T33490 Turkish: ucfırst (with a dotless i)
25045 !! options
25046 language=tr
25047 !! wikitext
25048 {{ucfırst:blah}}
25049 !! html
25050 <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>
25051 </p>
25052 !! end
25053
25054 !! test
25055 T33490 ucfırst (with a dotless i) with English language
25056 !! options
25057 language=en
25058 !! wikitext
25059 {{ucfırst:blah}}
25060 !! html
25061 <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>
25062 </p>
25063 !! end
25064
25065 # Note that Parsoid doesn't emit an explicit TOC.
25066 # Note also that the html2wt direction tends to emit an extra newline
25067 # between the __TOC__ magicword and the first heading unless *both*
25068 # the <meta> and the <h2> have a data-parsoid attribute set (even if
25069 # it's "{}").
25070
25071 !! test
25072 T28375: TOC with italics
25073 !! options
25074 title=[[Main Page]]
25075 !! wikitext
25076 __TOC__
25077 ==''Lost'' episodes==
25078 !! html/php
25079 <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>
25080 <ul>
25081 <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>
25082 </ul>
25083 </div>
25084
25085 <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>
25086
25087 !! html/parsoid
25088 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25089 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
25090 !! end
25091
25092 !! test
25093 T28375: TOC with bold
25094 !! options
25095 title=[[Main Page]]
25096 !! wikitext
25097 __TOC__
25098 =='''should be bold''' then normal text==
25099 !! html/php
25100 <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>
25101 <ul>
25102 <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>
25103 </ul>
25104 </div>
25105
25106 <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>
25107
25108 !! html/parsoid
25109 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25110 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25111 !! end
25112
25113 !! test
25114 T35845: Headings become cursive in TOC when they contain an image
25115 !! options
25116 title=[[Main Page]]
25117 !! wikitext
25118 __TOC__
25119 ==Image [[Image:foobar.jpg]]==
25120 !! html/php
25121 <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>
25122 <ul>
25123 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25124 </ul>
25125 </div>
25126
25127 <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>
25128
25129 !! html/parsoid
25130 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25131 <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>
25132 !! end
25133
25134 !! test
25135 T35845 (2): Headings become bold in TOC when they contain a blockquote
25136 !! options
25137 title=[[Main Page]]
25138 !! wikitext
25139 __TOC__
25140 ==<blockquote>Quote</blockquote>==
25141 !! html/php
25142 <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>
25143 <ul>
25144 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25145 </ul>
25146 </div>
25147
25148 <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>
25149
25150 !! html/php+tidy
25151 <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>
25152 <ul>
25153 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25154 </ul>
25155 </div>
25156
25157 <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>
25158 !! html/parsoid
25159 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25160 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25161 !! end
25162
25163 !! test
25164 Unclosed tags in TOC
25165 !! config
25166 wgFragmentMode=[ 'html5', 'legacy' ]
25167 !! options
25168 title=[[Main Page]]
25169 !! wikitext
25170 __TOC__
25171 ==Proof: 2 < 3==
25172 <small>Hanc marginis exiguitas non caperet.</small>
25173 QED
25174 !! html/php
25175 <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>
25176 <ul>
25177 <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>
25178 </ul>
25179 </div>
25180
25181 <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>
25182 <p><small>Hanc marginis exiguitas non caperet.</small>
25183 QED
25184 </p>
25185 !! html/parsoid
25186 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25187 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25188 <p><small>Hanc marginis exiguitas non caperet.</small>
25189 QED</p>
25190 !! end
25191
25192 !! test
25193 Multiple tags in TOC
25194 !! wikitext
25195 __TOC__
25196 ==<i>Foo</i> <b>Bar</b>==
25197
25198 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25199 !! html/php
25200 <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>
25201 <ul>
25202 <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>
25203 <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>
25204 </ul>
25205 </div>
25206
25207 <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>
25208 <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>
25209
25210 !! html/php+tidy
25211 <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>
25212 <ul>
25213 <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>
25214 <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>
25215 </ul>
25216 </div>
25217
25218 <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>
25219 <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>
25220 !! html/parsoid
25221 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25222 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25223
25224 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25225 !! end
25226
25227 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25228 # html5 tag parsing.
25229 !! test
25230 Tags with parameters in TOC
25231 !! options
25232 parsoid=wt2html
25233 !! wikitext
25234 __TOC__
25235 ==<sup class="in-h2">Hello</sup>==
25236
25237 ==<sup class="a > b">Evilbye</sup>==
25238 !! html/php
25239 <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>
25240 <ul>
25241 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25242 <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>
25243 </ul>
25244 </div>
25245
25246 <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>
25247 <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>
25248
25249 !! html/parsoid
25250 <meta property="mw:PageProp/toc" />
25251 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25252
25253 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25254 !! end
25255
25256 !! test
25257 span tags with directionality in TOC
25258 !! wikitext
25259 __TOC__
25260 ==<span dir="ltr">C++</span>==
25261
25262 ==<span dir="rtl">זבנג!</span>==
25263
25264 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25265
25266 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25267
25268 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25269 !! html/php
25270 <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>
25271 <ul>
25272 <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>
25273 <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>
25274 <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>
25275 <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>
25276 <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>
25277 </ul>
25278 </div>
25279
25280 <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>
25281 <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>
25282 <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>
25283 <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>
25284 <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>
25285
25286 !! html/parsoid
25287 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25288 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25289 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25290 <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>
25291 <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>
25292 <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>
25293 !! end
25294
25295 !! test
25296 T74884: bdi element in ToC
25297 !! wikitext
25298 __TOC__
25299 ==<bdi>test</bdi>==
25300 !! html/php
25301 <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>
25302 <ul>
25303 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25304 </ul>
25305 </div>
25306
25307 <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>
25308
25309 !! html/parsoid
25310 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25311 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25312 !! end
25313
25314 !! test
25315 T35715: s/strike element in ToC
25316 !! wikitext
25317 __TOC__
25318 ==<s>test</s> test <strike>test</strike>==
25319 !! html/php
25320 <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>
25321 <ul>
25322 <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>
25323 </ul>
25324 </div>
25325
25326 <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>
25327
25328 !! html/parsoid
25329 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25330 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25331 !! end
25332
25333 !! test
25334 T198618: style element in ToC
25335 !! options
25336 styletag=1
25337 !! wikitext
25338 __TOC__
25339 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25340 !! html/php
25341 <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>
25342 <ul>
25343 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25344 </ul>
25345 </div>
25346
25347 <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>
25348
25349 !! html/parsoid
25350 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25351 <h2 id="Style" data-parsoid="{}"><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo {}"}}'>.foo {}</style>Style<style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".bar {}"}}'>.bar {}</style></h2>
25352 !! end
25353
25354 !! test
25355 T198618: script element in ToC
25356 !! options
25357 wgRawHtml=1
25358 !! wikitext
25359 __TOC__
25360 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25361 !! html/php
25362 <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>
25363 <ul>
25364 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25365 </ul>
25366 </div>
25367
25368 <h2><span class="mw-headline" id="Script"><script>alert(1);</script>Script<script>alert(1);</script></span><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: Script">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25369
25370 !! html/parsoid
25371 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25372 <h2 id="Script" data-parsoid='{}'><script typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script>Script<script typeof="mw:Extension/html" about="#mwt6" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></h2>
25373 !! end
25374
25375 !! test
25376 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25377 !! wikitext
25378 __TOC__
25379 ==x==
25380 !! html/php
25381 <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>
25382 <ul>
25383 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25384 </ul>
25385 </div>
25386
25387 <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>
25388
25389 !! html/parsoid
25390 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25391 <h2 id="x" data-parsoid='{}'>x</h2>
25392 !! end
25393
25394 !! article
25395 MediaWiki:T34057
25396 !! text
25397 == {{int:headline_sample}} ==
25398 !! endarticle
25399
25400 !! test
25401 T34057: Title needed when expanding <h> nodes.
25402 !! options
25403 title=[[Main Page]]
25404 !! wikitext
25405 {{int:T34057}}
25406 !! html
25407 <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>
25408
25409 !! end
25410
25411 !! test
25412 Strip marker in urlencode
25413 !! wikitext
25414 {{urlencode:x<nowiki/>y}}
25415 {{urlencode:x<nowiki/>y|wiki}}
25416 {{urlencode:x<nowiki/>y|path}}
25417 {{urlencode:x<pre id="one">two</pre>y}}
25418 !! html/php
25419 <p>xy
25420 xy
25421 xy
25422 xy
25423 </p>
25424 !! end
25425
25426 !! test
25427 Strip marker in lc
25428 !! wikitext
25429 {{lc:x<nowiki/>y}}
25430 !! html
25431 <p>xy
25432 </p>
25433 !! end
25434
25435 !! test
25436 Strip marker in uc
25437 !! wikitext
25438 {{uc:x<nowiki/>y}}
25439 !! html
25440 <p>XY
25441 </p>
25442 !! end
25443
25444 !! test
25445 Strip marker in formatNum
25446 !! wikitext
25447 {{formatnum:1<nowiki/>2}}
25448 {{formatnum:1<nowiki/>2|R}}
25449 !! html
25450 <p>12
25451 12
25452 </p>
25453 !! end
25454
25455 !! test
25456 Check noCommafy in formatNum
25457 !! options
25458 language=be-tarask
25459 !! wikitext
25460 {{formatnum:123456.78}}
25461 {{formatnum:123456.78|NOSEP}}
25462 !! html
25463 <p>123 456,78
25464 123456.78
25465 </p>
25466 !! end
25467
25468 !! test
25469 Wrong option for formatNum (T58199)
25470 !! wikitext
25471 {{formatnum:1,234.56|Random}}
25472 {{formatnum:1,234.56|EVERYTHING}}
25473 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25474 !! html
25475 <p>1,234.56
25476 1,234.56
25477 1,234.56
25478 </p>
25479 !! end
25480
25481 !! test
25482 Strip marker in grammar
25483 !! options
25484 language=fi
25485 !! wikitext
25486 {{grammar:elative|foo<nowiki/>bar}}
25487 !! html
25488 <p>foobarista
25489 </p>
25490 !! end
25491
25492 !! test
25493 Strip marker in padleft
25494 !! wikitext
25495 {{padleft:|2|x<nowiki/>y}}
25496 !! html
25497 <p>xy
25498 </p>
25499 !! end
25500
25501 !! test
25502 Strip marker in padright
25503 !! wikitext
25504 {{padright:|2|x<nowiki/>y}}
25505 !! html
25506 <p>xy
25507 </p>
25508 !! end
25509
25510 !! test
25511 Strip marker in anchorencode
25512 !! wikitext
25513 {{anchorencode:x<nowiki/>y}}
25514 !! html/php
25515 <p>xy
25516 </p>
25517 !! html/parsoid
25518 <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>
25519 !! end
25520
25521 !! test
25522 nowiki inside link inside heading (T20295)
25523 !! wikitext
25524 ==[[foo|x<nowiki>y</nowiki>z]]==
25525 !! html
25526 <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>
25527
25528 !! end
25529
25530 !! test
25531 new support for bdi element (T33817)
25532 !! wikitext
25533 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25534 !! html
25535 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25536
25537 !!end
25538
25539 !! test
25540 Ignore pipe between table row attributes
25541 !! wikitext
25542 {|
25543 |quux
25544 |- id=foo | style='color: red'
25545 |bar
25546 |}
25547 !! html
25548 <table>
25549 <tr>
25550 <td>quux
25551 </td></tr>
25552 <tr id="foo" style="color: red">
25553 <td>bar
25554 </td></tr></table>
25555
25556 !! end
25557
25558 !!test
25559 Language parser function
25560 !! wikitext
25561 {{#language:ar}}
25562 !! html
25563 <p>العربية
25564 </p>
25565 !! end
25566
25567 !!test
25568 Padleft and padright (default 0-padding)
25569 !! wikitext
25570 {{padleft:xyz|5}}
25571 {{padright:xyz|5}}
25572 !! html/php
25573 <p>00xyz
25574 xyz00
25575 </p>
25576 !! html/parsoid
25577 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25578 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25579 !! end
25580
25581 !!test
25582 Padleft and padright (partial fill)
25583 !! wikitext
25584 {{padleft:xyz|6|ab}}
25585 {{padright:xyz|6|ab}}
25586 !! html/php
25587 <p>abaxyz
25588 xyzaba
25589 </p>
25590 !! html/parsoid
25591 <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>
25592 <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>
25593 !! end
25594
25595 !!test
25596 Padleft and padright as substr
25597 !! wikitext
25598 {{padleft:|3|abcde}}
25599 {{padright:|3|abcde}}
25600 !! html/php
25601 <p>abc
25602 abc
25603 </p>
25604 !! html/parsoid
25605 <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>
25606 <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>
25607 !! end
25608
25609 !! test
25610 Padleft and padright with non-numerical length (T180403)
25611 !! wikitext
25612 {{padleft:abcdef|junk}}
25613 {{padright:abcdef|junk}}
25614 !! html/php
25615 <p>abcdef
25616 abcdef
25617 </p>
25618 !! end
25619
25620 !!test
25621 Special parser function
25622 !! wikitext
25623 {{#special:RandomPage}}
25624 {{#special:BaDtItLe}}
25625 {{#special:Foobar}}
25626 !! html
25627 <p>Special:Random
25628 Special:Badtitle
25629 Special:Foobar
25630 </p>
25631 !! end
25632
25633 !!test
25634 T36939 - Case insensitive link parsing ([HttP://])
25635 !! wikitext
25636 [HttP://MediaWiki.Org/]
25637 !! html/php
25638 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25639 </p>
25640 !! html/parsoid
25641 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25642 !! end
25643
25644 !!test
25645 T36939 - Case insensitive link parsing ([HttP:// title])
25646 !! wikitext
25647 [HttP://MediaWiki.Org/ MediaWiki]
25648 !! html
25649 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25650 </p>
25651 !! end
25652
25653 !!test
25654 T36939 - Case insensitive link parsing (HttP://)
25655 !! wikitext
25656 HttP://MediaWiki.Org/
25657 !! html/php
25658 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25659 </p>
25660 !! html/parsoid
25661 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25662 !! end
25663
25664 !!test
25665 Disable TOC
25666 !! options
25667 notoc
25668 !! wikitext
25669 Lead
25670 ==Section 1==
25671 ==Section 2==
25672 ==Section 3==
25673 ==Section 4==
25674 ==Section 5==
25675 !! html
25676 <p>Lead
25677 </p>
25678
25679 <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>
25680 <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>
25681 <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>
25682 <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>
25683 <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>
25684
25685 !! end
25686
25687
25688 ###
25689 ### Parsoid-specific tests
25690 ### Parsoid-PHP parser incompatibilities
25691 ###
25692 !!test
25693 1. SOL-sensitive wikitext tokens as template-args
25694 !! options
25695 parsoid=wt2html,wt2wt
25696 !! wikitext
25697 {{echo|*a}}
25698 {{echo|#a}}
25699 {{echo|:a}}
25700 !! html/php+tidy
25701 <ul><li>a</li></ul>
25702 <ol><li>a</li></ol>
25703 <dl><dd>a</dd></dl>
25704 !! html/parsoid
25705 <span about="#mwt1" typeof="mw:Transclusion">
25706 </span><ul about="#mwt1"><li>a</li>
25707 </ul>
25708 <span about="#mwt2" typeof="mw:Transclusion">
25709 </span><ol about="#mwt2"><li>a</li>
25710 </ol>
25711 <span about="#mwt3" typeof="mw:Transclusion">
25712 </span><dl about="#mwt3"><dd>a</dd>
25713 </dl>
25714 !!end
25715
25716 #### -----------------------------------------------------------------
25717 #### Parsoid-specific functionality tests
25718 #### -----------------------------------------------------------------
25719
25720 # T65642/T68749: Formatting elt fixup around images.
25721 # We know wt2wt will fail, but we expect selser to pass.
25722 # Due to the nature of our testing, wt2wt and selser tests will enter the
25723 # blacklist and we'll catch selser regressions based on changes to the
25724 # blacklist entries for selser tests.
25725 !! test
25726 1. Treebuilder fixup of formatting elt
25727 !! options
25728 parsoid=wt2html,wt2wt
25729 !! wikitext
25730 {|
25731 |
25732 <small>
25733 [[Image:Foobar.jpg|right|Test]]
25734 </small>
25735 |}
25736 !! html/php+tidy
25737 <table>
25738 <tbody><tr>
25739 <td>
25740 <p><small>
25741 </small></p><small>
25742 <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>
25743 </small><p><small></small>
25744 </p>
25745 </td></tr></tbody></table>
25746 !! html/parsoid
25747 <table>
25748 <tbody><tr><td>
25749 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25750 <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>
25751 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25752 </tbody></table>
25753 !! end
25754
25755 !! test
25756 2. Treebuilder fixup of formatting elt
25757 !! options
25758 parsoid=wt2html,wt2wt
25759 !! wikitext
25760 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25761
25762 <small>[[Image:Foobar.jpg|right|300px]]</small>
25763 !! html/php+tidy
25764 <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>
25765 </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>
25766 !! html/parsoid
25767 <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>
25768
25769 <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>
25770 !! end
25771
25772 !! test
25773 3. Treebuilder fixup of formatting elt
25774 !! options
25775 parsoid=wt2html,wt2wt
25776 !! wikitext
25777 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25778 !! html/php+tidy
25779 <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>
25780 </p>
25781 !! html/parsoid
25782 <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>
25783 !! end
25784
25785 !! test
25786 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25787 !! options
25788 parsoid=wt2html,wt2wt
25789 !! wikitext
25790 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25791 !! html/php+tidy
25792 <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>
25793 !! html/parsoid
25794 <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>
25795 !! end
25796
25797 #### ----------------------------------------------------------------
25798 #### Parsoid-only testing of Parsoid's impl of LST
25799 #### Not implemented yet, see
25800 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25801 #### ----------------------------------------------------------------
25802
25803 ## We still need to support serializing the older format while content is stored.
25804 !! test
25805 LST Sections: Backwards compatibility
25806 !! options
25807 parsoid={
25808 "suppressErrors": true,
25809 "modes": ["html2wt"]
25810 }
25811 !! wikitext
25812 <section begin="2011-05-16" />
25813 <section end="2014-04-10 (MW 1.23wmf22)" />
25814 !! html/parsoid
25815 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25816 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25817 !! end
25818
25819 !! test
25820 LST Sections: Newfangled approach
25821 !! wikitext
25822 <section begin="2011-05-16" />
25823 <section end="2014-04-10 (MW 1.23wmf22)" />
25824 !! html/parsoid
25825 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25826 </span>
25827 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25828 </span></p>
25829 !! end
25830
25831 #--------- Test stripping of empty nodes in template content ----------
25832
25833 !! test
25834 Empty LI and TR nodes should be stripped from template content
25835 !! wikitext
25836 {{EmptyLITest}}
25837 {{EmptyTRTest}}
25838 !! html/parsoid
25839 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25840 <li>a</li>
25841 <li>b</li>
25842 </ul>
25843 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25844 <tbody>
25845 <tr>
25846 <td>foo</td>
25847 </tr>
25848 <tr>
25849 <td>bar</td>
25850 </tr>
25851 </tbody>
25852 </table>
25853 !! end
25854
25855 !! test
25856 Empty LI and TR nodes should not be stripped from top-level content
25857 !! wikitext
25858 *a
25859 *
25860 *b
25861
25862 {|
25863 |-
25864 |-
25865 |foo
25866 |}
25867 !! html/parsoid
25868 <ul>
25869 <li>a</li>
25870 <li class='mw-empty-elt'></li>
25871 <li>b</li>
25872 </ul>
25873 <table>
25874 <tbody>
25875 <tr class='mw-empty-elt'></tr>
25876 <tr>
25877 <td>foo</td>
25878 </tr>
25879 </tbody>
25880 </table>
25881 !! end
25882
25883 !! test
25884 Empty TR nodes should not be stripped if they have any attributes set
25885 !! wikitext
25886 {{EmptyTRWithHTMLAttrTest}}
25887 !! html/parsoid
25888 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25889 <tr align='center'></tr>
25890 <tr><td>foo</td></tr>
25891 <tr align='center'></tr>
25892 <tr><td>bar</td></tr>
25893 </table>
25894 !! end
25895
25896 #### ----------------------------------------------------------------
25897 #### The following section of tests are primarily to test
25898 #### wikitext escaping capabilities of Parsoid. Given that
25899 #### escaping can be done any number of ways, the wikitext (input)
25900 #### is always adjusted to reflect how Parsoid adds nowiki
25901 #### escape tags.
25902 ####
25903 #### We are marking several tests as parsoid-only since the
25904 #### HTML in the result section is different from what the
25905 #### PHP parser generates for it.
25906 #### ----------------------------------------------------------------
25907
25908
25909 #### --------------- Headings ---------------
25910 #### 0. Unnested
25911 #### 1. Nested inside html <h1>=foo=</h1>
25912 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25913 #### 3. Nested inside html with wikitext split by html tags
25914 #### 4. No escape needed
25915 #### 5. Empty headings <h1></h1>
25916 #### 6. Heading chars in SOL context
25917 #### ----------------------------------------
25918 !! test
25919 Headings: 0. Unnested
25920 !! options
25921 parsoid=html2wt
25922 !! html/parsoid
25923 <p>=foo=</p>
25924
25925 <p> =foo=
25926 <!--cmt-->
25927 =foo=</p>
25928
25929 <p>=foo<i>a</i>=</p>
25930 !! wikitext
25931 <nowiki>=foo=</nowiki>
25932
25933 <nowiki> </nowiki>=foo=
25934 <!--cmt-->
25935 <nowiki>=foo=</nowiki>
25936
25937 =foo''a''<nowiki>=</nowiki>
25938 !!end
25939
25940 # New headings and existing headings are handled differently
25941 !! test
25942 Headings: 1. Nested inside html
25943 !! options
25944 parsoid=html2wt
25945 !! html/parsoid
25946 <h1>=foo=</h1>
25947 <h2>=foo=</h2>
25948 <h3>=foo=</h3>
25949
25950 <h1 data-parsoid=''>=foo=</h1>
25951 <h2 data-parsoid=''>=foo=</h2>
25952 <h3 data-parsoid=''>=foo=</h3>
25953 <h4 data-parsoid=''>=foo=</h4>
25954 <h5 data-parsoid=''>=foo=</h5>
25955 <h6 data-parsoid=''>=foo=</h6>
25956 !! wikitext
25957 = =foo= =
25958
25959 == =foo= ==
25960
25961 === =foo= ===
25962
25963 =<nowiki>=foo=</nowiki>=
25964 ==<nowiki>=foo=</nowiki>==
25965 ===<nowiki>=foo=</nowiki>===
25966 ====<nowiki>=foo=</nowiki>====
25967 =====<nowiki>=foo=</nowiki>=====
25968 ======<nowiki>=foo=</nowiki>======
25969
25970 !!end
25971
25972 !! test
25973 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25974 !! options
25975 parsoid=html2wt
25976 !! html/parsoid
25977 <h1>foo</h1>*bar
25978 <h1>foo</h1>=bar
25979 <h1>foo</h1>=bar=
25980 !! wikitext
25981 = foo =
25982 <nowiki>*</nowiki>bar
25983
25984 = foo =
25985 =bar
25986
25987 = foo =
25988 <nowiki>=bar=</nowiki>
25989 !!end
25990
25991 !! test
25992 Headings: 3. Nested inside html with wikitext split by html tags
25993 !! options
25994 parsoid=html2wt
25995 !! html/parsoid
25996 <h1>=<b>bold</b>foo=</h1>
25997 !! wikitext
25998 = ='''bold'''foo= =
25999 !!end
26000
26001 !! test
26002 Headings: 4a. No escaping needed (testing just h1 and h2)
26003 !! options
26004 parsoid=html2wt
26005 !! html/parsoid
26006 <h1>=foo</h1>
26007 <h1>foo=</h1>
26008 <h1> =foo= </h1>
26009 <h1>=foo= bar</h1>
26010 <h2>=foo</h2>
26011 <h2>foo=</h2>
26012 <h1>=</h1>
26013 <h1><i>=</i>foo=</h1>
26014 !! wikitext
26015 = =foo =
26016
26017 = foo= =
26018
26019 = =foo= =
26020
26021 = =foo= bar =
26022
26023 == =foo ==
26024
26025 == foo= ==
26026
26027 = = =
26028
26029 = ''=''foo= =
26030 !!end
26031
26032 !! test
26033 Headings: 4b. No escaping needed (inside p-tags)
26034 !! options
26035 parsoid=html2wt
26036 !! html/parsoid
26037 <p>=foo= x
26038 =foo= <s></s>
26039 </p>
26040 !! wikitext
26041 =foo= x
26042 =foo= <s></s>
26043 !! html/php
26044 <p>=foo= x
26045 =foo= <s></s>
26046 </p>
26047 !!end
26048
26049 !! test
26050 Headings: 4c. Short headings (1)
26051 !! options
26052 parsoid=html2wt
26053 !! html/parsoid
26054 <p>===
26055 </p>
26056 !! wikitext
26057 <nowiki>===</nowiki>
26058 !! html/php
26059 <p>===
26060 </p>
26061 !! end
26062
26063 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
26064 !! test
26065 Headings: 4d. Short headings (2)
26066 !! options
26067 parsoid=wt2html,html2html
26068 !! wikitext
26069 =
26070 ==
26071 ===
26072 ====
26073 =====
26074 !! html/php
26075 <p>=
26076 ==
26077 </p>
26078 <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>
26079 <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>
26080 <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>
26081
26082 !! html/parsoid
26083 <p>=
26084 ==</p>
26085 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
26086 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
26087 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
26088 !! end
26089
26090 !! test
26091 Headings: 5. Empty headings
26092 !! options
26093 parsoid=html2wt
26094 !! html/parsoid
26095 <h1 data-parsoid='{}'></h1>
26096
26097 <h2 data-parsoid='{}'></h2>
26098
26099 <h3 data-parsoid='{}'></h3>
26100
26101 <h4 data-parsoid='{}'></h4>
26102
26103 <h5 data-parsoid='{}'></h5>
26104
26105 <h6 data-parsoid='{}'></h6>
26106 !! wikitext
26107 =<nowiki/>=
26108
26109 ==<nowiki/>==
26110
26111 ===<nowiki/>===
26112
26113 ====<nowiki/>====
26114
26115 =====<nowiki/>=====
26116
26117 ======<nowiki/>======
26118 !!end
26119
26120 !! test
26121 Headings: 6a. Heading chars in SOL context (with trailing spaces)
26122 !! options
26123 parsoid=html2wt
26124 !! html/parsoid
26125 <p>=a=</p>
26126
26127 <p>=a=</p>
26128
26129 <p>=a=</p>
26130 !! wikitext
26131 <nowiki>=a=</nowiki>
26132
26133 <nowiki>=a=</nowiki>
26134
26135 <nowiki>=a=</nowiki>
26136 !!end
26137
26138 !! test
26139 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26140 !! options
26141 parsoid=html2wt
26142 !! html/parsoid
26143 <p>=a=
26144 b</p>
26145
26146 <p>=a=
26147 b</p>
26148
26149 <p>=a=
26150 b</p>
26151 !! wikitext
26152 <nowiki>=a=</nowiki>
26153 b
26154
26155 <nowiki>=a=</nowiki>
26156 b
26157
26158 <nowiki>=a=</nowiki>
26159 b
26160 !!end
26161
26162 !! test
26163 Headings: 6c. Heading chars in SOL context (leading newline break)
26164 !! options
26165 parsoid=html2wt
26166 !! html/parsoid
26167 <p>a
26168 =b=</p>
26169 !! wikitext
26170 a
26171 <nowiki>=b=</nowiki>
26172 !!end
26173
26174 !! test
26175 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26176 !! options
26177 parsoid=html2wt
26178 !! html/parsoid
26179 <!--c0--><p>=a=</p>
26180
26181 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26182 !! wikitext
26183 <!--c0--><nowiki>=a=</nowiki>
26184
26185 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26186 !!end
26187
26188 !! test
26189 Headings: 6d. Heading chars in SOL context (No escaping needed)
26190 !! options
26191 parsoid=html2wt
26192 !! html/parsoid
26193 =a=<div>b</div>
26194 !! wikitext
26195 =a=<div>b</div>
26196 !!end
26197
26198 !! test
26199 Headings: 7. Insert a newline between new content and headings
26200 !! options
26201 parsoid=html2wt
26202 !! html/parsoid
26203 <h2>NEW</h2>
26204 <p>new</p>
26205 <h2 data-parsoid='{}'>A</h2>
26206 <p data-parsoid='{}'>a</p>
26207 !! wikitext
26208 == NEW ==
26209 new
26210
26211 ==A==
26212 a
26213
26214 !! end
26215
26216 !! test
26217 Headings: Used as horizontal rule
26218 !! config
26219 wgFragmentMode=[ 'html5', 'legacy' ]
26220 !! options
26221 parsoid=wt2html
26222 !! wikitext
26223 ===============
26224 !! html/php
26225 <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>
26226
26227 !! html/parsoid
26228 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26229 !! end
26230
26231 #### --------------- Lists ---------------
26232 #### 0. Outside nests (*foo, etc.)
26233 #### 1. Nested inside html <ul><li>*foo</li></ul>
26234 #### 2. Inside definition lists
26235 #### 3. Only bullets at start should be escaped
26236 #### 4. No escapes needed
26237 #### 5. No unnecessary escapes
26238 #### 6. Escape bullets in SOL position
26239 #### 7. Escape bullets in a multi-line context
26240 #### ----------------------------------------
26241
26242 !! test
26243 Lists: 0. Outside nests
26244 !! options
26245 parsoid=html2wt
26246 !! html/parsoid
26247 <p>*foo</p>
26248
26249 <p>#foo</p>
26250
26251 <p>;Foo:bar</p>
26252 !! wikitext
26253 <nowiki>*</nowiki>foo
26254
26255 <nowiki>#</nowiki>foo
26256
26257 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26258 !!end
26259
26260 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26261 ## to test wikitext escaping, and insignificant whitespace diffs
26262 ## cause PHP parser tests to barf
26263 !! test
26264 Lists: 1. Nested inside html (No unnecessary escapes)
26265 !! options
26266 parsoid=html2wt
26267 !! html/parsoid
26268 <ul>
26269 <li>*foo</li>
26270 <li>#foo</li>
26271 <li>:foo</li>
26272 <li>;foo</li>
26273 <li data-parsoid='{}'>*foo</li>
26274 <li data-parsoid='{}'>#foo</li>
26275 <li data-parsoid='{}'>:foo</li>
26276 <li data-parsoid='{}'>;foo</li>
26277 </ul>
26278
26279 <ol>
26280 <li>*foo</li>
26281 <li>#foo</li>
26282 <li>:foo</li>
26283 <li>;foo</li>
26284 <li data-parsoid='{}'>*foo</li>
26285 <li data-parsoid='{}'>#foo</li>
26286 <li data-parsoid='{}'>:foo</li>
26287 <li data-parsoid='{}'>;foo</li>
26288 </ol>
26289 !! wikitext
26290 * *foo
26291 * #foo
26292 * :foo
26293 * ;foo
26294 *<nowiki>*foo</nowiki>
26295 *<nowiki>#foo</nowiki>
26296 *<nowiki>:foo</nowiki>
26297 *<nowiki>;foo</nowiki>
26298
26299 # *foo
26300 # #foo
26301 # :foo
26302 # ;foo
26303 #<nowiki>*foo</nowiki>
26304 #<nowiki>#foo</nowiki>
26305 #<nowiki>:foo</nowiki>
26306 #<nowiki>;foo</nowiki>
26307 !!end
26308
26309 !! test
26310 Lists: 2. Inside definition lists
26311 !! options
26312 parsoid=html2wt
26313 !! html/parsoid
26314 <dl><dt>;foo</dt></dl>
26315 <dl><dt>:foo</dt></dl>
26316 <dl><dt>:foo</dt>
26317 <dd>bar</dd></dl>
26318 <dl><dd>:foo</dd></dl>
26319 !! wikitext
26320 ; ;foo
26321
26322 ; <nowiki>:foo</nowiki>
26323
26324 ; <nowiki>:foo</nowiki>
26325 : bar
26326
26327 : :foo
26328 !!end
26329
26330 !! test
26331 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26332 !! options
26333 parsoid=html2wt
26334 !! html/parsoid
26335 <ul>
26336 <li>*foo*bar</li>
26337 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26338 </ul>
26339 !! wikitext
26340 * *foo*bar
26341 *<nowiki>*foo</nowiki>''it''*bar
26342 !!end
26343
26344 !! test
26345 Lists: 4. No escapes needed
26346 !! options
26347 parsoid=html2wt
26348 !! html/parsoid
26349 <ul>
26350 <li>foo*bar
26351 </li>
26352 </ul>
26353 <ul>
26354 <li><i>foo</i>*bar
26355 </li>
26356 </ul>
26357 <ul>
26358 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26359 </li>
26360 </ul>
26361 <ul>
26362 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26363 </li>
26364 </ul>
26365 !! wikitext
26366 *foo*bar
26367
26368 *''foo''*bar
26369
26370 *[[Foo]]: bar
26371
26372 *[[Foo]]*bar
26373 !!end
26374
26375 !! test
26376 Lists: 5. No unnecessary escapes
26377 !! options
26378 parsoid=html2wt
26379 !! html/parsoid
26380 <ul><li> bar <span>[[foo]]</span></li></ul>
26381 <ul><li> =bar <span>[[foo]]</span></li></ul>
26382 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26383 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26384 <ul><li> =bar <span>foo]]</span>=</li></ul>
26385 <ul><li> <s></s>: a</li></ul>
26386 <ul><li> <i>* foo</i></li></ul>
26387
26388 !! wikitext
26389 * bar <span><nowiki>[[foo]]</nowiki></span>
26390
26391 * =bar <span><nowiki>[[foo]]</nowiki></span>
26392
26393 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26394
26395 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26396
26397 * =bar <span>foo]]</span>=
26398
26399 * <s></s>: a
26400
26401 * ''* foo''
26402 !!end
26403
26404 !! test
26405 Lists: 6. Escape bullets in SOL position
26406 !! options
26407 parsoid=html2wt
26408 !! html/parsoid
26409 <p><!--cmt-->*foo</p>
26410 !! wikitext
26411 <!--cmt--><nowiki>*</nowiki>foo
26412 !!end
26413
26414 !! test
26415 Lists: 7. Escape bullets in a multi-line context
26416 !! options
26417 parsoid=html2wt
26418 !! html/parsoid
26419 <p>a
26420 *b
26421 </p>
26422 !! wikitext
26423 a
26424 <nowiki>*</nowiki>b
26425 !!end
26426
26427 !! test
26428 Lists: 8. Escape colons only if not present in tags
26429 !! options
26430 parsoid=html2wt
26431 !! html/parsoid
26432 <dl><dt>a:b<i>c:d</i></dt></dl>
26433 !! wikitext
26434 ; <nowiki>a:b</nowiki>''c:d''
26435 !! end
26436
26437 #### --------------- HRs ---------------
26438 #### 1. Single line
26439 #### -----------------------------------
26440
26441 !! test
26442 HRs: 1. Single line
26443 !! options
26444 parsoid=html2wt
26445 !! html/parsoid
26446 <hr />----
26447 <hr />=foo=
26448 <hr />*foo
26449 !! wikitext
26450 ----<nowiki>----</nowiki>
26451 ----=foo=
26452 ----*foo
26453 !! end
26454
26455 #### --------------- Tables ---------------
26456 #### 1a. Simple example
26457 #### 1b. No escaping needed (!foo)
26458 #### 1c. No escaping needed (|foo)
26459 #### 1d. No escaping needed (|}foo)
26460 ####
26461 #### 2a. Nested in td (<td>foo|bar</td>)
26462 #### 2b. Nested in td (<td>foo||bar</td>)
26463 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26464 ####
26465 #### 3a. Nested in th (<th>foo!bar</th>)
26466 #### 3b. Nested in th (<th>foo!!bar</th>)
26467 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26468 ####
26469 #### 4a. Escape -
26470 #### 4b. Escape +
26471 #### 4c. No escaping needed
26472 #### --------------------------------------
26473
26474 !! test
26475 Tables: 1a. Simple example
26476 !! options
26477 parsoid=html2wt
26478 !! html/parsoid
26479 <p>{|
26480 |}
26481 </p>
26482 !! wikitext
26483 <nowiki>{|</nowiki>
26484 |}
26485 !! end
26486
26487 !! test
26488 Tables: 1b. No escaping needed
26489 !! options
26490 parsoid=html2wt
26491 !! html/parsoid
26492 <p>!foo
26493 </p>
26494 !! wikitext
26495 !foo
26496 !! end
26497
26498 !! test
26499 Tables: 1c. No escaping needed
26500 !! options
26501 parsoid=html2wt
26502 !! html/parsoid
26503 <p>|foo
26504 </p>
26505 !! wikitext
26506 |foo
26507 !! end
26508
26509 !! test
26510 Tables: 1d. No escaping needed
26511 !! options
26512 parsoid=html2wt
26513 !! html/parsoid
26514 <p>|}foo
26515 </p>
26516 !! wikitext
26517 |}foo
26518 !! end
26519
26520 !! test
26521 Tables: 2a. Nested in td
26522 !! options
26523 parsoid=html2wt
26524 !! html/parsoid
26525 <table><tbody><tr>
26526 <td>foo|bar</td></tr>
26527 <tr><td>x<div>a|b</div></td>
26528 </tbody></table>
26529 !! wikitext
26530 {|
26531 |<nowiki>foo|bar</nowiki>
26532 |-
26533 |x<div><nowiki>a|b</nowiki></div>
26534 |}
26535 !! html/php+tidy
26536 <table>
26537 <tbody><tr>
26538 <td>foo|bar
26539 </td></tr>
26540 <tr>
26541 <td>x<div>a|b</div>
26542 </td></tr></tbody></table>
26543 !! end
26544
26545 !! test
26546 Tables: 2b. Nested in td
26547 !! options
26548 parsoid=html2wt
26549 !! html/parsoid
26550 <table><tbody><tr>
26551 <td>foo||bar</td>
26552 <td>a<i>b||c</i></td>
26553 <td>a<i><div>b||c</div></i></td>
26554 </tr></tbody></table>
26555 !! wikitext
26556 {|
26557 |<nowiki>foo||bar</nowiki>
26558 |a''<nowiki>b||c</nowiki>''
26559 |a''<div><nowiki>b||c</nowiki></div>''
26560 |}
26561 !! html/php
26562 <table>
26563 <tr>
26564 <td>foo||bar
26565 </td>
26566 <td>a<i>b||c</i>
26567 </td>
26568 <td>a<i><div>b||c</div></i>
26569 </td></tr></table>
26570
26571 !! end
26572
26573 !! test
26574 Tables: 2c. Nested in td -- no escaping needed
26575 !! options
26576 parsoid=html2wt
26577 !! html/*
26578 <table>
26579 <tr>
26580 <td>foo!!bar
26581 </td></tr></table>
26582
26583 !! wikitext
26584 {|
26585 |foo!!bar
26586 |}
26587 !! end
26588
26589 !! test
26590 Tables: 3a. Nested in th
26591 !! options
26592 parsoid=html2wt
26593 !! html/*
26594 <table>
26595 <tr>
26596 <th>foo!bar
26597 </th></tr></table>
26598
26599 !! wikitext
26600 {|
26601 !foo!bar
26602 |}
26603 !! end
26604
26605 !! test
26606 Tables: 3b. Nested in th
26607 !! options
26608 parsoid=html2wt
26609 !! html/parsoid
26610 <table><tbody>
26611 <tr><th>foo!!bar</th>
26612 <th><i>foo|bar</i></th>
26613 <th><i>foo!!bar</i></th>
26614 <th><i><span>foo!!bar</span></i></th>
26615 </tr></tbody></table>
26616 !! wikitext
26617 {|
26618 !<nowiki>foo!!bar</nowiki>
26619 !''<nowiki>foo|bar</nowiki>''
26620 !''<nowiki>foo!!bar</nowiki>''
26621 !''<span><nowiki>foo!!bar</nowiki></span>''
26622 |}
26623 !! html/php
26624 <table>
26625 <tr>
26626 <th>foo!!bar
26627 </th>
26628 <th><i>foo|bar</i>
26629 </th>
26630 <th><i>foo!!bar</i>
26631 </th>
26632 <th><i><span>foo!!bar</span></i>
26633 </th></tr></table>
26634
26635 !! end
26636
26637 !! test
26638 Tables: 3c. Nested in th
26639 !! options
26640 parsoid=html2wt
26641 !! html/parsoid
26642 <table><tbody>
26643 <tr><th>foo||bar</th>
26644 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26645 </tr></tbody></table>
26646 !! wikitext
26647 {|
26648 !<nowiki>foo||bar</nowiki>
26649 !<nowiki>foo||bar</nowiki>
26650 |}
26651 !! html/php
26652 <table>
26653 <tr>
26654 <th>foo||bar
26655 </th>
26656 <th>foo||bar
26657 </th></tr></table>
26658
26659 !! end
26660
26661 !! test
26662 Tables: 4a. Escape -
26663 !! options
26664 parsoid=html2wt
26665 !! html/*
26666 <table>
26667 <tr>
26668 <th>-bar
26669 </th></tr>
26670 <tr>
26671 <td>-bar
26672 </td></tr></table>
26673
26674 !! wikitext
26675 {|
26676 !-bar
26677 |-
26678 |<nowiki>-bar</nowiki>
26679 |}
26680 !! end
26681
26682 !! test
26683 Tables: 4b. Escape +
26684 !! options
26685 parsoid=html2wt
26686 !! html/*
26687 <table>
26688 <tr>
26689 <th>+bar
26690 </th></tr>
26691 <tr>
26692 <td>+bar
26693 </td></tr></table>
26694
26695 !! wikitext
26696 {|
26697 !+bar
26698 |-
26699 |<nowiki>+bar</nowiki>
26700 |}
26701 !! end
26702
26703 !! test
26704 Tables: 4c. No escaping needed
26705 !! options
26706 parsoid=html2wt
26707 !! html/parsoid
26708 <table><tbody>
26709 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26710 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26711 <tr><td>foo
26712 <p>bar|baz
26713 +bar
26714 -bar</p></td></tr>
26715 <tr><td>x
26716 <div>a|b</div></td>
26717 </tbody></table>
26718 !! wikitext
26719 {|
26720 |foo-bar
26721 |foo+bar
26722 |-
26723 |''foo''-bar
26724 |''foo''+bar
26725 |-
26726 |foo
26727 bar|baz
26728 +bar
26729 -bar
26730 |-
26731 |x
26732 <div>a|b</div>
26733 |}
26734 !! html/php
26735 <table>
26736 <tr>
26737 <td>foo-bar
26738 </td>
26739 <td>foo+bar
26740 </td></tr>
26741 <tr>
26742 <td><i>foo</i>-bar
26743 </td>
26744 <td><i>foo</i>+bar
26745 </td></tr>
26746 <tr>
26747 <td>foo
26748 <p>bar|baz
26749 +bar
26750 -bar
26751 </p>
26752 </td></tr>
26753 <tr>
26754 <td>x
26755 <div>a|b</div>
26756 </td></tr></table>
26757
26758 !! end
26759
26760 !! test
26761 Tables: 4d. No escaping needed
26762 !! options
26763 parsoid=html2wt
26764 !! html/parsoid
26765 <table>
26766 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26767 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26768 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26769 </tbody></table>
26770 !! wikitext
26771 {|
26772 |[[Foo]]-bar
26773 ||+1
26774 ||-2
26775 |}
26776 !! html/php
26777 <table>
26778 <tr>
26779 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26780 </td>
26781 <td>+1
26782 </td>
26783 <td>-2
26784 </td></tr></table>
26785
26786 !! end
26787
26788 !! test
26789 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26790 !! options
26791 parsoid=html2wt
26792 !! html/parsoid
26793 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26794
26795 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26796
26797 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26798
26799 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26800 !! wikitext
26801 {|
26802 | || align="center" | ||
26803 |}
26804
26805 {|
26806 |
26807 | align="center" |
26808 |
26809 |}
26810
26811 {|
26812 | {{!}}{{!}} align="center" | ||
26813 |}
26814
26815 {|
26816 ! !! align="center" | !!
26817 |}
26818 !! html/php+tidy
26819 <table>
26820 <tbody><tr>
26821 <td></td>
26822 <td align="center"></td>
26823 <td>
26824 </td></tr></tbody></table>
26825 <table>
26826 <tbody><tr>
26827 <td>
26828 </td>
26829 <td align="center">
26830 </td>
26831 <td>
26832 </td></tr></tbody></table>
26833 <table>
26834 <tbody><tr>
26835 <td></td>
26836 <td align="center"></td>
26837 <td>
26838 </td></tr></tbody></table>
26839 <table>
26840 <tbody><tr>
26841 <th></th>
26842 <th align="center"></th>
26843 <th>
26844 </th></tr></tbody></table>
26845 !! end
26846
26847 !! test
26848 T97430: Don't emit empty nowiki pairs around marker meta tags
26849 !! options
26850 parsoid=html2wt
26851 !! html/parsoid
26852 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26853 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26854 !! wikitext
26855 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26856 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26857 !! end
26858
26859 !! test
26860 Unclosed xmlish element in table line shouldn't eat end delimiters
26861 !! options
26862 parsoid=html2wt
26863 !! html/parsoid
26864 <table>
26865 <tbody><tr><td> &lt;foo</td>
26866 <td> bar></td></tr>
26867 </tbody></table>
26868 !! wikitext
26869 {|
26870 | <foo
26871 | bar>
26872 |}
26873 !! html/php
26874 <table>
26875 <tr>
26876 <td>&lt;foo
26877 </td>
26878 <td>bar&gt;
26879 </td></tr></table>
26880
26881 !! end
26882
26883 #### --------------- Links ----------------
26884 #### 1. Quote marks in link text
26885 #### 2. Wikilinks: Escapes needed
26886 #### 3. Wikilinks: No escapes needed
26887 #### 4. Extlinks: Escapes needed
26888 #### 5. Extlinks: No escapes needed
26889 #### --------------------------------------
26890 !! test
26891 Links 1. WikiLinks: No escapes needed
26892 !! options
26893 parsoid=html2wt
26894 !! html/parsoid
26895 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26896 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26897 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26898 !! wikitext
26899 [[Foo|Foo''boo'']]
26900 [[Foo|[Foobar]]]
26901 [[Foo|x [Foobar] x]]
26902 !! html/php
26903 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26904 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26905 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26906 </p>
26907 !! end
26908
26909 !! test
26910 Links 2. WikiLinks: Escapes needed
26911 !! options
26912 parsoid=html2wt
26913 !! html/parsoid
26914 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26915 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26916 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26917 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26918 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26919 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26920 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26921 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26922 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26923 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26924 !! wikitext
26925 [[Foo|<nowiki>Foobar]</nowiki>]]
26926 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26927 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26928 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26929 [[Foo|<nowiki>|Bar</nowiki>]]
26930 [[Foo|<nowiki>]]bar</nowiki>]]
26931 [[Foo|<nowiki>[[bar</nowiki>]]
26932 [[Foo|<nowiki>x [[ y</nowiki>]]
26933 [[Foo|<nowiki>x ]] y</nowiki>]]
26934 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26935 !! html/php
26936 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26937 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26938 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26939 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26940 <a href="/wiki/Foo" title="Foo">|Bar</a>
26941 <a href="/wiki/Foo" title="Foo">]]bar</a>
26942 <a href="/wiki/Foo" title="Foo">[[bar</a>
26943 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26944 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26945 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26946 </p>
26947 !! end
26948
26949 !! test
26950 Links 3. WikiLinks: No escapes needed
26951 !! options
26952 parsoid=html2wt
26953 !! html/parsoid
26954 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26955 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26956 !! wikitext
26957 [[Foo|[Foobar]]
26958 [[Foo|foo|bar]]
26959 !! html/php
26960 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26961 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26962 </p>
26963 !! end
26964
26965 !! test
26966 Links 4. ExtLinks: Escapes needed
26967 !! options
26968 parsoid=html2wt
26969 !! html/parsoid
26970 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26971 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26972 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26973 <p>[http://google.com]</p>
26974 <p>[http://google.com google]</p>
26975 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26976 <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>
26977 !! wikitext
26978 [http://google.com <nowiki>[google]</nowiki>]
26979 [http://google.com <nowiki>google]</nowiki>]
26980 [http://google.com <nowiki>goog] le</nowiki>]
26981
26982 <nowiki>[http://google.com]</nowiki>
26983
26984 <nowiki>[http://google.com google]</nowiki>
26985
26986 [http://google.com<nowiki>]</nowiki>
26987
26988 [{{echo|http://google.com}}<nowiki>]</nowiki>
26989 !! html/php
26990 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26991 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26992 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26993 </p><p>[http://google.com]
26994 </p><p>[http://google.com google]
26995 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26996 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26997 </p>
26998 !! end
26999
27000 !! test
27001 Links 5. ExtLinks: No escapes needed
27002 !! options
27003 parsoid=html2wt
27004 !! html/parsoid
27005 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
27006 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
27007 !! wikitext
27008 [http://google.com [google]
27009
27010 [[http://google.com]]
27011 !! html/php
27012 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
27013 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
27014 </p>
27015 !! end
27016
27017 !! test
27018 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
27019 !! options
27020 parsoid=html2wt
27021 !! html/parsoid
27022 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
27023 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
27024 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
27025 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
27026 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
27027 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
27028 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27029 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
27030 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27031 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
27032 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
27033 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
27034 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
27035 </p>
27036 !! wikitext
27037 x<nowiki/>http://example.com<nowiki/>y
27038 http://example.com<nowiki/>?x
27039 http://example.com<nowiki/>&x
27040 http://example.com<nowiki/>'x
27041 http://example.com<nowiki/>,x
27042 http://example.com<nowiki/>.x
27043 http://example.com<nowiki/>;x
27044 http://example.com<nowiki/>:x
27045 http://example.com<nowiki/>;x
27046 http://example.com<nowiki/>!x
27047 http://example.com<nowiki/>=x
27048 http://example.com<nowiki/>(x)
27049 http://example.com(x<nowiki/>)
27050 !! end
27051
27052 !! test
27053 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27054 !! options
27055 parsoid=html2wt
27056 !! html/parsoid
27057 <p>x
27058 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
27059 y
27060 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
27061 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
27062 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
27063 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
27064 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
27065 </p>
27066 !! wikitext
27067 x
27068 http://example.com
27069 y
27070 "http://example.com"
27071 (http://example.com)
27072 (http://example.com) foo
27073 http://example.com,
27074 http://example.com, foo
27075 !! html/php
27076 <p>x
27077 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
27078 y
27079 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
27080 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
27081 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
27082 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
27083 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
27084 </p>
27085 !! end
27086
27087 !! test
27088 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27089 !! options
27090 parsoid=html2wt
27091 !! html/parsoid
27092 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
27093 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
27094 !! wikitext
27095 http://example.com.,;:!?\
27096 -http://example.com:
27097 !! html/php
27098 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
27099 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
27100 </p>
27101 !! end
27102
27103 !! test
27104 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
27105 !! options
27106 parsoid=html2wt
27107 !! html/parsoid
27108 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
27109 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
27110 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
27111 !! wikitext
27112 RFC 123<nowiki/>4
27113 RFC 123<nowiki/>y
27114 X<nowiki/>RFC 123<nowiki/>y
27115 !! end
27116
27117 !! test
27118 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
27119 !! options
27120 parsoid=html2wt
27121 !! html/parsoid
27122 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
27123 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
27124 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
27125 </p>
27126 !! wikitext
27127 RFC 123?foo
27128 RFC 123&foo
27129 -RFC 123-
27130 !! html/php
27131 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
27132 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
27133 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
27134 </p>
27135 !! end
27136
27137 !! test
27138 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27139 !! options
27140 parsoid=html2wt
27141 !! html/parsoid
27142 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27143 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27144 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27145 !! wikitext
27146 PMID 123<nowiki/>4
27147 PMID 123<nowiki/>y
27148 X<nowiki/>PMID 123<nowiki/>y
27149 !! end
27150
27151 !! test
27152 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27153 !! options
27154 parsoid=html2wt
27155 !! html/parsoid
27156 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27157 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27158 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27159 </p>
27160 !! wikitext
27161 PMID 123?foo
27162 PMID 123&foo
27163 -PMID 123-
27164 !! html/php
27165 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27166 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27167 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27168 </p>
27169 !! end
27170
27171 !! test
27172 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27173 !! options
27174 parsoid=html2wt
27175 !! html/parsoid
27176 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27177 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27178 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27179 </p>
27180 !! wikitext
27181 ISBN 1234567890<nowiki/>1
27182 ISBN 1234567890<nowiki/>x
27183 a<nowiki/>ISBN 1234567890<nowiki/>b
27184 !! end
27185
27186 !! test
27187 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27188 !! options
27189 parsoid=html2wt
27190 !! html/parsoid
27191 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27192 !! wikitext
27193 -ISBN 1234567890's
27194 !! html/php
27195 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27196 </p>
27197 !! end
27198
27199 !! test
27200 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27201 !! options
27202 parsoid=html2wt
27203 !! html/*
27204 <p>this is not a link: http://example.com
27205 </p>
27206 !! wikitext
27207 this is not a link: <nowiki>http://example.com</nowiki>
27208 !! end
27209
27210 !! test
27211 Links 15. Link trails can't become link prefixes.
27212 !! options
27213 language=is
27214 parsoid=html2wt
27215 !! html/parsoid
27216 <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>
27217 !! wikitext
27218 [[Söfnuður]]-[[00]]
27219 !! html/php
27220 <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>
27221 </p>
27222 !! end
27223
27224 #### --------------- Quotes ---------------
27225 #### 1. Quotes inside <b> and <i>
27226 #### 2. Link fragments separated by <i> and <b> tags
27227 #### 3. Link fragments inside <i> and <b>
27228 #### 4. No escaping needed
27229 #### --------------------------------------
27230 !! test
27231 1a. Quotes inside <b> and <i>
27232 !! options
27233 parsoid=html2wt
27234 !! html/*
27235 <p><i>'foo'</i>
27236 <i>''foo''</i>
27237 <i>'''foo'''</i>
27238 <i>foo</i>'s
27239 <b>'foo'</b>
27240 <b>''foo''</b>
27241 <b>'''foo'''</b>
27242 <b>foo'<i>bar'</i>baz</b>
27243 <b>foo</b>'s
27244 '<i>foo</i>
27245 <i>foo</i>'
27246 <i>foo'</i>'
27247 '<i>foo</i>'
27248 '<b>foo</b>
27249 <b>foo</b>'
27250 '<b>foo</b>'
27251 <i>fools'<span> errand</span></i>
27252 <i><span>fool</span>'s errand</i>
27253 '<i>foo</i> bar '<i>baz</i>
27254 a|!*#-:;+-~[]{}b'<i>x</i>
27255 </p>
27256 !! wikitext
27257 ''<nowiki/>'foo'''
27258 ''<nowiki>''foo''</nowiki>''
27259 ''<nowiki>'''foo'''</nowiki>''
27260 ''foo''<nowiki/>'s
27261 '''<nowiki/>'foo''''
27262 '''<nowiki>''foo''</nowiki>'''
27263 '''<nowiki>'''foo'''</nowiki>'''
27264 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27265 '''foo'''<nowiki/>'s
27266 '''foo''
27267 ''foo''<nowiki/>'
27268 ''foo'''<nowiki/>'
27269 '''foo''<nowiki/>'
27270 ''''foo'''
27271 '''foo'''<nowiki/>'
27272 ''''foo'''<nowiki/>'
27273 ''fools'<span> errand</span>''
27274 ''<span>fool</span>'s errand''
27275 '<nowiki/>''foo'' bar '''baz''
27276 a|!*#-:;+-~[]{}b'''x''
27277 !! end
27278
27279 !! test
27280 1b. Quotes inside <b> and <i> with other tags on same line
27281 !! options
27282 parsoid=html2wt
27283 !! html/parsoid
27284 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27285 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27286 <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>
27287 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27288 '<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>
27289 '<i>foo</i> <div title="name">test</div>
27290 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27291 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27292 <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>
27293 </ol>
27294 !! wikitext
27295 '''a'' foo ''[[bar]]''
27296 ''a''' foo ''[[bar]]''
27297 ''a''' foo '''{{echo|[[bar]]}}'''
27298 [[foo]] x'''[[bar]]''
27299 '''foo'' <ref>test</ref>
27300 '''foo'' <div title="name">test</div>
27301 '''foo'' and <br> bar
27302 <references />
27303 !! end
27304
27305 !! test
27306 2. Link fragments separated by <i> and <b> tags
27307 !! options
27308 parsoid=html2wt
27309 !! html/parsoid
27310 <p>[[<i>foo</i>hello]]</p>
27311 <p>[[<b>foo</b>hello]]</p>
27312 !! wikitext
27313 [[''foo''<nowiki>hello]]</nowiki>
27314
27315 [['''foo'''<nowiki>hello]]</nowiki>
27316 !! end
27317
27318 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27319 # this is one of the shortcomings of this format
27320 !! test
27321 3. Link fragments inside <i> and <b>
27322 !! options
27323 parsoid=html2wt
27324 !! html/parsoid
27325 <p><i>[[foo</i>]]</p>
27326 <p><b>[[foo</b>]]</p>
27327 !! wikitext
27328 ''[[foo''<nowiki>]]</nowiki>
27329
27330 '''[[foo'''<nowiki>]]</nowiki>
27331 !! end
27332
27333 !! test
27334 4. No escaping needed
27335 !! options
27336 parsoid=html2wt
27337 !! html/parsoid
27338 <p>'<span><i>bar</i></span>'
27339 '<span><b>bar</b></span>'
27340 'a:b'foo
27341 </p>
27342 !! wikitext
27343 '<span>''bar''</span>'
27344 '<span>'''bar'''</span>'
27345 'a:b'foo
27346 !! end
27347
27348 #### ----------- Paragraphs ---------------
27349 #### 1. No unnecessary escapes
27350 #### --------------------------------------
27351
27352 !! test
27353 1. No unnecessary escapes
27354 !! options
27355 parsoid=html2wt
27356 !! html/parsoid
27357 <p>bar <span>[[foo]]</span>
27358 </p><p>=bar <span>[[foo]]</span>
27359 </p><p>[[bar <span>[[foo]]</span>
27360 </p><p>]]bar <span>[[foo]]</span>
27361 </p><p>=bar <span>foo]]</span>=
27362 </p>
27363 !! wikitext
27364 bar <span><nowiki>[[foo]]</nowiki></span>
27365
27366 =bar <span><nowiki>[[foo]]</nowiki></span>
27367
27368 [[bar <span><nowiki>[[foo]]</nowiki></span>
27369
27370 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27371
27372 =bar <span>foo]]</span><nowiki>=</nowiki>
27373 !!end
27374
27375 #### ----------------------- PRE --------------------------
27376 !! test
27377 1. Leading whitespace in SOL context should be escaped
27378 !! options
27379 parsoid=html2wt
27380 !! html/parsoid
27381 <p> a</p>
27382
27383 <p> a</p>
27384
27385 <p> a(tab)</p>
27386
27387 <p> a
27388 <!--cmt-->
27389 a</p>
27390
27391 <p>a
27392 b</p>
27393
27394 <p>a
27395 b</p>
27396
27397 <p>a
27398 b</p>
27399 !! wikitext
27400 <nowiki> </nowiki>a
27401
27402 <nowiki> </nowiki> a
27403
27404 a(tab)
27405
27406 <nowiki> </nowiki> a
27407 <!--cmt-->
27408 <nowiki> </nowiki>a
27409
27410 a
27411 <nowiki> </nowiki>b
27412
27413 a
27414 b
27415
27416 a
27417 b
27418 !! html/php
27419 <p> a
27420 </p><p> a
27421 </p><p> a(tab)
27422 </p><p> a
27423 a
27424 </p><p>a
27425 b
27426 </p><p>a
27427 b
27428 </p><p>a
27429 b
27430 </p>
27431 !! end
27432
27433 !! test
27434 2. Leading whitespace in non-indent-pre contexts should not be escaped
27435 !! options
27436 parsoid=html2wt
27437 !! html/parsoid
27438 <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>
27439 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27440 <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>
27441 b</span></li>
27442 </ol>
27443 !! wikitext
27444 foo <ref>''a''
27445 b</ref>
27446 <references />
27447 !! end
27448
27449 !! test
27450 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27451 !! options
27452 parsoid=html2wt
27453 !! html/parsoid
27454 <blockquote>
27455 <p>
27456 a
27457 <span>b</span>
27458 c</p>
27459 </blockquote>
27460 !! wikitext
27461 <blockquote>
27462 a
27463 <span>b</span>
27464 c
27465 </blockquote>
27466 !! end
27467
27468 !! test
27469 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27470 !! options
27471 parsoid=html2wt
27472 !! html/parsoid
27473 <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>
27474 !! wikitext
27475 [[File:Foobar.jpg|thumb|caption]]
27476 !! end
27477
27478 !! test
27479 5. Nowiki escaping should account for indent-pres
27480 !! options
27481 parsoid=html2wt
27482 !! html/parsoid
27483 <pre>==foo==</pre>
27484 !! wikitext
27485 ==foo==
27486 !! end
27487
27488 !! test
27489 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27490 !! options
27491 parsoid=html2wt
27492 !! html/parsoid
27493 <pre>
27494 * foo
27495 * bar
27496 </pre>
27497 !! wikitext
27498 * foo
27499 * bar
27500 !! end
27501
27502 !! test
27503 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27504 !! options
27505 parsoid = {
27506 "modes": ["html2wt"],
27507 "scrubWikitext": true
27508 }
27509 !! html/parsoid
27510 <p> foo</p>
27511 <p> %foo</p>
27512 <p> *foo</p>
27513 <p> #foo</p>
27514 <p> =foo=</p>
27515 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27516 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27517 <p> <!--boo-->*foo</p>
27518 <p><!--boo--> *foo</p>
27519 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27520 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27521 !! wikitext
27522 foo
27523
27524 %foo
27525
27526 <nowiki/>*foo
27527
27528 <nowiki/>#foo
27529
27530 <nowiki/>=foo=
27531
27532 [[Category:Foo]]
27533 <nowiki/>*foo
27534
27535 [[Category:Foo]]
27536 <nowiki>*</nowiki>foo
27537
27538 <nowiki/><!--boo-->*foo
27539
27540 <!--boo--><nowiki/>*foo
27541
27542 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27543
27544 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27545 !! end
27546
27547 #### --------------- Behavior Switches --------------------
27548
27549 !! test
27550 1. Valid behavior switches should be escaped
27551 !! options
27552 parsoid=html2wt
27553 !! html/parsoid
27554 __TOC__
27555 <i>__TOC__</i>
27556 !! wikitext
27557 <nowiki>__TOC__</nowiki>
27558 ''<nowiki>__TOC__</nowiki>''
27559 !! end
27560
27561 !! test
27562 2. Invalid behavior switches should not be escaped
27563 !! options
27564 parsoid=html2wt
27565 !! html/parsoid
27566 __TOO__
27567 __|__
27568 !! wikitext
27569 __TOO__
27570 __|__
27571 !! end
27572
27573 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27574 !! test
27575 Behavior switches should be SOL-transparent
27576 !! options
27577 parsoid=html2wt
27578 !! html/parsoid
27579 <meta property="mw:PageProp/toc" />
27580
27581 <!-- this one's bogus -->
27582 <pre>__TOO__</pre>
27583
27584 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27585
27586 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27587 !! wikitext
27588 __TOC__
27589
27590 <!-- this one's bogus -->
27591 __TOO__
27592
27593 __TOC__ foo
27594
27595 __TOC__
27596 bar
27597 !! end
27598
27599 #### --------------- HTML tags ---------------
27600 #### 1. a tags
27601 #### 2. other tags
27602 #### 3. multi-line html tag
27603 #### 4. extension tags
27604 #### -----------------------------------------
27605 !! test
27606 1. a tags
27607 !! options
27608 parsoid=html2wt
27609 !! html/parsoid
27610 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27611 !! wikitext
27612 <a href="http://google.com">google</a>
27613 !! end
27614
27615 !! test
27616 2. other tags
27617 !! options
27618 parsoid=html2wt
27619 !! html/parsoid
27620 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27621 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27622 <li> &lt;td&gt;</li></ul>
27623
27624 !! wikitext
27625 * <nowiki><div>foo</div></nowiki>
27626 * <nowiki><div style="color:red">foo</div></nowiki>
27627 * <nowiki><td></nowiki>
27628 !! end
27629
27630 !! test
27631 3. multi-line html tag
27632 !! options
27633 parsoid=html2wt
27634 !! html/parsoid
27635 <p>&lt;div
27636 &gt;foo&lt;/div
27637 &gt;
27638 </p>
27639 !! wikitext
27640 <nowiki><div
27641 >foo</div
27642 ></nowiki>
27643 !! end
27644
27645 !! test
27646 4. extension tags
27647 !! options
27648 parsoid=html2wt
27649 !! html/parsoid
27650 <p>&lt;ref&gt;foo&lt;/ref&gt;
27651 </p><p>&lt;ref&gt;bar
27652 </p><p>baz&lt;/ref&gt;
27653 </p>
27654 !! wikitext
27655 <nowiki><ref>foo</ref></nowiki>
27656
27657 <nowiki><ref>bar</nowiki>
27658
27659 baz<nowiki></ref></nowiki>
27660 !! end
27661
27662 !! test
27663 Parsoid: newline inducing block nodes don't suppress <nowiki>
27664 !! options
27665 parsoid=html2wt
27666 !! html/parsoid
27667 a<h1>foo</h1>
27668 !! wikitext
27669 <nowiki> </nowiki>a
27670
27671 = foo =
27672 !! end
27673
27674 #### --------------- Others ---------------
27675 !! test
27676 Escaping nowikis
27677 !! options
27678 parsoid=html2wt
27679 !! html/parsoid
27680 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27681 </p>
27682 !! wikitext
27683 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27684 !! end
27685
27686 ## The quote-char in the input is necessary for triggering the bug
27687 !! test
27688 (T54035) Nowiki-escaping should not get tripped by " :" in text
27689 !! options
27690 parsoid=html2wt
27691 !! html/parsoid
27692 <p>foo's bar :</p>
27693 !! wikitext
27694 foo's bar :
27695 !! end
27696
27697 #----------- End of wikitext escaping tests --------------
27698
27699 !! test
27700
27701 Tag-like HTML structures are passed through as text
27702 !! wikitext
27703 <x y>
27704
27705 <x.y>
27706
27707 <x-y>
27708
27709 1>2
27710
27711 x<y
27712
27713 a>b
27714
27715 1<d e>f
27716 !! html
27717 <p>&lt;x y&gt;
27718 </p><p>&lt;x.y&gt;
27719 </p><p>&lt;x-y&gt;
27720 </p><p>1&gt;2
27721 </p><p>x&lt;y
27722 </p><p>a&gt;b
27723 </p><p>1&lt;d e&gt;f
27724 </p>
27725 !! end
27726
27727 !! test
27728 HTML tag with necessary entities in attributes
27729 !! wikitext
27730 <span title="&amp;amp;">foo</span>
27731 !! html
27732 <p><span title="&amp;amp;">foo</span>
27733 </p>
27734 !! end
27735
27736 !! test
27737 HTML tag with 'unnecessary' entity encoding in attributes
27738 !! wikitext
27739 <span title="&amp;">foo</span>
27740 !! html
27741 <p><span title="&amp;">foo</span>
27742 </p>
27743 !! end
27744
27745 !! test
27746 HTML tag with broken attribute value quoting
27747 !! options
27748 parsoid=wt2html,html2html
27749 !! wikitext
27750 <span title="Hello world>Foo</span>
27751 !! html/php
27752 <p><span title="Hello world">Foo</span>
27753 </p>
27754 !! html/parsoid
27755 <p><span title="Hello world">Foo</span></p>
27756 !! end
27757
27758 !! test
27759 Self-closed tag with broken attribute value quoting
27760 !! options
27761 parsoid=wt2html,html2html
27762 !! wikitext
27763 <div title="Hello world />Foo
27764 !! html/php+tidy
27765 <div title="Hello world"></div><p>Foo
27766 </p>
27767 !! html/parsoid
27768 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27769 !! end
27770
27771 !! test
27772 Table with broken attribute value quoting
27773 !! options
27774 parsoid=wt2html,html2html
27775 !! wikitext
27776 {|
27777 | title="Hello world|Foo
27778 |}
27779 !! html/php
27780 <table>
27781 <tr>
27782 <td title="Hello world">Foo
27783 </td></tr></table>
27784
27785 !! html/parsoid
27786 <table>
27787 <tr>
27788 <td title="Hello world">Foo
27789 </td></tr></table>
27790
27791 !! end
27792
27793 !! test
27794 Table with broken attribute value quoting on consecutive lines
27795 !! options
27796 parsoid=wt2html,html2html
27797 !! wikitext
27798 {|
27799 | title="Hello world|Foo
27800 | style="color:red|Bar
27801 |}
27802 !! html/php
27803 <table>
27804 <tr>
27805 <td title="Hello world">Foo
27806 </td>
27807 <td style="color:red">Bar
27808 </td></tr></table>
27809
27810 !! html/parsoid
27811 <table><tbody>
27812 <tr>
27813 <td title="Hello world">Foo
27814 </td><td style="color: red">Bar
27815 </td></tr></tbody></table>
27816
27817 !! end
27818
27819 !!test
27820 Accept empty td cell attribute
27821 !! wikitext
27822 {|
27823 | align="center" |foo|| |
27824 |}
27825 !! html
27826 <table>
27827 <tr>
27828 <td align="center">foo</td>
27829 <td>
27830 </td></tr></table>
27831
27832 !!end
27833
27834 !!test
27835 Non-empty attributes in th-cells
27836 !! wikitext
27837 {|
27838 !Foo!! style="color: red" |Bar
27839 |}
27840 !! html
27841 <table>
27842 <tr>
27843 <th>Foo</th>
27844 <th style="color: red">Bar
27845 </th></tr></table>
27846
27847 !!end
27848
27849 !!test
27850 Accept empty attributes in th-cells
27851 !! wikitext
27852 {|
27853 !|foo!!|bar
27854 |}
27855 !! html
27856 <table>
27857 <tr>
27858 <th>foo</th>
27859 <th>bar
27860 </th></tr></table>
27861
27862 !!end
27863
27864 !!test
27865 Empty table rows go away
27866 !! wikitext
27867 {|
27868 |Hello
27869 |there
27870 |- class="foo"
27871 |-
27872 |}
27873 !! html
27874 <table>
27875 <tr>
27876 <td>Hello
27877 </td>
27878 <td>there
27879 </td></tr>
27880
27881 </table>
27882
27883 !! end
27884
27885 ###
27886 ### Parsoid-centric tests for testing RTing of inter-element separators
27887 ### Edge cases not tested by existing parser tests and specific to
27888 ### Parsoid-specific serialization strategies.
27889 ###
27890
27891 !!test
27892 RT-ed inter-element separators should be valid separators
27893 !! wikitext
27894 {|
27895 |- [[foo]]
27896 |}
27897 !! html/php
27898 <table>
27899
27900 </table>
27901
27902 !! html/parsoid
27903 <table>
27904 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27905 </tbody></table>
27906 !!end
27907
27908 # Parsoid-only test of a DOM pass
27909 !!test
27910 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27911 !! wikitext
27912 {|
27913 |<small>foo
27914 bar
27915 |}
27916
27917 {|
27918 |<small>foo<small>
27919 |}
27920 !! html/parsoid
27921 <table>
27922 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27923 <p>bar</p></small></td></tr>
27924 </tbody></table>
27925
27926 <table>
27927 <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>
27928 </tbody></table>
27929 !!end
27930
27931 # Note that the "style" attribute is really a template parameter here.
27932 # The = would have to be {{=}} if you wanted the literal.
27933 !!test
27934 Empty TD followed by TD with tpl-generated attribute
27935 !! wikitext
27936 {|
27937 |-
27938 |
27939 |{{echo|style='color:red'}}|foo
27940 |}
27941 !! html
27942 <table>
27943
27944 <tr>
27945 <td>
27946 </td>
27947 <td>foo
27948 </td></tr></table>
27949
27950 !!end
27951
27952 !!test
27953 Indented table with an empty td
27954 !! wikitext
27955 {|
27956 |-
27957 |
27958 |foo
27959 |}
27960 !! html
27961 <table>
27962
27963 <tr>
27964 <td>
27965 </td>
27966 <td>foo
27967 </td></tr></table>
27968
27969 !!end
27970
27971 !! test
27972 Indented table with blank lines in between (T85627)
27973 !! wikitext
27974 {|
27975 |foo
27976
27977
27978 |}
27979 !! html/php
27980 <table>
27981 <tr>
27982 <td>foo
27983 <p><br />
27984 </p>
27985 </td></tr></table>
27986
27987 !! html/parsoid
27988 <table>
27989 <tbody><tr><td>foo
27990 <p>
27991 <br /></p></td></tr>
27992 </tbody></table>
27993 !! end
27994
27995 !!test
27996 Indented block & table
27997 !! wikitext
27998 <div>foo</div>
27999 {|
28000 |foo
28001 |}
28002 !! html/php
28003 <div>foo</div>
28004 <table>
28005 <tr>
28006 <td>foo
28007 </td></tr></table>
28008
28009 !! html/parsoid
28010 <div data-parsoid='{"stx":"html"}'>foo</div>
28011 <table><tbody>
28012 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
28013 </tbody></table>
28014 !!end
28015
28016 !! test
28017 Indent and comment before table row
28018 !! wikitext
28019 {|
28020 <!--hi-->|-
28021 |there
28022 |}
28023 !! html/php
28024 <table>
28025
28026 <tr>
28027 <td>there
28028 </td></tr></table>
28029
28030 !! html/parsoid
28031 <table>
28032 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
28033 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
28034 </tbody></table>
28035 !! end
28036
28037 # PHP parser omits empty TR
28038 !!test
28039 Empty TR followed by a template-generated TR
28040 !! wikitext
28041 {|
28042 |-
28043 {{echo|<tr><td>foo</td></tr>}}
28044 |}
28045 !! html/php+tidy
28046 <table>
28047
28048 <tbody><tr><td>foo</td></tr>
28049 </tbody></table>
28050 !! html/parsoid
28051 <table>
28052 <tbody>
28053 <tr class='mw-empty-elt'></tr>
28054 <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}}]}'>
28055 <td>foo</td></tr>
28056 </tbody></table>
28057 !!end
28058
28059 ## PHP and parsoid output differ for this; as usual PHP omits empty
28060 ## elements, and since it strips the comments the TR is empty.
28061 !!test
28062 Empty TR followed by mixed-ws-comment line should RT correctly
28063 !! wikitext
28064 {|
28065 |-
28066 <!--c-->
28067 |-
28068 <!--c--> <!--d-->
28069 |}
28070 !! html/php+tidy
28071 <table>
28072
28073
28074 </table>
28075 !! html/parsoid
28076 <table>
28077 <tbody>
28078 <tr class='mw-empty-elt'></tr>
28079 <!--c-->
28080 <tr>
28081 <!--c--> </tr><!--d-->
28082 </tbody></table>
28083
28084 !!end
28085
28086 !!test
28087 Multi-line image caption generated by templates with/without trailing newlines
28088 !! wikitext
28089 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
28090 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
28091 !! html/parsoid
28092 <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>
28093 <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>
28094 !!end
28095
28096 !! test
28097 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
28098 !! options
28099 parsoid=html2wt
28100 !! html/parsoid
28101 <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>
28102
28103 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
28104 !! wikitext
28105 <includeonly>foo</includeonly>
28106 new para
28107
28108 [[Category:Foo]]
28109
28110 = new heading =
28111 !! end
28112
28113 ## PHP emits broken html for this, and since this is primarily
28114 ## a Parsoid serializer test, marking this Parsoid only
28115 !!test
28116 Improperly nested inline or quotes tags with whitespace in between
28117 !! wikitext
28118 <span> <s>x</span> </s>
28119 ''' ''x''' ''
28120 !! html/parsoid
28121 <p><span> <s>x</s></span><s> </s>
28122 <b> <i>x</i></b><i> </i>
28123 </p>
28124 !!end
28125
28126 !!test
28127 Encapsulate protected attributes from wt
28128 !! wikitext
28129 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
28130
28131 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
28132 |ok
28133 |}
28134 !! html/parsoid
28135 <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>
28136
28137 <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">
28138 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
28139 </tbody></table>
28140 !!end
28141
28142 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28143 ## Having nested or stray pre tags results in the attempt to add duplicates,
28144 ## causing an assertion fail. This test tries to prevent that situation.
28145 !! test
28146 Ensure ParagraphWrapper can deal with stray closing pre tags
28147 !! options
28148 parsoid=wt2html
28149 !! wikitext
28150 plain text</pre>
28151 !! html/parsoid
28152 <p>plain text</p>
28153 !! end
28154
28155 ## Remex doesn't account for fostered content.
28156 !! test
28157 1. Ensure fostered text content is wrapped in element nodes
28158 !! options
28159 parsoid=wt2html
28160 !! wikitext
28161 <table>hi</table><table>ho</table>
28162 !! html/php+tidy
28163 hi<table></table>ho<table></table>
28164 !! html/parsoid
28165 <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>
28166 !! end
28167
28168 ## Remex doesn't account for fostered content.
28169 !! test
28170 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28171 !! options
28172 parsoid=wt2html,wt2wt
28173 !! wikitext
28174 <table>
28175 <tr> || ||
28176 <td> a
28177 </table>
28178 !! html/php+tidy
28179 || ||
28180 <table>
28181 <tbody><tr><td> a
28182 </td></tr></tbody></table>
28183 !! html/parsoid
28184 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28185 <table data-parsoid='{"stx":"html"}'>
28186 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28187 </td></tr></tbody></table>
28188 !! end
28189
28190 ## Remex doesn't account for fostered content.
28191 !! test
28192 Encapsulation properly handles null DSR information from foster box
28193 !! options
28194 parsoid=wt2html,wt2wt
28195 !! wikitext
28196 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28197 !! html/parsoid
28198 <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>
28199 !! end
28200
28201 ## Remex doesn't account for fostered content.
28202 !! test
28203 1. Encapsulate foster-parented transclusion content
28204 !! options
28205 parsoid=wt2wt,wt2html
28206 !! wikitext
28207 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28208 !! html/php+tidy
28209 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28210 !! html/parsoid
28211 <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>
28212 !! end
28213
28214 !! test
28215 2. Encapsulate foster-parented transclusion content
28216 !! options
28217 parsoid=wt2wt,wt2html
28218 !! wikitext
28219 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28220 !! html/parsoid
28221 <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>
28222 <table>
28223 <tbody>
28224 <tr>
28225 <td>bar</td>
28226 </tr>
28227 </tbody>
28228 </table>
28229 !! end
28230
28231 !! test
28232 3. Encapsulate foster-parented transclusion content
28233 !! options
28234 parsoid=wt2wt,wt2html
28235 !! wikitext
28236 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28237 !! html/parsoid
28238 <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;]}">
28239 <p>foo</p>
28240 </div>
28241 <table>
28242 <tbody>
28243 <tr>
28244 <td>bar</td>
28245 </tr>
28246 </tbody>
28247 </table>
28248 !! end
28249
28250 !! test
28251 4. Encapsulate foster-parented transclusion content
28252 !! options
28253 parsoid=wt2wt,wt2html
28254 !! wikitext
28255 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28256 !! html/parsoid
28257 <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;]}">
28258 <p>foo</p>
28259 </div>
28260 <table>
28261 <tbody>
28262 <tr>
28263 <td>bar</td>
28264 </tr>
28265 </tbody>
28266 </table>
28267 !! end
28268
28269 ## Remex doesn't account for fostered content.
28270 !! test
28271 5. Encapsulate foster-parented transclusion content
28272 !!options
28273 parsoid=wt2wt,wt2html
28274 !! wikitext
28275 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28276 !! html/php+tidy
28277 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28278 !! html/parsoid
28279 <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>
28280 !! end
28281
28282 ## Remex doesn't account for fostered content.
28283 !! test
28284 6. Encapsulate foster-parented transclusion content
28285 !! options
28286 parsoid=wt2wt,wt2html
28287 !! wikitext
28288 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28289 !! html/php+tidy
28290 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28291 !! html/parsoid
28292 <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>
28293 !! end
28294
28295 !! test
28296 7. Encapsulate foster-parented transclusion content
28297 !!options
28298 parsoid=wt2wt,wt2html
28299 !! wikitext
28300 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28301 !! html/parsoid
28302 <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>
28303 <table>
28304 <tbody>
28305 <tr>
28306 <td>bar</td>
28307 </tr>
28308 </tbody>
28309 </table>
28310 !! end
28311
28312 ## Remex doesn't account for fostered content.
28313 # Note that the wt is broken on purpose: the = should be {{=}} if you
28314 # don't want it to be a template parameter key.
28315 !! test
28316 8. Encapsulate foster-parented transclusion content
28317 !! options
28318 parsoid=wt2wt,wt2html
28319 !! wikitext
28320 {{echo|a
28321 }}{|{{echo|style='color:red'}}
28322 |-
28323 |b
28324 |}
28325 !! html/php+tidy
28326 <p>a
28327 </p>
28328 <table>
28329
28330 <tbody><tr>
28331 <td>b
28332 </td></tr></tbody></table>
28333 !! html/parsoid
28334 <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">
28335 </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">
28336 <tbody><tr>
28337 <td>b
28338 </td></tr></tbody></table>
28339 !! end
28340
28341 ## Remex doesn't account for fostered content.
28342 !! test
28343 9. Encapsulate foster-parented transclusion content
28344 !!options
28345 parsoid=wt2wt,wt2html
28346 !! wikitext
28347 <table>{{echo|hi</table>hello}}
28348 !! html/php+tidy
28349 hi<table></table><p>hello
28350 </p>
28351 !! html/parsoid
28352 <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>
28353 !! end
28354
28355 !! test
28356 Table in fosterable position
28357 !!options
28358 parsoid=wt2html
28359 !! wikitext
28360 {{OpenTable}}
28361 <div>
28362 {|
28363 |}
28364 </div>
28365 |}
28366 !! html/parsoid
28367 <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">
28368 </span>
28369 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28370
28371 <table>
28372 </table>
28373 !! end
28374
28375 # Parsoid only for T66747
28376 !! test
28377 Properly encapsulate empty-content transclusions in fosterable positions
28378 !! wikitext
28379 <table>
28380 {{#if:|
28381 <td>foo</td>
28382 }}
28383 </table>
28384 !! html/parsoid
28385 <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"}]]}'>
28386
28387 </table>
28388 !! end
28389
28390 ## No longer captures its original intention
28391 !! test
28392 Always encapsulate foster box when template range is expanded to table
28393 !! options
28394 disabled
28395 parsoid=wt2wt
28396 !! wikitext
28397 {|
28398 hello
28399 {{OpenTable}}
28400 |}
28401 !! html/parsoid
28402
28403 !! end
28404
28405 !! test
28406 T115289: Unclosed table
28407 !! wikitext
28408 {{echo|<table>}}<!--c-->[[Category:Two]]
28409 !! html/parsoid
28410 <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>
28411 !! end
28412
28413 !! test
28414 T115289: Don't migrate newlines out of tables with fostered content
28415 !! wikitext
28416 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28417 !! html/parsoid
28418 <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>
28419 !! end
28420
28421 !! test
28422 T73074: More fostering fun
28423 !! wikitext
28424 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28425 !! html/parsoid
28426 <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>
28427 !! end
28428
28429 !!test
28430 Support <object> element with .data attribute
28431 !!options
28432 parsoid=html2wt
28433 !! html/parsoid
28434 <object data="test.swf"></object>
28435 !! wikitext
28436 <object data="test.swf"></object>
28437 !!end
28438
28439 !! test
28440 Don't block XML namespace declaration
28441 !! wikitext
28442 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28443 !! html/php
28444 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28445 </p>
28446 !! html/parsoid
28447 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28448 !! end
28449
28450 # -----------------------------------------------------------------
28451 # The following section of tests are primarily to spec requirements
28452 # around Parsoid's serialization (old, new, edited content)
28453 #
28454 # All these tests are marked Parsoid html2wt and html2html only
28455 # ----------------------------------------------------------------
28456
28457 !! test
28458 Ignore rel attribute in a-tags during serialization to url-links
28459 !! options
28460 parsoid=html2wt
28461 !! html/parsoid
28462 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28463 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28464 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28465 !! wikitext
28466 http://en.wikipedia.org/wiki/Foobar
28467 http://en.wikipedia.org/wiki/Foobar
28468 http://en.wikipedia.org/wiki/Foobar
28469 !! end
28470
28471 # 'mi' is a localinterwiki prefix as well as a language
28472 !! test
28473 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28474 !! options
28475 parsoid=html2wt
28476 !! html/parsoid
28477 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28478 !! wikitext
28479 [[Foo]]
28480 !! end
28481
28482 !! test
28483 Parsoid should accept interwiki shortcuts
28484 !! options
28485 parsoid=html2wt
28486 !! html/parsoid
28487 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28488 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28489 <a href='./fr:Foo'>Foo</a></p>
28490 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28491 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28492 <a href='fr%3AFoo'>Foo</a></p>
28493 <p><a href='FR%3AFoo'>Foo</a>
28494 <a href='./FR:Foo'>Foo</a></p>
28495 !! wikitext
28496 [[:fr:Foo|Foo]]
28497 [[:fr:Foo|Foo]]
28498 [[:fr:Foo|Foo]]
28499
28500 [[:fr:Foo|Foo]]
28501 [[:fr:Foo|Foo]]
28502 [[:fr:Foo|Foo]]
28503
28504 [[:fr:Foo|Foo]]
28505 [[:fr:Foo|Foo]]
28506 !! end
28507
28508 !! test
28509 Parsoid should not accept invalid interwiki shortcuts
28510 !! options
28511 parsoid=html2wt
28512 !! html/parsoid
28513 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28514 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28515 <a href='news:Foo'>Foo</a></p>
28516 !! wikitext
28517 [news:Foo Foo]
28518 [news:Foo Foo]
28519 [news:Foo Foo]
28520 !! end
28521
28522 # See T93839
28523 !! test
28524 New wikilinks should be serialized properly
28525 !! options
28526 parsoid=html2wt
28527 !! html/parsoid
28528 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28529 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28530 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28531 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28532 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28533 !! wikitext
28534 [[Foo]]
28535 [[Foo]]
28536 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28537 http://en.wikipedia.org/wiki/Foo
28538 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28539 !! end
28540
28541 !! test
28542 New wiki links (href variations)
28543 !! options
28544 parsoid=html2wt
28545 !! html/parsoid
28546 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28547 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28548 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28549 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28550 !! wikitext
28551 [[Foo_bar]]
28552 [[Foo_bar]]
28553 [[Foo_bar]]
28554 [[Toxine bactérienne]]
28555 !! end
28556
28557 !! test
28558 New wiki links (content string variations)
28559 !! options
28560 parsoid=html2wt
28561 !! html/parsoid
28562 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28563 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28564 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28565 !! wikitext
28566 [[Foo_bar]]
28567 [[Foo bar]]
28568 [[Foo_bar|./Foo_bar]]
28569 !! end
28570
28571 !! test
28572 New category links (href variations)
28573 !! options
28574 parsoid=html2wt
28575 !! html/parsoid
28576 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28577 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28578 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28579 !! wikitext
28580 [[Category:Toxine bactérienne]]
28581 [[Category:Toxine bactérienne]]
28582 [[Category:Toxine bactérienne]]
28583 !! end
28584
28585 !! test
28586 New sol transparent links don't need indent-pre nowiki protection
28587 !! options
28588 parsoid=html2wt
28589 language=de
28590 !! html/parsoid
28591 <link rel="mw:PageProp/redirect" href="./Main_Page">
28592 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28593 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28594 !! wikitext
28595 #WEITERLEITUNG [[Main Page]]
28596 <!-- this is good --> [[Category:Good]]
28597 <!-- this is great --> [[Kategorie:Great]]
28598 !! end
28599
28600 !! test
28601 New interlanguage links (href variations)
28602 !! options
28603 parsoid=html2wt
28604 !! html/parsoid
28605 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28606 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28607 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28608 !! wikitext
28609 [[es:Toxine bactérienne]]
28610 [[es:Toxine_bactérienne]]
28611 [[es:Toxine_bactérienne]]
28612 !! end
28613
28614 !! test
28615 Image: Modifying size of an image (1)
28616 !! options
28617 parsoid={
28618 "modes": ["wt2wt"],
28619 "changes": [
28620 ["img[height]", "attr", "height", "22"],
28621 ["img[width]", "attr", "width", "200"]
28622 ]
28623 }
28624 !! wikitext
28625 [[Image:Foobar.jpg|230x230px]]
28626 !! wikitext/edited
28627 [[Image:Foobar.jpg|200x200px]]
28628 !!end
28629
28630 !! test
28631 Image: Modifying size of an image (2)
28632 !! options
28633 parsoid={
28634 "modes": ["wt2wt"],
28635 "changes": [
28636 ["img[height]", "attr", "height", "100"],
28637 ["img[width]", "attr", "width", "500"]
28638 ]
28639 }
28640 !! wikitext
28641 [[Image:Foobar.jpg|230x230px]]
28642 !! wikitext/edited
28643 [[Image:Foobar.jpg|500x500px]]
28644 !!end
28645
28646 # Change in size is ignored so long as class='mw-default-size'
28647 !! test
28648 Image: Modifying size of an image (3)
28649 !! options
28650 parsoid={
28651 "modes": ["wt2wt"],
28652 "changes": [
28653 ["figure[class]", "removeClass", "mw-default-size"],
28654 ["figure img", "attr", "height", "19"],
28655 ["figure img", "attr", "width", "170"]
28656 ]
28657 }
28658 !! wikitext
28659 [[Image:Foobar.jpg|thumb]]
28660 !! wikitext/edited
28661 [[Image:Foobar.jpg|thumb|170x170px]]
28662 !!end
28663
28664 !! test
28665 Image: Modifying alignment of an image (T50665)
28666 !! options
28667 parsoid={
28668 "modes": ["wt2wt"],
28669 "changes": [
28670 ["figure[class]", "removeClass", "mw-halign-right"],
28671 ["figure[class]", "addClass", "mw-halign-left"]
28672 ]
28673 }
28674 !! wikitext
28675 [[Image:Foobar.jpg|thumb|caption|right]]
28676 !! wikitext/edited
28677 [[Image:Foobar.jpg|thumb|caption|left]]
28678 !! end
28679
28680 !! test
28681 Image: Modifying mw-default-size of an frameless image (T64805)
28682 !! options
28683 parsoid={
28684 "modes": ["wt2wt"],
28685 "changes": [
28686 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28687 ]
28688 }
28689 !! wikitext
28690 [[Image:Foobar.jpg|frameless|right]]
28691 !! wikitext/edited
28692 [[Image:Foobar.jpg|frameless|right|220x220px]]
28693 !! end
28694
28695 !! test
28696 Image: Modifying valign of an image (T51221)
28697 !! options
28698 parsoid={
28699 "modes": ["wt2wt"],
28700 "changes": [
28701 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28702 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28703 ]
28704 }
28705 !! wikitext
28706 [[File:Foobar.jpg|20px|middle]]
28707 !! wikitext/edited
28708 [[File:Foobar.jpg|20px|text-top]]
28709 !! end
28710
28711 !! test
28712 Image: Modifying alt attribute of an image (T58400)
28713 !! options
28714 parsoid={
28715 "modes": ["wt2wt"],
28716 "changes": [
28717 ["img[alt]", "attr", "alt", "some alternate edited text"]
28718 ]
28719 }
28720 !! wikitext
28721 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28722 !! wikitext/edited
28723 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28724 !!end
28725
28726 !! test
28727 Image: Modifying caption of an image
28728 !! options
28729 parsoid={
28730 "modes": ["wt2wt"],
28731 "changes": [
28732 ["figcaption", "text", "new caption"]
28733 ]
28734 }
28735 !! wikitext
28736 [[Image:Foobar.jpg|thumb|original caption]]
28737 !! wikitext/edited
28738 [[Image:Foobar.jpg|thumb|new caption]]
28739 !!end
28740
28741 !! test
28742 Image: empty alt attribute (T50924)
28743 !! wikitext
28744 [[File:Foobar.jpg|thumb|alt=|bar]]
28745 !! html/php+tidy
28746 <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>
28747 !! html/parsoid
28748 <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>
28749 !! end
28750
28751 !! test
28752 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28753 !! options
28754 parsoid=html2wt
28755 language=ar
28756 disabled
28757 !! html/parsoid
28758 <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>
28759 !! wikitext
28760 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28761 !! end
28762
28763 !! test
28764 Image: Block level image should have \n before and after
28765 !! wikitext
28766 123
28767 [[File:Foobar.jpg|right|thumb|150x150px]]
28768 456
28769 !! html/parsoid
28770 <p>123</p>
28771 <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>
28772 <p>456</p>
28773 !! end
28774
28775 !! test
28776 Image: New block level image should have \n before and after (existing content)
28777 !! wikitext
28778 123
28779 [[File:Foobar.jpg|right|thumb|150x150px]]
28780 456
28781 !! html/parsoid
28782 <p>123</p>
28783 <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>
28784 <p>456</p>
28785 !! end
28786
28787 !! test
28788 Image: upright option (parsoid)
28789 !! wikitext
28790 [[File:Foobar.jpg|thumb|upright|caption]]
28791 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28792 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28793 !! html/parsoid
28794 <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>
28795 <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>
28796 <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>
28797 !! end
28798
28799 !! test
28800 Image: upright option is ignored on inline and frame images (parsoid)
28801 !! wikitext
28802 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28803 !! html/parsoid
28804 <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>
28805 !! end
28806
28807 !! test
28808 Image: in template parameter with empty parameter
28809 !! wikitext
28810 {{echo|[[File:Foobar.jpg|link=]]}}
28811 !! html/parsoid
28812 <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>
28813 !! end
28814
28815 !! test
28816 Image: from basic HTML (1)
28817 !! options
28818 parsoid=html2wt
28819 !! html/parsoid
28820 <span typeof="mw:Image">
28821 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28822 </span>
28823 !! wikitext
28824 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28825 !! end
28826
28827 !! test
28828 Image: from basic HTML (2)
28829 !! options
28830 parsoid=html2wt
28831 !! html/parsoid
28832 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28833 !! wikitext
28834 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28835 !! end
28836
28837 !! test
28838 Image: from basic HTML (3)
28839 !! options
28840 parsoid=html2wt
28841 !! html/parsoid
28842 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28843 !! wikitext
28844 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28845 !! end
28846
28847 !! test
28848 Image: from basic HTML (4)
28849 !! options
28850 parsoid=html2wt
28851 !! html/parsoid
28852 <img src="./File:Foobar.jpg">
28853 !! wikitext
28854 [[File:Foobar.jpg|link=]]
28855 !! end
28856
28857 !! test
28858 Image: Invalid title as link
28859 !! wikitext
28860 [[File:Foobar.jpg|link=<]]
28861 !! html/php
28862 <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>
28863 </p>
28864 !! html/parsoid
28865 <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>
28866 !! end
28867
28868 !! test
28869 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28870 !! options
28871 parsoid=html2wt
28872 !! html/parsoid
28873 <ul>
28874 <li><p>foo</p></li>
28875 </ul>
28876 !! wikitext
28877 * foo
28878 !! end
28879
28880 !! test
28881 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28882 !! options
28883 parsoid=html2wt
28884 !! html/parsoid
28885 <ul> <li>foo</li></ul>
28886 !! wikitext
28887 * foo
28888 !! end
28889
28890 !! test
28891 Don't strip leading whitespace when handling indent-pre suppressing tags
28892 !! options
28893 parsoid=html2wt
28894 !! html/parsoid
28895 <table>
28896 <tr><td> indented row</td></tr>
28897 </table>
28898 <blockquote><p>
28899 <b>This is very bold of you!</b>
28900 </p>
28901 <table><tr><td>
28902 indented cell (no pre-wrapping!)
28903 </td></tr></table>
28904 </blockquote>
28905 <p>foo</p>
28906 <div>bar</div>
28907 !! wikitext
28908 {|
28909 | indented row
28910 |}
28911 <blockquote>
28912 '''This is very bold of you!'''
28913
28914 {|
28915 |
28916 indented cell (no pre-wrapping!)
28917 |}
28918 </blockquote>
28919 foo
28920 <div>bar</div>
28921 !! end
28922
28923 !! test
28924 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28925 !! options
28926 parsoid=html2wt
28927 !! html/parsoid
28928 <p>foo</p>
28929 <span>bar</span>
28930
28931 <span>foo2
28932 </span>bar2
28933
28934 <div>foo</div>
28935 <span>bar</span>
28936
28937 <div>
28938 <span>foo</span>
28939 </div>
28940 !! wikitext
28941 foo
28942
28943 <span>bar</span>
28944
28945 <span>foo2
28946 <nowiki> </nowiki></span>bar2
28947
28948 <div>foo</div>
28949 <nowiki> </nowiki><span>bar</span>
28950
28951 <div>
28952 <nowiki> </nowiki><span>foo</span>
28953 </div>
28954 !! end
28955
28956 !! test
28957 Lists: Dont insert newlines in a serialized list item.
28958 !! options
28959 parsoid=html2wt
28960 !! html/parsoid
28961 <ul><li>a<br>b</li><li>c</li></ul>
28962 !! wikitext
28963 * a<br />b
28964 * c
28965 !! end
28966
28967 !! test
28968 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28969 !! options
28970 parsoid={
28971 "modes": ["html2wt"],
28972 "scrubWikitext": false
28973 }
28974 !! html/parsoid
28975 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28976 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28977
28978 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28979 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28980
28981 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28982
28983 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28984 !! wikitext
28985 == hello there [[Category:A1]] ==
28986
28987 == [[Category:A2]] hi pal ==
28988
28989 == <!--foo--> [[Category:A3]] how goes it ==
28990
28991 == it goes well [[Category:A4]] <!--bar--> ==
28992
28993 ==howdy [[Category:A5]]==
28994
28995 == __TOC__ ok ==
28996 !! end
28997
28998 !! test
28999 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
29000 !! options
29001 parsoid={
29002 "modes": ["html2wt"],
29003 "scrubWikitext": true
29004 }
29005 !! html/parsoid
29006 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29007 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29008
29009 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29010 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29011
29012 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29013 !! wikitext
29014 == hello there ==
29015 [[Category:A1]]
29016 [[Category:A2]]
29017
29018 == hi pal ==
29019
29020 <!--foo-->[[Category:A3]]
29021
29022 == how goes it ==
29023
29024 == it goes well ==
29025 [[Category:A4]] <!--bar-->
29026
29027 __TOC__
29028
29029 == ok ==
29030 !! end
29031
29032 !! test
29033 Headings: Don't hoist metas that come from templates
29034 !! options
29035 parsoid={
29036 "modes": ["html2wt"],
29037 "scrubWikitext": true
29038 }
29039 !! html/parsoid
29040 <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>
29041 !! wikitext
29042 == {{echo|foo [[Category:Foo]]}} ==
29043 !! end
29044
29045 !! test
29046 Headings: Category in ref isn't hoisted
29047 !! options
29048 parsoid={
29049 "modes": ["html2wt"],
29050 "scrubWikitext": true
29051 }
29052 !! html/parsoid
29053 <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>
29054
29055 <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>
29056 !! wikitext
29057 == foo <ref>bar
29058 [[Category:Baz]] </ref> ==
29059
29060 <references />
29061 !! end
29062
29063 !! test
29064 Parsoid: Serialize positional parameters with = in them as named parameter
29065 !! options
29066 parsoid=html2wt
29067 !! html/parsoid
29068 <p about="#mwt1" typeof="mw:Transclusion"
29069 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
29070
29071 <p about="#mwt1" typeof="mw:Transclusion"
29072 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
29073
29074 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29075 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29076 <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>
29077 !! wikitext
29078 {{echo|1=f=oo}}
29079
29080 {{echo|1=f=oo|2=bar}}
29081
29082 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29083 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29084 {{echo|<nowiki>f=oo</nowiki>|bar}}
29085 !! end
29086
29087 !! test
29088 Parsoid: Serialize positional parameters with = in extlink as named parameter
29089 !! options
29090 parsoid=html2wt
29091 !! html/parsoid
29092 <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>
29093 !! wikitext
29094 {{echo|1=http://stuff?is=ok}}
29095 !! end
29096
29097 !! test
29098 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
29099 !! options
29100 parsoid=html2wt
29101 !! html/parsoid
29102 <div>a<p>b</p></div>
29103 <div>a
29104 <p>b</p></div>
29105 <div>
29106 a
29107 <p>b</p></div>
29108 !! wikitext
29109 <div>a
29110 b
29111 </div>
29112 <div>a
29113 b
29114 </div>
29115 <div>
29116 a
29117
29118 b
29119 </div>
29120 !! end
29121
29122 !! test
29123 Substrings resembling wikitext in hrefs should not get nowiki escapes
29124 !! options
29125 parsoid=html2wt
29126 !! html/parsoid
29127 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
29128 !! wikitext
29129 [[Foo''bar''baz]]
29130 !! end
29131
29132 !! test
29133 Enforce single-line context in the serializer
29134 !! options
29135 parsoid=html2wt
29136 !! html/parsoid
29137 <h2>testing
29138 123</h2>
29139
29140 <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">
29141 </span><span about="#mwt1">you</span> </h2>
29142
29143 <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>
29144
29145 <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
29146 there</span></li></ol>
29147
29148 <ul><li>asd
29149 sdf</li></ul>
29150
29151 <ul><li>foo
29152 bar
29153 baz</li>
29154 <li>foo <b>bar</b>
29155 baz</li></ul>
29156
29157 <dl><dt>hi
29158 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29159 ho</dd></dl>
29160
29161 <dl><dd> <table>
29162 <tbody><tr><td> ha
29163 ha
29164 ha</td></tr>
29165 </tbody></table></dd></dl>
29166 !! wikitext
29167 == testing 123 ==
29168
29169 == hi {{bogus|there
29170 you}} ==
29171
29172 == foo <ref>hello
29173 there</ref> ==
29174
29175 <references />
29176
29177 * asd sdf
29178
29179 * foo bar baz
29180 * foo '''bar''' baz
29181
29182 ; hi ho : hi ho
29183
29184 : {|
29185 | ha
29186 ha
29187 ha
29188 |}
29189 !! end
29190
29191 !! test
29192 Serialize new placeholder space without spans
29193 !! options
29194 parsoid=html2wt
29195 !! html/parsoid
29196 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29197
29198 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29199
29200 <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>
29201 !! wikitext
29202 foo : bar
29203
29204 foo : bar
29205
29206 <ref>foo : bar</ref>ok
29207 !! end
29208
29209
29210 #-----------------------
29211 # Tag minimization tests
29212 #-----------------------
29213
29214 !! test
29215 1. I/B quote minimization: wikitext-only tags should be combined
29216 !! options
29217 parsoid=html2wt
29218 !! html/parsoid
29219 <p><i>A</i><i>B</i></p>
29220 <p><b>A</b><b>B</b></p>
29221 <p><i>A</i><b><i>B</i></b></p>
29222 <p><b>A</b><i><b>B</b></i></p>
29223 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29224 <p><i><b>A</b></i><i><b>B</b></i></p>
29225 <p><i><b>A</b></i><b><i>B</i></b></p>
29226 <p><b><i>A</i></b><i><b>B</b></i></p>
29227 !! wikitext
29228 ''AB''
29229
29230 '''AB'''
29231
29232 ''A'''B'''''
29233
29234 '''A''B'''''
29235
29236 '''A''BC''D'''
29237
29238 '''''AB'''''
29239
29240 '''''AB'''''
29241
29242 '''''AB'''''
29243 !! end
29244
29245 !! test
29246 2. I/B quote minimization: wikitext and html tags should not be combined
29247 !! options
29248 parsoid=html2wt
29249 !! html/parsoid
29250 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29251 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29252 !! wikitext
29253 ''A''<i>B</i>
29254
29255 ''A''<nowiki/>'''<i>B</i>'''
29256 !! end
29257
29258 !! test
29259 3. I/B quote minimization: templated content stops minimization
29260 !! options
29261 parsoid=html2wt
29262 !! html/parsoid
29263 <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>
29264 <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>
29265 !! wikitext
29266 ''A''{{echo|''B''}}
29267
29268 ''A''{{echo|'''''B'''''}}
29269 !! end
29270
29271 !! test
29272 4. I/B quote minimization: new content should be mimimized with adjacent old content
29273 !! options
29274 parsoid=html2wt
29275 !! html/parsoid
29276 <p><i>A</i><i>B</i></p>
29277 <p><b>A</b><b>B</b></p>
29278 <p><i>A</i><b><i>B</i></b></p>
29279 !! wikitext
29280 ''AB''
29281
29282 '''AB'''
29283
29284 ''A'''B'''''
29285 !! end
29286
29287 !! test
29288 5a. Merge adjacent quote nodes if they've been edited
29289 !! options
29290 parsoid={
29291 "modes": ["wt2wt", "selser"],
29292 "changes": [
29293 ["p", "contents", "remove", ":contains('b')"]
29294 ]
29295 }
29296 !! wikitext
29297 ''a''b''c''
29298 !! wikitext/edited
29299 ''ac''
29300 !! end
29301
29302 !! test
29303 5b. Merge adjacent quote nodes if they've been edited
29304 !! options
29305 parsoid={
29306 "modes": ["wt2wt", "selser"],
29307 "changes": [
29308 ["#x", "remove"]
29309 ]
29310 }
29311 !! wikitext
29312 ''a''<span id="x">b</span>''c''
29313 !! wikitext/edited
29314 ''ac''
29315 !! end
29316
29317 !! test
29318 1. Merge adjacent link nodes as long as at least one element is new
29319 !! options
29320 parsoid={
29321 "modes": ["html2wt"],
29322 "scrubWikitext": true
29323 }
29324 !! html/parsoid
29325 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29326 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29327 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29328 !! wikitext
29329 [[Football]]
29330 [[Football]]
29331 [[Football|Foot]][[Football|ball]]
29332 !! end
29333
29334 !! test
29335 2. Merge adjacent link nodes and enable additional normalizations
29336 !! options
29337 parsoid={
29338 "modes": ["html2wt"],
29339 "scrubWikitext": true
29340 }
29341 !! html/parsoid
29342 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29343 !! wikitext
29344 ''[[Football]]''
29345 !! end
29346
29347 !! test
29348 3. Don't merge adjacent link nodes if scrubWikitext is false
29349 !! options
29350 parsoid={
29351 "modes": ["html2wt"],
29352 "scrubWikitext": false
29353 }
29354 !! html/parsoid
29355 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29356 !! wikitext
29357 [[Football|Foot]][[Football|ball]]
29358 !! end
29359
29360 !! test
29361 1. Move format tags outside of WikiLink
29362 !! options
29363 parsoid={
29364 "modes": ["html2wt"],
29365 "scrubWikitext": true
29366 }
29367 !! html/parsoid
29368 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29369 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29370 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29371 !! wikitext
29372 ''[[Football]]''
29373 '''''[[Football]]'''''
29374 <u>'''''[[Football]]'''''</u>
29375 !! end
29376
29377 !! test
29378 2. Move format tags outside of WikiLink with mergable A tags
29379 !! options
29380 parsoid={
29381 "modes": ["html2wt"],
29382 "scrubWikitext": true
29383 }
29384 !! html/parsoid
29385 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29386 !! wikitext
29387 '''''[[Football]]'''''
29388 !! end
29389
29390 !! test
29391 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29392 !! options
29393 parsoid={
29394 "modes": ["html2wt"],
29395 "scrubWikitext": true
29396 }
29397 !! html/parsoid
29398 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29399 !! wikitext
29400 <font color="red"><u>'''[[Foo]]'''</u></font>
29401 !! end
29402
29403 !! test
29404 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29405 !! options
29406 parsoid={
29407 "modes": ["html2wt"],
29408 "scrubWikitext": true
29409 }
29410 !! html/parsoid
29411 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29412 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29413 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29414 !! wikitext
29415 [[Foo|<font color="red">Foo</font>]]
29416 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29417 [[Foo|<span class="Bar">Foo</span>]]
29418 !! end
29419
29420 !! test
29421 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29422 !! options
29423 parsoid={
29424 "modes": ["selser"],
29425 "scrubWikitext": true,
29426 "changes": [
29427 ["a", "html", "<i>Foo</i>"]
29428 ]
29429 }
29430 !! wikitext
29431 [[Foo]]
29432 !! wikitext/edited
29433 ''[[Foo]]''
29434 !! end
29435
29436 !! test
29437 6. Regression test: Manual edit test to ensure diff markers are not lost
29438 !! options
29439 parsoid={
29440 "modes": ["selser"],
29441 "scrubWikitext": true,
29442 "changes": [
29443 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29444 ]
29445 }
29446 !! wikitext
29447 ''Foo''
29448 !! wikitext/edited
29449 ''[[Foo]]''
29450 !! end
29451
29452 !! test
29453 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29454 !! options
29455 parsoid={
29456 "modes": ["selser"],
29457 "scrubWikitext": true,
29458 "changes": [
29459 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29460 ]
29461 }
29462 !! wikitext
29463 <div>placeholder</div>
29464 !! wikitext/edited
29465 <div>placeholder</div>
29466 [[Foo]] , placeholder
29467 !! end
29468
29469 #------------------------------
29470 # End of tag minimization tests
29471 #------------------------------
29472
29473 !!test
29474 T56262: New entities
29475 !! options
29476 parsoid=html2wt
29477 !! html/parsoid
29478 <span typeof="mw:Entity">&nbsp;</span>
29479 !! wikitext
29480 &nbsp;
29481 !! end
29482
29483 ## Note that there is no wikitext output for 'unknownproperty' ##
29484 ## Unknown magic words are silently dropped ##
29485
29486 !! test
29487 Magic words
29488 !! options
29489 parsoid=html2wt
29490 !! html/parsoid
29491 <meta property='mw:PageProp/toc' />
29492 <meta property='mw:PageProp/notoc' />
29493 <meta property='mw:PageProp/forcetoc' />
29494 <meta property='mw:PageProp/index' />
29495 <meta property='mw:PageProp/noindex' />
29496 <meta property='mw:PageProp/nogallery' />
29497 <meta property='mw:PageProp/noeditsection' />
29498 <meta property='mw:PageProp/notitleconvert' />
29499 <meta property='mw:PageProp/nocontentconvert' />
29500 <meta property='mw:PageProp/unknownproperty' />
29501 !! wikitext
29502 __TOC__
29503 __NOTOC__
29504 __FORCETOC__
29505 __INDEX__
29506 __NOINDEX__
29507 __NOGALLERY__
29508 __NOEDITSECTION__
29509 __NOTITLECONVERT__
29510 __NOCONTENTCONVERT__
29511 !! end
29512
29513 !! test
29514 Consecutive <pre>s should not get merged
29515 !! options
29516 parsoid=html2wt,html2html
29517 !! html/parsoid
29518 <pre>a</pre><pre>b</pre>
29519
29520 <pre>c
29521 </pre><pre>
29522 d</pre>
29523
29524 <pre>e
29525
29526 </pre><pre>
29527
29528 f</pre>
29529 !! wikitext
29530 a
29531
29532 b
29533
29534 c
29535
29536 d
29537
29538 e
29539
29540
29541
29542 f
29543 !! end
29544
29545 !! test
29546 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29547 !! options
29548 parsoid=html2wt
29549 !! html/parsoid
29550 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29551 !! wikitext
29552 [[Special:BookSources/1234567890|ISBN 1234567895]]
29553 !! end
29554
29555 !! test
29556 Edited RFC links not serializable as RFC links should serialize as extlinks
29557 !! options
29558 parsoid=html2wt
29559 !! html/parsoid
29560 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29561 !! wikitext
29562 [https://tools.ietf.org/html/rfc123 New RFC]
29563 !! end
29564
29565 !! test
29566 Edited PMID links not serializable as PMID links should serialize as extlinks
29567 !! options
29568 parsoid=html2wt
29569 !! html/parsoid
29570 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29571 !! wikitext
29572 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29573 !! end
29574
29575 !! test
29576 WTS of autolinks with trailing/surrounding context
29577 !! options
29578 parsoid=html2wt
29579 !! html/parsoid
29580 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29581 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29582 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29583 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29584 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29585 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29586 !! wikitext
29587 http://cscott.net'''foo'''
29588
29589 http://cscott.net<b>foo</b>
29590
29591 '''http://cscott.net'''
29592
29593 '''http://cscott.net '''
29594
29595 '''http://cscott.net<nowiki/>x'''
29596
29597 http://cscott.net<nowiki/>x
29598 !! end
29599
29600 !! test
29601 WTS of autolinks with nowikis (round-trip)
29602 !! wikitext
29603 x<nowiki/>http://cscott.net<nowiki/>x
29604 !! html/parsoid
29605 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29606 !! end
29607
29608 # this is the "easy" test because it leaves in place all the
29609 # data-parsoid information indicating this is an autolink
29610 !! test
29611 WTS of autolinks with escapes (editing)
29612 !! options
29613 parsoid={
29614 "modes": ["wt2wt"],
29615 "changes": [
29616 [ "span", "remove" ]
29617 ]
29618 }
29619 !! wikitext
29620 x<nowiki/>http://cscott.net<nowiki/>x
29621 !! wikitext/edited
29622 x<nowiki/>http://cscott.net<nowiki/>x
29623 !! end
29624
29625 !! test
29626 WTS of edited autolink-like text (T103364)
29627 !! options
29628 parsoid={
29629 "modes": ["wt2wt"],
29630 "changes": [
29631 [ "span[typeof]", "removeAttr", "typeof" ]
29632 ]
29633 }
29634 !! wikitext
29635 Not a link: <nowiki>http://example.com</nowiki>.
29636 !! wikitext/edited
29637 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29638 !! end
29639
29640 !! test
29641 WTS of newly-authored autolink-like text (T103364)
29642 !! options
29643 parsoid=html2wt
29644 !! html/parsoid
29645 <p>http://example.com is not a link.</p>
29646 !! wikitext
29647 <nowiki>http://example.com</nowiki> is not a link.
29648 !! end
29649
29650 !! test
29651 WTS of autolink-like text after an autolink (T108563)
29652 !! options
29653 parsoid=html2wt
29654 !! html/parsoid
29655 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29656 !! wikitext
29657 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29658 !! end
29659
29660 !! test
29661 Magic links inside links (not autolinked)
29662 !! wikitext
29663 [[Foo|http://example.com]]
29664 [[Foo|RFC 1234]]
29665 [[Foo|PMID 1234]]
29666 [[Foo|ISBN 123456789x]]
29667
29668 [http://foo.com http://example.com]
29669 [http://foo.com RFC 1234]
29670 [http://foo.com PMID 1234]
29671 [http://foo.com ISBN 123456789x]
29672 !! html+tidy
29673 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29674 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29675 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29676 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29677 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29678 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29679 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29680 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29681 </p>
29682 !! html/parsoid
29683 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29684 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29685 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29686 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29687
29688 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29689 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29690 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29691 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29692 !! end
29693
29694 !! test
29695 Magic links inside image captions (autolinked)
29696 !! wikitext
29697 [[File:Foobar.jpg|thumb|http://example.com]]
29698 [[File:Foobar.jpg|thumb|RFC 1234]]
29699 [[File:Foobar.jpg|thumb|PMID 1234]]
29700 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29701 !! html+tidy
29702 <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>
29703 <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>
29704 <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>
29705 <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>
29706 !! html/parsoid
29707 <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>
29708 <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>
29709 <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>
29710 <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>
29711 !! end
29712
29713 !! test
29714 WTS of magic word text (T109371)
29715 !! options
29716 parsoid=html2wt
29717 !! html/parsoid
29718 <p>RFC 1234</p>
29719 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29720 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29721 !! wikitext
29722 <nowiki>RFC 1234</nowiki>
29723
29724 [http://foo.com RFC 1234]
29725
29726 [[Foo|RFC 1234]]
29727 !! end
29728
29729 !! test
29730 Edited Redirect link should emit a non-piped wikitext link
29731 !! options
29732 parsoid=html2wt
29733 !! html/parsoid
29734 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29735 !! wikitext
29736 #REDIRECT [[Bar]]
29737 !! end
29738
29739 !! test
29740 T75121: Infer extension name from typeOf if data-mw is not present
29741 !! options
29742 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29743 !! html/parsoid
29744 <div typeOf="mw:Extension/foo"></div>
29745 !! wikitext
29746 <foo />
29747 !! end
29748
29749 # Note that the <p> wrapping isn't present in PHP parser output
29750 # The important thing for this test is that P-wrapping doesn't
29751 # interfere with the <nowiki> protection for leading - in <td>
29752 # (which isn't necessary for <th>).
29753 !! test
29754 T88318: p-wrapped dash in table.
29755 !! options
29756 parsoid=html2wt,wt2wt
29757 !! html/parsoid
29758 <table><tbody>
29759 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29760 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29761 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29762 </tbody></table>
29763 !! wikitext
29764 {|
29765 !-
29766 !-
29767 |-
29768 |<nowiki>-</nowiki>
29769 |<nowiki>- </nowiki>
29770 |-
29771 |<small>-</small>
29772 |<br />
29773 -
29774 |<br />-
29775 |}
29776 !! html/php+tidy
29777 <table>
29778 <tbody><tr>
29779 <th>-
29780 </th>
29781 <th>-
29782 </th></tr>
29783 <tr>
29784 <td>-
29785 </td>
29786 <td>-
29787 </td></tr>
29788 <tr>
29789 <td><small>-</small>
29790 </td>
29791 <td><br />
29792 <p>-
29793 </p>
29794 </td>
29795 <td><br />-
29796 </td></tr></tbody></table>
29797 !! end
29798
29799 !! test
29800 T149209: WTS: Handle newlines in table cells properly
29801 !! options
29802 parsoid=html2wt
29803 !! html/parsoid
29804 <table>
29805 <tbody>
29806 <tr><td>a
29807 b
29808 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29809 <tr><td><p>x</p>
29810 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29811 </tbody></table>
29812 <table>
29813 <tbody>
29814 <tr><th>a
29815 b
29816 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29817 <tr><th><p>x</h>
29818 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29819 </tbody></table>
29820 !! wikitext
29821 {|
29822 |a
29823 b
29824 |c
29825 |-
29826 |x
29827 {{!}}y
29828 |}
29829 {|
29830 !a
29831 b
29832 !c
29833 |-
29834 !x
29835 !y
29836 |}
29837 !! end
29838
29839 !! test
29840 T149209: Selser: Handle newlines in table cells properly
29841 !! options
29842 parsoid={
29843 "modes": ["selser"],
29844 "changes": [
29845 [ "#h1", "html", "a\nb\n" ],
29846 [ "#h2", "html", "a\nb\n" ],
29847 [ "#c1", "html", "a\nb\n" ],
29848 [ "#c2", "html", "<p>a</p>" ],
29849 [ "#c3", "html", "<p>a</p>" ],
29850 [ "#c4", "html", "edit-me<p>a</p>" ]
29851 ]
29852 }
29853 !! wikitext
29854 {|
29855 ! id="h1" |edit-me!!1
29856 |-
29857 ! id="h2" |edit-me||2
29858 |-
29859 | id="c1" |edit-me||3
29860 |-
29861 | id="c2" |edit-me||4
29862 |-
29863 | id="c3" |edit-me||p||q||r
29864 |-
29865 | id="c4" |edit-me||p||q||r
29866 |}
29867 !! wikitext/edited
29868 {|
29869 ! id="h1" |a
29870 b
29871 !1
29872 |-
29873 ! id="h2" |a
29874 b
29875 !2
29876 |-
29877 | id="c1" |a
29878 b
29879 |3
29880 |-
29881 | id="c2" |a
29882 |4
29883 |-
29884 | id="c3" |a
29885 |p||q||r
29886 |-
29887 | id="c4" |edit-me
29888 a
29889 |p||q||r
29890 |}
29891 !! end
29892
29893 !! test
29894 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29895 !! options
29896 parsoid=html2wt
29897 !! html/parsoid
29898 <table id='mwAb'>
29899 <td id='mwAc'>foo</td>
29900 <td id='serialize-this'>bar</td>
29901 </table>
29902 !! wikitext
29903 {|
29904 |foo
29905 | id="serialize-this" |bar
29906 |}
29907 !! end
29908
29909 !! test
29910 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29911 !! options
29912 parsoid=html2wt
29913 !! html/parsoid
29914 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29915 !! wikitext
29916 <div id="hello">ok</div>
29917 !! end
29918
29919 !! test
29920 Testing serialization after deletion in references
29921 !! options
29922 parsoid={
29923 "modes": ["wt2wt"],
29924 "changes": [
29925 ["#x", "remove"]
29926 ]
29927 }
29928 !! wikitext
29929 hi <ref><div id="x">ho</div></ref>
29930
29931 <references />
29932 !! wikitext/edited
29933 hi <ref></ref>
29934
29935 <references />
29936 !! end
29937
29938 !!test
29939 Testing serialization after deletion of table cells
29940 !!options
29941 parsoid={
29942 "modes": ["wt2wt", "selser"],
29943 "changes": [
29944 ["#x", "remove"]
29945 ]
29946 }
29947 !!wikitext
29948 {|
29949 !h1 !!h2 !!h3
29950 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29951 |}
29952 !! wikitext/edited
29953 {|
29954 !h1!!h2!!h3
29955 |c2|||c3
29956 |}
29957 !!end
29958
29959 !! test
29960 Testing selser after addition of new row before first row (T125419)
29961 !! options
29962 parsoid={
29963 "modes": ["wt2wt", "selser"],
29964 "changes": [
29965 [ "tr", "before", "<tr><td>X</td></tr>" ]
29966 ]
29967 }
29968 !! wikitext
29969 {|
29970 |a
29971 |}
29972 !! wikitext/edited
29973 {|
29974 |X
29975 |-
29976 |a
29977 |}
29978 !! end
29979
29980 !! test
29981 Serialize new table rows in a HTML table using HTML tags
29982 !! options
29983 parsoid={
29984 "modes": ["wt2wt", "selser"],
29985 "changes": [
29986 [ "tr", "before", "<tr><td>X</td></tr>" ]
29987 ]
29988 }
29989 !! wikitext
29990 <table><tr><td>a</td></tr></table>
29991 !! wikitext/edited
29992 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29993 !! end
29994
29995 !! test
29996 Serialize new table cells in a HTML row using HTML tags
29997 !! options
29998 parsoid={
29999 "modes": ["wt2wt", "selser"],
30000 "changes": [
30001 [ "td", "before", "<td>X</td>" ]
30002 ]
30003 }
30004 !! wikitext
30005 <table><tr><td>a</td></tr></table>
30006 !! wikitext/edited
30007 <table><tr><td>X</td><td>a</td></tr></table>
30008 !! end
30009
30010 !! test
30011 Serialize wikitext list items as HTML list items when embedded in a HTML list
30012 !! options
30013 parsoid=html2wt
30014 !! html/parsoid
30015 <ul data-parsoid='{"stx": "html"}'>
30016 <li data-parsoid='{}'>a</li>
30017 <li>b</li>
30018 </ul>
30019 !! wikitext
30020 <ul>
30021 <li>a</li>
30022 <li>b</li>
30023 </ul>
30024 !! html/php+tidy
30025 <ul>
30026 <li>a</li>
30027 <li>b</li>
30028 </ul>
30029 !! end
30030
30031 # Nested list should be inside <li>, that is
30032 # <ul><li>foo<ul>..</ul></li></ul> instead of
30033 # <ul><li>foo</li><ul>..</ul></ul>
30034 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
30035 !! test
30036 Wikitext lists can be nested inside HTML lists
30037 !! options
30038 parsoid=html2wt
30039 !! html/parsoid
30040 <ul data-parsoid='{"stx": "html"}'>
30041 <li data-parsoid='{"stx": "html"}'>a
30042 <ul><li>b</li></ul>
30043 </li>
30044 </ul>
30045
30046 <ul data-parsoid='{"stx": "html"}'>
30047 <li>x
30048 <ul><li>y</li></ul>
30049 </li>
30050 </ul>
30051 !! wikitext
30052 <ul>
30053 <li>a
30054 * b
30055 </li>
30056 </ul>
30057
30058 <ul>
30059 <li>x
30060 * y
30061 </li>
30062 </ul>
30063 !! html/php+tidy
30064 <ul>
30065 <li>a
30066 <ul><li>b</li></ul>
30067 </li>
30068 </ul>
30069 <ul>
30070 <li>x
30071 <ul><li>y</li></ul>
30072 </li>
30073 </ul>
30074 !! end
30075
30076 !! test
30077 WTS change modes
30078 !! options
30079 parsoid={
30080 "modes": ["wt2wt"],
30081 "changes": [
30082 [ "#xyz", "before", "<b>before</b> stuff " ],
30083 [ "#xyz", "after", " stuff <i>after</i>" ],
30084 [ "#xyz", "html", "x <b>y</b> z" ]
30085 ]
30086 }
30087 !! wikitext
30088 <span id="xyz">hello</span>
30089 !! wikitext/edited
30090 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
30091 !! end
30092
30093 !! test
30094 Never serialize a-tag as html, regardless of what data-parsoid has to say
30095 !! options
30096 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30097 !! html/parsoid
30098 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
30099 !! wikitext
30100 [[Foo]]
30101 !! end
30102
30103 ## SSS FIXME: This is broken output nevertheless.
30104 ## What might be a reasonable non-broken output for this?
30105 ## This is an edge case unlikely to be seen in production
30106 ## that I am not wasting more time on this right now.
30107 !! test
30108 Never serialize a-tag as html, no matter what attributes it has
30109 !! options
30110 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30111 !! html/parsoid
30112 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
30113 !! wikitext
30114 [http://boo.org http://boohoo.org]
30115 !! end
30116
30117 # Misnested is an indication that selser can reuse the source but these have
30118 # shown to sneak through on occasion. See T101768.
30119 # The original wikitext here is: [http://test.com [[one]] two three]
30120 !! test
30121 Strip span tags added to mark misnested links
30122 !! options
30123 parsoid=html2wt
30124 !! html/parsoid
30125 <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>
30126 !! wikitext
30127 [http://test.com][[one]] two three
30128 !! end
30129
30130 !! test
30131 Catch regression when unpacking misnested links
30132 !! options
30133 parsoid=wt2html
30134 !! wikitext
30135 {{echo|hi}}[http://example.com [[ho]]]
30136 !! html/parsoid
30137 <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>
30138 !! end
30139
30140 !! test
30141 Catch regression when unpacking with trailing content
30142 !! wikitext
30143 {{echo|Foo <references/> bar}}
30144 !! html/parsoid
30145 <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>
30146 !! end
30147
30148 !! test
30149 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
30150 !! options
30151 parsoid=html2wt
30152 !! html/parsoid
30153 <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|}"]}'>
30154 <tbody><tr><td>d
30155 </td></tr>
30156 </tbody></table>
30157 !! wikitext
30158 {{echo|a}}
30159 {|{{echo|c
30160 {{!}}d
30161 }}
30162 |}
30163 !! end
30164
30165 ## This test verifies the presence and computation of this attribute indirectly
30166 ## by making an edit and ensuring that the serialization is correct (which it would be
30167 ## only if firstWikitextNode is properly set).
30168 !! test
30169 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30170 !! options
30171 parsoid= {
30172 "modes": ["wt2wt"],
30173 "changes": [
30174 [ "div#x", "remove" ],
30175 [ "div", "before", "<div>new</div>" ]
30176 ]
30177 }
30178 !! wikitext
30179 <div id="x">foo</div>
30180 {|
30181 {{echo|<div>boo</div>
30182 {{!}}b}}
30183 |c
30184 |}
30185 !! wikitext/edited
30186
30187 <div>new</div>
30188 {|
30189 {{echo|<div>boo</div>
30190 {{!}}b}}
30191 |c
30192 |}
30193 !! end
30194
30195 # --------------------------------------------
30196 # Tests spec'ing wikitext serialization norms |
30197 # --------------------------------------------
30198
30199 !! test
30200 Serialize multi-line indent-pre starting with wikitext syntax
30201 !! options
30202 parsoid=html2wt
30203 !! html/parsoid
30204 <pre>* 1
30205 ** 2
30206 * 3</pre>
30207 !! wikitext
30208 * 1
30209 ** 2
30210 * 3
30211 !! end
30212
30213 !! test
30214 1. Categories should always be serialized on their own line
30215 !! options
30216 parsoid=html2wt
30217 !! html/parsoid
30218 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30219 !! wikitext
30220 foo
30221 [[Category:Foo]]
30222 bar
30223 !! end
30224
30225 !! test
30226 2. Categories that are part of templates should not introduce a line break
30227 !! wikitext
30228 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30229 !! html/parsoid
30230 <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>
30231 !! end
30232
30233 # Careful while editing these next 2 tests. There are \u200f characters
30234 # before and after the <link> tags in the HTML and following some
30235 # of the categories in wikitext
30236 # Do not remove these characters in edits.
30237 #
30238 # As part of the serialization, these bidi characters will get stripped.
30239 !! test
30240 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30241 !! options
30242 parsoid={
30243 "modes": ["html2wt"],
30244 "scrubWikitext": true
30245 }
30246 !! html/parsoid
30247 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30248 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30249 !! wikitext
30250 [[קטגוריה:טקסים]]
30251 [[קטגוריה: שיטות משפט]]
30252 !! end
30253
30254 !! test
30255 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30256 !! options
30257 parsoid={
30258 "modes": ["html2wt"],
30259 "scrubWikitext": true
30260 }
30261 !! html/parsoid
30262 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30263 !! wikitext
30264 [[קטגוריה:טקסים]]
30265 ‏y
30266 !! end
30267
30268 !! test
30269 Lists: Add space after bullets
30270 !! options
30271 parsoid=html2wt
30272 !! html/parsoid
30273 <ul>
30274 <li>foo</li>
30275 <li> bar</li>
30276 <li><span> baz</span></li>
30277 </ul>
30278 !! wikitext
30279 * foo
30280 * bar
30281 * <span> baz</span>
30282 !! end
30283
30284 !! test
30285 1. Headings: Add space before/after == (T53744)
30286 !! options
30287 parsoid=html2wt
30288 !! html/parsoid
30289 <h2>foo</h2>
30290 <h2> bar</h2>
30291 <h2>baz </h2>
30292 <h2><span> baz</span></h2>
30293 !! wikitext
30294 == foo ==
30295
30296 == bar ==
30297
30298 == baz ==
30299
30300 == <span> baz</span> ==
30301 !! end
30302
30303 !! test
30304 2. Headings: Add space before/after == even after hoisted content
30305 !! options
30306 parsoid={
30307 "modes": ["html2wt"],
30308 "scrubWikitext": true
30309 }
30310 !! html/parsoid
30311 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30312 !! wikitext
30313 [[Category:A2]]
30314
30315 == ok ==
30316 !! end
30317
30318 !! test
30319 1. Headings: suppress newly created empty headings
30320 !! options
30321 parsoid={
30322 "modes": ["html2wt"],
30323 "scrubWikitext": true
30324 }
30325 !! html/parsoid
30326 <h2></h2>
30327 !! wikitext
30328 !! end
30329
30330 !! test
30331 2. Headings: don't suppress empty headings if scrubWikitext is false
30332 !! options
30333 parsoid=html2wt
30334 !! html/parsoid
30335 <h2></h2>
30336 !! wikitext
30337 ==<nowiki/>==
30338 !! end
30339
30340 !! test
30341 3. Headings: suppress empty headings on edits
30342 !! options
30343 parsoid={
30344 "modes": ["selser"],
30345 "scrubWikitext": true,
30346 "changes": [
30347 [ "#x", "remove"]
30348 ]
30349 }
30350 !! wikitext
30351 ==<span id="x">foo</span>==
30352 !! wikitext/edited
30353 !! end
30354
30355 !! test
30356 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30357 !! options
30358 parsoid={
30359 "modes": ["html2wt"],
30360 "scrubWikitext": true
30361 }
30362 !! html/parsoid
30363 <h2>foo<br/>bar</h2>
30364 <h2>foo <span><br/>bar</span> baz</h2>
30365 !! wikitext
30366 == foo bar ==
30367
30368 == foo <span> bar</span> baz ==
30369 !! end
30370
30371 !! test
30372 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30373 !! options
30374 parsoid={
30375 "modes": ["html2wt"],
30376 "scrubWikitext": false
30377 }
30378 !! html/parsoid
30379 <h2>foo<br/>bar</h2>
30380 !! wikitext
30381 == foo<br />bar ==
30382 !! end
30383
30384 !! test
30385 1. WT Quote Tags: suppress newly created empty style tags
30386 !! options
30387 parsoid={
30388 "modes": ["html2wt"],
30389 "scrubWikitext": true
30390 }
30391 !! html/parsoid
30392 <i></i><b></b>
30393 !! wikitext
30394 !! end
30395
30396 !! test
30397 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30398 !! options
30399 parsoid=html2wt
30400 !! html/parsoid
30401 <i></i><b></b>
30402 !! wikitext
30403 ''<nowiki/>'''''<nowiki/>'''
30404 !! end
30405
30406 !! test
30407 3. WT Quote Tags: suppress empty style tags on edits
30408 !! options
30409 parsoid={
30410 "modes": ["selser"],
30411 "scrubWikitext": true,
30412 "changes": [
30413 [ "#x", "remove"]
30414 ]
30415 }
30416 !! wikitext
30417 '''<span id="x">foo</span>'''
30418 !! wikitext/edited
30419 !! end
30420
30421 !! test
30422 1. Anchors: suppress newly created empty anchors
30423 !! options
30424 parsoid={
30425 "modes": ["html2wt"],
30426 "scrubWikitext": true
30427 }
30428 !! html/parsoid
30429 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30430 !! wikitext
30431 !! end
30432
30433 !! test
30434 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30435 !! options
30436 parsoid={
30437 "modes": ["html2wt"],
30438 "scrubWikitext": false
30439 }
30440 !! html/parsoid
30441 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30442 !! wikitext
30443 [[Test|<nowiki/>]]
30444 !! end
30445
30446 !! test
30447 3. Anchors: suppress empty anchors on edits
30448 !! options
30449 parsoid={
30450 "modes": ["selser"],
30451 "scrubWikitext": true,
30452 "changes": [
30453 [ "#x", "remove"]
30454 ]
30455 }
30456 !! wikitext
30457 [[Test|<span id="x">foo</span>]]
30458 !! wikitext/edited
30459 !! end
30460
30461 !! test
30462 3a. Anchors: do not suppress numbered extlinks
30463 !! options
30464 parsoid={
30465 "modes": ["wt2wt"],
30466 "scrubWikitext": true
30467 }
30468 !! wikitext
30469 [http://foo.com]
30470 !! html/parsoid
30471 <a rel="mw:ExtLink" href="http://foo.com"></a>
30472 !! end
30473
30474 !! test
30475 3b. Anchors: do not suppress numbered extlinks
30476 !! options
30477 parsoid={
30478 "modes": ["wt2wt"],
30479 "scrubWikitext": true,
30480 "changes": [
30481 [ "#x", "remove"]
30482 ]
30483 }
30484 !! wikitext
30485 [http://foo.com <span id="x">foo</span>]
30486 !! wikitext/edited
30487 [http://foo.com]
30488 !! end
30489
30490 !!test
30491 Normalizations should be restricted to edited content
30492 !!options
30493 parsoid={
30494 "modes": ["selser"],
30495 "scrubWikitext": true,
30496 "changes": [
30497 [ "h1", "before", "<i></i>"]
30498 ]
30499 }
30500 !!wikitext
30501 a
30502 = =
30503 b
30504 !!wikitext/edited
30505 a
30506 = =
30507 b
30508 !!end
30509
30510 !! test
30511 1. Multiple normalizations (html2wt)
30512 !! options
30513 parsoid={
30514 "modes": ["html2wt"],
30515 "scrubWikitext": true
30516 }
30517 !! html/parsoid
30518 <h2><i></i></h2>
30519 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30520 </a><b><i></i></b>x</p>
30521 !! wikitext
30522
30523 [[foo]]
30524 x
30525
30526 !! end
30527
30528 !! test
30529 2. Multiple normalizations (selser)
30530 !! options
30531 parsoid={
30532 "modes": ["selser"],
30533 "scrubWikitext": true,
30534 "changes": [
30535 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30536 ]
30537 }
30538 !! wikitext
30539 <div id="x">foo</div>
30540 !! wikitext/edited
30541 <div id="x">foo</div>
30542 bar
30543 !! end
30544
30545 !! test
30546 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30547 !! options
30548 parsoid={
30549 "modes": ["html2wt"],
30550 "scrubWikitext": true
30551 }
30552 !! html/parsoid
30553 <p> hi</p>
30554 <p> hello</p>
30555 !! wikitext
30556 hi
30557
30558 hello
30559 !! end
30560
30561 !! test
30562 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30563 !! options
30564 parsoid=html2wt
30565 !! html/parsoid
30566 <p> hi</p>
30567 <p> hello</p>
30568 !! wikitext
30569 <nowiki> </nowiki>hi
30570
30571 <nowiki> </nowiki> hello
30572 !! end
30573
30574 !! test
30575 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30576 !! options
30577 parsoid={
30578 "modes": ["html2wt"],
30579 "scrubWikitext": true
30580 }
30581 !! html/parsoid
30582 <p>Foo
30583 bar
30584 baz</p>
30585
30586 <table><tr><td>Foo
30587 bar
30588 baz bang</td></tr></table>
30589
30590 <p><!--boo--> foo
30591 bar</p>
30592
30593 <p> foo
30594 bar<span>boo</span></p>
30595 !! wikitext
30596 Foo
30597 bar
30598 baz
30599
30600 {|
30601 |Foo
30602 bar
30603 baz bang
30604 |}
30605
30606 <!--boo-->foo
30607 bar
30608
30609 foo
30610 bar<span>boo</span>
30611 !! end
30612
30613 !! test
30614 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30615 !! options
30616 parsoid={
30617 "modes": ["selser"],
30618 "scrubWikitext": true,
30619 "changes": [
30620 [ "p", "html", " a\n b" ]
30621 ]
30622 }
30623 !! wikitext
30624 xyz
30625 !! wikitext/edited
30626 a
30627 b
30628 !! end
30629
30630 !! test
30631 1. New links that end in spaces
30632 !! options
30633 parsoid={
30634 "modes": ["html2wt"],
30635 "scrubWikitext": false
30636 }
30637 !! html/parsoid
30638 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30639 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30640 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30641 !! wikitext
30642 [[Berlin ]]<nowiki/>is the capital of Germany.
30643
30644 [[Foo ]]'''bar'''
30645
30646 [[Boston ]] is a city.
30647 !! end
30648
30649 !! test
30650 2. New links that end in spaces
30651 !! options
30652 parsoid={
30653 "modes": ["html2wt"],
30654 "scrubWikitext": true
30655 }
30656 !! html/parsoid
30657 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30658 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30659 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30660 !! wikitext
30661 [[Berlin]] is the capital of Germany.
30662
30663 [[Foo]] '''bar'''
30664
30665 [[Boston]] is a city.
30666 !! end
30667
30668 !! test
30669 1. Table cells with escapable prefixes
30670 !! options
30671 parsoid={
30672 "modes": ["html2wt"],
30673 "scrubWikitext": false
30674 }
30675 !! html/parsoid
30676 <table>
30677 <tr><td>a</td></tr>
30678 <tr><td>-</td></tr>
30679 <tr><td>+</td></tr>
30680 </table>
30681 !! wikitext
30682 {|
30683 |a
30684 |-
30685 |<nowiki>-</nowiki>
30686 |-
30687 |<nowiki>+</nowiki>
30688 |}
30689 !! end
30690
30691 !! test
30692 2. Table cells with escapable prefixes
30693 !! options
30694 parsoid={
30695 "modes": ["html2wt"],
30696 "scrubWikitext": true
30697 }
30698 !! html/parsoid
30699 <table>
30700 <tr><td>a</td></tr>
30701 <tr><td>-</td></tr>
30702 <tr><td>+</td></tr>
30703 </table>
30704 !! wikitext
30705 {|
30706 |a
30707 |-
30708 | -
30709 |-
30710 | +
30711 |}
30712 !! end
30713
30714 !! test
30715 3a. Table cells with escapable prefixes after edits
30716 !! options
30717 parsoid={
30718 "modes": ["selser"],
30719 "scrubWikitext": true,
30720 "changes": [
30721 [ "table tbody tr:first-child td:first-child", "remove"]
30722 ]
30723 }
30724 !! wikitext
30725 {|
30726 |a||-
30727 |}
30728 !! wikitext/edited
30729 {|
30730 | -
30731 |}
30732 !! end
30733
30734 !! test
30735 3b. Table cells with escapable prefixes after edits
30736 !! options
30737 parsoid={
30738 "modes": ["selser"],
30739 "scrubWikitext": true,
30740 "changes": [
30741 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30742 [ "#x", "remove" ]
30743 ]
30744 }
30745 !! wikitext
30746 {|
30747 |pqr
30748 |<span id="x">foo</span>+
30749 |}
30750 !! wikitext/edited
30751 {|
30752 | -
30753 | +
30754 |}
30755 !! end
30756
30757 # FIXME: This test will fail because
30758 # normalization doesn't realize that the id attribute
30759 # will eliminate the escapable scenario
30760 !! test
30761 4a. Table cells without escapable prefixes after edits
30762 !! options
30763 parsoid={
30764 "modes": ["selser"],
30765 "scrubWikitext": true,
30766 "changes": [
30767 [ "#x", "html", "-" ]
30768 ]
30769 }
30770 !! wikitext
30771 {|
30772 | id="x" |abcd
30773 |}
30774 !! wikitext/edited
30775 {|
30776 | id="x" |-
30777 |}
30778 !! end
30779
30780 ## This tests normalizer's ability to discriminate between
30781 ## cells having identical content.
30782 !! test
30783 4b. Table cells without escapable prefixes after edits
30784 !! options
30785 parsoid={
30786 "modes": ["selser"],
30787 "scrubWikitext": true,
30788 "changes": [
30789 [ "td", "html", "-" ]
30790 ]
30791 }
30792 !! wikitext
30793 {|
30794 |a||b
30795 |}
30796 !! wikitext/edited
30797 {|
30798 | -||-
30799 |}
30800 !! end
30801
30802 ## This tests normalizer's ability to not be tripped by
30803 ## comments (and whitespace)
30804 !! test
30805 4c. Table cells without escapable prefixes after edits
30806 !! options
30807 parsoid={
30808 "modes": ["selser"],
30809 "scrubWikitext": true,
30810 "changes": [
30811 [ "table tbody tr td:first-child", "remove" ]
30812 ]
30813 }
30814 !! wikitext
30815 {|
30816 |-
30817 <!--foo--> |a||-
30818 |}
30819 !! wikitext/edited
30820 {|
30821 |-
30822 <!--foo--> | -
30823 |}
30824 !! end
30825
30826 ## This tests normalizer's ability to handle HTML cells
30827 !! test
30828 4d. Table cells without escapable prefixes after edits
30829 !! options
30830 parsoid={
30831 "modes": ["selser"],
30832 "scrubWikitext": true,
30833 "changes": [
30834 [ "td", "html", "-" ]
30835 ]
30836 }
30837 !! wikitext
30838 <table>
30839 <tr><td>a</td></tr>
30840 </table>
30841 !! wikitext/edited
30842 <table>
30843 <tr><td>-</td></tr>
30844 </table>
30845 !! end
30846
30847 ## T111151 Remove font elements without attributes
30848 !! test
30849 5a. font tags without attributes should be dropped in scrubWikitext mode
30850 !! options
30851 parsoid={
30852 "modes": ["html2wt"],
30853 "scrubWikitext": true
30854 }
30855 !! html/parsoid
30856 <font>foo</font>
30857 <font><font>bar</font></font>
30858 <font class="x">boo</font>
30859 !! wikitext
30860 foo
30861 bar
30862 <font class="x">boo</font>
30863 !! end
30864
30865 !! test
30866 5b. font tags should not be dropped without scrubWikitext being enabled
30867 !! options
30868 parsoid={
30869 "modes": ["html2wt"],
30870 "scrubWikitext": false
30871 }
30872 !! html/parsoid
30873 <font>foo</font>
30874 !! wikitext
30875 <font>foo</font>
30876 !! end
30877
30878 !! test
30879 Escape nowiki DOM elements
30880 !! options
30881 parsoid=html2wt
30882 !! html/parsoid
30883 <nowiki><i>foo</i></nowiki>
30884 !! wikitext
30885 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30886 !! end
30887
30888 # This is meant to be an interim fix while we go about figuring out
30889 # how to not introduce these trailing <nowiki/>s in the first place.
30890 !! test
30891 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30892 !! options
30893 parsoid=html2wt
30894 !! html/parsoid
30895 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30896 y</p>
30897 <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>
30898 <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>
30899 !! wikitext
30900 x
30901 y
30902
30903 {{echo|
30904 1 = <nowiki/>}}
30905
30906 {{echo|
30907 1 = <nowiki/>
30908 }}
30909 !! end
30910
30911 !! test
30912 New list is serialized on newlines
30913 !! options
30914 parsoid=html2wt
30915 !! html/parsoid
30916 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30917 <li>Yesterday</li>
30918 <li>Today</li>
30919 <li>Tomorrow</li>
30920 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30921 !! wikitext
30922 The quick brown fox jumps over the lazy dog.
30923
30924 * Yesterday
30925 * Today
30926 * Tomorrow
30927
30928 The quick onyx goblin jumps over the lazy dwarf.
30929 !! end
30930
30931 !! test
30932 New lists in formatting elements serialized w/o newlines
30933 !! options
30934 parsoid=html2wt
30935 !! html/parsoid
30936 <small>
30937
30938 <ul>
30939 <li>123</li>
30940 </ul>
30941
30942 </small>
30943
30944 <small><ul><li>hi</li></ul></small>
30945 !! wikitext
30946 <small>
30947 * 123
30948 </small>
30949
30950 <small>
30951 * hi
30952 </small>
30953 !! end
30954
30955 !! test
30956 New list in table doesn't need newlines
30957 !! options
30958 parsoid=html2wt
30959 !! html/parsoid
30960 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30961 !! wikitext
30962 {|
30963 |
30964 * test
30965 * 123
30966 |}
30967 !! end
30968
30969 # ---------------------------------------------------
30970 # End of tests spec'ing wikitext serialization norms |
30971 # ---------------------------------------------------
30972
30973 # T104032
30974 !! test
30975 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30976 !! options
30977 parsoid=html2wt
30978 !! html/parsoid
30979 a<p>b</p>
30980 <b>c</b><p>d</p>
30981 <table><tr>
30982 <td>a<p>b</p></td>
30983 <td><b>c</b><p>d</p></td>
30984 </tr></table>
30985 !! wikitext
30986 a
30987
30988 b
30989
30990 '''c'''
30991
30992 d
30993 {|
30994 |a
30995 b
30996 |'''c'''
30997 d
30998 |}
30999 !! end
31000
31001 !! test
31002 Anchor without href scenarios
31003 !! options
31004 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
31005 !! html/parsoid
31006 <a class="bc"></a>
31007 <a class="no">dice</a>
31008 <a name="foo"></a>
31009 !! wikitext
31010
31011 dice
31012 <span name="foo"></span>
31013 !! end
31014
31015 !! test
31016 New transclusion added after a list should be serialized after the list
31017 !! options
31018 parsoid=html2wt
31019 !! html/parsoid
31020 <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>
31021 !! wikitext
31022 * a
31023 {{echo|foo}}
31024 !! end
31025
31026 # -----------------------------------------------------------------
31027 # End of section for Parsoid-only html2wt tests for serialization
31028 # of new content
31029 # -----------------------------------------------------------------
31030
31031 # -----------------------------------------------------------------
31032 # The following section of tests are primarily to spec behavior of
31033 # the selective serializer. All these tests have manual selser
31034 # changes. The automated selser changes for all tests handle the
31035 # wide variation of changes, but these tests here capture specs
31036 # deterministically.
31037 # ----------------------------------------------------------------
31038
31039 ## T90517
31040 !! test
31041 Selser: New comments should not be lost
31042 !! options
31043 parsoid={
31044 "modes": ["selser"],
31045 "changes": [
31046 [ "#a", "after", "<!--c1-->" ],
31047 [ "#b", "before", "<!--c2-->" ]
31048 ]
31049 }
31050 !! wikitext
31051 <span id="a">a</span>
31052
31053 <span id="b">b</span>
31054 !! wikitext/edited
31055 <span id="a">a</span><!--c1-->
31056
31057 <!--c2--><span id="b">b</span>
31058 !! end
31059
31060 ## T89383
31061 !! test
31062 Selser: Check for validity of DSR before using it
31063 !! options
31064 parsoid={
31065 "modes": ["selser"],
31066 "changes": [
31067 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31068 ]
31069 }
31070 !! wikitext
31071 <span id="a">a</span>
31072 !! wikitext/edited
31073 {{DISPLAYTITLE:foo}}
31074 <span id="a">a</span>
31075 !! end
31076
31077 !! test
31078 1. DOMDiff: Changes to <ref> content should be looked up using id
31079 !! options
31080 parsoid={
31081 "modes": ["selser"],
31082 "changes": [
31083 ["#X", "after", "bar"],
31084 ["#Y", "after", "baz"]
31085 ]
31086 }
31087 !! wikitext
31088 X <ref><span id="X">foo</span></ref>
31089 Y <ref name="a" />
31090 <references>
31091 <ref name="a"><span id="Y">foo</span></ref>
31092 </references>
31093 !! wikitext/edited
31094 X <ref><span id="X">foo</span>bar</ref>
31095 Y <ref name="a" />
31096 <references>
31097 <ref name="a"><span id="Y">foo</span>baz</ref>
31098 </references>
31099 !! end
31100
31101 !! test
31102 2. DOMDiff: Changes to <ref> content should be looked up using id
31103 !! options
31104 parsoid={
31105 "modes": ["selser"],
31106 "changes": [
31107 ["#Z", "after", "bar"]
31108 ]
31109 }
31110 !! wikitext
31111 A <ref>foo bar for a</ref>
31112 B <ref group="X" name="b" />
31113
31114 <references />
31115
31116 <references group="X">
31117 <ref name="b"><span id="Z">foo</span></ref>
31118 </references>
31119 !! wikitext/edited
31120 A <ref>foo bar for a</ref>
31121 B <ref group="X" name="b" />
31122
31123 <references />
31124
31125 <references group="X">
31126 <ref name="b"><span id="Z">foo</span>bar</ref>
31127 </references>
31128 !! end
31129
31130 !! test
31131 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31132 !! options
31133 parsoid={
31134 "modes": ["selser"],
31135 "changes": [
31136 [ "div:first-child", "text", "bar" ]
31137 ]
31138 }
31139 !! wikitext
31140 <div style="{{1x|color:red;}}%">foo</div>
31141 !! wikitext/edited
31142 <div style="{{1x|color:red;}}%">bar</div>
31143 !! end
31144
31145 !! test
31146 Empty LI (T49673)
31147 !! wikitext
31148 *a
31149 *
31150 *
31151 *b
31152 !! html+tidy
31153 <ul><li>a</li>
31154 <li class="mw-empty-elt"></li>
31155 <li class="mw-empty-elt"></li>
31156 <li>b</li></ul>
31157 !! end
31158
31159 !! test
31160 Thumbnail output
31161 !! wikitext
31162 [[File:Thumb.png|thumb]]
31163 !! html/php+tidy
31164 <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>
31165 !! html/parsoid
31166 <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>
31167 !! end
31168
31169 !! test
31170 unclosed internal link XSS (T137264)
31171 !! wikitext
31172 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31173 !! html/php
31174 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31175 </p>
31176 !! html/parsoid
31177 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31178 !! end
31179
31180 !! test
31181 Validating that <style> isn't eaten by tidy (T167349)
31182 !! options
31183 styletag=1
31184 !! wikitext
31185 <div class="foo">
31186 <style>.foo::before { content: "<foo>"; }</style>
31187 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31188 </div>
31189 !! html/php+tidy
31190 <div class="foo">
31191 <style>.foo::before { content: "<foo>"; }</style>
31192 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31193 </div>
31194 !! html/parsoid
31195 <div class="foo">
31196 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31197 <style data-x-data-mw-foobar="baz" typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{"data-x-data-mw-foobar":"baz"},"body":{"extsrc":".foo::after { content: \"&lt;bar>\"; }"}}'>.foo::after { content: "<bar>"; }</style>
31198 </div>
31199 !! end
31200
31201 ## Right now, Parsoid doesn't de-duplicate style tags.
31202 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31203 ## In a followup patch, when we de-duplicate style tags and
31204 ## introduce link tags, we'll add a hook for link tags in
31205 ## the parser test runner script.
31206 !! test
31207 Validating that <style> isn't wrapped in a paragraph (T186965)
31208 !! options
31209 styletag=1
31210 !! wikitext
31211 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31212
31213 <style>.foo::before { content: "<foo>"; }</style>
31214
31215 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31216
31217 But if it's on a line with other content, let it be wrapped.
31218
31219 <style>.foo::before { content: "<foo>"; }</style> bar
31220
31221 foo <style>.foo::before { content: "<foo>"; }</style>
31222
31223 foo <style>.foo::before { content: "<foo>"; }</style> bar
31224
31225 And the same if we have non-paragraph-breaking whitespace
31226
31227 foo
31228 <style>.foo::before { content: "<foo>"; }</style>
31229 bar
31230 !! html/php
31231 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31232 </p>
31233 <style>.foo::before { content: "<foo>"; }</style>
31234 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31235 <p>But if it's on a line with other content, let it be wrapped.
31236 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31237 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31238 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31239 </p><p>And the same if we have non-paragraph-breaking whitespace
31240 </p><p>foo
31241 <style>.foo::before { content: "<foo>"; }</style>
31242 bar
31243 </p>
31244 !! html/parsoid
31245 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31246
31247 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31248
31249 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> &lt;link rel="foo" href="bar"/><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
31250
31251 <p>But if it's on a line with other content, let it be wrapped.</p>
31252
31253 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
31254
31255 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
31256
31257 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
31258
31259 <p>And the same if we have non-paragraph-breaking whitespace</p>
31260
31261 <p>foo
31262 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31263 bar</p>
31264 !! end
31265
31266 !! test
31267 Validating that <link> isn't wrapped in a paragraph (T186965)
31268 !! options
31269 styletag=1
31270 !! wikitext
31271 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31272
31273 <link rel="foo" href="bar"/>
31274
31275 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31276
31277 But if it's on a line with other content, let it be wrapped.
31278
31279 <link rel="foo" href="bar"/> bar
31280
31281 foo <link rel="foo" href="bar"/>
31282
31283 foo <link rel="foo" href="bar"/> bar
31284
31285 And the same if we have non-paragraph-breaking whitespace
31286
31287 foo
31288 <link rel="foo" href="bar"/>
31289 bar
31290 !! html/php
31291 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31292 </p>
31293 <link rel="foo" href="bar"/>
31294 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31295 <p>But if it's on a line with other content, let it be wrapped.
31296 </p><p><link rel="foo" href="bar"/> bar
31297 </p><p>foo <link rel="foo" href="bar"/>
31298 </p><p>foo <link rel="foo" href="bar"/> bar
31299 </p><p>And the same if we have non-paragraph-breaking whitespace
31300 </p><p>foo
31301 <link rel="foo" href="bar"/>
31302 bar
31303 </p>
31304 !! end
31305
31306 !! test
31307 Extension returning multiple nodes starting with a style tag roundtrips
31308 !! options
31309 wgRawHtml=1
31310 !! wikitext
31311 <table>
31312 {{echo|<html><style>.hi { color: red; }</style>
31313 </html>}}
31314 <tr><td class="hi">ho</td></tr>
31315 </table>
31316 !! html/parsoid
31317 <p about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;html>&lt;style>.hi { color: red; }&lt;/style>\n&lt;/html>"}},"i":0}},"\n&lt;tr>&lt;td class=\"hi\">ho&lt;/td>&lt;/tr>\n&lt;/table>"]}'><style typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;style>.hi { color: red; }&lt;/style>\n"}}'>.hi { color: red; }</style><span about="#mwt4">
31318 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31319
31320 <tbody><tr><td class="hi">ho</td></tr>
31321 </tbody></table>
31322 !! end
31323
31324 !! test
31325 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31326 !! config
31327 wgFragmentMode=[ 'html5', 'legacy' ]
31328 !! wikitext
31329 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31330 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31331 !! html/php
31332 <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>
31333 <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>
31334 </p>
31335 !! html/parsoid
31336 <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>
31337 <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>
31338 !! end
31339
31340 !! test
31341 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31342 !! config
31343 wgFragmentMode=[ 'legacy' ]
31344 !! wikitext
31345 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31346 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31347 !! html/php
31348 <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>
31349 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31350 </p>
31351 !! end
31352
31353 !! test
31354 Decoding of HTML entities in embedded HTML tags
31355 !! wikitext
31356 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31357 !! html/php
31358 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31359
31360 !! html/parsoid
31361 <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>
31362 !! end
31363
31364 !! test
31365 Decoding of HTML entities in indicator names for IDs (T104196)
31366 !! options
31367 parsoid=wt2html,html2html
31368 showindicators
31369 !! wikitext
31370 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31371 !! html/php
31372 1&2&3&amp;4&amp;amp;5=Indicator
31373
31374 !! html/parsoid
31375 <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>
31376 !! end
31377
31378 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31379 !! test
31380 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31381 !! options
31382 showindicators
31383 !! wikitext
31384 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31385 !! html/php
31386 1&2&3&amp;4&amp;amp;5=Indicator
31387
31388 !! html/parsoid
31389 <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>
31390 !! end
31391
31392 # This fragment mode is what Parsoid supports.
31393 !! test
31394 HTML5 ids: fallback to legacy
31395 !! config
31396 wgFragmentMode=[ 'html5', 'legacy' ]
31397 !! wikitext
31398 ==Foo bar==
31399
31400 ==foo Bar==
31401
31402 ==Тест==
31403
31404 ==Тест==
31405
31406 ==тест==
31407
31408 ==Hey < # " > % : '==
31409 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31410
31411 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31412
31413 <!-- These two links should produce identical HTML -->
31414 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31415
31416 !! html/php
31417 <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>
31418 <ul>
31419 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31420 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31421 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31422 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31423 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31424 <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>
31425 </ul>
31426 </div>
31427
31428 <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>
31429 <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>
31430 <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>
31431 <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>
31432 <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>
31433 <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>
31434 <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>
31435 </p><p>💩 <span id="💩"></span>
31436 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31437 </p>
31438 !! html/parsoid
31439 <h2 id="Foo_bar">Foo bar</h2>
31440
31441 <h2 id="foo_Bar_2">foo Bar</h2>
31442
31443 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31444
31445 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31446
31447 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31448
31449 <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>
31450 <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>
31451
31452 <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>
31453
31454 <!-- These two links should produce identical HTML -->
31455 <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>
31456 !! end
31457
31458 # Parsoid doesn't support this mode
31459 !! test
31460 HTML5 ids: legacy with a fallback to modern
31461 !! config
31462 wgFragmentMode=[ 'legacy', 'html5' ]
31463 !! wikitext
31464 ==Foo bar==
31465
31466 ==foo Bar==
31467
31468 ==Тест==
31469
31470 ==Тест==
31471
31472 ==тест==
31473
31474 ==Hey < # " > % : '==
31475 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31476
31477 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31478
31479 <!-- These two links should produce identical HTML -->
31480 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31481
31482 !! html/php
31483 <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>
31484 <ul>
31485 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31486 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31487 <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>
31488 <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>
31489 <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>
31490 <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>
31491 </ul>
31492 </div>
31493
31494 <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>
31495 <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>
31496 <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>
31497 <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>
31498 <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>
31499 <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>
31500 <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>
31501 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31502 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31503 </p>
31504 !! end
31505
31506 # Parsoid doesn't support this mode.
31507 !! test
31508 HTML5 ids: no legacy
31509 !! config
31510 wgFragmentMode=[ 'html5' ]
31511 !! wikitext
31512 ==Foo bar==
31513
31514 ==foo Bar==
31515
31516 ==Тест==
31517
31518 ==Тест==
31519
31520 ==тест==
31521
31522 ==Hey < # " > % : '==
31523 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31524
31525 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31526
31527 <!-- These two links should produce identical HTML -->
31528 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31529
31530 !! html/php
31531 <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>
31532 <ul>
31533 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31534 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31535 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31536 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31537 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31538 <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>
31539 </ul>
31540 </div>
31541
31542 <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>
31543 <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>
31544 <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>
31545 <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>
31546 <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>
31547 <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>
31548 <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>
31549 </p><p>💩 <span id="💩"></span>
31550 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31551 </p>
31552 !! end
31553
31554 !! test
31555 T90902: Normalize weird characters in section IDs
31556 !! config
31557 wgFragmentMode=[ 'html5', 'legacy' ]
31558 !! wikitext
31559 ==Foo&nbsp;bar==
31560 [[#Foo&nbsp;bar]]
31561
31562 !! html/php
31563 <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>
31564 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31565 </p>
31566 !! html/parsoid
31567 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31568 <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>
31569 !! end
31570
31571 !! test
31572 T51672: Test for brackets in attributes of elements in external link texts
31573 !! wikitext
31574 [http://example.com/ link <span title="title with [brackets]">span</span>]
31575 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31576
31577 !! html/php
31578 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31579 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31580 </p>
31581 !! html/parsoid
31582 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31583 <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>
31584 !! end
31585
31586 !! test
31587 T72875: Test for brackets in attributes of elements in internal link texts
31588 !! wikitext
31589 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31590 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31591
31592 !! html/php
31593 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31594 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31595 </p>
31596 !! html/parsoid
31597 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31598 <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>
31599 !! end
31600
31601 !! test
31602 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31603 !! options
31604 parsoid={
31605 "modes": ["html2wt"]
31606 }
31607 !! html/parsoid
31608 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31609 <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>
31610 !! wikitext
31611 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31612 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31613 !! end
31614
31615 !! test
31616 T179544: {{anchorencode:}} output should be always usable in links
31617 !! config
31618 wgFragmentMode=[ 'html5' ]
31619 !! wikitext
31620 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31621 !! html/php
31622 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31623 </p>
31624 !! html/parsoid
31625 <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>
31626 !! end
31627
31628 ## ------------------------------
31629 ## Parsoid section-wrapping tests
31630 ## ------------------------------
31631 !! test
31632 Section wrapping for well-nested sections (no leading content)
31633 !! options
31634 parsoid={
31635 "wrapSections": true
31636 }
31637 !! wikitext
31638 =1=
31639 a
31640
31641 =2=
31642 b
31643
31644 ==2.1==
31645 c
31646
31647 ==2.2==
31648 d
31649
31650 ===2.2.1===
31651 e
31652
31653 =3=
31654 f
31655 !! html/parsoid
31656 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31657 <p>a</p>
31658
31659 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31660 <p>b</p>
31661
31662 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31663 <p>c</p>
31664
31665 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31666 <p>d</p>
31667
31668 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31669 <p>e</p>
31670
31671 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31672 <p>f</p>
31673
31674 </section>
31675 !! end
31676
31677 !! test
31678 Section wrapping for well-nested sections (with leading content)
31679 !! options
31680 parsoid={
31681 "wrapSections": true
31682 }
31683 !! wikitext
31684 Para 1.
31685
31686 Para 2 with a <div>nested in it</div>
31687
31688 Para 3.
31689
31690 =1=
31691 a
31692
31693 =2=
31694 b
31695
31696 ==2.1==
31697 c
31698 !! html/parsoid
31699 <section data-mw-section-id="0"><p>Para 1.</p>
31700
31701 <p>Para 2 with a </p><div>nested in it</div>
31702
31703 <p>Para 3.</p>
31704
31705 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31706 <p>a</p>
31707
31708 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31709 <p>b</p>
31710
31711 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31712 <p>c</p>
31713
31714 </section></section>
31715 !! end
31716
31717 !! test
31718 Section wrapping with template-generated sections (good nesting 1)
31719 !! options
31720 parsoid={
31721 "wrapSections": true
31722 }
31723 !! wikitext
31724 =1=
31725 a
31726
31727 {{echo|1=
31728 ==1.1==
31729 b
31730 }}
31731
31732 ==1.2==
31733 c
31734
31735 =2=
31736 d
31737 !! html/parsoid
31738 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31739 <p>a</p>
31740
31741 <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">
31742 </span><p about="#mwt1">b</p>
31743 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31744 <p>c</p>
31745
31746 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31747 <p>d</p></section>
31748 !! end
31749
31750 # In this example, the template scope is mildly expanded to incorporate the
31751 # trailing newline after the transclusion since that is part of section 1.1.1
31752 !! test
31753 Section wrapping with template-generated sections (good nesting 2)
31754 !! options
31755 parsoid={
31756 "wrapSections": true,
31757 "modes": ["wt2html", "wt2wt"]
31758 }
31759 !! wikitext
31760 =1=
31761 a
31762
31763 {{echo|1=
31764 ==1.1==
31765 b
31766 ===1.1.1===
31767 d
31768 }}
31769 =2=
31770 e
31771 !! html/parsoid
31772 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31773 <p>a</p>
31774
31775 <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">
31776 </span><p about="#mwt1">b</p><span about="#mwt1">
31777 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31778 </span><p about="#mwt1">d</p><span about="#mwt1">
31779 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31780 <p>e</p></section>
31781 !! end
31782
31783 # In this example, the template scope is mildly expanded to incorporate the
31784 # trailing newline after the transclusion since that is part of section 1.2.1
31785 !! test
31786 Section wrapping with template-generated sections (good nesting 3)
31787 !! options
31788 parsoid={
31789 "wrapSections": true,
31790 "modes": ["wt2html", "wt2wt"]
31791 }
31792 !! wikitext
31793 =1=
31794 a
31795
31796 {{echo|1=
31797 x
31798 ==1.1==
31799 b
31800 ==1.2==
31801 c
31802 ===1.2.1===
31803 d
31804 }}
31805 =2=
31806 e
31807 !! html/parsoid
31808 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31809 <p>a</p>
31810
31811 <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">
31812 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31813 </span><p about="#mwt1">b</p><span about="#mwt1">
31814 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31815 </span><p about="#mwt1">c</p><span about="#mwt1">
31816 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31817 </span><p about="#mwt1">d</p><span about="#mwt1">
31818 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31819 <p>e</p></section>
31820 !! end
31821
31822 # Because of section-wrapping and template-wrapping interactions,
31823 # the scope of the template is expanded so that the template markup
31824 # is valid in the presence of <section> tags.
31825 # This exercises the s1 is null scenario in the wrapSections code
31826 !! test
31827 Section wrapping with template-generated sections (bad nesting 1)
31828 !! options
31829 parsoid={
31830 "wrapSections": true
31831 }
31832 !! wikitext
31833 <div>
31834 a
31835
31836 {{echo|
31837 =1=
31838 b
31839 }}
31840
31841 c
31842 </div>
31843 !! html/parsoid
31844 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31845 <p>a</p>
31846
31847 <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"]}'>
31848 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31849 </span><p about="#mwt1">b
31850 </p><span about="#mwt1">
31851
31852 </span><p about="#mwt1">c</p><span about="#mwt1">
31853 </span></section></div></section>
31854 !! end
31855
31856 # Because of section-wrapping and template-wrapping interactions,
31857 # the scope of the template is expanded so that the template markup
31858 # is valid in the presence of <section> tags.
31859 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31860 !! test
31861 Section wrapping with template-generated sections (bad nesting 2)
31862 !! options
31863 parsoid={
31864 "wrapSections": true
31865 }
31866 !! wikitext
31867 =1=
31868 a
31869
31870 {{echo|1=
31871 =2=
31872 b
31873 ==2.1==
31874 c
31875 }}
31876
31877 d
31878
31879 =3=
31880 e
31881 !! html/parsoid
31882 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31883 <p>a</p>
31884
31885 </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">
31886 </span><p about="#mwt1">b</p><span about="#mwt1">
31887 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31888 </span><p about="#mwt1">c</p><span about="#mwt1">
31889
31890 </span><p about="#mwt1">d</p><span about="#mwt1">
31891
31892 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31893 <p>e</p></section>
31894 !! end
31895
31896 # Because of section-wrapping and template-wrapping interactions,
31897 # additional template wrappers are added to <section> tags
31898 # so that template wrapping semantics are valid whether section
31899 # tags are retained or stripped. But, the template scope can expand
31900 # greatly when accounting for section tags.
31901 # This exercises the s1 and s2 are in different subtrees scenario
31902 !! test
31903 Section wrapping with template-generated sections (bad nesting 3)
31904 !! options
31905 parsoid={
31906 "wrapSections": true,
31907 "modes": ["wt2html", "wt2wt"]
31908 }
31909 !! wikitext
31910 =1=
31911 a
31912
31913 {{echo|1=
31914 ==1.2==
31915 b
31916 =2=
31917 c
31918 }}
31919
31920 d
31921
31922 =3=
31923 e
31924 !! html/parsoid
31925 <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>
31926 <p>a</p>
31927
31928 <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">
31929 </span><p about="#mwt1">b</p><span about="#mwt1">
31930 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31931 </span><p about="#mwt1">c</p>
31932
31933 <p>d</p>
31934 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31935 <p>e</p></section>
31936 !! end
31937
31938 !! test
31939 Section wrapping with uneditable lead section + div wrapping multiple sections
31940 !! options
31941 parsoid={
31942 "wrapSections": true
31943 }
31944 !! wikitext
31945 foo
31946
31947 <div style="border:1px solid red;">
31948 =1=
31949 a
31950
31951 ==1.1==
31952 b
31953
31954 =2=
31955 c
31956 </div>
31957
31958 =3=
31959 d
31960
31961 ==3.1==
31962 e
31963 !! html/parsoid
31964 <section data-mw-section-id="-1"><p>foo</p>
31965
31966 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31967 <section data-mw-section-id="1"><h1 id="1">1</h1>
31968 <p>a</p>
31969
31970 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31971 <p>b</p>
31972
31973 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31974 <p>c</p>
31975 </section></div>
31976
31977 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31978 <p>d</p>
31979
31980 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31981 <p>e</p>
31982 </section></section>
31983 !! end
31984
31985 !! test
31986 Section wrapping with editable lead section + div overlapping multiple sections
31987 !! options
31988 parsoid={
31989 "wrapSections": true
31990 }
31991 !! wikitext
31992 foo
31993
31994 =1=
31995 a
31996 <div style="border:1px solid red;">
31997 b
31998
31999 ==1.1==
32000 c
32001
32002 =2=
32003 d
32004 </div>
32005 e
32006
32007 =3=
32008 f
32009
32010 ==3.1==
32011 g
32012 !! html/parsoid
32013 <section data-mw-section-id="0"><p>foo</p>
32014
32015 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
32016 <p>a</p>
32017 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32018 <p>b</p>
32019
32020 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
32021 <p>c</p>
32022
32023 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
32024 <p>d</p>
32025 </section></div>
32026 <p>e</p>
32027
32028 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
32029 <p>f</p>
32030
32031 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
32032 <p>g</p>
32033 </section></section>
32034 !! end
32035
32036 !! test
32037 HTML header tags should not be wrapped in section tags
32038 !! options
32039 parsoid={
32040 "wrapSections": true
32041 }
32042 !! wikitext
32043 foo
32044
32045 <h1>a</h1>
32046
32047 =b=
32048
32049 <h1>c</h1>
32050
32051 =d=
32052 !! html/parsoid
32053 <section data-mw-section-id="0"><p>foo</p>
32054
32055 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32056
32057 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
32058
32059 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32060
32061 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
32062 !! end
32063
32064 !! test
32065 Lead section containing only whitespace and comments.
32066 !! options
32067 parsoid={
32068 "wrapSections": true
32069 }
32070 !! wikitext
32071
32072 <!-- this is a comment, presumably significant to editors -->
32073 =1=
32074 a
32075
32076 =2=
32077 b
32078 !! html/parsoid
32079 <section data-mw-section-id="0" data-parsoid="{}">
32080 <!-- this is a comment, presumably significant to editors -->
32081 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
32082 <p>a</p>
32083
32084 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
32085 <p>b</p></section>
32086 !! end
32087
32088 !! test
32089 Pseudo-sections emitted by templates should have id -2
32090 !! options
32091 parsoid={
32092 "wrapSections": true
32093 }
32094 !! wikitext
32095 foo
32096 {{echo|<div>
32097 ==a==
32098 ==b==
32099 </div>
32100 }}
32101 !! html/parsoid
32102 <section data-mw-section-id="-1"><p>foo</p>
32103 </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}}]}'>
32104 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32105 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32106 </section></div><span about="#mwt1">
32107 </span></section>
32108 !! end
32109
32110 ##########################################################################
32111 Tests demonstrating white-space insensitivity in input wikitext
32112 for wikitext headings, wikitext list items, and wikitext table captions,
32113 headings, and cells. HTML versions of the same should preserve whitespace.
32114 ##########################################################################
32115 !! test
32116 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32117 !! options
32118 parsoid={
32119 "modes": ["wt2html"],
32120 "preserveIEW": true
32121 }
32122 !! wikitext
32123 __NOTOC__
32124 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32125 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32126 == <!--Headings with fallback ids--> Личная жизнь ==
32127 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32128 ; <!--term to define--> term : <!--term's definition--> definition
32129 {|
32130 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32131 |-
32132 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32133 |-
32134 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32135 |-
32136 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32137 |-
32138 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32139 |}
32140 : {|
32141 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32142 |} foo <!--c1-->
32143 !! html/php+tidy
32144 <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>
32145 <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>
32146 <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>
32147 <ul><li>List item</li></ul>
32148 <dl><dt>term&#160;</dt>
32149 <dd>definition</dd></dl>
32150 <table>
32151 <caption>Table Caption
32152 </caption>
32153 <tbody><tr>
32154 <th>Table Heading 1</th>
32155 <th>Table Heading 2
32156 </th></tr>
32157 <tr>
32158 <td>Table Cell 1</td>
32159 <td>Table Cell 2
32160 </td></tr>
32161 <tr>
32162 <td>class="foo"</td>
32163 <td>Table Cell 3
32164 </td></tr>
32165 <tr>
32166 <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
32167 </td></tr></tbody></table>
32168 <dl><dd><table>
32169 <tbody><tr>
32170 <td>Table Cell 1</td>
32171 <td>Table Cell 2
32172 </td></tr></tbody></table> foo</dd></dl>
32173 !! html/parsoid
32174 <meta property="mw:PageProp/notoc">
32175 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32176 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32177 <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>
32178 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32179 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32180 <table>
32181 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32182 <tbody><tr>
32183 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32184 <tr>
32185 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32186 <tr>
32187 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32188 <tr>
32189 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32190 </tbody></table>
32191 <dl><dd><table>
32192 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32193 </tbody></table> foo<!--c1--></dd></dl>
32194 !! end
32195
32196 # Looks like <caption> is not accepted in HTML
32197 !! test
32198 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32199 !! options
32200 parsoid={
32201 "modes": ["wt2html"],
32202 "preserveIEW": true
32203 }
32204 !! wikitext
32205 __NOTOC__
32206 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32207 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32208 <table>
32209 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32210 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32211 </table>
32212 !! html/php+tidy
32213 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32214 <ul><li> List item </li></ul>
32215 <table>
32216 <tbody><tr><th> Table Heading </th><th></th></tr>
32217 <tr><td> Table Cell </td><th></th></tr>
32218 </tbody></table>
32219 !! html/parsoid
32220 <meta property="mw:PageProp/notoc"/>
32221 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32222 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32223 <table>
32224 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32225 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32226 </tbody></table>
32227 !! end
32228
32229 !! test
32230 Do not trim whitespace in links and quotes
32231 !! options
32232 parsoid={
32233 "modes": ["wt2html"],
32234 "preserveIEW": true
32235 }
32236 !! wikitext
32237 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32238 [[Foo| some text ]]
32239 !! html/php+tidy
32240 <p>foo <i> italic </i> and <b> bold </b>
32241 <a href="/wiki/Foo" title="Foo"> some text </a>
32242 </p>
32243 !! html/parsoid
32244 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32245 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32246 !! end
32247
32248 !! test
32249 Remove p tags surrounding a single element in a figcaption
32250 !! options
32251 parsoid=html2wt
32252 !! wikitext
32253 [[File:Foobar.jpg|right|200x200px|Caption]]
32254 !! html/parsoid
32255 <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>
32256 !! end
32257
32258 !! test
32259 Selser preserves lack of newline before list and allows newline after the list
32260 !! options
32261 parsoid={
32262 "modes": ["selser"],
32263 "scrubWikitext": true,
32264 "changes": [
32265 [ "ul", "after", "<p>footer</p>" ]
32266 ]
32267 }
32268 !! wikitext
32269 header
32270 *foo
32271 *bar
32272 !! wikitext/edited
32273 header
32274 *foo
32275 *bar
32276
32277 footer
32278 !! end
32279
32280
32281 !! test
32282 Selser does not introduce newlines between unedited paragraph preceding the list
32283 !! options
32284 parsoid={
32285 "modes": ["selser"],
32286 "changes": [
32287 [ "table tbody tr td p:last-child", "empty" ]
32288 ]
32289 }
32290 !! wikitext
32291 {|
32292 |
32293 header
32294 *foo
32295 *bar
32296 footer
32297 |}
32298 !! wikitext/edited
32299 {|
32300 |
32301 header
32302 *foo
32303 *bar
32304
32305 |}
32306 !! end
32307
32308 !! test
32309 Selser does not introduce newlines between unedited paragraph following the list
32310 !! options
32311 parsoid={
32312 "modes": ["selser"],
32313 "changes": [
32314 [ "table tbody tr td p:first-child", "empty" ]
32315 ]
32316 }
32317 !! wikitext
32318 {|
32319 |
32320 header
32321 *foo
32322 *bar
32323 footer
32324 |}
32325 !! wikitext/edited
32326 {|
32327 |
32328
32329 *foo
32330 *bar
32331 footer
32332 |}
32333 !! end
32334
32335 !! test
32336 Remove a list item but do not insert newline above list
32337 !! options
32338 parsoid={
32339 "modes": ["selser"],
32340 "changes": [
32341 [ "ul li:last-child", "remove" ]
32342 ]
32343 }
32344 !! wikitext
32345 header
32346 *foo
32347 *bar
32348 footer
32349 !! wikitext/edited
32350 header
32351 *foo
32352 footer
32353 !! end