Merge "Fix global variable name typo in LocalIdLookupTest.php"
[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/ParserTestParserHook.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 class="one two" typeof="mw:Extension/pre" about="#mwt2" 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:Extension/pre mw:Transclusion" 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 class="123" typeof="mw:Extension/pre" about="#mwt2" 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 !! test
6277 A table with stray table end tags on start tag line (wt2html)
6278 !! options
6279 parsoid=wt2html
6280 !! wikitext
6281 {|style="color: red;"|}
6282
6283 {|style="color: red;" |}
6284 |foo
6285 |}
6286
6287 {|style="color: red;"|} id="foo"
6288 |foo
6289 |}
6290
6291 {|style="color: red;" |} id="foo"
6292 |foo
6293 |}
6294 !! html/php+tidy
6295 <table style="color: red;">
6296
6297 </table><table style="color: red;">
6298 <tbody><tr>
6299 <td>foo
6300 </td></tr></tbody></table>
6301 <table style="color: red;" id="foo">
6302 <tbody><tr>
6303 <td>foo
6304 </td></tr></tbody></table>
6305 <table style="color: red;" id="foo">
6306 <tbody><tr>
6307 <td>foo
6308 </td></tr></tbody></table>
6309 !! html/parsoid
6310 <table style="color: red;"></table>
6311
6312 <table style="color: red;">
6313 <tbody><tr>
6314 <td>foo</td>
6315 </tr></tbody>
6316 </table>
6317
6318 <table style="color: red;" id="foo">
6319 <tbody><tr>
6320 <td>foo</td>
6321 </tr></tbody>
6322 </table>
6323
6324 <table style="color: red;" id="foo">
6325 <tbody><tr>
6326 <td>foo</td>
6327 </tr></tbody>
6328 </table>
6329
6330 !! end
6331
6332 !! test
6333 A table with no data (take 2)
6334 !! wikitext
6335 {|
6336 |}
6337 !! html/parsoid
6338 <table></table>
6339 !! end
6340
6341 # A table with nothing but a caption is invalid XHTML, we might want to render
6342 # this as <p>caption</p>
6343 # Parsoid team replies: table with only a caption is legal in HTML5
6344 !! test
6345 A table with nothing but a caption
6346 !! wikitext
6347 {|
6348 |+caption
6349 |}
6350 !! html/php
6351 <table>
6352 <caption>caption
6353 </caption><tr><td></td></tr></table>
6354
6355 !! html/parsoid
6356 <table><caption>caption</caption></table>
6357 !! end
6358
6359 !! test
6360 A table with caption with default-spaced attributes and a table row
6361 !! wikitext
6362 {|
6363 |+ style="color: red;" |caption1
6364 |-
6365 |foo
6366 |}
6367 !! html
6368 <table>
6369 <caption style="color: red;">caption1
6370 </caption>
6371 <tr>
6372 <td>foo
6373 </td></tr></table>
6374
6375 !! end
6376
6377 !! test
6378 A table with captions with non-default spaced attributes and a table row
6379 !! wikitext
6380 {|
6381 |+style="color: red;"|caption2
6382 |+ style="color: red;"|caption3
6383 |-
6384 |foo
6385 |}
6386 !! html
6387 <table>
6388 <caption style="color: red;">caption2
6389 </caption>
6390 <caption style="color: red;">caption3
6391 </caption>
6392 <tr>
6393 <td>foo
6394 </td></tr></table>
6395
6396 !! end
6397
6398 !! test
6399 Table td-cell syntax variations
6400 !! wikitext
6401 {|
6402 |foo bar foo|baz
6403 |foo bar foo||baz
6404 |style='color:red;'|baz
6405 |style='color:red;'||baz
6406 |}
6407 !! html
6408 <table>
6409 <tr>
6410 <td>baz
6411 </td>
6412 <td>foo bar foo</td>
6413 <td>baz
6414 </td>
6415 <td style="color:red;">baz
6416 </td>
6417 <td>style='color:red;'</td>
6418 <td>baz
6419 </td></tr></table>
6420
6421 !! end
6422
6423 !! test
6424 Simple table
6425 !! wikitext
6426 {|
6427 |1||2
6428 |-
6429 |3||4
6430 |}
6431 !! html
6432 <table>
6433 <tr>
6434 <td>1</td>
6435 <td>2
6436 </td></tr>
6437 <tr>
6438 <td>3</td>
6439 <td>4
6440 </td></tr></table>
6441
6442 !! end
6443
6444 !! test
6445 Simple table but with multiple dashes for row wikitext
6446 !! wikitext
6447 {|
6448 |foo
6449 |-----
6450 |bar
6451 |}
6452 !! html
6453 <table>
6454 <tr>
6455 <td>foo
6456 </td></tr>
6457 <tr>
6458 <td>bar
6459 </td></tr></table>
6460
6461 !! end
6462
6463 !! test
6464 Multiplication table
6465 !! wikitext
6466 {| border="1" cellpadding="2"
6467 |+Multiplication table
6468 |-
6469 !&times;!!1!!2!!3
6470 |-
6471 !1
6472 |1||2||3
6473 |-
6474 !2
6475 |2||4||6
6476 |-
6477 !3
6478 |3||6||9
6479 |-
6480 !4
6481 |4||8||12
6482 |-
6483 !5
6484 |5||10||15
6485 |}
6486 !! html
6487 <table border="1" cellpadding="2">
6488 <caption>Multiplication table
6489 </caption>
6490 <tr>
6491 <th>&#215;</th>
6492 <th>1</th>
6493 <th>2</th>
6494 <th>3
6495 </th></tr>
6496 <tr>
6497 <th>1
6498 </th>
6499 <td>1</td>
6500 <td>2</td>
6501 <td>3
6502 </td></tr>
6503 <tr>
6504 <th>2
6505 </th>
6506 <td>2</td>
6507 <td>4</td>
6508 <td>6
6509 </td></tr>
6510 <tr>
6511 <th>3
6512 </th>
6513 <td>3</td>
6514 <td>6</td>
6515 <td>9
6516 </td></tr>
6517 <tr>
6518 <th>4
6519 </th>
6520 <td>4</td>
6521 <td>8</td>
6522 <td>12
6523 </td></tr>
6524 <tr>
6525 <th>5
6526 </th>
6527 <td>5</td>
6528 <td>10</td>
6529 <td>15
6530 </td></tr></table>
6531
6532 !! end
6533
6534 !! test
6535 Accept "||" in table headings
6536 !! wikitext
6537 {|
6538 !h1||h2
6539 |}
6540 !! html
6541 <table>
6542 <tr>
6543 <th>h1</th>
6544 <th>h2
6545 </th></tr></table>
6546
6547 !! end
6548
6549 !! test
6550 Accept "!!" in table data
6551 !! wikitext
6552 {|
6553 |Foo!!||
6554 |}
6555 !! html
6556 <table>
6557 <tr>
6558 <td>Foo!!</td>
6559 <td>
6560 </td></tr></table>
6561
6562 !! html/parsoid
6563 <table>
6564 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6565 </tbody></table>
6566 !! end
6567
6568 !! test
6569 Accept "||" in indented table headings
6570 !! wikitext
6571 :{|
6572 !h1||h2
6573 |}
6574 !! html
6575 <dl><dd><table>
6576 <tr>
6577 <th>h1</th>
6578 <th>h2
6579 </th></tr></table></dd></dl>
6580
6581 !! end
6582
6583 !! test
6584 Accept "!!" in templates
6585 !! wikitext
6586 {|
6587 !a {{echo|b!!c}}
6588 |}
6589 !! html/php
6590 <table>
6591 <tr>
6592 <th>a b</th>
6593 <th>c
6594 </th></tr></table>
6595
6596 !! html/parsoid
6597 <table>
6598 <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>
6599 !! end
6600
6601 !! test
6602 Accept "!!" in table headings after newline
6603 !! wikitext
6604 {|
6605 !a
6606 b!!c
6607 |}
6608 !! html/php
6609 <table>
6610 <tr>
6611 <th>a
6612 <p>b!!c
6613 </p>
6614 </th></tr></table>
6615
6616 !! html/parsoid
6617 <table>
6618 <tbody><tr><th>a
6619 <p>b!!c</p></th></tr>
6620 </tbody></table>
6621 !! end
6622
6623 !! test
6624 Accept "!!" in table data of mixed wikitext / html syntax
6625 !! wikitext
6626 {|
6627 !a
6628 <tr><td>b!!c</td></tr>
6629 |}
6630 !! html/php+tidy
6631 <table>
6632 <tbody><tr>
6633 <th>a
6634 </th></tr><tr><td>b!!c</td></tr>
6635 </tbody></table>
6636 !! html/parsoid
6637 <table>
6638 <tbody><tr><th>a</th></tr>
6639 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6640 </tbody></table>
6641 !! end
6642
6643 !! test
6644 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6645 !! wikitext
6646 {|
6647 !|h1
6648 ||a
6649 |}
6650 !! html
6651 <table>
6652 <tr>
6653 <th>h1
6654 </th>
6655 <td>a
6656 </td></tr></table>
6657
6658 !! end
6659
6660 !!test
6661 Accept "| !" at start of line in tables (ignore !-attribute)
6662 !! wikitext
6663 {|
6664 |-
6665 |!style="color:red"|bar
6666 |}
6667 !! html
6668 <table>
6669
6670 <tr>
6671 <td>bar
6672 </td></tr></table>
6673
6674 !!end
6675
6676 !!test
6677 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 +/-
6678 !! wikitext
6679 {|
6680 |-
6681 |style='color:red;'|+1
6682 |style='color:blue;'|-1
6683 |-
6684 |1||2||3
6685 |1||+2||-3
6686 |-
6687 | +1
6688 | -1
6689 |}
6690 !! html
6691 <table>
6692
6693 <tr>
6694 <td style="color:red;">+1
6695 </td>
6696 <td style="color:blue;">-1
6697 </td></tr>
6698 <tr>
6699 <td>1</td>
6700 <td>2</td>
6701 <td>3
6702 </td>
6703 <td>1</td>
6704 <td>+2</td>
6705 <td>-3
6706 </td></tr>
6707 <tr>
6708 <td>+1
6709 </td>
6710 <td>-1
6711 </td></tr></table>
6712
6713 !!end
6714
6715 !! test
6716 Table rowspan
6717 !! wikitext
6718 {| border=1
6719 |Cell 1, row 1
6720 |rowspan=2|Cell 2, row 1 (and 2)
6721 |Cell 3, row 1
6722 |-
6723 |Cell 1, row 2
6724 |Cell 3, row 2
6725 |}
6726 !! html
6727 <table border="1">
6728 <tr>
6729 <td>Cell 1, row 1
6730 </td>
6731 <td rowspan="2">Cell 2, row 1 (and 2)
6732 </td>
6733 <td>Cell 3, row 1
6734 </td></tr>
6735 <tr>
6736 <td>Cell 1, row 2
6737 </td>
6738 <td>Cell 3, row 2
6739 </td></tr></table>
6740
6741 !! end
6742
6743 !! test
6744 Nested table
6745 !! wikitext
6746 {| border=1
6747 | &alpha;
6748 |
6749 {| bgcolor=#ABCDEF border=2
6750 |nested
6751 |-
6752 |table
6753 |}
6754 |the original table again
6755 |}
6756 !! html
6757 <table border="1">
6758 <tr>
6759 <td>&#945;
6760 </td>
6761 <td>
6762 <table bgcolor="#ABCDEF" border="2">
6763 <tr>
6764 <td>nested
6765 </td></tr>
6766 <tr>
6767 <td>table
6768 </td></tr></table>
6769 </td>
6770 <td>the original table again
6771 </td></tr></table>
6772
6773 !! end
6774
6775 !! test
6776 Invalid attributes in table cell (T3830)
6777 !! wikitext
6778 {|
6779 |Cell:|broken
6780 |}
6781 !! html
6782 <table>
6783 <tr>
6784 <td>broken
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6791 !! wikitext
6792 {|
6793 |title="foo" |bar
6794 |title="foo<nowiki>|</nowiki>" |bar
6795 |title="foo<nowiki>|</nowiki>" bar
6796 |}
6797 !! html/php
6798 <table>
6799 <tr>
6800 <td title="foo">bar
6801 </td>
6802 <td title="foo&#124;">bar
6803 </td>
6804 <td>title="foo|" bar
6805 </td></tr></table>
6806
6807 !! html/parsoid
6808 <table>
6809 <tbody><tr><td title="foo">bar</td>
6810 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6811 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6812 </tbody></table>
6813 !! end
6814
6815 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6816 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6817 # *2wt modes will fail.
6818 !! test
6819 Table security: embedded pipes
6820 !! options
6821 parsoid=wt2html,html2html
6822 !! wikitext
6823 {|
6824 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6825 !! html/php
6826 <table>
6827 <tr>
6828 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6829 <td>]" onmouseover="alert(document.cookie)"&gt;test
6830 </td>
6831 </tr>
6832 </table>
6833
6834 !! html/parsoid
6835 <table><tbody>
6836 <tr>
6837 <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>
6838 !! end
6839
6840 !! test
6841 Element attributes with double ! should not be broken up by <th>
6842 !! wikitext
6843 {|
6844 !hi <div class="!!">ha</div> ho
6845 |}
6846 !! html/php
6847 <table>
6848 <tr>
6849 <th>hi <div class="!!">ha</div> ho
6850 </th></tr></table>
6851
6852 !! html/parsoid
6853 <table>
6854 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6855 </tbody></table>
6856 !! end
6857
6858 !! test
6859 ! and || in element attributes should not be parsed as <th>/<td>
6860 !! wikitext
6861 {|
6862 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6863 |}
6864 !! html/php
6865 <table>
6866 <tr>
6867 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6868 </td></tr></table>
6869
6870 !! html/parsoid
6871 <table>
6872 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6873 </tbody></table>
6874 !! end
6875
6876 # FIXME: The output seems broken. Filed as T110268.
6877 !! test
6878 ! and || in td attributes should not be parsed as <th>/<td>
6879 !! options
6880 parsoid=wt2html
6881 !! wikitext
6882 {|
6883 |style="color: red !important;" data-contrived="put this here ||"|foo
6884 |}
6885 !! html/php
6886 <table>
6887 <tr>
6888 <td>style="color: red !important;" data-contrived="put this here</td>
6889 <td>foo
6890 </td></tr></table>
6891
6892 !! html/parsoid
6893 <table>
6894 <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>
6895 </tbody></table>
6896 !! end
6897
6898 !! test
6899 Break on | in element attribute in template
6900 !! options
6901 parsoid=wt2html,html2html
6902 !! wikitext
6903 {{echo|1=<div class="hi|ho">ha</div>}}
6904 !! html/php
6905 <p>ho"&gt;ha&lt;/div&gt;
6906 </p>
6907 !! html/parsoid
6908 <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>
6909 !! end
6910
6911 !! test
6912 Break on | in element attribute name in template
6913 !! wikitext
6914 {{echo|<div cla|ss="hiho">ha</div>}}
6915 !! html/parsoid
6916 <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>
6917 !! end
6918
6919 !! test
6920 Don't break on | in extension attribute in template
6921 !! wikitext
6922 {{echo|<ref name="hi|ho">ha</ref>}}
6923
6924 <references />
6925 !! html/parsoid
6926 <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="./Parser_test#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6927
6928 <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="./Parser_test#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>
6929 !! end
6930
6931 ## We don't support roundtripping of these attributes in Parsoid.
6932 ## Selective serialization takes care of preventing dirty diffs.
6933 ## But, on edits, we dirty-diff the invalid attribute text.
6934 !! test
6935 Invalid text in table attributes should be discarded
6936 !! options
6937 parsoid=wt2html
6938 !! wikitext
6939 {| <span>boo</span> style='border:1px solid black'
6940 | <span>boo</span> style='color:blue' |1
6941 |<span>boo</span> style='color:blue'|2
6942 |}
6943 !! html/php
6944 <table style="border:1px solid black">
6945 <tr>
6946 <td style="color:blue">1
6947 </td>
6948 <td style="color:blue">2
6949 </td></tr></table>
6950
6951 !! html/parsoid
6952 <table style="border:1px solid black">
6953 <tr>
6954 <td style="color:blue">1</td>
6955 <td style="color:blue">2</td>
6956 </tr>
6957 </table>
6958 !! end
6959
6960 !! test
6961 Invalid text in table attributes should be preserved by selective serializer
6962 !! options
6963 parsoid={
6964 "modes": ["selser"],
6965 "changes": [
6966 ["td:first-child", "text", "abc"],
6967 ["td + td", "text", "xyz"]
6968 ]
6969 }
6970 !! wikitext
6971 {| <span>boo</span> style='border:1px solid black'
6972 | <span>boo</span> style='color:blue' | 1
6973 |<span>boo</span> style='color:blue'| 2
6974 |}
6975 !! wikitext/edited
6976 {| <span>boo</span> style='border:1px solid black'
6977 | <span>boo</span> style='color:blue' | abc
6978 |<span>boo</span> style='color:blue'| xyz
6979 |}
6980 !! end
6981
6982 !! test
6983 1. Template-generated table cell attributes and cell content
6984 !! wikitext
6985 {|
6986 |{{table_attribs}}
6987 | {{table_attribs}}
6988 || {{table_attribs_5}}
6989 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6990 |align=center {{table_attribs}}
6991 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6992 |}
6993 !! html
6994 <table>
6995 <tr>
6996 <td style="color:red;">Foo
6997 </td>
6998 <td style="color:red;">Foo
6999 </td>
7000 <td>style="color:red;"</td>
7001 <td>Bar
7002 </td>
7003 <td style="color:red;">Foo
7004 </td>
7005 <td align="center" style="color:red;">Foo
7006 </td>
7007 <td align="center" style="color:red;">Foo
7008 </td></tr></table>
7009
7010 !! end
7011
7012 !! test
7013 2. Template-generated table cell attributes and cell content
7014 !! wikitext
7015 {|
7016 |{{table_attribs_2}}
7017 |}
7018 !! html/php
7019 <table>
7020 <tr>
7021 <td style="color:red;">Foo
7022 </td>
7023 <td>Bar</td>
7024 <td>Baz
7025 </td></tr></table>
7026
7027 !! html/parsoid
7028 <table>
7029 <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>
7030 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
7031 </tbody></table>
7032 !! end
7033
7034 !! test
7035 3. Template-generated table cell attributes and cell content
7036 !! wikitext
7037 {|
7038 !align=center {{table_header_cells}}
7039 |-
7040 |align=center {{table_cells}}
7041 |}
7042 !! html/php
7043 <table>
7044 <tr>
7045 <th align="center" style="color:red;">Foo</th>
7046 <th style="color:red;"><i>Bar</i></th>
7047 <th style="color:brown;"><i>Foo</i> and Baz
7048 </th></tr>
7049 <tr>
7050 <td align="center" style="color:red;">Foo</td>
7051 <td style="color:red;"><i>Bar</i></td>
7052 <td style="color:brown;"><i>Foo</i> and Baz
7053 </td></tr></table>
7054
7055 !! html/parsoid
7056 <table>
7057 <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>
7058 <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>
7059 </tbody></table>
7060 !! end
7061
7062 !! test
7063 4. Template-generated table cell attributes and cell content inside a templated table
7064 !! wikitext
7065 {{tbl-start}}
7066 !align=center {{table_header_cells}}
7067 |-
7068 |align=center {{table_cells}}
7069 {{tbl-end}}
7070 !! html/php
7071 <table>
7072 <tr>
7073 <th align="center" style="color:red;">Foo</th>
7074 <th style="color:red;"><i>Bar</i></th>
7075 <th style="color:brown;"><i>Foo</i> and Baz
7076 </th></tr>
7077 <tr>
7078 <td align="center" style="color:red;">Foo</td>
7079 <td style="color:red;"><i>Bar</i></td>
7080 <td style="color:brown;"><i>Foo</i> and Baz
7081 </td></tr></table>
7082
7083 !! html/parsoid
7084 <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}}]}'>
7085 <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>
7086 <tr>
7087 <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>
7088 </tbody></table>
7089 !! end
7090
7091 ## Edge case fix to prevent future regressions
7092 !! test
7093 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7094 !! wikitext
7095 {|
7096 |{{table_attribs_7}}
7097 |}
7098 <references />
7099 !! html/parsoid
7100 <table>
7101 <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="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7102 </tbody></table>
7103 <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="./Parser_test#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>
7104 !! end
7105
7106 !! test
7107 Table with row followed by newlines and table heading
7108 !! options
7109 parsoid=wt2html,html2html
7110 !! wikitext
7111 {|
7112 |-
7113
7114 !foo
7115 |}
7116 !! html/*
7117 <table>
7118
7119
7120 <tr>
7121 <th>foo
7122 </th></tr></table>
7123
7124 !! end
7125
7126 !! test
7127 Table with empty line following the start tag
7128 !! options
7129 parsoid=wt2html,html2html
7130 !! wikitext
7131 {|
7132
7133 |-
7134 |foo
7135 |}
7136 !! html/*
7137 <table>
7138
7139
7140 <tr>
7141 <td>foo
7142 </td></tr></table>
7143
7144 !! end
7145
7146 !! test
7147 Table attributes with empty value
7148 !! options
7149 parsoid=wt2html,html2html
7150 !! wikitext
7151 {|
7152 | style=|hello
7153 |}
7154 !! html/php
7155 <table>
7156 <tr>
7157 <td style="">hello
7158 </td></tr></table>
7159
7160 !! html/parsoid
7161 <table>
7162 <tbody><tr><td style="">hello</td></tr>
7163 </tbody></table>
7164 !! end
7165
7166 !! test
7167 Wikitext table with a lot of comments
7168 !! wikitext
7169 {|
7170 <!-- c0 -->
7171 |foo
7172 <!-- c1 -->
7173 |-<!-- c2 -->
7174 <!-- c3 -->
7175 |<!-- c4 -->
7176 <!-- c5 -->
7177 |}
7178 !! html
7179 <table>
7180 <tr>
7181 <td>foo
7182 </td></tr>
7183 <tr>
7184 <td>
7185 </td></tr></table>
7186
7187 !! end
7188
7189 !! test
7190 Wikitext table comments represented in parsoid dom
7191 !! wikitext
7192 {|<!--c1--><!--c2-->
7193 |-<!--c3-->
7194 |x
7195 |}
7196 !! html/php+tidy
7197 <table>
7198
7199 <tbody><tr>
7200 <td>x
7201 </td></tr></tbody></table>
7202 !! html/parsoid
7203 <table><!--c1--><!--c2-->
7204 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7205 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7206 </tbody></table>
7207 !! end
7208
7209 !! test
7210 Wikitext table with double-line table cell
7211 !! wikitext
7212 {|
7213 |a
7214 b
7215 |}
7216 !! html
7217 <table>
7218 <tr>
7219 <td>a
7220 <p>b
7221 </p>
7222 </td></tr></table>
7223
7224 !! end
7225
7226 !! test
7227 Table cell with a single comment
7228 !! wikitext
7229 {|
7230 |<!-- c1 -->
7231 |a
7232 |}
7233 !! html
7234 <table>
7235 <tr>
7236 <td>
7237 </td>
7238 <td>a
7239 </td></tr></table>
7240
7241 !! end
7242
7243 !! test
7244 Table-cell after a comment-only-empty-line
7245 !! wikitext
7246 {|
7247 |a
7248 <!--c1-->
7249 <!--c2-->|b
7250 |}
7251 !! html
7252 <table>
7253 <tr>
7254 <td>a
7255 </td>
7256 <td>b
7257 </td></tr></table>
7258
7259 !! html/parsoid
7260 <table>
7261 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7262 <!--c1-->
7263 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7264 </tbody></table>
7265
7266 !! end
7267
7268 !! test
7269 Build table with {{!}}
7270 !! wikitext
7271 {{{!}} class="wikitable"
7272 !header
7273 !second header
7274 {{!}}- style="color:red;"
7275 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7276 {{!}}}
7277 !! html
7278 <table class="wikitable">
7279 <tr>
7280 <th>header
7281 </th>
7282 <th>second header
7283 </th></tr>
7284 <tr style="color:red;">
7285 <td>data</td>
7286 <td style="color:red;">second data
7287 </td></tr></table>
7288
7289 !! end
7290
7291 !! test
7292 Build table with pipe as data
7293 !! wikitext
7294 {| class="wikitable"
7295 !header
7296 !second header
7297 |- style="color:red;"
7298 |data|| style="color:red;" |second data
7299 |-
7300 | style="color:red;" |data with | || style="color:red;" | second data with |
7301 |-
7302 ||data with | |||second data with |
7303 |}
7304 !! html
7305 <table class="wikitable">
7306 <tr>
7307 <th>header
7308 </th>
7309 <th>second header
7310 </th></tr>
7311 <tr style="color:red;">
7312 <td>data</td>
7313 <td style="color:red;">second data
7314 </td></tr>
7315 <tr>
7316 <td style="color:red;">data with |</td>
7317 <td style="color:red;">second data with |
7318 </td></tr>
7319 <tr>
7320 <td>data with |</td>
7321 <td>second data with |
7322 </td></tr></table>
7323
7324 !! end
7325
7326 !! test
7327 Build table with wikilink
7328 !! wikitext
7329 {| class="wikitable"
7330 !header||second header
7331 |- style="color:red;"
7332 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7333 |-
7334 |data||second data [[Main Page|link|text with pipe]]
7335 |}
7336 !! html
7337 <table class="wikitable">
7338 <tr>
7339 <th>header</th>
7340 <th>second header
7341 </th></tr>
7342 <tr style="color:red;">
7343 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7344 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7345 </td></tr>
7346 <tr>
7347 <td>data</td>
7348 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7349 </td></tr></table>
7350
7351 !! end
7352
7353 # The expected HTML structure in this test is debatable. The PHP parser does
7354 # not parse this kind of table at all. The main focus for Parsoid is on
7355 # round-tripping, so this output is ok for now. TODO: revisit!
7356 !! test
7357 Wikitext table with html-syntax row
7358 !! wikitext
7359 {|
7360 |-
7361 <td>foo</td>
7362 |}
7363 !! html/parsoid
7364 <table>
7365 <tbody>
7366 <tr>
7367 <td>foo</td></tr></tbody></table>
7368 !! end
7369
7370 ## Remex doesn't account for fostered content.
7371 !! test
7372 Fostered content in tables: Plain text
7373 !! options
7374 parsoid=wt2html
7375 !! wikitext
7376 {|
7377 |-
7378 a
7379 |}
7380 !! html/php
7381 <table>
7382
7383 a
7384 </table>
7385
7386 !! html/php+tidy
7387
7388
7389 a
7390 <table></table>
7391 !! html/parsoid
7392 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7393 a</p>
7394 <table>
7395 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7396 !! end
7397
7398 !! test
7399 Fostered content in tables: Lists
7400 !! options
7401 parsoid=wt2html,html2html
7402 !! wikitext
7403 {|
7404 |-
7405 *a
7406 |}
7407 !! html/php
7408 <table>
7409
7410 <ul><li>a</li></ul>
7411 </table>
7412
7413 !! html/php+tidy
7414 <ul><li>a</li></ul><table>
7415
7416
7417 </table>
7418 !! html/parsoid
7419 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7420 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7421
7422 </tr></tbody></table>
7423 !! end
7424
7425 !! test
7426 Template generated table cell with attributes
7427 !! wikitext
7428 {|
7429 |-
7430 {{table_attribs_4}} ||a||b
7431 |}
7432 !! html/php+tidy
7433 <table>
7434
7435 <tbody><tr>
7436 <td style="background-color:#DC241f;" width="10px"></td>
7437 <td>a</td>
7438 <td>b
7439 </td></tr></tbody></table>
7440 !! html/parsoid
7441 <table>
7442 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7443 <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>
7444 !! end
7445
7446 !! test
7447 Parsoid: Round-trip tables directly followed by content (T53219)
7448 !! options
7449 parsoid=wt2html,wt2wt
7450 !! wikitext
7451 {|
7452 |foo
7453 |} bar
7454
7455 {|
7456 |baz
7457 |}<b>quux</b>
7458 !! html+tidy
7459 <table>
7460 <tbody><tr>
7461 <td>foo
7462 </td></tr></tbody></table><p> bar
7463 </p><table>
7464 <tbody><tr>
7465 <td>baz
7466 </td></tr></tbody></table><p><b>quux</b>
7467 </p>
7468 !! end
7469
7470 !! test
7471 Parsoid: Default to a newline after tables in new content (T53219)
7472 !! options
7473 parsoid=html2wt
7474 !! html/parsoid
7475 <table><tbody>
7476 <tr><td>foo</td></tr></tbody></table> bar
7477 <table><tbody>
7478 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7479 !! wikitext
7480 {|
7481 |foo
7482 |}
7483 <nowiki> </nowiki>bar
7484 {|
7485 |baz
7486 |}
7487 '''quux'''
7488 !! end
7489
7490 !! test
7491 Parsoid: Row-syntax table headings followed by comment & table cells
7492 !! options
7493 parsoid=wt2html,wt2wt
7494 !! wikitext
7495 {|
7496 !foo||bar
7497 <!-- foo --> ||baz||quux
7498 |}
7499 !! html/php
7500 <table>
7501 <tr>
7502 <th>foo</th>
7503 <th>bar
7504 </th>
7505 <td>baz</td>
7506 <td>quux
7507 </td></tr></table>
7508
7509 !! html/parsoid
7510 <table>
7511 <tbody><tr><th>foo</th><th>bar
7512 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7513 </tbody></table>
7514 !! end
7515
7516 !!test
7517 Parsoid: Recover better from broken table attributes
7518 !!options
7519 parsoid=wt2html
7520 !!wikitext
7521 {| class="foo
7522 | class="bar" |
7523 foo
7524 |}
7525 !!html/php+tidy
7526 <table class="foo">
7527 <tbody><tr>
7528 <td class="bar">
7529 <p>foo
7530 </p>
7531 </td></tr></tbody></table>
7532 !!html/parsoid
7533 <table class="foo">
7534 <tr>
7535 <td class="bar">
7536 <p>foo</p></td></tr>
7537 </tbody></table>
7538 !!end
7539
7540 # Note: PHP parser omits empty rows
7541 !! test
7542 Tables: Digest broken attributes on table and tr tag
7543 !! options
7544 parsoid=wt2html
7545 !! wikitext
7546 {| || |} ++
7547 |- || || ++ --
7548 |- > [
7549 |}
7550 !! html/php+tidy
7551 <table>
7552
7553
7554 </table>
7555 !! html/parsoid
7556 <table>
7557 <tbody>
7558 <tr class='mw-empty-elt'></tr>
7559 <tr class='mw-empty-elt'></tr>
7560 </tbody></table>
7561 !! end
7562
7563 !! test
7564 Table with missing opening <tr> tag
7565 !! options
7566 parsoid=wt2html,wt2wt
7567 !! wikitext
7568 <table>
7569 <td>foo</td>
7570 </tr>
7571 </table>
7572 !! html+tidy
7573 <table>
7574 <tbody><tr><td>foo</td>
7575 </tr>
7576 </tbody></table>
7577 !! end
7578
7579 # T137406: Whitespace in the HTML
7580 !! test
7581 1. Generate correct wikitext for tables with thead/tbody/tfoot
7582 !! options
7583 parsoid=html2wt
7584 !! html/parsoid
7585 <table>
7586 <caption>Test</caption>
7587 <thead>
7588 <tr>
7589 <th>Month</th>
7590 <th>Savings</th>
7591 </tr>
7592 </thead>
7593 <tbody>
7594 <tr>
7595 <td>January</td>
7596 <td>$100</td>
7597 </tr>
7598 <tr>
7599 <td>February</td>
7600 <td>$80</td>
7601 </tr>
7602 </tbody>
7603 <tfoot>
7604 <tr>
7605 <td>Sum</td>
7606 <td>$180</td>
7607 </tr>
7608 </tfoot>
7609 </table>
7610 !! wikitext
7611 {|
7612 |+Test
7613 !Month
7614 !Savings
7615 |-
7616 |January
7617 |$100
7618 |-
7619 |February
7620 |$80
7621 |-
7622 |Sum
7623 |$180
7624 |}
7625 !! html/php+tidy
7626 <table>
7627 <caption>Test
7628 </caption>
7629 <tbody><tr>
7630 <th>Month
7631 </th>
7632 <th>Savings
7633 </th></tr>
7634 <tr>
7635 <td>January
7636 </td>
7637 <td>$100
7638 </td></tr>
7639 <tr>
7640 <td>February
7641 </td>
7642 <td>$80
7643 </td></tr>
7644 <tr>
7645 <td>Sum
7646 </td>
7647 <td>$180
7648 </td></tr></tbody></table>
7649 !! end
7650
7651 # T137406: No whitespace in the HTML
7652 !! test
7653 2. Generate correct wikitext for tables with thead/tbody/tfoot
7654 !! options
7655 parsoid=html2wt
7656 !! html/parsoid
7657 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7658 !! wikitext
7659 {|
7660 !heading
7661 |-
7662 |foo
7663 |}
7664 !! end
7665
7666 !! test
7667 Wikitext tables can be nested inside HTML tables
7668 !! options
7669 parsoid=html2wt
7670 !! html/parsoid
7671 <table data-parsoid='{"stx":"html"}'>
7672 <tr><td>
7673 <table>
7674 <tr><td>foo</td></tr>
7675 </table>
7676 </td></tr>
7677 </table>
7678 !! wikitext
7679 <table>
7680 <tr><td>
7681 {|
7682 |foo
7683 |}
7684 </td></tr>
7685 </table>
7686 !! html/php+tidy
7687 <table>
7688 <tbody><tr><td>
7689 <table>
7690 <tbody><tr>
7691 <td>foo
7692 </td></tr></tbody></table>
7693 </td></tr>
7694 </tbody></table>
7695 !! end
7696
7697 ###
7698 ### Internal links
7699 ###
7700 !! test
7701 Plain link, capitalized
7702 !! wikitext
7703 [[Main Page]]
7704 !! html
7705 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7706 </p>
7707 !! end
7708
7709 !! test
7710 Plain link, uncapitalized
7711 !! wikitext
7712 [[main Page]]
7713 !! html
7714 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7715 </p>
7716 !! end
7717
7718 !! test
7719 Piped link
7720 !! wikitext
7721 [[Main Page|The Main Page]]
7722 !! html
7723 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7724 </p>
7725 !! end
7726
7727 !! test
7728 Piped link with comment in link text
7729 !! wikitext
7730 [[Main Page|The Main<!--front--> Page]]
7731 !! html
7732 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7733 </p>
7734 !! end
7735
7736 !! test
7737 Piped link with multiple pipe characters in link text
7738 !! wikitext
7739 [[Main Page||The|Main|Page|]]
7740 !! html/php
7741 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7742 </p>
7743 !! html/parsoid
7744 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7745 !! end
7746
7747 !! test
7748 Piped link with no link text
7749 !! wikitext
7750 [[Thomas Bek (bishop of St David's)|]]
7751 !! html/php
7752 <p>[[Thomas Bek (bishop of St David's)|]]
7753 </p>
7754 !! html/parsoid
7755 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7756 !! end
7757
7758 !! test
7759 Piped link with empty link text
7760 !! wikitext
7761 [[Main Page|<nowiki/>]] - empty nowiki
7762 [[Main Page| ]] - empty space
7763 [[Main Page|&nbsp;]] - empty non breaking space
7764 !! html/php
7765 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7766 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7767 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7768 </p>
7769 !! html/parsoid
7770 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7771 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7772 <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>
7773 !! end
7774
7775 !! test
7776 Broken link
7777 !! wikitext
7778 [[Zigzagzogzagzig]]
7779 !! html
7780 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Broken link with fragment
7786 !! wikitext
7787 [[Zigzagzogzagzig#zug]]
7788 !! html
7789 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7790 </p>
7791 !! end
7792
7793 !! test
7794 Special page link with fragment
7795 !! wikitext
7796 [[Special:Version#anchor]]
7797 !! html
7798 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7799 </p>
7800 !! end
7801
7802 !! test
7803 Nonexistent special page link with fragment
7804 !! wikitext
7805 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7806 !! html
7807 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7808 </p>
7809 !! end
7810
7811 !! test
7812 Link with prefix
7813 !! wikitext
7814 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7815 !! html
7816 <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>
7817 </p>
7818 !! end
7819
7820 !! test
7821 Link with suffix
7822 !! wikitext
7823 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7824 !! html
7825 <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>!!!
7826 </p>
7827 !! end
7828
7829 !! article
7830 prefixed article
7831 !! text
7832 Some text
7833 !! endarticle
7834
7835 !! test
7836 T45661: Piped links with identical prefixes
7837 !! wikitext
7838 [[prefixed article|prefixed articles with spaces]]
7839
7840 [[prefixed article|prefixed articlesaoeu]]
7841
7842 [[Main Page|Main Page test]]
7843 !! html
7844 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7845 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7846 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7847 </p>
7848 !! end
7849
7850
7851 !! test
7852 Link with HTML entity in suffix / tail
7853 !! wikitext
7854 [[Main Page]]&quot;, [[Main Page]]&#97;
7855 !! html/php
7856 <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;
7857 </p>
7858 !! html/parsoid
7859 <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>
7860 !! end
7861
7862 !! test
7863 Link with 3 brackets
7864 !! wikitext
7865 [[[Main Page]]]
7866 Foo [[[Main Page]]]
7867 !! html
7868 <p>[[[Main Page]]]
7869 Foo [[[Main Page]]]
7870 </p>
7871 !! end
7872
7873 !! test
7874 Link with 4 brackets
7875 !! wikitext
7876 [[[[Main Page]]]]
7877 !! html
7878 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7879 </p>
7880 !! end
7881
7882 !! test
7883 Piped link with 3 brackets
7884 !! wikitext
7885 [[[main page|the main page]]]
7886 !! html
7887 <p>[[[main page|the main page]]]
7888 </p>
7889 !! end
7890
7891 !! test
7892 Piped link with extlink-like text
7893 !! wikitext
7894 [[Main Page|[bar]]]
7895 [[Main Page|This is a [bar]]]
7896 [[Main Page|[bar]]
7897 !! html/php
7898 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7899 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7900 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7901 </p>
7902 !! html/parsoid
7903 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7904 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7905 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7906 !! end
7907
7908 !! test
7909 Link with multiple pipes
7910 !! wikitext
7911 [[Main Page|The|Main|Page]]
7912 !! html
7913 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7914 </p>
7915 !! end
7916
7917 !! test
7918 Anchor containing a #. (T65430)
7919 !! config
7920 wgFragmentMode=[ 'html5', 'legacy' ]
7921 !! wikitext
7922 [[Main Page#And#Link]]
7923 !! html/php
7924 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7925 </p>
7926 !! html/parsoid
7927 <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>
7928 !! end
7929
7930 !! test
7931 Link to namespaces
7932 !! wikitext
7933 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7934 !! html
7935 <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>
7936 </p>
7937 !! end
7938
7939 !! test
7940 Link with space in namespace
7941 !! wikitext
7942 [[User talk:Foo bar]]
7943 !! html
7944 <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>
7945 </p>
7946 !! end
7947
7948 !! article
7949 MemoryAlpha:AlphaTest
7950 !! text
7951 This is an article in the MemoryAlpha namespace
7952 (which shadows the memoryalpha interwiki link).
7953 !! endarticle
7954
7955 !! test
7956 Namespace takes precedence over interwiki link (T53680)
7957 !! wikitext
7958 [[MemoryAlpha:AlphaTest]]
7959 !! html
7960 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7961 </p>
7962 !! end
7963
7964 # The previous test doesn't work correctly in html2*, due to not recognizing the
7965 # link as an internal one. This one checks for the correct behavior.
7966 !! test
7967 Link to namespace preferred over interwiki with correct rel attribute
7968 !! options
7969 parsoid=html2wt,html2html
7970 !! html/parsoid
7971 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7972 !! wikitext
7973 [[MemoryAlpha:AlphaTest]]
7974 !! end
7975
7976 !! test
7977 Piped link to namespace
7978 !! wikitext
7979 [[Meta:Disclaimers|The disclaimers]]
7980 !! html
7981 <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>
7982 </p>
7983 !! end
7984
7985 !! test
7986 Link containing }
7987 !! wikitext
7988 [[Usually caused by a typo (oops}]]
7989 !! html
7990 <p>[[Usually caused by a typo (oops}]]
7991 </p>
7992 !! end
7993
7994 !! article
7995 7% Solution
7996 !! text
7997 Just a test of an article title containing a percent.
7998 !! endarticle
7999
8000 !! test
8001 Link containing % (not as a hex sequence)
8002 !! wikitext
8003 [[7% Solution]]
8004 [[7% Solution|7%25 Solution]]
8005 !! html/php
8006 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
8007 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
8008 </p>
8009 !! html/parsoid
8010 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
8011 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
8012 !! end
8013
8014 # note that the parsoid HTML is identical to the previous test output,
8015 # so the previous test ensures that the html2wt mode will generate the
8016 # "not as a hex sequence" wikitext.
8017 !! test
8018 Link containing % as a single hex sequence interpreted to char
8019 !! options
8020 parsoid=wt2wt,wt2html,html2html
8021 !! wikitext
8022 [[7%25 Solution]]
8023 [[7%25 Solution|7%25 Solution]]
8024 !! html/php
8025 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
8026 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
8027 </p>
8028 !! html/parsoid
8029 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
8030 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
8031 !!end
8032
8033 !! test
8034 Link containing % as a double hex sequence interpreted to hex sequence
8035 !! wikitext
8036 [[7%2525 Solution]]
8037 !! html
8038 <p>[[7%2525 Solution]]
8039 </p>
8040 !!end
8041
8042 ## Example for such a section: == < ==
8043 !! test
8044 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
8045 !! options
8046 title=[[Main Page]]
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 !! options
8826 title=[[Main Page]]
8827 !! config
8828 wgFragmentMode=[ 'html5', 'legacy' ]
8829 !! wikitext
8830 [[#Is this great?]]
8831 [[Foo#Is this great?]]
8832 [[meatball:Foo#Is this great?]]
8833 !! html/php
8834 <p><a href="#Is_this_great?">#Is this great?</a>
8835 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8836 <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>
8837 </p>
8838 !! html/parsoid
8839 <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>
8840 <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>
8841 <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>
8842 !! end
8843
8844 !! test
8845 Link scenarios with escaped fragments (legacy)
8846 !! config
8847 wgFragmentMode=[ 'legacy' ]
8848 !! wikitext
8849 [[#Is this great?]]
8850 [[Foo#Is this great?]]
8851 [[meatball:Foo#Is this great?]]
8852 !! html/php
8853 <p><a href="#Is_this_great.3F">#Is this great?</a>
8854 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8855 <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>
8856 </p>
8857 !! end
8858
8859 # Ideally the wikipedia: prefix here should be proto-relative too
8860 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8861 # define the 'en' prefix, and originally the test used 'wikipedia',
8862 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8863 # article.
8864 !! test
8865 Different interwiki prefixes mapping to the same URL
8866 !! wikitext
8867 [[:en:Foo]]
8868
8869 [[:en:Foo|Foo]]
8870
8871 [[wikipedia:Foo]]
8872
8873 [[:wikipedia:Foo|Foo]]
8874
8875 [[wikipedia:en:Foo]]
8876
8877 [[:wikipedia:en:Foo]]
8878
8879 [[ wikiPEdia :Foo]]
8880 !! html/parsoid
8881 <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>
8882
8883 <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>
8884
8885 <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>
8886
8887 <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>
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/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>
8892
8893 <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>
8894 !! end
8895
8896 !! test
8897 Interwiki links that cannot be represented in wiki syntax
8898 !! wikitext
8899 [[meatball:ok]]
8900 [[meatball:ok#foo|ok with fragment]]
8901 [[meatball:ok_as_well?|ok ending with ? mark]]
8902 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8903 [http://de.wikipedia.org/wiki/#foo is just fragment]
8904
8905 !! html/php
8906 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8907 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8908 <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>
8909 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8910 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8911 </p>
8912 !! html/parsoid
8913 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8914 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8915 <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>
8916 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8917 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8918 !! end
8919
8920 !! test
8921 Interwiki links: trail
8922 !! wikitext
8923 [[wikipedia:Foo|Ba]]r
8924 !! html/php
8925 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8926 </p>
8927 !! html/parsoid
8928 <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>
8929 !! end
8930
8931 !! test
8932 Local interwiki link
8933 !! options
8934 parsoid=wt2html,wt2wt,html2html
8935 !! wikitext
8936 [[local:Template:Foo]]
8937 !! html/php
8938 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8939 </p>
8940 !! html/parsoid
8941 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8942 !! end
8943
8944 # Parsoid does not mark self-links, by design.
8945 !! test
8946 Local interwiki link: self-link to current page
8947 !! options
8948 title=[[Main Page]]
8949 parsoid=wt2html,wt2wt,html2html
8950 !! wikitext
8951 [[local:Main Page]]
8952 !! html/php
8953 <p><a class="mw-selflink selflink">local:Main Page</a>
8954 </p>
8955 !! html/parsoid
8956 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8957 !! end
8958
8959 !! test
8960 Local interwiki link: prefix only (T66167)
8961 !! options
8962 parsoid=wt2html,wt2wt,html2html
8963 !! wikitext
8964 [[local:]]
8965 !! html/php
8966 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8967 </p>
8968 !! html/parsoid
8969 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8970 !! end
8971
8972 !! test
8973 Local interwiki link: with additional interwiki prefix (T63357)
8974 !! options
8975 parsoid=wt2html,wt2wt,html2html
8976 !! wikitext
8977 [[local:meatball:Hello]]
8978 !! html/php
8979 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8980 </p>
8981 !! html/parsoid
8982 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8983 !! end
8984
8985 !! test
8986 Multiple local interwiki link prefixes
8987 !! wikitext
8988 [[local:local:local:local:mi:local:Foo]]
8989 !! options
8990 parsoid=wt2html,wt2wt,html2html
8991 !! html/php
8992 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8993 </p>
8994 !! html/parsoid
8995 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8996 !! end
8997
8998 !! test
8999 Interwiki link with percent encoded target
9000 !! wikitext
9001 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
9002 !! html/php
9003 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
9004 </p>
9005 !! html/parsoid
9006 <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>
9007 !! end
9008
9009 ###
9010 ### Interlanguage links
9011 ### Language links (so that searching for '### language' matches..)
9012 ###
9013
9014 !! test
9015 Interlanguage link
9016 !! wikitext
9017 Blah blah blah
9018 [[zh:Chinese]]
9019 !! html/php
9020 <p>Blah blah blah
9021 </p>
9022 !! html/parsoid
9023 <p>Blah blah blah</p>
9024 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9025 !! end
9026
9027 ## parsoid html2wt will lose the space variations
9028 !! test
9029 Interlanguage link with spacing
9030 !! options
9031 parsoid=wt2html,wt2wt,html2html
9032 !! wikitext
9033 Blah blah blah
9034 [[ zh : Chinese ]]
9035 !! html/php
9036 <p>Blah blah blah
9037 </p>
9038 !! html/parsoid
9039 <p>Blah blah blah</p>
9040 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9041 !! end
9042
9043 !! test
9044 Double interlanguage link
9045 !! wikitext
9046 Blah blah blah
9047 [[es:Spanish]]
9048 [[zh:Chinese]]
9049 !! html/php
9050 <p>Blah blah blah
9051 </p>
9052 !! html/parsoid
9053 <p>Blah blah blah</p>
9054 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9055 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9056 !! end
9057
9058 ## parsoid html2wt will lose the space variations
9059 !! test
9060 Interlanguage link variations
9061 !! options
9062 parsoid=wt2html,wt2wt,html2html
9063 !! wikitext
9064 Blah blah blah
9065 [[ es :Spanish]]
9066 [[ ZH :Chinese]]
9067 [[es:Foo_bar]]
9068 !! html/php
9069 <p>Blah blah blah
9070 </p>
9071 !! html/parsoid
9072 <p>Blah blah blah</p>
9073 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9074 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9075 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9076 !! end
9077
9078 !! test
9079 Escaping of interlanguage links (T129218, T156308)
9080 !! wikitext
9081 Blah blah blah
9082 [[:es:Spanish]]
9083 [[ : zh : Chinese ]]
9084 !! html/php
9085 <p>Blah blah blah
9086 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9087 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9088 </p>
9089 !! html/parsoid
9090 <p>Blah blah blah
9091 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9092 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9093 !! end
9094
9095 !! test
9096 Multiple colons escaping interlanguage links
9097 !! options
9098 parsoid=wt2html
9099 !! wikitext
9100 [[:es:Spanish]]
9101 [[::es:Spanish]]
9102 [[:::es:Spanish]]
9103 !! html/php
9104 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9105 [[::es:Spanish]]
9106 [[:::es:Spanish]]
9107 </p>
9108 !! html/parsoid
9109 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9110 [[::es:Spanish]]
9111 [[:::es:Spanish]]</p>
9112 !! end
9113
9114 ## parsoid html2wt will normalize the space to _
9115 !! test
9116 Space and question mark encoding in interlanguage links (T95473)
9117 !! options
9118 parsoid=wt2html,wt2wt,html2html
9119 !! wikitext
9120 Blah blah blah
9121 [[es:Foo bar?]]
9122 !! html/php
9123 <p>Blah blah blah
9124 </p>
9125 !! html/parsoid
9126 <p>Blah blah blah</p>
9127 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9128 !! end
9129
9130 !! test
9131 Interlanguage link, with prefix links
9132 !! options
9133 language=ln
9134 !! wikitext
9135 Blah blah blah
9136 [[zh:Chinese]]
9137 !! html/php
9138 <p>Blah blah blah
9139 </p>
9140 !! html/parsoid
9141 <p>Blah blah blah</p>
9142 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9143 !! end
9144
9145 !! test
9146 Double interlanguage link, with prefix links (T10897)
9147 !! options
9148 language=ln
9149 !! wikitext
9150 Blah blah blah
9151 [[es:Spanish]]
9152 [[zh:Chinese]]
9153 !! html/php
9154 <p>Blah blah blah
9155 </p>
9156 !! html/parsoid
9157 <p>Blah blah blah</p>
9158 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9159 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9160 !! end
9161
9162 !! test
9163 "Extra" interlanguage links (T34189 / gerrit 111390)
9164 !! wikitext
9165 Blah blah blah
9166 [[mul:Article]]
9167 !! html/php
9168 <p>Blah blah blah
9169 </p>
9170 !! html/parsoid
9171 <p>Blah blah blah</p>
9172 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9173 !! end
9174
9175 ## PHP parser tests script needs an update
9176 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9177 !! test
9178 Language links render as inline links if $wgInterwikiMagic=false
9179 !! options
9180 wgInterwikiMagic=false
9181 parsoid=wt2html,wt2wt,html2html
9182 !! wikitext
9183 Blah blah blah
9184 [[zh:Chinese]]
9185 !! html/parsoid
9186 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9187 !! end
9188
9189 ## PHP parser tests script needs an update
9190 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9191 !! test
9192 Language links render as inline links in the Talk namespace
9193 !! options
9194 title=Talk:Foo
9195 parsoid=wt2html,wt2wt,html2html
9196 !! wikitext
9197 Blah blah blah
9198 [[zh:Chinese]]
9199 !! html/parsoid
9200 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9201 !! end
9202
9203 !! test
9204 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9205 !! options
9206 language=ln
9207 !! wikitext
9208 [[WW&nbsp;II]]
9209 !! html
9210 <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>
9211 </p>
9212 !! end
9213
9214 !! test
9215 Parsoid T55221: Wikilinks should be properly entity-escaped
9216 !! options
9217 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9218 !! html/parsoid
9219 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9220 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9221 !! wikitext
9222 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9223
9224 He&amp;nbsp;llo He&amp;nbsp;llo
9225 !! html/php
9226 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9227 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9228 </p>
9229 !! end
9230
9231 # html2wt will fail because of title normalization without data-parsoid
9232 !! test
9233 Parsoid: handle constructor well
9234 !! options
9235 parsoid=wt2html,wt2wt
9236 !! wikitext
9237 [[constructor]]
9238
9239 [[constructor:foo]]
9240 !! html/php
9241 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9242 </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>
9243 </p>
9244 !! html/parsoid
9245 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9246
9247 <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>
9248 !! end
9249
9250 !! test
9251 Template parameter named "constructor"
9252 !! wikitext
9253 {{echo| constructor = |hi}}
9254 !! html/parsoid
9255 <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>
9256 !! end
9257
9258 !! article
9259 ko:
9260 !! text
9261 Test.
9262 !! endarticle
9263
9264 # Note that `ko` isn't a known interlanguage prefix
9265 !! test
9266 Parsoid: recognize interlanguage links without a target page
9267 !! options
9268 ill
9269 !! wikitext
9270 [[es:]]
9271
9272 [[ko:]]
9273 !! html/php
9274 es:
9275 !! html/parsoid
9276 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9277
9278 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9279 !! end
9280
9281 # Note that `ko` isn't a known interwiki prefix
9282 !! test
9283 Parsoid: recognize interwiki links without a target page
9284 !! options
9285 parsoid=wt2html,wt2wt,html2html
9286 !! wikitext
9287 [[:es:]]
9288
9289 [[:ko:]]
9290 !! html/php
9291 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9292 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9293 </p>
9294 !! html/parsoid
9295 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9296 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9297 !! end
9298
9299 !! test
9300 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9301 !! wikitext
9302 [[mi:Foo]]
9303 !! html/php
9304 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9305 </p>
9306 !! html/parsoid
9307 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9308 !! end
9309
9310 !! test
9311 Interlanguage link with preceding local interwiki link (T70085)
9312 !! options
9313 parsoid=wt2html,wt2wt,html2html
9314 !! wikitext
9315 Blah blah blah
9316 [[local:es:Spanish]]
9317 !! html/php
9318 <p>Blah blah blah
9319 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9320 </p>
9321 !! html/parsoid
9322 <p>Blah blah blah
9323 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9324 !! end
9325
9326 !! test
9327 Looks like an interlanguage link, but is actually a local interwiki
9328 !! options
9329 parsoid=wt2html,wt2wt,html2html
9330 !! wikitext
9331 Blah blah blah
9332 [[mi:Template:Foo]]
9333 !! html/php
9334 <p>Blah blah blah
9335 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9336 </p>
9337 !! html/parsoid
9338 <p>Blah blah blah
9339 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9340 !! end
9341
9342 ###
9343 ### Redirects, Parsoid-only
9344 ###
9345
9346 !! test
9347 1. Simple redirect to page
9348 !! wikitext
9349 #REDIRECT [[Main Page]]
9350 !! html/parsoid
9351 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9352 !! end
9353
9354 !! test
9355 2. Other redirect variants
9356 !! wikitext
9357 #REDIRECT [[Main_Page]]
9358 !! html/parsoid
9359 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9360 !! end
9361
9362 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9363 # This tests the Parsoid bail-out code.
9364 !! test
9365 3. Other redirect variants
9366 !! options
9367 parsoid=wt2html
9368 !! wikitext
9369 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9370 !! html/parsoid
9371 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9372 !! end
9373
9374 !! test
9375 4. Redirect to a templated destination
9376 !! wikitext
9377 #REDIRECT [[{{echo|Foo}}bar]]
9378 !! html/parsoid
9379 <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"}]]}'/>
9380 !! end
9381
9382 !! test
9383 Empty redirect
9384 !! options
9385 parsoid=wt2html,wt2wt
9386 !! wikitext
9387 #REDIRECT [[]]
9388 !! html/parsoid
9389 <ol>
9390 <li>REDIRECT [[]]</li></ol>
9391 !! end
9392
9393 !! test
9394 Optional colon in #REDIRECT
9395 !! options
9396 # the colon is archaic syntax. we support it for wt2html, but we
9397 # don't care that it roundtrips back to the modern syntax.
9398 parsoid=wt2html,html2html
9399 !! wikitext
9400 #REDIRECT:[[Main Page]]
9401 !! html/parsoid
9402 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9403 !! end
9404
9405 !! test
9406 Whitespace in #REDIRECT with optional colon
9407 !! options
9408 # the colon and gratuitous whitespace is archaic syntax. we support
9409 # it for wt2html, but we don't care that it roundtrips back to the
9410 # modern syntax (without extra whitespace)
9411 parsoid=wt2html,html2html
9412 !! wikitext
9413
9414 #REDIRECT
9415 :
9416 [[Main Page]]
9417 !! html/parsoid
9418 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9419 !! end
9420
9421 !! test
9422 Piped link in #REDIRECT
9423 !! options
9424 # content after piped link is ignored. we support this syntax,
9425 # but don't care that the piped link is lost when we roundtrip this.
9426 parsoid=wt2html
9427 !! wikitext
9428 #REDIRECT [[Main Page|bar]]
9429 !! html/parsoid
9430 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9431 !! end
9432
9433 !! test
9434 Redirect to category (T104502)
9435 !! options
9436 parsoid=wt2html,wt2wt
9437 !! wikitext
9438 #REDIRECT [[Category:Foo]]
9439 !! html/parsoid
9440 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9441 !! end
9442
9443 !! test
9444 Redirect to category with URL encoding (T104502)
9445 !! options
9446 parsoid=wt2html
9447 !! wikitext
9448 #REDIRECT [[Category%3AFoo]]
9449 !! html/parsoid
9450 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9451 !! end
9452
9453 !! test
9454 Redirect to category page
9455 !! wikitext
9456 #REDIRECT [[:Category:Foo]]
9457 !! html/parsoid
9458 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9459 !! end
9460
9461 !! test
9462 Redirect to image page (1)
9463 !! wikitext
9464 #REDIRECT [[File:Wiki.png]]
9465 !! html/parsoid
9466 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9467 !! end
9468
9469 !! test
9470 Redirect to image page (2)
9471 !! wikitext
9472 #REDIRECT [[Image:Wiki.png]]
9473 !! html/parsoid
9474 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9475 !! end
9476
9477 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9478 # Next test confirms this.
9479 !! test
9480 Redirect to language (1) (T104918)
9481 !! options
9482 parsoid=wt2html,wt2wt,html2html
9483 !! wikitext
9484 #REDIRECT [[en:File:Wiki.png]]
9485 !! html/parsoid
9486 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9487 !! end
9488
9489 !! test
9490 Redirect to language (2) (T104918)
9491 !! wikitext
9492 #REDIRECT [[:en:File:Wiki.png]]
9493 !! html/parsoid
9494 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9495 !! end
9496
9497 !! test
9498 Redirect to interwiki (T104918)
9499 !! wikitext
9500 #REDIRECT [[meatball:File:Wiki.png]]
9501 !! html/parsoid
9502 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9503 !! end
9504
9505 !! test
9506 Non-English #REDIRECT
9507 !! options
9508 language=is
9509 !! wikitext
9510 #TILVÍSUN [[Main Page]]
9511 !! html/parsoid
9512 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9513 !! end
9514
9515 !! test
9516 Redirect syntax under text isn't considered a redirect
9517 !! wikitext
9518 some text
9519
9520 #redirect [[Main Page]]
9521 !! html/parsoid
9522 <p>some text</p>
9523 <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>
9524 !! end
9525
9526 !! test
9527 New redirect
9528 !! options
9529 parsoid=html2wt
9530 !! html/parsoid
9531 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9532 !! wikitext
9533 #REDIRECT [[Foo]]
9534 Foo
9535 !! end
9536
9537 !! test
9538 Redirect followed by block on the same line
9539 !! options
9540 parsoid=wt2html
9541 !! wikitext
9542 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9543 !! html/parsoid
9544 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9545 !! end
9546
9547 !! test
9548 Redirect followed by a newline
9549 !! wikitext
9550 #REDIRECT [[Main Page]]
9551 A newline
9552 !! html/parsoid
9553 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9554 <p>A newline</p>
9555 !! end
9556
9557 !! test
9558 Redirect followed by multiple newlines
9559 !! wikitext
9560 #REDIRECT [[Main Page]]
9561
9562
9563 A newline
9564 !! html/parsoid
9565 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9566
9567 <p><br/>
9568 A newline</p>
9569 !! end
9570
9571 !! test
9572 Drop duplicate redirects
9573 !! options
9574 parsoid=html2wt
9575 !! html/parsoid
9576 <link rel="mw:PageProp/redirect" href="./Foo"/>
9577 <link rel="mw:PageProp/redirect" href="./Bar"/>
9578 <link rel="mw:PageProp/redirect" href="./Baz"/>
9579 !! wikitext
9580 #REDIRECT [[Foo]]
9581 !! end
9582
9583 ##
9584 ## XHTML tidiness
9585 ###
9586
9587 !! test
9588 <br> to <br />
9589 !! wikitext
9590 1<br>2<br />3
9591 !! html
9592 <p>1<br />2<br />3
9593 </p>
9594 !! end
9595
9596 !! test
9597 Broken br tag sanitization
9598 !! wikitext
9599 </br>
9600 !! html/php
9601 <p>&lt;/br&gt;
9602 </p>
9603 !! end
9604
9605 # TODO: Fix html2html mode (T53055)!
9606 !! test
9607 Parsoid: Broken br tag recognition
9608 !! options
9609 parsoid=wt2html
9610 !! wikitext
9611 </br>
9612
9613 <br/ >
9614 !! html+tidy
9615 <p><br />
9616 </p><p><br />
9617 </p>
9618 !! end
9619
9620 !! test
9621 Incorrecly removing closing slashes from correctly formed XHTML
9622 !! wikitext
9623 <br style="clear:both;" />
9624 !! html
9625 <p><br style="clear:both;" />
9626 </p>
9627 !! end
9628
9629 !! test
9630 Failing to transform badly formed HTML into correct XHTML
9631 !! wikitext
9632 <br style="clear: left;">
9633 <br style="clear: right;">
9634 <br style="clear: both;">
9635 !! html
9636 <p><br style="clear: left;" />
9637 <br style="clear: right;" />
9638 <br style="clear: both;" />
9639 </p>
9640 !!end
9641
9642 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9643 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9644 !! test
9645 Handling html with a div self-closing tag
9646 !! wikitext
9647 <div title />
9648 <div title/>
9649 <div title/ >
9650 <div title=bar />
9651 <div title=bar/>
9652 <div title=bar/ >
9653 !! html/php+tidy
9654 <div title=""></div>
9655 <div title=""></div>
9656 <div title="">
9657 <div title="bar"></div>
9658 <div title="bar"></div>
9659 <div title="bar/">
9660 </div></div>
9661 !! html/parsoid
9662 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9663 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9664 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9665 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9666 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9667 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9668 !! end
9669
9670 !! test
9671 Elements with solidus in various attribute positions
9672 !! options
9673 parsoid=wt2html,html2html
9674 !! wikitext
9675 <div cla/ss="123">ha</div>
9676
9677 <div / class="123">ha</div>
9678
9679 <div class= / "123">ha</div>
9680 !! html/php+tidy
9681 <div>ha</div>
9682 <div class="123">ha</div>
9683 <div class="/">ha</div>
9684 !! html/parsoid
9685 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9686
9687 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9688
9689 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9690 !! end
9691
9692 !! test
9693 Handling html with a br self-closing tag
9694 !! wikitext
9695 <br title />
9696 <br title/>
9697 <br title/ >
9698 <br title=bar />
9699 <br title=bar/>
9700 <br title=bar/ >
9701 !! html/php+tidy
9702 <p><br title="" />
9703 <br title="" />
9704 <br title="" />
9705 <br title="bar" />
9706 <br title="bar" />
9707 <br title="bar/" />
9708 </p>
9709 !! html/parsoid
9710 <p><br title="" />
9711 <br title="" />
9712 <br title="" />
9713 <br title="bar" />
9714 <br title="bar" />
9715 <br title="bar/" />
9716 </p>
9717 !! end
9718
9719 !! test
9720 Quoted attributes without spaces
9721 !! options
9722 parsoid=wt2html
9723 !! wikitext
9724 <div class="foo"style="color:red">red</div>
9725 !! html/php+tidy
9726 <div class="foo" style="color:red">red</div>
9727 !! html/parsoid
9728 <div class="foo" style="color:red">red</div>
9729 !! end
9730
9731 !! test
9732 Horizontal ruler (should it add that extra space?)
9733 !! wikitext
9734 <hr>
9735 <hr >
9736 foo <hr
9737 > bar
9738 !! html+tidy
9739 <hr />
9740 <hr /><p>
9741 foo </p><hr /><p> bar
9742 </p>
9743 !! end
9744
9745 !! test
9746 Horizontal ruler -- 4+ dashes render hr
9747 !! wikitext
9748 ----
9749 !! html
9750 <hr />
9751
9752 !! end
9753
9754 !! test
9755 Horizontal ruler -- eats additional dashes on the same line
9756 !! wikitext
9757 ---------
9758 !! html
9759 <hr />
9760
9761 !! end
9762
9763 !! test
9764 Horizontal ruler -- does not collapse dashes on consecutive lines
9765 !! wikitext
9766 ----
9767 ----
9768 !! html
9769 <hr />
9770 <hr />
9771
9772 !! end
9773
9774 !! test
9775 Horizontal ruler -- <4 dashes render as plain text
9776 !! wikitext
9777 ---
9778 !! html
9779 <p>---
9780 </p>
9781 !! end
9782
9783 !! test
9784 Horizontal ruler -- Supports content following dashes on same line
9785 !! wikitext
9786 ---- Foo
9787 !! html
9788 <hr /> Foo
9789
9790 !! html+tidy
9791 <hr /><p> Foo
9792 </p>
9793 !! end
9794
9795 ###
9796 ### Block-level elements
9797 ###
9798 !! test
9799 Common list
9800 !! wikitext
9801 *Common list
9802 *item 2
9803 *item 3
9804 !! html
9805 <ul><li>Common list</li>
9806 <li>item 2</li>
9807 <li>item 3</li></ul>
9808
9809 !! end
9810
9811 !! test
9812 Numbered list
9813 !! wikitext
9814 #Numbered list
9815 #item 2
9816 #item 3
9817 !! html
9818 <ol><li>Numbered list</li>
9819 <li>item 2</li>
9820 <li>item 3</li></ol>
9821
9822 !! end
9823
9824 # the switch from level 3 to ordered should not introduce a newline between
9825 !! test
9826 Mixed list
9827 !! wikitext
9828 *Mixed list
9829 *#with numbers
9830 **and bullets
9831 *#and numbers
9832 *bullets again
9833 **bullet level 2
9834 ***bullet level 3
9835 ***#Number on level 4
9836 **bullet level 2
9837 **#Number on level 3
9838 **#Number on level 3
9839 *#number level 2
9840 *Level 1
9841 ***Level 3
9842 #**Level 3, but ordered
9843 !! html
9844 <ul><li>Mixed list
9845 <ol><li>with numbers</li></ol>
9846 <ul><li>and bullets</li></ul>
9847 <ol><li>and numbers</li></ol></li>
9848 <li>bullets again
9849 <ul><li>bullet level 2
9850 <ul><li>bullet level 3
9851 <ol><li>Number on level 4</li></ol></li></ul></li>
9852 <li>bullet level 2
9853 <ol><li>Number on level 3</li>
9854 <li>Number on level 3</li></ol></li></ul>
9855 <ol><li>number level 2</li></ol></li>
9856 <li>Level 1
9857 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9858 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9859
9860 !! end
9861
9862 !! test
9863 1. Nested mixed wikitext and html list
9864 !! wikitext
9865 *hi
9866 *<ul><li>ho</li></ul>
9867 *hi
9868 **ho
9869 !! html/php
9870 <ul><li>hi</li>
9871 <li><ul><li>ho</li></ul></li>
9872 <li>hi
9873 <ul><li>ho</li></ul></li></ul>
9874
9875 !! html/parsoid
9876 <ul><li>hi</li>
9877 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9878 <li>hi
9879 <ul><li>ho</li></ul></li></ul>
9880 !! end
9881
9882 !! test
9883 2. Nested mixed wikitext and html list (incompatible)
9884 !! wikitext
9885 ;hi
9886 :{{echo|<li>ho</li>}}
9887 !! html/php
9888 <dl><dt>hi</dt>
9889 <dd><li>ho</li></dd></dl>
9890
9891 !! html/parsoid
9892 <dl><dt>hi</dt>
9893 <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>
9894 !! end
9895
9896 !! test
9897 Nested lists 1
9898 !! wikitext
9899 *foo
9900 **bar
9901 !! html
9902 <ul><li>foo
9903 <ul><li>bar</li></ul></li></ul>
9904
9905 !! end
9906
9907 !! test
9908 Nested lists 2
9909 !! wikitext
9910 **foo
9911 *bar
9912 !! html
9913 <ul><li><ul><li>foo</li></ul></li>
9914 <li>bar</li></ul>
9915
9916 !! end
9917
9918 !! test
9919 Nested lists 3 (first element empty)
9920 !! wikitext
9921 *
9922 **bar
9923 !! html
9924 <ul><li>
9925 <ul><li>bar</li></ul></li></ul>
9926
9927 !! end
9928
9929 !! test
9930 Nested lists 4 (first element empty)
9931 !! wikitext
9932 **
9933 *bar
9934 !! html
9935 <ul><li><ul><li></li></ul></li>
9936 <li>bar</li></ul>
9937
9938 !! end
9939
9940 !! test
9941 Nested lists 5 (both elements empty)
9942 !! wikitext
9943 **
9944 *
9945 !! html
9946 <ul><li><ul><li></li></ul></li>
9947 <li></li></ul>
9948
9949 !! end
9950
9951 !! test
9952 Nested lists 6 (both elements empty)
9953 !! wikitext
9954 *
9955 **
9956 !! html
9957 <ul><li>
9958 <ul><li></li></ul></li></ul>
9959
9960 !! end
9961
9962 !! test
9963 Nested lists 7 (skip initial nesting levels)
9964 !! wikitext
9965 ***foo
9966 !! html
9967 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9968
9969 !! end
9970
9971 !! test
9972 Nested lists 8 (multiple nesting transitions)
9973 !! wikitext
9974 *foo
9975 ***bar
9976 **baz
9977 *boo
9978 !! html
9979 <ul><li>foo
9980 <ul><li><ul><li>bar</li></ul></li>
9981 <li>baz</li></ul></li>
9982 <li>boo</li></ul>
9983
9984 !! end
9985
9986 # XXX this test should be moved to citeParserTests, since it depends
9987 # on the Cite extension, which is "built in" to Parsoid.
9988 !! test
9989 Nested lists 9 (extension interaction)
9990 !! wikitext
9991 *<references />
9992 !! html/php+tidy-DISABLED
9993 <ul><li class="mw-empty-elt"></li></ul>
9994 !! html/parsoid
9995 <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>
9996 !! end
9997
9998 !! test
9999 1. Lists with start-of-line-transparent tokens before bullets: Comments
10000 !! wikitext
10001 *foo
10002 *<!--cmt-->bar
10003 <!--cmt-->*baz
10004 !! html
10005 <ul><li>foo</li>
10006 <li>bar</li>
10007 <li>baz</li></ul>
10008
10009 !! end
10010
10011 !! test
10012 Nested lists 10 (list and span siblings: wt2wt regression)
10013 !! wikitext
10014 *a <span>x</span>
10015 **b <span>y</span>
10016 !! html/parsoid
10017 <ul><li>a <span>x</span>
10018 <ul><li>b <span>y</span></li></ul></li></ul>
10019 !! end
10020
10021 !! test
10022 2. Lists with start-of-line-transparent tokens before bullets: Template close
10023 !! wikitext
10024 *foo {{echo|bar
10025 }}*baz
10026 !! html
10027 <ul><li>foo bar</li>
10028 <li>baz</li></ul>
10029
10030 !! end
10031
10032 !! test
10033 List items are not parsed correctly following a <pre> block (T2785)
10034 !! wikitext
10035 *<pre>foo</pre>
10036 *<pre>bar</pre>
10037 *zar
10038 !! html/php
10039 <ul><li><pre>foo</pre></li>
10040 <li><pre>bar</pre></li>
10041 <li>zar</li></ul>
10042
10043 !! html/parsoid
10044 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
10045 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
10046 <li>zar</li></ul>
10047 !! end
10048
10049 # FIXME: Might benefit from a html/parsoid since this has a template
10050 !! test
10051 List items from template
10052 !! wikitext
10053
10054 {{inner list}}
10055 *item 2
10056
10057 *item 0
10058 {{inner list}}
10059 *item 2
10060
10061 *item 0
10062 *notSOL{{inner list}}
10063 *item 2
10064 !! html
10065 <ul><li>item 1</li>
10066 <li>item 2</li></ul>
10067 <ul><li>item 0</li>
10068 <li>item 1</li>
10069 <li>item 2</li></ul>
10070 <ul><li>item 0</li>
10071 <li>notSOL</li>
10072 <li>item 1</li>
10073 <li>item 2</li></ul>
10074
10075 !! end
10076
10077 !! test
10078 List interrupted by empty line or heading
10079 !! wikitext
10080 *foo
10081
10082 **bar
10083 ==A heading==
10084 *Another list item
10085 !! html
10086 <ul><li>foo</li></ul>
10087 <ul><li><ul><li>bar</li></ul></li></ul>
10088 <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>
10089 <ul><li>Another list item</li></ul>
10090
10091 !!end
10092
10093 !! test
10094 Multiple list tags generated by templates
10095 !! wikitext
10096 {{echo|<li>}}a
10097 {{echo|<li>}}b
10098 {{echo|<li>}}c
10099 !! html
10100 <li>a
10101 <li>b
10102 <li>c</li>
10103 </li>
10104 </li>
10105
10106
10107 !! html+tidy
10108 <li>a
10109 </li><li>b
10110 </li><li>c
10111 </li>
10112 !! html/parsoid
10113 <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>
10114 <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>
10115 <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>
10116 !! end
10117
10118 !! test
10119 Multiple newlines in between HTML list items don't induce paragraph wrapping
10120 !! wikitext
10121 <ul>
10122 <li>hi</li>
10123
10124
10125
10126
10127 <li>ho</li>
10128 </ul>
10129
10130 <dl>
10131 <dt>hi</dt>
10132 <dd>ho<div>123</div>
10133 </dd>
10134
10135
10136 </dl>
10137 !! html/php+tidy
10138 <ul>
10139 <li>hi</li>
10140
10141
10142
10143
10144 <li>ho</li>
10145 </ul>
10146 <dl>
10147 <dt>hi</dt>
10148 <dd>ho<div>123</div>
10149 </dd>
10150
10151
10152 </dl>
10153 !! end
10154
10155 !!test
10156 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10157 !! wikitext
10158 *a
10159 <!--This line will NOT split the list-->
10160 *b
10161 <!--This line will NOT split the list either-->
10162 *c
10163 <!--foo--> <!----> <!--This line NOT split the list either-->
10164 *d
10165 !! html
10166 <ul><li>a</li>
10167 <li>b</li>
10168 <li>c</li>
10169 <li>d</li></ul>
10170
10171 !!end
10172
10173 !!test
10174 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10175 !! wikitext
10176 *a
10177 <!--This line will NOT split the list-->
10178 *b
10179 <!--This line will NOT split the list either-->
10180 *c
10181 <!--foo--> <!----> <!--This line NOT split the list
10182 either-->
10183 *d
10184 !! html
10185 <ul><li>a</li>
10186 <li>b</li>
10187 <li>c</li>
10188 <li>d</li></ul>
10189
10190 !!end
10191
10192 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10193 # That pass could possibly be removed.
10194 !!test
10195 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10196 !!options
10197 parsoid=wt2html,wt2wt
10198 !! wikitext
10199 *foo
10200 *<li>li-hack
10201 *{{echo|<li>templated li-hack}}
10202 *<!--foo--><li> unsupported li-hack with preceding comments
10203
10204 <ul>
10205 <li><li>not a li-hack
10206 </li>
10207 </ul>
10208 !! html+tidy
10209 <ul><li>foo</li>
10210 <li class="mw-empty-elt"></li><li>li-hack</li>
10211 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10212 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10213 <ul>
10214 <li class="mw-empty-elt"></li><li>not a li-hack
10215 </li>
10216 </ul>
10217 !! html/parsoid
10218 <ul><li> foo</li>
10219 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10220 <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>
10221 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10222
10223 <ul data-parsoid='{"stx":"html"}'>
10224 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10225 </li>
10226 </ul>
10227
10228 !!end
10229
10230 !! test
10231 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10232 !! wikitext
10233 #foo
10234 ##bar
10235
10236 *foo
10237 **bar
10238
10239 :foo
10240 ::bar
10241 !! html/php+tidy
10242 <ol><li>foo
10243 <ol><li>bar</li></ol></li></ol>
10244 <ul><li>foo
10245 <ul><li>bar</li></ul></li></ul>
10246 <dl><dd>foo
10247 <dl><dd>bar</dd></dl></dd></dl>
10248 !! html/parsoid
10249 <ol>
10250 <li>foo<ol>
10251 <li>bar</li>
10252 </ol></li>
10253 </ol><ul>
10254 <li>foo<ul>
10255 <li>bar</li>
10256 </ul></li>
10257 </ul><dl>
10258 <dd>foo<dl>
10259 <dd>bar</dd>
10260 </dl></dd>
10261 </dl>
10262 !! end
10263
10264 !! test
10265 Parsoid: Test of whitespace serialization with Templated bullets
10266 !! options
10267 parsoid=wt2html
10268 !! wikitext
10269 * {{bullet}}
10270 !! html/parsoid
10271 <ul>
10272 <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>
10273 </ul>
10274 !! end
10275
10276 # ------------------------------------------------------------------------
10277 # The next set of tests are about Parsoid's ability to handle badly nested
10278 # tags (parse, minimize scope of fixup, and roundtrip back)
10279 # ------------------------------------------------------------------------
10280
10281 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10282 # Parsoid's list handling is more aware of block structure.
10283 !! test
10284 Unbalanced closing block tags break a list
10285 !! wikitext
10286 <div>
10287 *a</div><div>
10288 *b</div>
10289 !! html+tidy
10290 <div>
10291 <ul><li>a</li></ul></div><div>
10292 <li>b</li></div>
10293 !! html/parsoid
10294 <div><ul>
10295 <li>a</li>
10296 </ul></div>
10297 <div><ul>
10298 <li>b</li>
10299 </ul></div>
10300 !! end
10301
10302 !! test
10303 Unbalanced closing non-block tags don't break a list
10304 !! options
10305 parsoid=wt2html,html2html
10306 !! wikitext
10307 <span>
10308 *a</span><span>
10309 *b</span>
10310 !! html/php+tidy
10311 <p><span>
10312 </span></p>
10313 <ul><li>a<span></span></li>
10314 <li>b</li></ul>
10315 !! html/parsoid
10316 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10317 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10318 <li>b</li></ul>
10319 !! end
10320
10321 # Parsoid does some post-dom-building cleanup
10322 # which is why its output differs from Remex.
10323 !! test
10324 Unclosed formatting tags that straddle lists are closed and reopened
10325 !! options
10326 parsoid=wt2html,wt2wt,html2html
10327 !! wikitext
10328 #<s> a
10329 #b </s>
10330 !! html/php+tidy
10331 <ol><li><s> a</s></li><s>
10332 </s><li><s>b </s></li></ol>
10333 !! html/parsoid
10334 <ol><li><s> a</s></li>
10335 <li><s>b </s></li></ol>
10336 !! end
10337
10338 # Output is ugly because of all the misnested tag fixups.
10339 !! test
10340 1. List embedded in a formatting tag
10341 !! wikitext
10342 <small>
10343 *foo
10344 </small>
10345 !! html/php+tidy
10346 <p><small>
10347 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10348 </p>
10349 !! html/parsoid
10350 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10351 <ul><li data-parsoid='{}'>foo</li></ul></small>
10352 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10353 !! end
10354
10355 # Output is ugly because of all the misnested tag fixups.
10356 !! test
10357 2. List embedded in a formatting tag in a misnested way
10358 !! wikitext
10359 <small>
10360 *a
10361 *b</small>
10362 !! html/php+tidy
10363 <p><small>
10364 </small></p><small></small><ul><small><li>a</li>
10365 </small><li><small>b</small></li></ul>
10366 !! html/parsoid
10367 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10368 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10369 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10370 !! end
10371
10372 # Output is ugly because of all the misnested tag fixups.
10373 !! test
10374 3. List embedded in a formatting tag in a misnested way
10375 !! wikitext
10376 <small>
10377
10378 ** 123</small>
10379 !! html/php+tidy
10380 <p><small>
10381 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10382 !! html/parsoid
10383 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10384
10385 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10386 !! end
10387
10388 ###
10389 ### Magic Words
10390 ###
10391
10392 # Note that the current date is hard-coded as
10393 # 1970-01-01T00:02:03Z (a Thursday)
10394 # when running parser tests. The timezone is also fixed to GMT, so
10395 # local date will be identical to current date.
10396
10397 !! test
10398 Magic Word: {{CURRENTDAY}}
10399 !! wikitext
10400 {{CURRENTDAY}}
10401 !! html
10402 <p>1
10403 </p>
10404 !! end
10405
10406 !! test
10407 Magic Word: {{CURRENTDAY2}}
10408 !! wikitext
10409 {{CURRENTDAY2}}
10410 !! html
10411 <p>01
10412 </p>
10413 !! end
10414
10415 !! test
10416 Magic Word: {{CURRENTDAYNAME}}
10417 !! wikitext
10418 {{CURRENTDAYNAME}}
10419 !! html
10420 <p>Thursday
10421 </p>
10422 !! end
10423
10424 !! test
10425 Magic Word: {{CURRENTDOW}}
10426 !! wikitext
10427 {{CURRENTDOW}}
10428 !! html
10429 <p>4
10430 </p>
10431 !! end
10432
10433 !! test
10434 Magic Word: {{CURRENTMONTH}}
10435 !! wikitext
10436 {{CURRENTMONTH}}
10437 !! html
10438 <p>01
10439 </p>
10440 !! end
10441
10442 !! test
10443 Magic Word: {{CURRENTMONTH1}}
10444 !! wikitext
10445 {{CURRENTMONTH1}}
10446 !! html
10447 <p>1
10448 </p>
10449 !! end
10450
10451 !! test
10452 Magic Word: {{CURRENTMONTHABBREV}}
10453 !! wikitext
10454 {{CURRENTMONTHABBREV}}
10455 !! html
10456 <p>Jan
10457 </p>
10458 !! end
10459
10460 !! test
10461 Magic Word: {{CURRENTMONTHNAME}}
10462 !! wikitext
10463 {{CURRENTMONTHNAME}}
10464 !! html
10465 <p>January
10466 </p>
10467 !! end
10468
10469 !! test
10470 Magic Word: {{CURRENTMONTHNAMEGEN}}
10471 !! wikitext
10472 {{CURRENTMONTHNAMEGEN}}
10473 !! html
10474 <p>January
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{CURRENTTIME}}
10480 !! wikitext
10481 {{CURRENTTIME}}
10482 !! html
10483 <p>00:02
10484 </p>
10485 !! end
10486
10487 !! test
10488 Magic Word: {{CURRENTHOUR}}
10489 !! wikitext
10490 {{CURRENTHOUR}}
10491 !! html
10492 <p>00
10493 </p>
10494 !! end
10495
10496 !! test
10497 Magic Word: {{CURRENTWEEK}} (T6594)
10498 !! wikitext
10499 {{CURRENTWEEK}}
10500 !! html
10501 <p>1
10502 </p>
10503 !! end
10504
10505 !! test
10506 Magic Word: {{CURRENTYEAR}}
10507 !! wikitext
10508 {{CURRENTYEAR}}
10509 !! html
10510 <p>1970
10511 </p>
10512 !! end
10513
10514 !! test
10515 Magic Word: {{CURRENTTIMESTAMP}}
10516 !! wikitext
10517 {{CURRENTTIMESTAMP}}
10518 !! html
10519 <p>19700101000203
10520 </p>
10521 !! end
10522
10523 !! test
10524 Magic Words LOCAL (UTC)
10525 !! wikitext
10526 *{{LOCALMONTH}}
10527 *{{LOCALMONTH1}}
10528 *{{LOCALMONTHNAME}}
10529 *{{LOCALMONTHNAMEGEN}}
10530 *{{LOCALMONTHABBREV}}
10531 *{{LOCALDAY}}
10532 *{{LOCALDAY2}}
10533 *{{LOCALDAYNAME}}
10534 *{{LOCALYEAR}}
10535 *{{LOCALTIME}}
10536 *{{LOCALHOUR}}
10537 *{{LOCALWEEK}}
10538 *{{LOCALDOW}}
10539 *{{LOCALTIMESTAMP}}
10540 !! html
10541 <ul><li>01</li>
10542 <li>1</li>
10543 <li>January</li>
10544 <li>January</li>
10545 <li>Jan</li>
10546 <li>1</li>
10547 <li>01</li>
10548 <li>Thursday</li>
10549 <li>1970</li>
10550 <li>00:02</li>
10551 <li>00</li>
10552 <li>1</li>
10553 <li>4</li>
10554 <li>19700101000203</li></ul>
10555
10556 !! end
10557
10558 !! test
10559 Magic Word: {{FULLPAGENAME}}
10560 !! options
10561 title=[[User:Ævar Arnfjörð Bjarmason]]
10562 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10563 !! wikitext
10564 {{FULLPAGENAME}}
10565 !! html/*
10566 <p>User:Ævar Arnfjörð Bjarmason
10567 </p>
10568 !! end
10569
10570 !! test
10571 Magic Word: {{FULLPAGENAMEE}}
10572 !! options
10573 title=[[User:Ævar Arnfjörð Bjarmason]]
10574 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10575 !! wikitext
10576 {{FULLPAGENAMEE}}
10577 !! html/*
10578 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10579 </p>
10580 !! end
10581
10582 !! test
10583 Magic Word: {{TALKSPACE}}
10584 !! options
10585 title=[[User:Ævar Arnfjörð Bjarmason]]
10586 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10587 !! wikitext
10588 {{TALKSPACE}}
10589 !! html/*
10590 <p>User talk
10591 </p>
10592 !! end
10593
10594 !! test
10595 Magic Word: {{TALKSPACE}}, same namespace
10596 !! options
10597 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10598 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10599 !! wikitext
10600 {{TALKSPACE}}
10601 !! html/*
10602 <p>User talk
10603 </p>
10604 !! end
10605
10606 !! test
10607 Magic Word: {{TALKSPACE}}, main namespace
10608 !! options
10609 title=[[Parser Test]]
10610 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10611 !! wikitext
10612 {{TALKSPACE}}
10613 !! html/*
10614 <p>Talk
10615 </p>
10616 !! end
10617
10618 !! test
10619 Magic Word: {{TALKSPACEE}}
10620 !! options
10621 title=[[User:Ævar Arnfjörð Bjarmason]]
10622 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10623 !! wikitext
10624 {{TALKSPACEE}}
10625 !! html/*
10626 <p>User_talk
10627 </p>
10628 !! end
10629
10630 !! test
10631 Magic Word: {{SUBJECTSPACE}}
10632 !! options
10633 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10634 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10635 !! wikitext
10636 {{SUBJECTSPACE}}
10637 !! html/*
10638 <p>User
10639 </p>
10640 !! end
10641
10642 !! test
10643 Magic Word: {{SUBJECTSPACE}}, same namespace
10644 !! options
10645 title=[[User:Ævar Arnfjörð Bjarmason]]
10646 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10647 !! wikitext
10648 {{SUBJECTSPACE}}
10649 !! html/*
10650 <p>User
10651 </p>
10652 !! end
10653
10654 !! test
10655 Magic Word: {{SUBJECTSPACE}}, main namespace
10656 !! options
10657 title=[[Parser Test]]
10658 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10659 !! wikitext
10660 {{SUBJECTSPACE}}
10661 !! html/*
10662
10663 !! end
10664
10665 !! test
10666 Magic Word: {{SUBJECTSPACEE}}
10667 !! options
10668 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10669 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10670 !! wikitext
10671 {{SUBJECTSPACEE}}
10672 !! html/*
10673 <p>User
10674 </p>
10675 !! end
10676
10677 !! test
10678 Magic Word: {{NAMESPACE}}
10679 !! options
10680 title=[[User:Ævar Arnfjörð Bjarmason]]
10681 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10682 !! wikitext
10683 {{NAMESPACE}}
10684 !! html/*
10685 <p>User
10686 </p>
10687 !! end
10688
10689 !! test
10690 Magic Word: {{NAMESPACEE}}
10691 !! options
10692 title=[[User:Ævar Arnfjörð Bjarmason]]
10693 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10694 !! wikitext
10695 {{NAMESPACEE}}
10696 !! html/*
10697 <p>User
10698 </p>
10699 !! end
10700
10701 !! test
10702 Magic Word: {{NAMESPACENUMBER}}
10703 !! options
10704 title=[[User:Ævar Arnfjörð Bjarmason]]
10705 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10706 !! wikitext
10707 {{NAMESPACENUMBER}}
10708 !! html/*
10709 <p>2
10710 </p>
10711 !! end
10712
10713 !! test
10714 Magic Word: {{SUBPAGENAME}}
10715 !! options
10716 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10717 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10718 !! wikitext
10719 {{SUBPAGENAME}}
10720 !! html/*
10721 <p>sub ö
10722 </p>
10723 !! end
10724
10725 !! test
10726 Magic Word: {{SUBPAGENAMEE}}
10727 !! options
10728 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10729 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10730 !! wikitext
10731 {{SUBPAGENAMEE}}
10732 !! html/*
10733 <p>sub_%C3%B6
10734 </p>
10735 !! end
10736
10737 !! test
10738 Magic Word: {{ROOTPAGENAME}}
10739 !! options
10740 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10741 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10742 !! wikitext
10743 {{ROOTPAGENAME}}
10744 !! html/*
10745 <p>Ævar Arnfjörð Bjarmason
10746 </p>
10747 !! end
10748
10749 !! test
10750 Magic Word: {{ROOTPAGENAMEE}}
10751 !! options
10752 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10753 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10754 !! wikitext
10755 {{ROOTPAGENAMEE}}
10756 !! html/*
10757 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10758 </p>
10759 !! end
10760
10761 !! test
10762 Magic Word: {{BASEPAGENAME}}
10763 !! options
10764 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10765 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10766 !! wikitext
10767 {{BASEPAGENAME}}
10768 !! html/*
10769 <p>Ævar Arnfjörð Bjarmason
10770 </p>
10771 !! end
10772
10773 !! test
10774 Magic Word: {{BASEPAGENAMEE}}
10775 !! options
10776 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10777 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10778 !! wikitext
10779 {{BASEPAGENAMEE}}
10780 !! html/*
10781 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10782 </p>
10783 !! end
10784
10785 !! test
10786 Magic Word: {{TALKPAGENAME}}
10787 !! options
10788 title=[[User:Ævar Arnfjörð Bjarmason]]
10789 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10790 !! wikitext
10791 {{TALKPAGENAME}}
10792 !! html/*
10793 <p>User talk:Ævar Arnfjörð Bjarmason
10794 </p>
10795 !! end
10796
10797 !! test
10798 Magic Word: {{TALKPAGENAMEE}}
10799 !! options
10800 title=[[User:Ævar Arnfjörð Bjarmason]]
10801 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10802 !! wikitext
10803 {{TALKPAGENAMEE}}
10804 !! html/*
10805 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10806 </p>
10807 !! end
10808
10809 !! test
10810 Magic Word: {{SUBJECTPAGENAME}}
10811 !! options
10812 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10813 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10814 !! wikitext
10815 {{SUBJECTPAGENAME}}
10816 !! html/*
10817 <p>User:Ævar Arnfjörð Bjarmason
10818 </p>
10819 !! end
10820
10821 !! test
10822 Magic Word: {{SUBJECTPAGENAMEE}}
10823 !! options
10824 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10825 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10826 !! wikitext
10827 {{SUBJECTPAGENAMEE}}
10828 !! html/*
10829 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10830 </p>
10831 !! end
10832
10833 !! test
10834 Magic Word: {{NUMBEROFFILES}}
10835 !! options
10836 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10837 !! wikitext
10838 {{NUMBEROFFILES}}
10839 !! html/*
10840 <p>7
10841 </p>
10842 !! end
10843
10844 !! test
10845 Magic Word: {{PAGENAME}}
10846 !! options
10847 title=[[User:Ævar Arnfjörð Bjarmason]]
10848 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10849 !! wikitext
10850 {{PAGENAME}}
10851 !! html/*
10852 <p>Ævar Arnfjörð Bjarmason
10853 </p>
10854 !! end
10855
10856 !! test
10857 Magic Word: {{PAGENAME}} with metacharacters
10858 !! options
10859 title=[['foo & bar = baz']]
10860 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10861 !! wikitext
10862 ''{{PAGENAME}}''
10863 !! html+tidy
10864 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10865 </p>
10866 !! end
10867
10868 !! test
10869 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10870 !! options
10871 title=[[*RFC 1234 http://example.com/]]
10872 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10873 !! wikitext
10874 {{PAGENAME}}
10875 !! html+tidy
10876 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10877 </p>
10878 !! end
10879
10880 !! test
10881 Magic Word: {{PAGENAMEE}}
10882 !! options
10883 title=[[User:Ævar Arnfjörð Bjarmason]]
10884 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10885 !! wikitext
10886 {{PAGENAMEE}}
10887 !! html/*
10888 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10889 </p>
10890 !! end
10891
10892 !! test
10893 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10894 !! options
10895 title=[[*RFC 1234 http://example.com/]]
10896 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10897 !! wikitext
10898 {{PAGENAMEE}}
10899 !! html+tidy
10900 <p>&#42;RFC_1234_http&#58;//example.com/
10901 </p>
10902 !! end
10903
10904 !! test
10905 Magic Word: {{REVISIONID}}
10906 !! options
10907 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10908 showflags
10909 !! wikitext
10910 {{REVISIONID}}
10911 !! html/*
10912 <p>1337
10913 </p>
10914 flags=vary-revision-id
10915 !! end
10916
10917 !! test
10918 Magic Word: {{SCRIPTPATH}}
10919 !! options
10920 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10921 !! wikitext
10922 {{SCRIPTPATH}}
10923 !! html/*
10924
10925 !! end
10926
10927 !! test
10928 Magic Word: {{STYLEPATH}}
10929 !! options
10930 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10931 !! wikitext
10932 {{STYLEPATH}}
10933 !! html/*
10934 <p>/skins
10935 </p>
10936 !! end
10937
10938 !! test
10939 Magic Word: {{SERVER}}
10940 !! options
10941 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10942 !! wikitext
10943 {{SERVER}}
10944 !! html/*
10945 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10946 </p>
10947 !! end
10948
10949 !! test
10950 Magic Word: {{SERVERNAME}}
10951 !! options
10952 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10953 !! wikitext
10954 {{SERVERNAME}}
10955 !! html/*
10956 <p>example.org
10957 </p>
10958 !! end
10959
10960 !! test
10961 Magic Word: {{SITENAME}}
10962 !! options
10963 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10964 !! wikitext
10965 {{SITENAME}}
10966 !! html/*
10967 <p>MediaWiki
10968 </p>
10969 !! end
10970
10971 !! test
10972 Magic Word: {{PAGELANGUAGE}}
10973 !! options
10974 language=fr
10975 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10976 !! wikitext
10977 {{PAGELANGUAGE}}
10978 !! html/*
10979 <p>fr
10980 </p>
10981 !! end
10982
10983 !! test
10984 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10985 !! options
10986 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10987 !! wikitext
10988 {{PAGELANGUAGE}}
10989 !! html/*
10990 <p>en
10991 </p>
10992 !! end
10993
10994 !! test
10995 Case-sensitive magic words, when cased differently, should just be template transclusions
10996 !! wikitext
10997 {{CurrentMonth}}
10998 {{currentday}}
10999 {{cURreNTweEK}}
11000 {{currentHour}}
11001 !! html
11002 <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>
11003 <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>
11004 <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>
11005 <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>
11006 </p>
11007 !! end
11008
11009 !! test
11010 Case-insensitive magic words should still work with weird casing.
11011 !! wikitext
11012 {{sErVeRNaMe}}
11013 {{LCFirst:AOEU}}
11014 {{ucFIRST:aoeu}}
11015 {{SERver}}
11016 !! html
11017 <p>example.org
11018 aOEU
11019 Aoeu
11020 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11021 </p>
11022 !! end
11023
11024 # From plwiki:PLOS_ONE
11025 !! test
11026 Parsoid: Page property magic word with magic word contents
11027 !! options
11028 showtitle
11029 !! config
11030 wgAllowDisplayTitle=true
11031 wgRestrictDisplayTitle=false
11032 !! wikitext
11033 {{DISPLAYTITLE:''{{PAGENAME}}''}}
11034 !! html/php+tidy
11035 <i>Parser test</i>
11036
11037 !! html/parsoid
11038 <meta property="mw:PageProp/displaytitle" content="Parser test" 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;>Parser test&lt;/span>&lt;/i>"}]]}'/>
11039 !! end
11040
11041 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
11042 # But, this is a limitation of our representation and is documented in
11043 # TemplateHandler.js in processSpecialMagicWord
11044 !! test
11045 Parsoid: Template-generated DISPLAYTITLE
11046 !! wikitext
11047 {{{{echo|DISPLAYTITLE}}:Foo}}
11048 !! options
11049 showtitle
11050 !! config
11051 wgAllowDisplayTitle=true
11052 wgRestrictDisplayTitle=false
11053 !! html/php
11054 Foo
11055
11056 !! html/parsoid
11057 <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"}]]}'/>
11058 !! end
11059
11060 !! test
11061 Namespace 1 {{ns:1}}
11062 !! wikitext
11063 {{ns:1}}
11064 !! html
11065 <p>Talk
11066 </p>
11067 !! end
11068
11069 !! test
11070 Namespace 1 {{ns:01}}
11071 !! wikitext
11072 {{ns:01}}
11073 !! html
11074 <p>Talk
11075 </p>
11076 !! end
11077
11078 !! test
11079 Namespace 0 {{ns:0}} (T6783)
11080 !! wikitext
11081 {{ns:0}}
11082 !! html
11083
11084 !! end
11085
11086 !! test
11087 Namespace 0 {{ns:00}} (T6783)
11088 !! wikitext
11089 {{ns:00}}
11090 !! html
11091
11092 !! end
11093
11094 !! test
11095 Namespace -1 {{ns:-1}}
11096 !! wikitext
11097 {{ns:-1}}
11098 !! html
11099 <p>Special
11100 </p>
11101 !! end
11102
11103 !! test
11104 Namespace User {{ns:User}}
11105 !! wikitext
11106 {{ns:User}}
11107 !! html
11108 <p>User
11109 </p>
11110 !! end
11111
11112 !! test
11113 Namespace User talk {{ns:User_talk}}
11114 !! wikitext
11115 {{ns:User_talk}}
11116 !! html
11117 <p>User talk
11118 </p>
11119 !! end
11120
11121 !! test
11122 Namespace User talk {{ns:uSeR tAlK}}
11123 !! wikitext
11124 {{ns:uSeR tAlK}}
11125 !! html
11126 <p>User talk
11127 </p>
11128 !! end
11129
11130 !! test
11131 Namespace File {{ns:File}}
11132 !! wikitext
11133 {{ns:File}}
11134 !! html
11135 <p>File
11136 </p>
11137 !! end
11138
11139 !! test
11140 Namespace File {{ns:Image}}
11141 !! wikitext
11142 {{ns:Image}}
11143 !! html
11144 <p>File
11145 </p>
11146 !! end
11147
11148 !! test
11149 Namespace (lang=de) Benutzer {{ns:User}}
11150 !! options
11151 language=de
11152 !! wikitext
11153 {{ns:User}}
11154 !! html
11155 <p>Benutzer
11156 </p>
11157 !! end
11158
11159 !! test
11160 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11161 !! options
11162 language=de
11163 !! wikitext
11164 {{ns:3}}
11165 !! html
11166 <p>Benutzer Diskussion
11167 </p>
11168 !! end
11169
11170 !! test
11171 Urlencode
11172 !! wikitext
11173 {{urlencode:hi world?!}}
11174 {{urlencode:hi world?!|WIKI}}
11175 {{urlencode:hi world?!|PATH}}
11176 {{urlencode:hi world?!|QUERY}}
11177 !! html/php
11178 <p>hi+world%3F%21
11179 hi_world%3F!
11180 hi%20world%3F%21
11181 hi+world%3F%21
11182 </p>
11183 !! end
11184
11185 !! test
11186 Magic Word: prioritize type info over data-parsoid
11187 !! options
11188 parsoid=html2wt
11189 !! html/parsoid
11190 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11191 !! wikitext
11192 __FORCETOC__
11193 !! end
11194
11195 !! test
11196 Magic Word: serialize on separate line (parsoid)
11197 !! options
11198 parsoid=wt2wt,html2wt
11199 !! wikitext
11200 foo
11201 __NOTOC__
11202 bar
11203 !! html/parsoid
11204 foo<meta property="mw:PageProp/notoc"/>bar
11205 !! end
11206
11207 !! test
11208 Magic Word: rt non-english wikis
11209 !! options
11210 parsoid=wt2wt
11211 language=de
11212 !! wikitext
11213 __NOEDITSECTION__
11214 !! html/parsoid
11215 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11216 !! end
11217
11218 !!test
11219 __proto__ is treated as normal wikitext (T105997)
11220 !!wikitext
11221 __proto__
11222 !!html
11223 <p>__proto__
11224 </p>
11225 !!end
11226
11227 ###
11228 ### Magic links
11229 ###
11230 !! test
11231 Magic links: internal link to RFC (T2479)
11232 !! wikitext
11233 [[RFC 123]]
11234 !! html/php
11235 <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>
11236 </p>
11237 !! html/parsoid
11238 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11239 !! end
11240
11241 !! test
11242 Magic links: RFC (T2479)
11243 !! wikitext
11244 RFC 822
11245 !! html/php
11246 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11247 </p>
11248 !! html/parsoid
11249 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11250 !! end
11251
11252 !! test
11253 Magic links: RFC (T67278)
11254 !! wikitext
11255 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11256 !! html/php
11257 <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.
11258 </p>
11259 !! html/parsoid
11260 <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>
11261 !! end
11262
11263 !! test
11264 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11265 !! wikitext
11266 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11267 RFC
11268 822
11269 !! html/php
11270 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11271 RFC
11272 822
11273 </p>
11274 !! html/parsoid
11275 <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>
11276 RFC
11277 822</p>
11278 !! end
11279
11280 !! test
11281 Magic links: ISBN (T3937)
11282 !! wikitext
11283 ISBN 0-306-40615-2
11284 !! html/php
11285 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11286 </p>
11287 !! html/parsoid
11288 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11289 !! end
11290
11291 !! test
11292 Magic links: ISBN (T67278)
11293 !! wikitext
11294 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11295 !! html/php
11296 <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.
11297 </p>
11298 !! html/parsoid
11299 <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>
11300 !! end
11301
11302 !! test
11303 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11304 !! wikitext
11305 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11306 ISBN
11307 9780316098113
11308 ISBN 978
11309 0316098113
11310 !! html/php
11311 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11312 ISBN
11313 9780316098113
11314 ISBN 978
11315 0316098113
11316 </p>
11317 !! html/parsoid
11318 <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>
11319 ISBN
11320 9780316098113
11321 ISBN 978
11322 0316098113</p>
11323 !! end
11324
11325 !! test
11326 Magic links: PMID incorrectly converts space to underscore
11327 !! wikitext
11328 PMID 1234
11329 !! html/php
11330 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11331 </p>
11332 !! html/parsoid
11333 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11334 !! end
11335
11336 !! test
11337 Magic links: PMID (T67278)
11338 !! wikitext
11339 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11340 !! html/php
11341 <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.
11342 </p>
11343 !! html/parsoid
11344 <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>
11345 !! end
11346
11347 !! test
11348 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11349 !! wikitext
11350 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11351 PMID
11352 1234
11353 !! html/php
11354 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11355 PMID
11356 1234
11357 </p>
11358 !! html/parsoid
11359 <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>
11360 PMID
11361 1234</p>
11362 !! end
11363
11364 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11365 # since these are ExtLinkText, not MagicLinkText
11366 !! test
11367 Magic links: use appropriate serialization for "almost" magic links.
11368 !! wikitext
11369 X[[Special:BookSources/0978739256|foo]]
11370
11371 X[https://tools.ietf.org/html/rfc1234 foo]
11372 !! html/php
11373 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11374 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11375 </p>
11376 !! html/parsoid
11377 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11378 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11379 !! end
11380
11381 !! test
11382 Magic links: All disabled (T47942)
11383 !! options
11384 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11385 !! wikitext
11386 ISBN 0-306-40615-2
11387 PMID 1234
11388 RFC 4321
11389 !! html/php
11390 <p>ISBN 0-306-40615-2
11391 PMID 1234
11392 RFC 4321
11393 </p>
11394 !! end
11395
11396 ###
11397 ### Templates
11398 ####
11399
11400 !! test
11401 Nonexistent template
11402 !! wikitext
11403 {{thistemplatedoesnotexist}}
11404 !! html
11405 <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>
11406 </p>
11407 !! end
11408
11409 !! test
11410 Template with invalid target containing tags
11411 !! wikitext
11412 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11413 !! html
11414 <p>{{a<b>b</b>|foo|a=b|a = b}}
11415 </p>
11416 !! end
11417
11418 !! test
11419 Template with invalid target containing unclosed tag
11420 !! wikitext
11421 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11422 !! html
11423 <p>{{a<b>|foo|a=b|a = b}}</b>
11424 </p>
11425 !! end
11426
11427 !! test
11428 Template with invalid target containing wikilink
11429 !! wikitext
11430 {{[[Main Page]]}}
11431 !! html/php
11432 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11433 </p>
11434 !! html/parsoid
11435 <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>
11436 !! end
11437
11438 !! test
11439 Template with just whitespace in it, T70421
11440 !! wikitext
11441 {{echo|{{ }}}}
11442 !! html/parsoid
11443 <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>
11444 !! end
11445
11446 !! article
11447 Template:test
11448 !! text
11449 This is a test template
11450 !! endarticle
11451
11452 !! test
11453 Simple template
11454 !! wikitext
11455 {{test}}
11456 !! html
11457 <p>This is a test template
11458 </p>
11459 !! end
11460
11461 !! test
11462 Template with explicit namespace
11463 !! wikitext
11464 {{Template:test}}
11465 !! html
11466 <p>This is a test template
11467 </p>
11468 !! end
11469
11470
11471 !! article
11472 Template:paramtest
11473 !! text
11474 This is a test template with parameter {{{param}}}
11475 !! endarticle
11476
11477 !! test
11478 Template parameter
11479 !! wikitext
11480 {{paramtest|param=foo}}
11481 !! html
11482 <p>This is a test template with parameter foo
11483 </p>
11484 !! end
11485
11486 !! article
11487 Template:paramtestnum
11488 !! text
11489 [[{{{1}}}|{{{2}}}]]
11490 !! endarticle
11491
11492 !! test
11493 Template unnamed parameter
11494 !! wikitext
11495 {{paramtestnum|Main Page|the main page}}
11496 !! html
11497 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11498 </p>
11499 !! end
11500
11501 !! article
11502 Template:templatesimple
11503 !! text
11504 (test)
11505 !! endarticle
11506
11507 !! article
11508 Template:templateredirect
11509 !! text
11510 #redirect [[Template:templatesimple]]
11511 !! endarticle
11512
11513 !! article
11514 Template:templateasargtestnum
11515 !! text
11516 {{{{{1}}}}}
11517 !! endarticle
11518
11519 !! article
11520 Template:templateasargtest
11521 !! text
11522 {{template{{{templ}}}}}
11523 !! endarticle
11524
11525 !! article
11526 Template:templateasargtest2
11527 !! text
11528 {{{{{templ}}}}}
11529 !! endarticle
11530
11531 !! test
11532 Template with template name as unnamed argument
11533 !! wikitext
11534 {{templateasargtestnum|templatesimple}}
11535 !! html
11536 <p>(test)
11537 </p>
11538 !! end
11539
11540 !! test
11541 Template with template name as argument
11542 !! wikitext
11543 {{templateasargtest|templ=simple}}
11544 !! html
11545 <p>(test)
11546 </p>
11547 !! end
11548
11549 !! test
11550 Template with template name as argument (2)
11551 !! wikitext
11552 {{templateasargtest2|templ=templatesimple}}
11553 !! html
11554 <p>(test)
11555 </p>
11556 !! end
11557
11558 !! article
11559 Template:templateasargtestdefault
11560 !! text
11561 {{{{{templ|templatesimple}}}}}
11562 !! endarticle
11563
11564 !! article
11565 Template:templa
11566 !! text
11567 '''templ'''
11568 !! endarticle
11569
11570 !! test
11571 Template with default value
11572 !! wikitext
11573 {{templateasargtestdefault}}
11574 !! html
11575 <p>(test)
11576 </p>
11577 !! end
11578
11579 !! test
11580 Template with default value (value set)
11581 !! wikitext
11582 {{templateasargtestdefault|templ=templa}}
11583 !! html
11584 <p><b>templ</b>
11585 </p>
11586 !! end
11587
11588 !! test
11589 Template redirect
11590 !! wikitext
11591 {{templateredirect}}
11592 !! html/php
11593 <p>(test)
11594 </p>
11595 !! html/parsoid
11596 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11597 !! end
11598
11599 !! test
11600 Template with argument in separate line
11601 !! wikitext
11602 {{ templateasargtest |
11603 templ = simple }}
11604 !! html
11605 <p>(test)
11606 </p>
11607 !! end
11608
11609 !! test
11610 Template with complex template as argument
11611 !! wikitext
11612 {{paramtest|
11613 param ={{ templateasargtest |
11614 templ = simple }}}}
11615 !! html
11616 <p>This is a test template with parameter (test)
11617 </p>
11618 !! end
11619
11620 !! test
11621 Templates with templated name
11622 !! wikitext
11623 {{{{echo|echo}}|foo}}
11624 {{{{echo|inner list}} }}
11625 !! html
11626 <p>foo
11627 </p>
11628 <ul><li>item 1</li></ul>
11629
11630 !! html/parsoid
11631 <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>
11632 <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>
11633 !! end
11634
11635 ## Regression test; the output here isn't really that interesting.
11636 !! test
11637 Templates with templated name and top level template args
11638 !! wikitext
11639 {{1{{2{{{3}}}|4=5}}}}
11640 !! html/parsoid
11641 <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>
11642 !! end
11643
11644 # Parsoid markup is deliberate "broken". This is an edge case.
11645 # See long comment in TemplateHandler.js:convertAttribsToString.
11646 !! test
11647 Templates with invalid templated targets
11648 !! wikitext
11649 {{echo
11650 {{echo|foo}}
11651 }}
11652 !! html/php
11653 <p>{{echo
11654 foo
11655 }}
11656 </p>
11657 !! html/parsoid
11658 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11659 foo }}</p>
11660 !! end
11661
11662 !! test
11663 Template with thumb image (with link in description)
11664 !! wikitext
11665 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11666 !! html/php
11667 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>
11668
11669 !! html+tidy
11670 <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>
11671 !! html/parsoid
11672 <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>
11673 !! end
11674
11675 !! article
11676 Template:complextemplate
11677 !! text
11678 {{{1}}} {{paramtest|
11679 param ={{{param}}}}}
11680 !! endarticle
11681
11682 !! test
11683 Template with complex arguments
11684 !! wikitext
11685 {{complextemplate|
11686 param ={{ templateasargtest |
11687 templ = simple }}|[[Template:complextemplate|link]]}}
11688 !! html
11689 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11690 </p>
11691 !! end
11692
11693 !! test
11694 T2553: link with two variables in a piped link
11695 !! wikitext
11696 {|
11697 |[[{{{1}}}|{{{2}}}]]
11698 |}
11699 !! html/php
11700 <table>
11701 <tr>
11702 <td>[[{{{1}}}|{{{2}}}]]
11703 </td></tr></table>
11704
11705 !! html/parsoid
11706 <table>
11707 <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>
11708 </tbody></table>
11709 !! end
11710
11711 # See: T2553
11712 !! test
11713 Abort table cell attribute parsing on wikilink
11714 !! wikitext
11715 {|
11716 |testing [[one|two]] |three||four
11717 |testing one two |three||four
11718 |testing="[[one|two]]" |three||four
11719 |}
11720 !! html/php
11721 <table>
11722 <tr>
11723 <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>
11724 <td>four
11725 </td>
11726 <td>three</td>
11727 <td>four
11728 </td>
11729 <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>
11730 <td>four
11731 </td></tr></table>
11732
11733 !! html/parsoid
11734 <table>
11735 <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>
11736 <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>
11737 <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>
11738 </tbody></table>
11739 !! end
11740
11741 !! test
11742 Don't abort table cell attribute parsing if wikilink is found in template arg
11743 !! wikitext
11744 {|
11745 |Test {{#tag:ref|One two "[[three]]" four}}
11746 |}
11747 !! html/parsoid
11748 <table>
11749 <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>
11750 </tbody></table>
11751 !! end
11752
11753 !! test
11754 Magic variable as template parameter
11755 !! wikitext
11756 {{paramtest|param={{SITENAME}}}}
11757 !! html
11758 <p>This is a test template with parameter MediaWiki
11759 </p>
11760 !! end
11761
11762 !! article
11763 Template:linktest
11764 !! text
11765 [[{{{param}}}|link]]
11766 !! endarticle
11767
11768 !! test
11769 Template parameter as link source
11770 !! wikitext
11771 {{linktest|param=Main Page}}
11772 !! html
11773 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11774 </p>
11775 !! end
11776
11777 !!article
11778 Template:paramtest2
11779 !! text
11780 including another template, {{paramtest|param={{{arg}}}}}
11781 !! endarticle
11782
11783 !! test
11784 Template passing argument to another template
11785 !! wikitext
11786 {{paramtest2|arg='hmm'}}
11787 !! html
11788 <p>including another template, This is a test template with parameter 'hmm'
11789 </p>
11790 !! end
11791
11792 !! article
11793 Template:Linktest2
11794 !! text
11795 Main Page
11796 !! endarticle
11797
11798 !! test
11799 Template as link source
11800 !! wikitext
11801 [[{{linktest2}}]]
11802
11803 [[{{linktest2}}|Main Page]]
11804
11805 [[{{linktest2}}]]Page
11806 !! html
11807 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11808 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11809 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11810 </p>
11811 !! end
11812
11813
11814 !! article
11815 Template:loop1
11816 !! text
11817 {{loop2}}
11818 !! endarticle
11819
11820 !! article
11821 Template:loop2
11822 !! text
11823 {{loop1}}
11824 !! endarticle
11825
11826 !! test
11827 Template infinite loop
11828 !! wikitext
11829 {{loop1}}
11830 !! html
11831 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11832 </p>
11833 !! end
11834
11835 !! test
11836 Template from main namespace
11837 !! wikitext
11838 {{:Main Page}}
11839 !! html
11840 <p>blah blah
11841 </p>
11842 !! end
11843
11844 !! test
11845 Template from non-includable namespace
11846 !! options
11847 wgNonincludableNamespaces=10
11848 !! wikitext
11849 {{echo|uh oh!}}
11850 !! html
11851 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11852 </p>
11853 !! end
11854
11855 !! article
11856 Template:table
11857 !! text
11858 {|
11859 | 1 || 2
11860 |-
11861 | 3 || 4
11862 |}
11863 !! endarticle
11864
11865 !! test
11866 T2529: Template with table, not included at beginning of line
11867 !! wikitext
11868 foo {{table}}
11869 !! html
11870 <p>foo
11871 </p>
11872 <table>
11873 <tr>
11874 <td>1</td>
11875 <td>2
11876 </td></tr>
11877 <tr>
11878 <td>3</td>
11879 <td>4
11880 </td></tr></table>
11881
11882 !! end
11883
11884 !! test
11885 T2523: Template shouldn't eat newline (or add an extra one before table)
11886 !! wikitext
11887 foo
11888 {{table}}
11889 !! html
11890 <p>foo
11891 </p>
11892 <table>
11893 <tr>
11894 <td>1</td>
11895 <td>2
11896 </td></tr>
11897 <tr>
11898 <td>3</td>
11899 <td>4
11900 </td></tr></table>
11901
11902 !! end
11903
11904 !! test
11905 T2041: Template parameters shown as broken links
11906 !! wikitext
11907 {{{parameter}}}
11908 !! html
11909 <p>{{{parameter}}}
11910 </p>
11911 !! end
11912
11913 !! test
11914 Template with targets containing wikilinks
11915 !! options
11916 parsoid=wt2html
11917 !! wikitext
11918 {{[[foo]]}}
11919
11920 {{[[{{echo|foo}}]]}}
11921
11922 {{{{echo|[[foo}}]]}}
11923 !! html/php
11924 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11925 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11926 </p><p>{{[[foo}}]]
11927 </p>
11928 !! html/parsoid
11929 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11930 <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>
11931 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11932 !! end
11933
11934 !! article
11935 Template:''
11936 !! text
11937 bar
11938 !! endarticle
11939
11940 !! test
11941 Templates: Double quotes as template target
11942 !! wikitext
11943 foo {{''}} baz
11944 !! html/php
11945 <p>foo bar baz
11946 </p>
11947 !! html/parsoid
11948 <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
11949 </p>
11950 !! end
11951
11952 ## This test is about making sure Parsoid's data-mw is well formed in the
11953 ## face of multiple templates with intersecting and overlapping ranges. The
11954 ## wikitext itself is wretched.
11955 !! test
11956 Templates with intersecting and overlapping ranges
11957 !! wikitext
11958 {|{{echo|
11959 <p>ha</p>}}
11960 {|{{echo|
11961 <p>ho</p>}}
11962 {{echo|{{!}}hi}}
11963 |}
11964 !! html/php+tidy
11965 <p>ha</p><table>
11966
11967 </table><p>ho</p><table>
11968
11969 <tbody><tr>
11970 <td>hi
11971 </td></tr></tbody></table>
11972 !! html/parsoid
11973 <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":""}]]}'>
11974
11975 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11976
11977 <tbody><tr><td>hi</td></tr>
11978 </tbody></table>
11979 !! end
11980
11981 !! article
11982 Template:MSGNW test
11983 !! text
11984 ''None'' of '''this''' should be
11985 * interpreted
11986 but rather passed unmodified
11987 {{test}}
11988 <gallery>
11989 File:Foobar.jpg
11990 </gallery>
11991 <!-- comment -->
11992 !! endarticle
11993
11994 # hmm, fix this or just deprecate msgnw and document its behavior?
11995 !! test
11996 msgnw keyword
11997 !! wikitext
11998 {{msgnw:MSGNW test}}
11999 !! html/php
12000 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
12001 &#42; interpreted
12002 &#32;but rather passed unmodified
12003 &#123;&#123;test&#125;&#125;
12004 &#60;gallery&#62;
12005 File:Foobar.jpg
12006 &#60;/gallery&#62;
12007 &#60;!-- comment --&#62;
12008 </p>
12009 !! end
12010
12011 !! test
12012 int keyword
12013 !! wikitext
12014 {{int:youhavenewmessages|lots of money|not!}}
12015 !! html
12016 <p>You have lots of money (not!).
12017 </p>
12018 !! end
12019
12020 !! test
12021 int keyword - non-existing message
12022 !! wikitext
12023 {{int:var}}
12024 !! html
12025 <p>⧼var⧽
12026 </p>
12027 !! end
12028
12029 !! article
12030 Template:Includes
12031 !! text
12032 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12033 !! endarticle
12034
12035 !! test
12036 <includeonly> and <noinclude> being included
12037 !! wikitext
12038 {{Includes}}
12039 !! html
12040 <p>Foobar
12041 </p>
12042 !! end
12043
12044 !! article
12045 Template:Includes2
12046 !! text
12047 <onlyinclude>Foo</onlyinclude>bar
12048 !! endarticle
12049
12050 !! test
12051 <onlyinclude> being included
12052 !! wikitext
12053 {{Includes2}}
12054 !! html
12055 <p>Foo
12056 </p>
12057 !! end
12058
12059
12060 !! article
12061 Template:Includes3
12062 !! text
12063 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
12064 !! endarticle
12065
12066 !! test
12067 <onlyinclude> and <includeonly> being included
12068 !! wikitext
12069 {{Includes3}}
12070 !! html
12071 <p>Foo
12072 </p>
12073 !! end
12074
12075 !! test
12076 <includeonly> and <noinclude> on a page
12077 !! wikitext
12078 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12079 !! html
12080 <p>Foozar
12081 </p>
12082 !! end
12083
12084 !! test
12085 Un-closed <noinclude>
12086 !! wikitext
12087 <noinclude>
12088 !! html
12089 !! end
12090
12091 !! test
12092 <onlyinclude> on a page
12093 !! wikitext
12094 <onlyinclude>Foo</onlyinclude>bar
12095 !! html
12096 <p>Foobar
12097 </p>
12098 !! end
12099
12100 !! test
12101 Un-closed <onlyinclude>
12102 !! wikitext
12103 <onlyinclude>
12104 !! html
12105 !! end
12106
12107 !!test
12108 Self-closed noinclude, includeonly, onlyinclude tags
12109 !! wikitext
12110 <noinclude />
12111 <includeonly />
12112 <onlyinclude />
12113 !! html
12114 <p><br />
12115 </p>
12116 !!end
12117
12118 !!test
12119 Unbalanced includeonly and noinclude tags
12120 !! wikitext
12121 {|
12122 |a</noinclude>
12123 |b</noinclude></noinclude>
12124 |c</noinclude></includeonly>
12125 |d</includeonly></includeonly>
12126 |}
12127 !! html
12128 <table>
12129 <tr>
12130 <td>a
12131 </td>
12132 <td>b
12133 </td>
12134 <td>c&lt;/includeonly&gt;
12135 </td>
12136 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12137 </td></tr></table>
12138
12139 !!end
12140
12141 !! article
12142 Template:Includeonly section
12143 !! text
12144 <includeonly>
12145 ==Includeonly section==
12146 </includeonly>
12147 ==Section T-1==
12148 !!endarticle
12149
12150 !! test
12151 T8563: Edit link generation for section shown by <includeonly>
12152 !! wikitext
12153 {{includeonly section}}
12154 !! html
12155 <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>
12156 <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>
12157
12158 !! end
12159
12160 # Uses same input as the contents of [[Template:Includeonly section]]
12161 !! test
12162 T8563: Section extraction for section shown by <includeonly>
12163 !! options
12164 section=T-2
12165 !! wikitext
12166 <includeonly>
12167 ==Includeonly section==
12168 </includeonly>
12169 ==Section T-2==
12170 !! html
12171 ==Section T-2==
12172 !! end
12173
12174 !! test
12175 T8563: Edit link generation for section suppressed by <includeonly>
12176 !! wikitext
12177 <includeonly>
12178 ==Includeonly section==
12179 </includeonly>
12180 ==Section 1==
12181 !! html
12182 <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>
12183
12184 !! end
12185
12186 !! test
12187 T8563: Section extraction for section suppressed by <includeonly>
12188 !! options
12189 section=1
12190 !! wikitext
12191 <includeonly>
12192 ==Includeonly section==
12193 </includeonly>
12194 ==Section 1==
12195 !! html
12196 ==Section 1==
12197 !! end
12198
12199 !! test
12200 Un-closed <includeonly>
12201 !! wikitext
12202 <includeonly>
12203 !! html/php
12204 !! html/parsoid
12205 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12206 !! end
12207
12208 ## We used to, but no longer wt2wt this test since the default serializer
12209 ## will normalize the include directives to serialize on their own line.
12210 ## Selser will take care of preserving formatting in scenarios where they
12211 ## intermingled with other wikitext.
12212 !! test
12213 Includes and comments at SOL
12214 !! options
12215 parsoid=wt2html,html2html
12216 !! wikitext
12217 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12218
12219 <noinclude>
12220 some
12221 </noinclude>*stuff
12222 *here
12223
12224 <noinclude>
12225 some</noinclude>* stuff
12226 * here
12227
12228 <includeonly>can have stuff</includeonly>===here===
12229
12230 !! html/php
12231 <h2><span class="mw-headline" id="hu">hu</span></h2>
12232 <p>some
12233 </p>
12234 <ul><li>stuff</li>
12235 <li>here</li></ul>
12236 <p><br />
12237 some* stuff
12238 </p>
12239 <ul><li>here</li></ul>
12240 <h3><span class="mw-headline" id="here">here</span></h3>
12241
12242 !! html/parsoid
12243 <!-- 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>
12244
12245 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12246 <p>some</p>
12247 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12248 <li>here</li></ul>
12249
12250 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12251 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12252 <ul><li>here</li></ul>
12253
12254 <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>
12255
12256 !! end
12257
12258 # TODO: test with DOM fragment reuse!
12259 !! test
12260 Parsoid: DOM fragment reuse
12261 !! options
12262 parsoid=wt2wt,wt2html
12263 !! wikitext
12264 a{{echo|b<table></table>c}}d
12265
12266 a{{echo|b
12267 <table></table>
12268 c}}d
12269
12270 {{echo|a
12271
12272 <table></table>
12273
12274 b}}
12275 !! html/php+tidy
12276 <p>ab</p><table></table><p>cd
12277 </p><p>ab
12278 </p>
12279 <table></table>
12280 <p>cd
12281 </p><p>a
12282 </p>
12283 <table></table>
12284 <p>b
12285 </p>
12286 !! html/parsoid
12287 <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>
12288
12289 <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">
12290 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12291 </span><p about="#mwt2">cd</p>
12292
12293 <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">
12294
12295 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12296
12297 </span><p about="#mwt3">b</p>
12298 !! end
12299
12300 !! test
12301 Parsoid: Merge double tds (T52603)
12302 !! wikitext
12303 {|
12304 |{{echo|{{!}} foo}}
12305 |}
12306 !! html/php+tidy
12307 <table>
12308 <tbody><tr>
12309 <td>foo
12310 </td></tr></tbody></table>
12311 !! html/parsoid
12312 <table><tbody>
12313 <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>
12314 </tbody></table>
12315 !! end
12316
12317 !! test
12318 Parsoid: Merge double tds in nested transclusion content (T52603)
12319 !! wikitext
12320 {{echo|<div>}}
12321 {|
12322 |{{echo|{{!}} foo}}
12323 |}
12324 {{echo|</div>}}
12325 !! html/php+tidy
12326 <div>
12327 <table>
12328 <tbody><tr>
12329 <td>foo
12330 </td></tr></tbody></table>
12331 </div>
12332 !! html/parsoid
12333 <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}}]}'>
12334 <table><tbody>
12335 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12336 </tbody></table>
12337 </div>
12338 !! end
12339
12340 ###
12341 ### <includeonly> and <noinclude> in attributes
12342 ###
12343 !!test
12344 0. includeonly around the entire attribute
12345 !! wikitext
12346 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12347 !! html
12348 <p><span id="v2">bar</span>
12349 </p>
12350 !!end
12351
12352 !!test
12353 1. includeonly in html attr key
12354 !! wikitext
12355 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12356 !! html
12357 <p><span id="foo">bar</span>
12358 </p>
12359 !!end
12360
12361 !!test
12362 2. includeonly in html attr value
12363 !! wikitext
12364 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12365 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12366 !! html
12367 <p><span id="v1">bar</span>
12368 <span id="v1">bar</span>
12369 </p>
12370 !!end
12371
12372 !!test
12373 3. includeonly in part of an attr value
12374 !! wikitext
12375 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12376 !! html
12377 <p><span style="color:red;">bar</span>
12378 </p>
12379 !!end
12380
12381 !!test
12382 4. includeonly in table attributes
12383 !! wikitext
12384 {|
12385 |- <noinclude>
12386 |-
12387 |a
12388 </noinclude>
12389 |- <includeonly>
12390 |-
12391 |b
12392 </includeonly>
12393 |}
12394 !! html
12395 <table>
12396
12397
12398 <tr>
12399 <td>a
12400 </td></tr>
12401 </table>
12402
12403 !!end
12404
12405 ###
12406 ### Preprocessor precedence tests
12407 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12408 ###
12409 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12410 !! test
12411 Preprocessor precedence 1: link is rightmost opening
12412 !! options
12413 parsoid=wt2html
12414 !! wikitext
12415 {{[[Foo|bar}}]]
12416
12417 But close-brace is not a valid character in a link title:
12418 {{[[Foo}}|bar]]
12419
12420 However, we can still tell this was handled as a link in the preprocessor:
12421 {{echo|[[Foo}}|bar]]|bat}}
12422 !! html/php
12423 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12424 </p><p>But close-brace is not a valid character in a link title:
12425 {{[[Foo}}|bar]]
12426 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12427 [[Foo}}|bar]]
12428 </p>
12429 !! html/parsoid
12430 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12431 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12432 <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>
12433 !! end
12434
12435 !! test
12436 Preprocessor precedence 2: template is rightmost opening
12437 !! options
12438 language=zh
12439 !! wikitext
12440 -{{echo|foo}-}}-
12441 !! html/php
12442 <p>-foo}--
12443 </p>
12444 !! html/parsoid
12445 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12446 !! end
12447
12448 !! test
12449 Preprocessor precedence 3: language converter is rightmost opening
12450 !! options
12451 language=zh
12452 parsoid=wt2html
12453 !! wikitext
12454 {{echo|hi}}
12455
12456 {{-{R|echo|hi}}}-
12457
12458 [[-{R|raw]]}-
12459 !! html/php
12460 <p>hi
12461 </p><p>{{echo|hi}}
12462 </p><p>[[raw]]
12463 </p>
12464 !! html/parsoid
12465 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12466 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12467 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12468 !! end
12469
12470 !! test
12471 Preprocessor precedence 4: left-most angle bracket
12472 !! options
12473 language=zh
12474 !! wikitext
12475 <!--{raw}-->
12476 !! html/php
12477 !! html/parsoid
12478 <!--{raw}-->
12479 !! end
12480
12481 !! article
12482 Template:Precedence5
12483 !! text
12484 {{{{{1}}}}}
12485 !! endarticle
12486
12487 !! test
12488 Preprocessor precedence 5: tplarg takes precedence over template
12489 !! wikitext
12490 {{Precedence5|Bullet}}
12491 !! html/php
12492 <ul><li>Bar</li></ul>
12493
12494 !! html/parsoid
12495 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12496 !! end
12497
12498 !! test
12499 Preprocessor precedence 6: broken link is rightmost opening
12500 !! options
12501 parsoid=wt2html
12502 !! wikitext
12503 {{echo|[[Foo}}
12504
12505 {{echo|[[Foo|bar|bat=baz}}
12506 !! html/php
12507 <p>{{echo|[[Foo}}
12508 </p><p>{{echo|[[Foo|bar|bat=baz}}
12509 </p>
12510 !! html/parsoid
12511 <p>{{echo|[[Foo}}</p>
12512 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12513 !! end
12514
12515 # This next test exposes a difference between PHP and Parsoid:
12516 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12517 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12518 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12519 # outer `[[Foo` extends until the `y]]`
12520 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12521 # intermediate result (after template expansion), and link processing
12522 # happens on this intermediate result, which moves the wikilink
12523 # boundary leftward to `[[Foo|Bar]]`
12524 # 2b) Parsoid works in a single step, so it's going to keep the
12525 # wikilink as extending to the `y]]`
12526 # 3a) Then PHP does linktrail processing which slurps up the trailing
12527 # `xy` inside the link.
12528 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12529 # `z` inside the link.
12530 # This is "correct" behavior. Parsoid's basic worldview is that the
12531 # `]]` inside the template shouldn't be allowed to leak out to affect
12532 # the surrounding wikilink. PHP may match Parsoid (in the future)
12533 # if you use {{#balance}} (T114445).
12534
12535 !! test
12536 Preprocessor precedence 7: broken template is rightmost opening
12537 !! options
12538 parsoid=wt2html
12539 !! wikitext
12540 [[Foo|{{echo|Bar]]
12541
12542 [[Foo|{{echo|Bar]]-x}}-y]]-z
12543
12544 Careful: linktrails can move the end of the wikilink:
12545 [[Foo|{{echo|y']]a}}l]]l
12546 !! html/php
12547 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12548 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12549 </p><p>Careful: linktrails can move the end of the wikilink:
12550 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12551 </p>
12552 !! html/parsoid
12553 <p>[[Foo|{{echo|Bar]]</p>
12554 <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>
12555 <p>Careful: linktrails can move the end of the wikilink:
12556 <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>
12557 !! end
12558
12559 !! test
12560 Preprocessor precedence 8: broken language converter is rightmost opening
12561 !! options
12562 language=zh
12563 !! wikitext
12564 [[Foo-{R|raw]]
12565 !! html
12566 <p>[[Foo-{R|raw]]
12567 </p>
12568 !! end
12569
12570 !! article
12571 Template:Preprocessor_precedence_9
12572 !! text
12573 ;4: {{{{1}}}}
12574 ;5: {{{{{2}}}}}
12575 ;6: {{{{{{3}}}}}}
12576 ;7: {{{{{{{4}}}}}}}
12577 !! endarticle
12578
12579 !! test
12580 Preprocessor precedence 9: groups of braces
12581 !! wikitext
12582 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12583 !! html/php
12584 <dl><dt>4</dt>
12585 <dd>{Four}</dd>
12586 <dt>5</dt>
12587 <dd></dd></dl>
12588 <ul><li>Bar</li></ul>
12589 <dl><dt>6</dt>
12590 <dd>Four</dd>
12591 <dt>7</dt>
12592 <dd>{Bullet}</dd></dl>
12593
12594 !! html/parsoid
12595 <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}}]}'>
12596 <dt>4</dt>
12597 <dd>{Four}</dd>
12598 <dt>5</dt>
12599 <dd></dd>
12600 </dl><ul about="#mwt1">
12601 <li>Bar</li>
12602 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12603 <dt>6</dt>
12604 <dd>Four</dd>
12605 <dt>7</dt>
12606 <dd>{Bullet}</dd>
12607 </dl>
12608 !! end
12609
12610 !! article
12611 Template:Preprocessor_precedence_10
12612 !! text
12613 ;1: -{R|raw}-
12614 ;2: -{{Bullet}}-
12615 ;3: -{{{1}}}-
12616 ;4: -{{{{2}}}}-
12617 ;5: -{{{{{3}}}}}-
12618 ;6: -{{{{{{4}}}}}}-
12619 ;7: -{{{{{{{5}}}}}}}-
12620 !! endarticle
12621
12622 !! test
12623 Preprocessor precedence 10: groups of braces with leading dash
12624 !! options
12625 language=zh
12626 !! wikitext
12627 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12628 !! html/php
12629 <dl><dt>1</dt>
12630 <dd>raw</dd>
12631 <dt>2</dt>
12632 <dd>-</dd></dl>
12633 <ul><li>Bar-</li></ul>
12634 <dl><dt>3</dt>
12635 <dd>-Three-</dd>
12636 <dt>4</dt>
12637 <dd>raw2</dd>
12638 <dt>5</dt>
12639 <dd>-</dd></dl>
12640 <ul><li>Bar-</li></ul>
12641 <dl><dt>6</dt>
12642 <dd>-Three-</dd>
12643 <dt>7</dt>
12644 <dd>raw2</dd></dl>
12645
12646 !! html/parsoid
12647 <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}}]}'>
12648 <dt>1</dt>
12649 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12650 <dt>2</dt>
12651 <dd>-</dd>
12652 </dl><ul about="#mwt1">
12653 <li>Bar-</li>
12654 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12655 <dt>3</dt>
12656 <dd>-Three-</dd>
12657 <dt>4</dt>
12658 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12659 <dt>5</dt>
12660 <dd>-</dd>
12661 </dl><ul about="#mwt1">
12662 <li>Bar-</li>
12663 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12664 <dt>6</dt>
12665 <dd>-Three-</dd>
12666 <dt>7</dt>
12667 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12668 </dl>
12669 !! end
12670
12671 !! test
12672 Preprocessor precedence 11: found during visual diff testing
12673 !! wikitext
12674 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12675
12676 {{echo|-{{echo|-{{echo|x}}}}}}
12677
12678 {{echo|-{{echo|x}}}}
12679 !! html/php
12680 <p><span>-<span>-x</span></span>
12681 </p><p>--x
12682 </p><p>-x
12683 </p>
12684 !! html/parsoid
12685 <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>
12686
12687 <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>
12688
12689 <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>
12690 !! end
12691
12692 !! test
12693 Preprocessor precedence 12: broken language converter closed by brace.
12694 !! options
12695 parsoid=wt2html
12696 !! wikitext
12697 This form breaks the template, which is unfortunate:
12698 *{{echo|foo-{bar}bat}}
12699
12700 But if the broken language converter markup is inside an extension
12701 tag, nothing bad happens:
12702 *<nowiki>foo-{bar}bat</nowiki>
12703 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12704 *<pre>foo-{bar}bat</pre>
12705 *{{echo|<pre>foo-{bar}bat</pre>}}
12706
12707 <tag>foo-{bar}bat</tag>
12708 {{echo|<tag>foo-{bar}bat</tag>}}
12709
12710 !! html/php+tidy
12711 <p>This form breaks the template, which is unfortunate:
12712 </p>
12713 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12714 <p>But if the broken language converter markup is inside an extension
12715 tag, nothing bad happens:
12716 </p>
12717 <ul><li>foo-&#123;bar}bat</li>
12718 <li>foo-&#123;bar}bat</li>
12719 <li><pre>foo-{bar}bat</pre></li>
12720 <li><pre>foo-{bar}bat</pre></li></ul>
12721 <pre>'foo-{bar}bat'
12722 array (
12723 )
12724 </pre>
12725 <pre>'foo-{bar}bat'
12726 array (
12727 )
12728 </pre>
12729 !! html/parsoid
12730 <p>This form breaks the template, which is unfortunate:</p>
12731 <ul>
12732 <li>{{echo|foo-{bar}bat}}</li>
12733 </ul>
12734 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12735 <ul>
12736 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12737 <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>
12738 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12739 <li><pre typeof="mw:Extension/pre mw:Transclusion" 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>
12740 </ul>
12741 <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>
12742 !! end
12743
12744 !! test
12745 Preprocessor precedence 13: broken language converter in external link
12746 !! options
12747 parsoid=wt2html
12748 !! wikitext
12749 *[http://example.com/-{foo Example in URL]
12750 *[http://example.com Example in -{link} description]
12751 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12752 !! html/php+tidy
12753 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12754 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12755 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12756 !! html/parsoid
12757 <ul>
12758 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12759 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12760 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12761 </ul>
12762 !! end
12763
12764 !! test
12765 Preprocessor precedence 14: broken language converter in comment
12766 !! wikitext
12767 *<!--{{foo}}-->...should be ok
12768 *<!---{{foo}}-->...extra dashes
12769 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12770 !! html/php+tidy
12771 <ul><li>...should be ok</li>
12772 <li>...extra dashes</li>
12773 <li>foobat...should be ok</li></ul>
12774 !! html/parsoid
12775 <ul>
12776 <li><!--{{foo}}-->...should be ok</li>
12777 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12778 <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>
12779 </ul>
12780 !! end
12781
12782 !! test
12783 Preprocessor precedence 15: broken brace markup in headings
12784 !! config
12785 wgFragmentMode=[ 'html5', 'legacy' ]
12786 !! options
12787 parsoid=wt2html
12788 !! wikitext
12789 __NOTOC__ __NOEDITSECTION__
12790 ===1 foo[bar 1===
12791 1
12792 ===2 foo[[bar 2===
12793 2
12794 ===3 foo{bar 3===
12795 3
12796 ===4 foo{{bar 4===
12797 4
12798 ===5 foo{{{bar 5===
12799 5
12800 ===6 foo-{bar 6===
12801 6
12802 !! html/php+tidy
12803 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12804 <p>1
12805 </p>
12806 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12807 <p>2
12808 </p>
12809 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12810 <p>3
12811 </p>
12812 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12813 <p>4
12814 </p>
12815 <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>
12816 <p>5
12817 </p>
12818 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12819 <p>6
12820 </p>
12821 !! html/parsoid
12822 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12823 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12824 <p>1</p>
12825 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12826 <p>2</p>
12827 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12828 <p>3</p>
12829 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12830 <p>4</p>
12831 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12832 <p>5</p>
12833 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12834 <p>6</p>
12835 !! end
12836
12837 !! test
12838 Preprocessor precedence 16: matching closing braces to opening braces
12839 !! options
12840 language=zh
12841 parsoid=wt2html
12842 !! wikitext
12843 -{{{echo|foo}}bar}-
12844 !! html/php
12845 <p>foobar
12846 </p>
12847 !! html/parsoid
12848 <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>
12849 !! end
12850
12851 !! test
12852 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12853 !! options
12854 parsoid=wt2html
12855 !! wikitext
12856 {{echo|hi {{}}}}
12857 !! html/php
12858 <p>hi {{}}
12859 </p>
12860 !! html/parsoid
12861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12862 !! end
12863
12864 # Ensure we're using a language without variants for this test; even
12865 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12866 !! test
12867 Preprocessor precedence 18: another rightmost wins scenario
12868 !! options
12869 parsoid=wt2html
12870 language=de
12871 !! wikitext
12872 {{ -{{{{1|tplarg}}} }} }-
12873 !! html/php
12874 <p>{{ -{tplarg }} }-
12875 </p>
12876 !! html/parsoid
12877 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12878 !! end
12879
12880 !! test
12881 Preprocessor precedence 19: break syntax
12882 !! options
12883 parsoid=wt2html
12884 !! wikitext
12885 -{{
12886 !! html/php
12887 <p>-{{
12888 </p>
12889 !! html/parsoid
12890 <p>-{{</p>
12891 !! end
12892
12893 ###
12894 ### Token Stream Patcher tests
12895 ###
12896 ### These tests won't always pass wt2wt and other modes because
12897 ### on serialization, the table will be output on a new line.
12898 ### For now, we are blacklisting them, and using this to test selser.
12899 ###
12900
12901 !!test
12902 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12903 !!options
12904 parsoid=wt2html,wt2wt
12905 !!wikitext
12906 {{echo|}}{| width = '100%'
12907 |foo
12908 |}
12909 !!html/parsoid
12910 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12911 <tbody><tr><td>foo</td></tr>
12912 </tbody></table>
12913 !!end
12914
12915 ## We used to, but no longer wt2wt this test since the default serializer
12916 ## will normalize the include directives to serialize on their own line.
12917 ## Selser will take care of preserving formatting in scenarios where they
12918 ## intermingled with other wikitext.
12919 !!test
12920 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12921 !!options
12922 parsoid=wt2html
12923 !!wikitext
12924 <includeonly>a</includeonly>{| {{{b}}}
12925 |c
12926 |}
12927 !!html/parsoid
12928 <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":""}]]}'>
12929 <tbody><tr><td>c</td></tr>
12930 </tbody></table>
12931 !!end
12932
12933 !! test
12934 Table wikitext syntax outside wiki-tables
12935 !! wikitext
12936 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 !! html
12947 <p>a
12948 |+ not a caption
12949 ! not a table heading
12950 |- not a table row
12951 | not a table cell
12952 | class="foo bar" | baz
12953 b
12954 |}
12955 |-
12956 c
12957 </p>
12958 !! end
12959
12960 ###
12961 ### Testing parsing of templates where a template arg
12962 ### has the same name as the template itself.
12963 ###
12964
12965 !! article
12966 Template:quote
12967 !! text
12968 {{{quote|{{{1}}}}}}
12969 !! endarticle
12970
12971 !!test
12972 Templates: Template Name/Arg clash: 1. Use of positional param
12973 !! wikitext
12974 {{quote|foo}}
12975 !! html
12976 <p>foo
12977 </p>
12978 !!end
12979
12980 !!test
12981 Templates: Template Name/Arg clash: 2. Use of named param
12982 !! wikitext
12983 {{quote|quote=foo}}
12984 !! html
12985 <p>foo
12986 </p>
12987 !!end
12988
12989 !!test
12990 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12991 !! wikitext
12992 {{quote|quote}}
12993 !! html
12994 <p>quote
12995 </p>
12996 !!end
12997
12998 ###
12999 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
13000 ###
13001
13002 !!test
13003 Templates: 1. Simple use
13004 !! wikitext
13005 {{echo|Foo}}
13006 !! html
13007 <p>Foo
13008 </p>
13009 !!end
13010
13011 !!test
13012 Templates: 2. Inside a block tag
13013 !! wikitext
13014 <div>{{echo|Foo}}</div>
13015 <blockquote>{{echo|Foo}}</blockquote>
13016 !! html
13017 <div>Foo</div>
13018 <blockquote>Foo</blockquote>
13019
13020 !! html+tidy
13021 <div>Foo</div>
13022 <blockquote><p>Foo</p></blockquote>
13023 !!end
13024
13025 !!test
13026 Templates: P-wrapping: 1a. Templates on consecutive lines
13027 !! wikitext
13028 {{echo|Foo}}
13029 {{echo|bar}}
13030 !! html
13031 <p>Foo
13032 bar
13033 </p>
13034 !!end
13035
13036 !!test
13037 Templates: P-wrapping: 1b. Templates on consecutive lines
13038 !! wikitext
13039 Foo
13040
13041 {{echo|bar}}
13042 {{echo|baz}}
13043 !! html
13044 <p>Foo
13045 </p><p>bar
13046 baz
13047 </p>
13048 !!end
13049
13050 !!test
13051 Templates: P-wrapping: 1c. Templates on consecutive lines
13052 !! wikitext
13053 {{echo|Foo}}
13054 {{echo|bar}} <div>baz</div>
13055 !! html
13056 <p>Foo
13057 </p>
13058 bar <div>baz</div>
13059
13060 !! html+tidy
13061 <p>Foo
13062 </p><p>
13063 bar </p><div>baz</div>
13064 !! end
13065
13066 !! test
13067 Templates: P-wrapping: 1d. Template preceded by comment-only line
13068 !! wikitext
13069 <!-- foo -->
13070 {{echo|Bar}}
13071 !! html/php+tidy
13072 <p>Bar
13073 </p>
13074 !! html/parsoid
13075 <!-- foo -->
13076
13077 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
13078 !!end
13079
13080 !! test
13081 Templates: Scopes should not be expanded unnecessarily
13082 !! options
13083 parsoid=wt2html,wt2wt
13084 !! wikitext
13085 {{echo|<div>a</div>}}b{{echo|
13086 <div>c</div>}}
13087 !! html/php+tidy
13088 <div>a</div><p>b
13089 </p><div>c</div>
13090 !! html/parsoid
13091 <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}}]}'>
13092 </span><div about="#mwt2">c</div>
13093 !! end
13094
13095 !!test
13096 Templates: Inline Text: 1. Multiple template uses
13097 !! wikitext
13098 {{echo|Foo}}bar{{echo|baz}}
13099 !! html
13100 <p>Foobarbaz
13101 </p>
13102 !!end
13103
13104 !!test
13105 Templates: Inline Text: 2. Back-to-back template uses
13106 !! wikitext
13107 {{echo|Foo}}{{echo|bar}}
13108 !! html
13109 <p>Foobar
13110 </p>
13111 !!end
13112
13113 !!test
13114 Templates: Block Tags: 1. Multiple template uses
13115 !! wikitext
13116 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13117 !! html
13118 <div>Foo</div><div>bar</div><div>baz</div>
13119
13120 !!end
13121
13122 !!test
13123 Templates: Block Tags: 2. Back-to-back template uses
13124 !! wikitext
13125 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13126 !! html
13127 <div>Foo</div><div>bar</div>
13128
13129 !!end
13130
13131 ## Parsoid drops empty elements in templates.
13132 !! test
13133 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13134 !! wikitext
13135 {{echo|a
13136 b</p>}}
13137 !! html/php+tidy
13138 <p>a
13139 </p><p>
13140 b</p><p class="mw-empty-elt"></p>
13141 !! html/parsoid
13142 <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">
13143 </span><p about="#mwt1">b</p>
13144 !! end
13145
13146 !!test
13147 Templates: Links: 1. Simple example
13148 !! wikitext
13149 {{echo|[[Foo|bar]]}}
13150 !! html
13151 <p><a href="/wiki/Foo" title="Foo">bar</a>
13152 </p>
13153 !!end
13154
13155 !!test
13156 Templates: Links: 2. Generation of link href
13157 !! wikitext
13158 [[{{echo|Foo}}|bar]]
13159 !! html
13160 <p><a href="/wiki/Foo" title="Foo">bar</a>
13161 </p>
13162 !!end
13163
13164 !!test
13165 Templates: Links: 3. Generation of part of a link href
13166 !! wikitext
13167 [[Fo{{echo|o}}|bar]]
13168
13169 [[Foo{{echo|bar}}]]
13170
13171 [[Foo{{echo|bar}}baz]]
13172
13173 [[Foo{{echo|bar}}|bar]]
13174
13175 [[:Foo{{echo|bar}}]]
13176
13177 [[:Foo{{echo|bar}}|bar]]
13178 !! html
13179 <p><a href="/wiki/Foo" title="Foo">bar</a>
13180 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13181 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13182 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13183 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13184 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13185 </p>
13186 !!end
13187
13188 !!test
13189 Templates: Links: 4. Multiple templates generating link href
13190 !! wikitext
13191 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13192 !! html
13193 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13194 </p>
13195 !!end
13196
13197 !!test
13198 Templates: Links: 5. Generation of link text
13199 !! wikitext
13200 [[Foo|{{echo|bar}}]]
13201 !! html
13202 <p><a href="/wiki/Foo" title="Foo">bar</a>
13203 </p>
13204 !!end
13205
13206 !!test
13207 Templates: Links: 5. Nested templates (only outermost template should be marked)
13208 !! wikitext
13209 {{echo|[[{{echo|Foo}}|bar]]}}
13210 !! html
13211 <p><a href="/wiki/Foo" title="Foo">bar</a>
13212 </p>
13213 !!end
13214
13215 !!test
13216 Templates: HTML Tag: 1. Generation of HTML attr. key
13217 !! wikitext
13218 <div {{echo|style}}="color:red;">foo</div>
13219 !! html
13220 <div style="color:red;">foo</div>
13221
13222 !!end
13223
13224 !!test
13225 Templates: HTML Tag: 2. Generation of HTML attr. value
13226 !! wikitext
13227 <div style={{echo|'color:red;'}}>foo</div>
13228 !! html
13229 <div style="color:red;">foo</div>
13230
13231 !!end
13232
13233 !!test
13234 Templates: HTML Tag: 3. Generation of HTML attr key and value
13235 !! wikitext
13236 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13237 !! html
13238 <div style="color:red;">foo</div>
13239
13240 !!end
13241
13242 !!test
13243 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13244 !! wikitext
13245 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13246 !! html
13247 <div title="This is a long title with just one piece templated">foo</div>
13248
13249 !!end
13250
13251 !!test
13252 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13253 !! wikitext
13254 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13255 !! html
13256 <div title="This is a long title with just one piece templated">foo</div>
13257
13258 !!end
13259
13260 !!test
13261 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13262 !! wikitext
13263 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13264 !! html
13265 <div title="This is a long title with just one piece templated">foo</div>
13266
13267 !!end
13268
13269 # SSS FIXME: While it is great we added support for all this,
13270 # do we want to make this part of the spec? Maybe we want to
13271 # deprecate this kind of usage in the future?
13272 !!test
13273 Templates: HTML Tag: 7. Generation of partial attribute key string
13274 !! wikitext
13275 <div st{{echo|yle}}="color:red;">foo</div>
13276 !! html
13277 <div style="color:red;">foo</div>
13278
13279 !!end
13280
13281 !! test
13282 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13283 !! wikitext
13284 <div {{echo|1=id="v1"}}>bar</div>
13285 !! html
13286 <div id="v1">bar</div>
13287
13288 !!end
13289
13290 !! test
13291 Templates: HTML Tag: 9. Multiple template-generated attributes
13292 !! wikitext
13293 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13294 !! html
13295 <div id="v1" title="foo">bar</div>
13296
13297 !!end
13298
13299 !! test
13300 Templates: Support for templates generating attributes and content
13301 !! wikitext
13302 {| {{mixed_attr_content_template}}
13303 |-
13304 |bar
13305 |}
13306 !! html/php
13307 <table style="color:red;" title="T48811">
13308
13309 <tr>
13310 <td>foo
13311 </td></tr>
13312 <tr>
13313 <td>bar
13314 </td></tr></table>
13315
13316 !! html/parsoid
13317 <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|}"]}'>
13318 <tbody><tr>
13319 <td>foo</td></tr>
13320 <tr>
13321 <td>bar</td></tr>
13322 </tbody></table>
13323 !!end
13324
13325 !! article
13326 Template:attribute_from_template
13327 !! text
13328 class="123"
13329 !! endarticle
13330
13331 !! test
13332 Table cell with attribute before expanded attribute
13333 !! wikitext
13334 {|
13335 | align="center" {{attribute_from_template}} |456
13336 |}
13337 !! html/parsoid
13338 <table>
13339 <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>
13340 </tbody></table>
13341 !! end
13342
13343 !! test
13344 1. Entities and nowikis inside templated attributes should be handled correctly
13345 !! wikitext
13346 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13347 !! html/php
13348 <div style="background:#f9f9f9;">foo</div>
13349
13350 !! html/parsoid
13351 <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>
13352 !! end
13353
13354 !! test
13355 2. Entities and nowikis inside templated attributes should be handled correctly
13356 !! wikitext
13357 {|
13358 |{{table_attribs_3}}
13359 |}
13360 !! html/php
13361 <table>
13362 <tr>
13363 <td style="background:#f9f9f9;">Foo
13364 </td></tr></table>
13365
13366 !! html/parsoid
13367 <table>
13368 <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>
13369 </tbody></table>
13370 !! end
13371
13372 !! test
13373 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13374 !! wikitext
13375 {{tbl-start}}
13376 |{{table_attribs_3}}
13377 {{tbl-end}}
13378 !! html/php
13379 <table>
13380 <tr>
13381 <td style="background:#f9f9f9;">Foo
13382 </td></tr></table>
13383
13384 !! html/parsoid
13385 <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}}]}'>
13386 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13387 </tbody></table>
13388 !! end
13389
13390 # T107622
13391 !! test
13392 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13393 !! wikitext
13394 {|
13395 |{{table_attribs_6}} hi
13396 |}
13397 !! html/php
13398 <table>
13399 <tr>
13400 <td style="background: red;">hi
13401 </td></tr></table>
13402
13403 !! html/parsoid
13404 <table>
13405 <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>
13406 </tbody></table>
13407 !! end
13408
13409 !!test
13410 Templates: HTML Tables: 1. Generating start of a HTML table
13411 !! wikitext
13412 {{echo|<table><tr><td>foo</td>}}</tr></table>
13413 !! html
13414 <table><tr><td>foo</td></tr></table>
13415
13416 !!end
13417
13418 !!test
13419 Templates: HTML Tables: 2a. Generating middle of a HTML table
13420 !! wikitext
13421 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13422 !! html
13423 <table><tr><td>foo</td></tr></table>
13424
13425 !!end
13426
13427 !!test
13428 Templates: HTML Tables: 2b. Generating middle of a HTML table
13429 !! wikitext
13430 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13431 !! html
13432 <table><tr><td>foo</td></tr></table>
13433
13434 !!end
13435
13436 !!test
13437 Templates: HTML Tables: 3. Generating end of a HTML table
13438 !! wikitext
13439 <table><tr>{{echo|<td>foo</td></tr></table>}}
13440 !! html
13441 <table><tr><td>foo</td></tr></table>
13442
13443 !!end
13444
13445 !!test
13446 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13447 !! wikitext
13448 {{echo|<table>}}<tr><td>foo</td></tr></table>
13449 !! html
13450 <table><tr><td>foo</td></tr></table>
13451
13452 !!end
13453
13454 !!test
13455 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13456 !! wikitext
13457 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13458 !! html
13459 <table><tr><td>foo</td></tr></table>
13460
13461 !!end
13462
13463 !!test
13464 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13465 !! wikitext
13466 <table><tr>{{echo|<td>}}foo</td></tr></table>
13467 !! html
13468 <table><tr><td>foo</td></tr></table>
13469
13470 !!end
13471
13472 !!test
13473 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13474 !! wikitext
13475 <table><tr><td>foo{{echo|</td>}}</tr></table>
13476 !! html
13477 <table><tr><td>foo</td></tr></table>
13478
13479 !!end
13480
13481 !!test
13482 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13483 !! wikitext
13484 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13485 !! html
13486 <table><tr><td>foo</td></tr></table>
13487
13488 !!end
13489
13490 !!test
13491 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13492 !! wikitext
13493 <table><tr><td>foo</td></tr>{{echo|</table>}}
13494 !! html
13495 <table><tr><td>foo</td></tr></table>
13496
13497 !!end
13498
13499 !!test
13500 Templates: HTML Tables: 5. Proper fostering of categories from inside
13501 !!options
13502 parsoid=wt2html,wt2wt
13503 !! wikitext
13504 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13505 <!--Two categories (T52330)-->
13506 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13507 !! html/php+tidy
13508 <table><tbody><tr><td>foo</td></tr></tbody></table>
13509 <table><tbody><tr><td>foo</td></tr></tbody></table>
13510 !! html/parsoid
13511 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13512 <!--Two categories (T52330)-->
13513 <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>
13514 !!end
13515
13516 ## Remex doesn't account for fostered content.
13517 !! test
13518 Templates: Wiki Tables: 1a. Fostering of entire template content
13519 !! wikitext
13520 {|
13521 {{echo|a}}
13522 |}
13523 !! html/php
13524 <table>
13525 a
13526 <tr><td></td></tr></table>
13527
13528 !! html/php+tidy
13529
13530 a
13531 <table><tbody><tr><td></td></tr></tbody></table>
13532 !! html/parsoid
13533 <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">
13534
13535 </table>
13536 !! end
13537
13538 !!test
13539 Templates: Wiki Tables: 1b. Fostering of entire template content
13540 !! wikitext
13541 {|
13542 {{echo|<div>}}
13543 foo
13544 {{echo|</div>}}
13545 |}
13546 !! html
13547 <table>
13548 <div>
13549 <p>foo
13550 </p>
13551 </div>
13552 <tr><td></td></tr></table>
13553
13554 !! html/php+tidy
13555 <div>
13556 <p>foo
13557 </p>
13558 </div><table>
13559
13560 <tbody><tr><td></td></tr></tbody></table>
13561 !! html/parsoid
13562 <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|}"]}'>
13563 <p>foo</p>
13564 </div><table about="#mwt3">
13565
13566 </table>
13567 !! end
13568
13569 ## Remex doesn't account for fostered content.
13570 !! test
13571 Templates: Wiki Tables: 2. Fostering of partial template content
13572 !! wikitext
13573 {|
13574 {{echo|a
13575 <div>b</div>}}
13576 |}
13577 !! html/php
13578 <table>
13579 a
13580 <div>b</div>
13581 <tr><td></td></tr></table>
13582
13583 !! html/php+tidy
13584
13585 a
13586 <div>b</div><table>
13587 <tbody><tr><td></td></tr></tbody></table>
13588 !! html/parsoid
13589 <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">
13590
13591
13592 </table>
13593 !! end
13594
13595 !!test
13596 Templates: Wiki Tables: 3. td-content via multiple templates
13597 !! wikitext
13598 {|
13599 {{echo|{{pipe}}a}}{{echo|b}}
13600 |}
13601 !! html
13602 <table>
13603 <tr>
13604 <td>ab
13605 </td></tr></table>
13606
13607 !!end
13608
13609 !!test
13610 Templates: Wiki Tables: 4. Templated tags, no content
13611 !! wikitext
13612 {{tbl-start}}
13613 {{tbl-end}}
13614 !! html
13615 <table>
13616 <tr><td></td></tr></table>
13617
13618 !!end
13619
13620 !!test
13621 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13622 !! wikitext
13623 {{tbl-start}}
13624 |foo
13625 {{tbl-end}}
13626 !! html
13627 <table>
13628 <tr>
13629 <td>foo
13630 </td></tr></table>
13631
13632 !!end
13633
13634 !!test
13635 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13636 !! wikitext
13637 {{tbl-start}}
13638 {{!}}foo
13639 {{tbl-end}}
13640 !! html
13641 <table>
13642 <tr>
13643 <td>foo
13644 </td></tr></table>
13645
13646 !!end
13647
13648 ## This test case is very specific to Parsoid's internals
13649 ## and is hence only tested for Parsoid's code. Parsoid uses
13650 ## a <meta> marker tag for <ref> tags and they are expanded
13651 ## much later. We are verifying that this <meta> tag usage
13652 ## doesn't prevent foster parenting.
13653 !! test
13654 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13655 !! wikitext
13656 {{PartialTable}}<ref>foo</ref>
13657 |}
13658
13659 <references />
13660 !! html/parsoid
13661 <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="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
13662 <tbody>
13663 </tbody></table>
13664
13665 <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="./Parser_test#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>
13666 !! end
13667
13668 !! test
13669 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13670 !! wikitext
13671 {{echo|
13672 {{{!}}
13673 {{!}}-}}
13674 <onlyinclude>
13675 |foo
13676 </onlyinclude>
13677 {{!}}}
13678 !! html/parsoid
13679 <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{{!}}}"]}'>
13680 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13681 <tbody><tr>
13682
13683 <td>foo
13684 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13685 </tbody></table>
13686 !! end
13687
13688 !!test
13689 Templates: Lists: Multi-line list-items via templates
13690 !! wikitext
13691 *{{echo|a {{nonexistent|
13692 unused}}}}
13693 *{{echo|b {{nonexistent|
13694 unused}}}}
13695 !! html
13696 <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>
13697 <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>
13698
13699 !!end
13700
13701 !!test
13702 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13703 !! wikitext
13704 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13705 !! html
13706 <p><i>ab</i>c<i>d</i>e
13707 </p>
13708 !!end
13709
13710 !!test
13711 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13712 (PHP parser generates misnested html)
13713 !! wikitext
13714 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13715 !! html/parsoid
13716 <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>
13717 !!end
13718
13719 !!test
13720 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13721 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13722 !! options
13723 parsoid=wt2html,wt2wt
13724 !! wikitext
13725 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13726 !! html/php+tidy
13727 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13728 !! html/parsoid
13729 <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>
13730 <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>
13731 <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>
13732 !!end
13733
13734 !!test
13735 Templates: Ugly nesting: 4. Divs opened/closed across templates
13736 !! wikitext
13737 a<div>b{{echo|c</div>d}}e
13738 !! html
13739 a<div>bc</div>de
13740
13741 !! html+tidy
13742 <p>a</p><div>bc</div><p>de
13743 </p>
13744 !! end
13745
13746 !! test
13747 Templates: Ugly templates: 3. newline-only template parameter
13748 !! wikitext
13749 foo {{echo|
13750 }}
13751 !! html
13752 <p>foo
13753 </p>
13754 !! end
13755
13756 # This looks like a bug: a single newline triggers p/br for some reason.
13757 !! test
13758 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13759 !! wikitext
13760 {{echo|
13761 }}
13762 !! html
13763 <p><br />
13764 </p>
13765 !! end
13766
13767 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13768 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13769 !! test
13770 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13771 !! wikitext
13772 {{echo|<table>}}
13773 {{echo|<div>foo}}
13774 {{echo|</table>}}
13775 !! html/parsoid
13776 <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">
13777 </span><table about="#mwt1">
13778 </table>
13779 !! end
13780
13781 # T66017 -- ugly wikitext with fostered content generates two template ranges
13782 # that are "identical" and generate nesting cycles in the algorithm
13783 !! test
13784 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13785 !! wikitext
13786 {{echo|<table><tr><td><table>}}
13787 {{echo|<div>}}
13788 {{echo|</div>}}
13789 !! html/parsoid
13790 <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"}'>
13791 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13792 </table></td></tr></tbody></table>
13793 !! end
13794
13795 !! test
13796 Templates: Parameters substituted at the top-level
13797 !! wikitext
13798 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13799
13800 {{{foo|bar|baz}}}
13801 !! html/php
13802 <p><i>who</i> me? <b>never!</b>
13803 </p><p>bar
13804 </p>
13805 !! html/parsoid
13806 <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>
13807
13808 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13809 !! end
13810
13811 !! test
13812 Templates: Param with empty arg in the final position
13813 !! wikitext
13814 {{{hi|}}}
13815 !! html/parsoid
13816 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13817 !! end
13818
13819 !!test
13820 Parser Functions: 1. Simple example
13821 !! wikitext
13822 {{uc:foo}}
13823 !! html
13824 <p>FOO
13825 </p>
13826 !!end
13827
13828 !!test
13829 Parser Functions: 2. Nested use (only outermost should be marked up)
13830 !! wikitext
13831 {{uc:{{lc:FOO}}}}
13832 !! html
13833 <p>FOO
13834 </p>
13835 !!end
13836
13837 ## Note that the templates inside the references are not wrapped
13838 !! test
13839 Template nested in extension tag in template
13840 !! options
13841 title=[[Main Page]]
13842 language=zh
13843 !! wikitext
13844 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13845 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13846 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13847 <references />
13848 !! html/parsoid
13849 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13850 <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="./Main_Page#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
13851 <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="./Main_Page#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
13852 <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="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Ho" title="Ho">hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><a 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="./Main_Page#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>
13853 !! end
13854
13855 ###
13856 ### Pre-save transform tests
13857 ###
13858
13859 !! test
13860 pre-save transform: subst:
13861 !! options
13862 pst
13863 !! wikitext
13864 {{subst:test}}
13865 !! html/php
13866 This is a test template
13867 !! end
13868
13869 !! test
13870 pre-save transform: normal template
13871 !! options
13872 pst
13873 !! wikitext
13874 {{test}}
13875 !! html/php
13876 {{test}}
13877 !! end
13878
13879 !! test
13880 pre-save transform: nonexistent template
13881 !! options
13882 pst
13883 !! wikitext
13884 {{thistemplatedoesnotexist}}
13885 !! html/php
13886 {{thistemplatedoesnotexist}}
13887 !! end
13888
13889 !! test
13890 pre-save transform: subst magic variables
13891 !! options
13892 pst
13893 !! wikitext
13894 {{subst:SITENAME}}
13895 !! html/php
13896 MediaWiki
13897 !! end
13898
13899 # This is T2089, which I fixed. -- wtm
13900 !! test
13901 pre-save transform: subst: templates with parameters
13902 !! options
13903 pst
13904 !! wikitext
13905 {{subst:paramtest|param="something else"}}
13906 !! html/php
13907 This is a test template with parameter "something else"
13908 !! end
13909
13910 !! article
13911 Template:nowikitest
13912 !! text
13913 <nowiki>'''not wiki'''</nowiki>
13914 !! endarticle
13915
13916 !! test
13917 pre-save transform: nowiki in subst (T3188)
13918 !! options
13919 pst
13920 !! wikitext
13921 {{subst:nowikitest}}
13922 !! html/php
13923 <nowiki>'''not wiki'''</nowiki>
13924 !! end
13925
13926 !! article
13927 Template:commenttest
13928 !! text
13929 This template has <!-- a comment --> in it.
13930 !! endarticle
13931
13932 !! test
13933 pre-save transform: comment in subst (T3936)
13934 !! options
13935 pst
13936 !! wikitext
13937 {{subst:commenttest}}
13938 !! html/php
13939 This template has <!-- a comment --> in it.
13940 !! end
13941
13942 !! test
13943 pre-save transform: unclosed tag
13944 !! options
13945 pst
13946 !! wikitext
13947 <nowiki>'''not wiki'''
13948 !! html/php
13949 <nowiki>'''not wiki'''
13950 !! end
13951
13952 !! test
13953 pre-save transform: mixed tag case
13954 !! options
13955 pst
13956 !! wikitext
13957 <NOwiki>'''not wiki'''</noWIKI>
13958 !! html/php
13959 <NOwiki>'''not wiki'''</noWIKI>
13960 !! end
13961
13962 !! test
13963 pre-save transform: unclosed comment in <nowiki>
13964 !! options
13965 pst
13966 !! wikitext
13967 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13968 !! html/php
13969 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13970 !!end
13971
13972 # Leading @ in this template definition works around a limitation
13973 # in parsoid's parserTests which otherwise strips the <span> from the
13974 # result (confusing it for a template wrapper)
13975 !! article
13976 Template:dangerous
13977 !!text
13978 @<span onmouseover="alert('crap')">Oh no</span>
13979 !!endarticle
13980
13981 !!test
13982 (confirming safety of fix for subst T3936)
13983 !! wikitext
13984 {{Template:dangerous}}
13985 !! html
13986 <p>@<span>Oh no</span>
13987 </p>
13988 !! end
13989
13990 !! test
13991 pre-save transform: comment containing gallery (T7024)
13992 !! options
13993 pst
13994 !! wikitext
13995 <!-- <gallery>data</gallery> -->
13996 !! html/php
13997 <!-- <gallery>data</gallery> -->
13998 !!end
13999
14000 !! test
14001 pre-save transform: comment containing extension
14002 !! options
14003 pst
14004 !! wikitext
14005 <!-- <tag>data</tag> -->
14006 !! html/php
14007 <!-- <tag>data</tag> -->
14008 !!end
14009
14010 !! test
14011 pre-save transform: comment containing nowiki
14012 !! options
14013 pst
14014 !! wikitext
14015 <!-- <nowiki>data</nowiki> -->
14016 !! html/php
14017 <!-- <nowiki>data</nowiki> -->
14018 !!end
14019
14020 !! test
14021 pre-save transform: <noinclude> in subst (T5298)
14022 !! options
14023 pst
14024 !! wikitext
14025 {{subst:Includes}}
14026 !! html/php
14027 Foobar
14028 !! end
14029
14030 !! test
14031 pre-save transform: <onlyinclude> in subst (T5298)
14032 !! options
14033 pst
14034 !! wikitext
14035 {{subst:Includes2}}
14036 !! html/php
14037 Foo
14038 !! end
14039
14040 !! article
14041 Template:SubstTest
14042 !!text
14043 {{<includeonly>subst:</includeonly>Includes}}
14044 !! endarticle
14045
14046 !! article
14047 Template:SafeSubstTest
14048 !! text
14049 {{<includeonly>safesubst:</includeonly>Includes}}
14050 !! endarticle
14051
14052 !! test
14053 T24297: safesubst: works during PST
14054 !! options
14055 pst
14056 !! wikitext
14057 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
14058 !! html/php
14059 FoobarFoobar
14060 !! end
14061
14062 !! test
14063 T24297: safesubst: works during normal parse
14064 !! wikitext
14065 {{SafeSubstTest}}
14066 !! html
14067 <p>Foobar
14068 </p>
14069 !! end
14070
14071 !! test
14072 subst: does not work during normal parse
14073 !! wikitext
14074 {{SubstTest}}
14075 !! html
14076 <p>{{subst:Includes}}
14077 </p>
14078 !! end
14079
14080 !! test
14081 pre-save transform: context links ("pipe trick")
14082 !! options
14083 pst
14084 !! wikitext
14085 [[Article (context)|]]
14086 [[Bar:Article|]]
14087 [[:Bar:Article|]]
14088 [[Bar:Article (context)|]]
14089 [[:Bar:Article (context)|]]
14090 [[|Article]]
14091 [[|Article (context)]]
14092 [[Bar:X (Y) Z|]]
14093 [[:Bar:X (Y) Z|]]
14094 !! html/php
14095 [[Article (context)|Article]]
14096 [[Bar:Article|Article]]
14097 [[:Bar:Article|Article]]
14098 [[Bar:Article (context)|Article]]
14099 [[:Bar:Article (context)|Article]]
14100 [[Article]]
14101 [[Article (context)]]
14102 [[Bar:X (Y) Z|X (Y) Z]]
14103 [[:Bar:X (Y) Z|X (Y) Z]]
14104 !! end
14105
14106 !! test
14107 pre-save transform: context links ("pipe trick") with interwiki prefix
14108 !! options
14109 pst
14110 !! wikitext
14111 [[interwiki:Article|]]
14112 [[:interwiki:Article|]]
14113 [[interwiki:Bar:Article|]]
14114 [[:interwiki:Bar:Article|]]
14115 !! html/php
14116 [[interwiki:Article|Article]]
14117 [[:interwiki:Article|Article]]
14118 [[interwiki:Bar:Article|Bar:Article]]
14119 [[:interwiki:Bar:Article|Bar:Article]]
14120 !! end
14121
14122 !! test
14123 pre-save transform: context links ("pipe trick") with parens in title
14124 !! options
14125 pst title=[[Somearticle (context)]]
14126 !! wikitext
14127 [[|Article]]
14128 !! html/php
14129 [[Article (context)|Article]]
14130 !! end
14131
14132 !! test
14133 pre-save transform: context links ("pipe trick") with comma in title
14134 !! options
14135 pst title=[[Someplace, Somewhere]]
14136 !! wikitext
14137 [[|Otherplace]]
14138 [[Otherplace, Elsewhere|]]
14139 [[Otherplace, Elsewhere, Anywhere|]]
14140 !! html/php
14141 [[Otherplace, Somewhere|Otherplace]]
14142 [[Otherplace, Elsewhere|Otherplace]]
14143 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14144 !! end
14145
14146 !! test
14147 pre-save transform: context links ("pipe trick") with parens and comma
14148 !! options
14149 pst title=[[Someplace (IGNORED), Somewhere]]
14150 !! wikitext
14151 [[|Otherplace]]
14152 [[Otherplace (place), Elsewhere|]]
14153 !! html/php
14154 [[Otherplace, Somewhere|Otherplace]]
14155 [[Otherplace (place), Elsewhere|Otherplace]]
14156 !! end
14157
14158 !! test
14159 pre-save transform: context links ("pipe trick") with comma and parens
14160 !! options
14161 pst title=[[Who, me? (context)]]
14162 !! wikitext
14163 [[|Yes, you.]]
14164 [[Me, Myself, and I (1937 song)|]]
14165 !! html/php
14166 [[Yes, you. (context)|Yes, you.]]
14167 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14168 !! end
14169
14170 !! test
14171 pre-save transform: context links ("pipe trick") with namespace
14172 !! options
14173 pst title=[[Ns:Somearticle]]
14174 !! wikitext
14175 [[|Article]]
14176 !! html/php
14177 [[Ns:Article|Article]]
14178 !! end
14179
14180 !! test
14181 pre-save transform: context links ("pipe trick") with namespace and parens
14182 !! options
14183 pst title=[[Ns:Somearticle (context)]]
14184 !! wikitext
14185 [[|Article]]
14186 !! html/php
14187 [[Ns:Article (context)|Article]]
14188 !! end
14189
14190 !! test
14191 pre-save transform: context links ("pipe trick") with namespace and comma
14192 !! options
14193 pst title=[[Ns:Somearticle, Context, Whatever]]
14194 !! wikitext
14195 [[|Article]]
14196 !! html/php
14197 [[Ns:Article, Context, Whatever|Article]]
14198 !! end
14199
14200 !! test
14201 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14202 !! options
14203 pst title=[[Ns:Somearticle, Context (context)]]
14204 !! wikitext
14205 [[|Article]]
14206 !! html/php
14207 [[Ns:Article (context)|Article]]
14208 !! end
14209
14210 !! test
14211 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14212 !! options
14213 pst title=[[Ns:Somearticle (IGNORED), Context]]
14214 !! wikitext
14215 [[|Article]]
14216 !! html/php
14217 [[Ns:Article, Context|Article]]
14218 !! end
14219
14220 !! test
14221 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14222 !! options
14223 pst
14224 !! wikitext
14225 [[Article(context)|]]
14226 [[Bar:Article(context)|]]
14227 [[:Bar:Article(context)|]]
14228 [[|Article(context)]]
14229 [[Bar:X(Y)Z|]]
14230 [[:Bar:X(Y)Z|]]
14231 !! html/php
14232 [[Article(context)|Article]]
14233 [[Bar:Article(context)|Article]]
14234 [[:Bar:Article(context)|Article]]
14235 [[Article(context)]]
14236 [[Bar:X(Y)Z|X(Y)Z]]
14237 [[:Bar:X(Y)Z|X(Y)Z]]
14238 !! end
14239
14240 !! test
14241 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14242 !! options
14243 pst
14244 !! wikitext
14245 [[Article (context)|]]
14246 [[Bar:Article (context)|]]
14247 [[:Bar:Article (context)|]]
14248 [[|Article (context)]]
14249 [[Bar:X (Y) Z|]]
14250 [[:Bar:X (Y) Z|]]
14251 !! html/php
14252 [[Article (context)|Article]]
14253 [[Bar:Article (context)|Article]]
14254 [[:Bar:Article (context)|Article]]
14255 [[Article (context)]]
14256 [[Bar:X (Y) Z|X (Y) Z]]
14257 [[:Bar:X (Y) Z|X (Y) Z]]
14258 !! end
14259
14260 !! test
14261 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14262 !! options
14263 pst
14264 !! wikitext
14265 [[Article(context)|]]
14266 [[Bar:Article(context)|]]
14267 [[:Bar:Article(context)|]]
14268 [[|Article(context)]]
14269 [[Bar:X(Y)Z|]]
14270 [[:Bar:X(Y)Z|]]
14271 !! html/php
14272 [[Article(context)|Article]]
14273 [[Bar:Article(context)|Article]]
14274 [[:Bar:Article(context)|Article]]
14275 [[Article(context)]]
14276 [[Bar:X(Y)Z|X(Y)Z]]
14277 [[:Bar:X(Y)Z|X(Y)Z]]
14278 !! end
14279
14280 !! test
14281 pre-save transform: context links ("pipe trick") with commas (T23660)
14282 !! options
14283 pst
14284 !! wikitext
14285 [[Article (context), context|]]
14286 [[Article (context),context|]]
14287 [[Bar:Article (context), context|]]
14288 [[Bar:Article (context),context|]]
14289 [[:Bar:Article (context), context|]]
14290 [[:Bar:Article (context),context|]]
14291 !! html/php
14292 [[Article (context), context|Article]]
14293 [[Article (context),context|Article]]
14294 [[Bar:Article (context), context|Article]]
14295 [[Bar:Article (context),context|Article]]
14296 [[:Bar:Article (context), context|Article]]
14297 [[:Bar:Article (context),context|Article]]
14298 !! end
14299
14300 !! test
14301 Parsoid: backwards pipe trick
14302 !! wikitext
14303 [[|'''bar''']]
14304 !! html/php
14305 <p>[[|<b>bar</b>]]
14306 </p>
14307 !! html/parsoid
14308 <p>[[|<b>bar</b>]]</p>
14309 !! end
14310
14311 !! test
14312 pre-save transform: trim trailing empty lines
14313 !! options
14314 pst
14315 !! wikitext
14316 Empty lines are trimmed
14317
14318
14319
14320
14321 !! html/php
14322 Empty lines are trimmed
14323 !! end
14324
14325 !! test
14326 pre-save transform: Signature expansion
14327 !! options
14328 pst
14329 !! wikitext
14330 * ~~~
14331 * ~~~~
14332 * ~~~~~
14333 * <noinclude>~~~</noinclude>
14334 * <includeonly>~~~</includeonly>
14335 * <onlyinclude>~~~</onlyinclude>
14336 !! html/php
14337 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14338 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14339 * 00:02, 1 January 1970 (UTC)
14340 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14341 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14342 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14343 !! end
14344
14345
14346 !! test
14347 ParserOutput flags from signature expansion (T84843)
14348 !! options
14349 pst
14350 showflags
14351 !! wikitext
14352 ~~~~
14353 !! html/php
14354 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14355 flags=user-signature
14356 !! end
14357
14358
14359 !! test
14360 pre-save transform: Signature expansion in nowiki tags (T2093)
14361 !! options
14362 pst disabled
14363 !! wikitext
14364 Shall not expand:
14365
14366 <nowiki>~~~~</nowiki>
14367
14368 <includeonly><nowiki>~~~~</nowiki></includeonly>
14369
14370 <noinclude><nowiki>~~~~</nowiki></noinclude>
14371
14372 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14373
14374 {{subst:Foo}} shall be converted to FOO
14375
14376 As well as inside noinclude/onlyinclude
14377 <noinclude>{{subst:Foo}}</noinclude>
14378 <onlyinclude>{{subst:Foo}}</onlyinclude>
14379
14380 But not inside includeonly
14381 <includeonly>{{subst:Foo}}</includeonly>
14382 !! html/php
14383 Shall not expand:
14384
14385 <nowiki>~~~~</nowiki>
14386
14387 <includeonly><nowiki>~~~~</nowiki></includeonly>
14388
14389 <noinclude><nowiki>~~~~</nowiki></noinclude>
14390
14391 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14392
14393 FOO shall be converted to FOO
14394
14395 As well as inside noinclude/onlyinclude
14396 <noinclude>FOO</noinclude>
14397 <onlyinclude>FOO</onlyinclude>
14398
14399 But not inside includeonly
14400 <includeonly>{{subst:Foo}}</includeonly>
14401 !! end
14402
14403 !! test
14404 Parsoid: Recognize nowiki with trailing space in tags
14405 !! options
14406 parsoid=wt2html
14407 !! wikitext
14408 <nowiki ><div>[[foo]]</nowiki >
14409
14410 a<nowiki / >b
14411
14412 c<nowiki />d
14413
14414 e<nowiki/ >f
14415 !! html/php+tidy
14416 <p>&lt;div&gt;[[foo]]
14417 </p><p>a&lt;nowiki / &gt;b
14418 </p><p>cd
14419 </p><p>e&lt;nowiki/ &gt;f
14420 </p>
14421 !! html/parsoid
14422 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14423
14424 <p>a&lt;nowiki / >b</p>
14425
14426 <p>c<span typeof="mw:Nowiki"></span>d</p>
14427
14428 <p>e&lt;nowiki/ >f</p>
14429 !! end
14430
14431 !! test
14432 Parsoid: Recognize nowiki with odd capitalization
14433 !! options
14434 parsoid=wt2html
14435 !! wikitext
14436 <noWikI ><div>[[foo]]</Nowiki >
14437 !! html/php+tidy
14438 <p>&lt;div&gt;[[foo]]
14439 </p>
14440 !! html/parsoid
14441 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14442 !! end
14443
14444
14445 !! test
14446 Parsoid: Escape nowiki with trailing space in tags
14447 !! options
14448 parsoid=html2wt
14449 !! html/parsoid
14450 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14451 <p>a&lt;nowiki /&gt;b</p>
14452 <p>c&lt;nowiki/ &gt;d</p>
14453 !! wikitext
14454 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14455
14456 a&lt;nowiki /&gt;b
14457
14458 c&lt;nowiki/ &gt;d
14459 !! end
14460
14461 !! test
14462 Parsoid: Escape weird noWikI capitalizations
14463 !! options
14464 parsoid=html2wt
14465 !! html/parsoid
14466 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14467 !! wikitext
14468 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14469 !! end
14470
14471 ###
14472 ### Message transform tests
14473 ###
14474 !! test
14475 message transform: magic variables
14476 !! options
14477 msg
14478 !! wikitext
14479 {{SITENAME}}
14480 !! html
14481 MediaWiki
14482 !! end
14483
14484 !! test
14485 message transform: should not transform wiki markup
14486 !! options
14487 msg
14488 !! wikitext
14489 ''test''
14490 !! html
14491 ''test''
14492 !! end
14493
14494 !! test
14495 message transform: <noinclude> in transcluded template (T6926)
14496 !! options
14497 msg
14498 !! wikitext
14499 {{Includes}}
14500 !! html
14501 Foobar
14502 !! end
14503
14504 !! test
14505 message transform: <onlyinclude> in transcluded template (T6926)
14506 !! options
14507 msg
14508 !! wikitext
14509 {{Includes2}}
14510 !! html
14511 Foo
14512 !! end
14513
14514 !! test
14515 {{#special:}} page name, known
14516 !! options
14517 msg
14518 !! wikitext
14519 {{#special:Recentchanges}}
14520 !! html
14521 Special:RecentChanges
14522 !! end
14523
14524 !! test
14525 {{#special:}} page name with subpage, known
14526 !! options
14527 msg
14528 !! wikitext
14529 {{#special:Recentchanges/param}}
14530 !! html
14531 Special:RecentChanges/param
14532 !! end
14533
14534 !! test
14535 {{#special:}} page name, unknown
14536 !! options
14537 msg
14538 !! wikitext
14539 {{#special:foobar nonexistent}}
14540 !! html
14541 Special:Foobar nonexistent
14542 !! end
14543
14544 !! test
14545 {{#speciale:}} page name, known
14546 !! options
14547 msg
14548 !! wikitext
14549 {{#speciale:Recentchanges}}
14550 !! html
14551 Special:RecentChanges
14552 !! end
14553
14554 !! test
14555 {{#speciale:}} page name with subpage, known
14556 !! options
14557 msg
14558 !! wikitext
14559 {{#speciale:Recentchanges/param}}
14560 !! html
14561 Special:RecentChanges/param
14562 !! end
14563
14564 !! test
14565 {{#speciale:}} page name, unknown
14566 !! options
14567 msg
14568 !! wikitext
14569 {{#speciale:foobar nonexistent}}
14570 !! html
14571 Special:Foobar_nonexistent
14572 !! end
14573
14574 ###
14575 ### Images
14576 ###
14577 ### For Parsoid-specific tests, see
14578 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14579
14580 !! test
14581 Simple image
14582 !! options
14583 parsoid=wt2html,wt2wt,html2html
14584 !! wikitext
14585 [[Image:foobar.jpg]]
14586 !! html/php
14587 <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>
14588 </p>
14589 !! html/parsoid
14590 <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>
14591 !! end
14592
14593 !! test
14594 Serialize simple image with span wrapper
14595 !! options
14596 parsoid=html2wt
14597 !! html/parsoid
14598 <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>
14599 !! wikitext
14600 [[File:Foobar.jpg]]
14601 !! end
14602
14603 !! test
14604 Simple image (using File: namespace, now canonical)
14605 !! wikitext
14606 [[File:Foobar.jpg]]
14607 !! html/php
14608 <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>
14609 </p>
14610 !! html/parsoid
14611 <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>
14612 !! end
14613
14614 !! test
14615 Right-aligned image
14616 !! wikitext
14617 [[File:Foobar.jpg|right]]
14618 !! html/php
14619 <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>
14620
14621 !! html/parsoid
14622 <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>
14623 !! end
14624
14625 !! test
14626 Image with caption
14627 !! wikitext
14628 [[File:Foobar.jpg|right|Caption text]]
14629 !! html/php
14630 <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>
14631
14632 !! html/parsoid
14633 <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>
14634 !! end
14635
14636 !! test
14637 Image with caption, T55312 #1
14638 !! wikitext
14639 [[File:Foobar.jpg|right|Caption page stuff]]
14640 !! html/php
14641 <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>
14642
14643 !! html/parsoid
14644 <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>
14645 !! end
14646
14647 !! test
14648 Image with caption, T55312 #2
14649 !! wikitext
14650 [[File:Foobar.jpg|right|Caption page=]]
14651 !! html/php
14652 <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>
14653
14654 !! html/parsoid
14655 <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>
14656 !! end
14657
14658 !! test
14659 Image with caption, T55312 #3
14660 !! wikitext
14661 [[File:Foobar.jpg|right|Caption page=stuff]]
14662 !! html/php
14663 <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>
14664
14665 !! html/parsoid
14666 <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>
14667 !! end
14668
14669 !! test
14670 Image caption with pipe entity
14671 !! wikitext
14672 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14673 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14674 !! html/php
14675 <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>
14676 <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>
14677
14678 !! html/parsoid
14679 <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>
14680 <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>
14681 !! end
14682
14683 !! test
14684 Allow empty links in image captions (T62753)
14685 !! options
14686 thumbsize=220
14687 !! wikitext
14688 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14689 [[]]
14690 [[Link2]]
14691 ]]
14692 !! html/php
14693 <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>
14694
14695 !! html/parsoid
14696 <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>
14697 [[]]
14698 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14699 </figcaption></figure>
14700 !! end
14701
14702 !! test
14703 Titles in unlinked images (T23454)
14704 !! wikitext
14705 [[File:Foobar.jpg|link=|stuff]]
14706 !! html/php
14707 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14708 </p>
14709 !! html/parsoid
14710 <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>
14711 !! end
14712
14713 !! test
14714 Link with empty target
14715 !! wikitext
14716 [[]]
14717 !! html
14718 <p>[[]]
14719 </p>
14720 !! end
14721
14722 !! test
14723 Image with link trail
14724 !! wikitext
14725 Linktrails should not work for images: [[File:Foobar.jpg]]s
14726 !! html/php
14727 <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
14728 </p>
14729 !! html/parsoid
14730 <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>
14731 !! end
14732
14733 !! test
14734 Image with empty attribute
14735 !! options
14736 parsoid=wt2html,wt2wt,html2html
14737 !! wikitext
14738 [[File:Foobar.jpg|right||Caption text]]
14739 !! html/php
14740 <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>
14741
14742 !! html/parsoid
14743 <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>
14744 !! end
14745
14746 !! test
14747 1. Block image with individual attributes from templates
14748 !! wikitext
14749 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14750 !! html/php
14751 <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>
14752
14753 !! html/parsoid
14754 <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>
14755 !! end
14756
14757 !! test
14758 2. Block Image with individual attributes from templates
14759 !! wikitext
14760 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14761 !! html/php
14762 <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>
14763
14764 !! html/parsoid
14765 <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>
14766 !! end
14767
14768 !! test
14769 3. Inline image with individual attributes from templates
14770 !! wikitext
14771 [[File:Foobar.jpg|{{echo|50px}}]]
14772 !! html/php
14773 <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>
14774 </p>
14775 !! html/parsoid
14776 <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>
14777 !! end
14778
14779 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14780 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14781 !! test
14782 Image with multiple attributes from the same template
14783 !! wikitext
14784 [[File:Foobar.jpg|{{image_attribs}}]]
14785 !! html/php
14786 <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>
14787
14788 !! html/parsoid
14789 <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>
14790 !! end
14791
14792 !! test
14793 Image with link tails
14794 !! options
14795 thumbsize=220
14796 !! wikitext
14797 123[[File:Foobar.jpg]]456
14798 123[[File:Foobar.jpg|right]]456
14799 123[[File:Foobar.jpg|thumb]]456
14800 !! html/php
14801 <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
14802 </p>
14803 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
14804 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
14805
14806 !! html/php+tidy
14807 <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
14808 </p><p>
14809 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
14810 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
14811 </p>
14812 !! html/parsoid
14813 <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>
14814 <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
14815 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>
14816 !! end
14817
14818 !! test
14819 Image with multiple captions -- only last one is accepted
14820 !! wikitext
14821 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14822 !! html/php
14823 <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>
14824
14825 !! html/parsoid
14826 <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>
14827 !! end
14828
14829 !! test
14830 Image with multiple widths -- use last
14831 !! wikitext
14832 [[File:Foobar.jpg|200px|300px|caption]]
14833 !! html/php
14834 <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>
14835 </p>
14836 !! html/parsoid
14837 <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>
14838 !! end
14839
14840 !! test
14841 Image with multiple alignments -- use first (T50664)
14842 !! options
14843 thumbsize=220
14844 !! wikitext
14845 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14846
14847 [[File:Foobar.jpg|middle|text-top|caption]]
14848 !! html/php
14849 <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>
14850 <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>
14851 </p>
14852 !! html/parsoid
14853 <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>
14854 <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>
14855 !! end
14856
14857 !! test
14858 Image with width attribute at different positions
14859 !! wikitext
14860 [[File:Foobar.jpg|200px|right|Caption]]
14861 [[File:Foobar.jpg|right|200px|Caption]]
14862 [[File:Foobar.jpg|right|Caption|200px]]
14863 !! html/php
14864 <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>
14865 <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>
14866 <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>
14867
14868 !! html/parsoid
14869 <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>
14870 <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>
14871 <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>
14872 !! end
14873
14874 # a sad bit of backward-compatibility
14875 !! test
14876 Image with size specified with pxpx (T15500, T53628)
14877 !! options
14878 parsoid=wt2html,wt2wt,html2html
14879 !! wikitext
14880 [[File:Foobar.jpg|20pxpx]]
14881 [[File:Foobar.jpg|200x20pxpx]]
14882 !! html/php
14883 <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>
14884 <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>
14885 </p>
14886 !! html/parsoid
14887 <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>
14888 !! end
14889
14890 !! test
14891 Image with link parameter, wiki target
14892 !! wikitext
14893 [[File:Foobar.jpg|link=Main Page]]
14894 !! html/php
14895 <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>
14896 </p>
14897 !! html/parsoid
14898 <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>
14899 !! end
14900
14901 # parsoid T51293 (part 1)
14902 !! test
14903 Image with link parameter, URL target
14904 !! wikitext
14905 [[File:Foobar.jpg|link=http://example.com/]]
14906 !! html/php
14907 <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>
14908 </p>
14909 !! html/parsoid
14910 <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>
14911 !! end
14912
14913 # parsoid T51293 (part 2)
14914 !! test
14915 Image with link parameter, protocol-less URL target
14916 !! wikitext
14917 [[File:Foobar.jpg|link=//example.com/]]
14918 !! html/php
14919 <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>
14920 </p>
14921 !! html/parsoid
14922 <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>
14923 !! end
14924
14925 !! test
14926 Escaping non-block captions (T107435)
14927 !! options
14928 parsoid={
14929 "modes": ["wt2wt"],
14930 "changes": [
14931 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14932 ]
14933 }
14934 !! wikitext
14935 [[Image:Foobar.jpg|caption]]
14936 !! wikitext/edited
14937 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14938 !! end
14939
14940 # wgExternalLinkTarget not supported by Parsoid
14941 !! test
14942 Image with link parameter, wgExternalLinkTarget
14943 !! wikitext
14944 [[Image:foobar.jpg|link=http://example.com/]]
14945 !! config
14946 wgExternalLinkTarget='foobar'
14947 !! html/php
14948 <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>
14949 </p>
14950 !! end
14951
14952 !! test
14953 Image with link parameter, wgNoFollowLinks set to false
14954 !! wikitext
14955 [[Image:foobar.jpg|link=http://example.com/]]
14956 !! config
14957 wgNoFollowLinks=false
14958 !! html/php
14959 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14960 </p>
14961 !! end
14962
14963 !! test
14964 Image with link parameter, wgNoFollowDomainExceptions
14965 !! wikitext
14966 [[Image:foobar.jpg|link=http://example.com/]]
14967 !! config
14968 wgNoFollowDomainExceptions='example.com'
14969 !! html/php
14970 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14971 </p>
14972 !! end
14973
14974 # wgExternalLinkTarget not supported by Parsoid
14975 !! test
14976 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14977 !! wikitext
14978 [[Image:foobar.jpg|link=http://example.com/|Title]]
14979 !! config
14980 wgExternalLinkTarget='foobar'
14981 !! html/php
14982 <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>
14983 </p>
14984 !! end
14985
14986 !! test
14987 Image with empty link parameter
14988 !! wikitext
14989 [[File:Foobar.jpg|link=]]
14990 !! html/php
14991 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14992 </p>
14993 !! html/parsoid
14994 <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>
14995 !! end
14996
14997 !! test
14998 Image with link parameter (wiki target) and unnamed parameter
14999 !! wikitext
15000 [[File:Foobar.jpg|link=Main_Page|Title]]
15001 !! html/php
15002 <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>
15003 </p>
15004 !! html/parsoid
15005 <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>
15006 !! end
15007
15008 !! test
15009 Image with link parameter (URL target) and unnamed parameter
15010 !! wikitext
15011 [[File:Foobar.jpg|link=http://example.com/|Title]]
15012 !! html/php
15013 <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>
15014 </p>
15015 !! html/parsoid
15016 <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>
15017 !! end
15018
15019 !! test
15020 Thumbnail image with link parameter
15021 !! options
15022 thumbsize=220
15023 parsoid=wt2html,wt2wt,html2html
15024 !! wikitext
15025 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
15026 !! html/php
15027 <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>
15028
15029 !! html/parsoid
15030 <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>
15031 !! end
15032
15033 !! test
15034 Manually-specified thumbnail image
15035 !! options
15036 thumbsize=220
15037 !! wikitext
15038 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15039 !! html/php
15040 <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>
15041
15042 !! html/parsoid
15043 <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>
15044 !! end
15045
15046 !! test
15047 Manually-specified thumbnail image with explicit link to wiki page
15048 !! options
15049 thumbsize=220
15050 parsoid=wt2html,wt2wt,html2html
15051 !! wikitext
15052 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
15053 !! html/php
15054 <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>
15055
15056 !! html/parsoid
15057 <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>
15058 !! end
15059
15060 !! test
15061 Manually-specified thumbnail image with explicit link to url
15062 !! options
15063 thumbsize=220
15064 parsoid=wt2html,wt2wt,html2html
15065 !! wikitext
15066 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
15067 !! html/php
15068 <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>
15069
15070 !! html/parsoid
15071 <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>
15072 !! end
15073
15074 !! test
15075 Manually-specified thumbnail image with explicit no link
15076 !! options
15077 thumbsize=220
15078 parsoid=wt2html,wt2wt,html2html
15079 !! wikitext
15080 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
15081 !! html/php
15082 <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>
15083
15084 !! html/parsoid
15085 <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>
15086 !! end
15087
15088 !! test
15089 Manually-specified thumbnail image with explicit link and alt text
15090 !! options
15091 thumbsize=220
15092 parsoid=wt2html,wt2wt,html2html
15093 !! wikitext
15094 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
15095 !! html/php
15096 <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>
15097
15098 !! html/parsoid
15099 <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>
15100 !! end
15101
15102 !! test
15103 Image with frame and link
15104 !! options
15105 parsoid=wt2html,wt2wt,html2html
15106 !! wikitext
15107 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
15108 !! html/php
15109 <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>
15110
15111 !! html/parsoid
15112 <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>
15113 !! end
15114
15115 !! test
15116 Image with frame and link and explicit alt
15117 !! options
15118 parsoid=wt2html,wt2wt,html2html
15119 !! wikitext
15120 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15121 !! html/php
15122 <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>
15123
15124 !! html/parsoid
15125 <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>
15126 !! end
15127
15128 !! test
15129 Image with wiki markup in implicit alt
15130 !! wikitext
15131 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15132
15133 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15134 !! html/php
15135 <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>
15136 </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>
15137 </p>
15138 !! html/parsoid
15139 <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>
15140
15141 <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>
15142 !! end
15143
15144 !! test
15145 Alt image option should handle most kinds of wikitext without barfing
15146 !! wikitext
15147 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15148 !! html/php
15149 <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>
15150
15151 !! html/parsoid
15152 <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>
15153 !! end
15154
15155 !! test
15156 Ampersand in alt attribute (T206940)
15157 !! options
15158 parsoid = {
15159 "nativeGallery": true
15160 }
15161 !! wikitext
15162 [[File:Foobar.jpg|alt=&amp;amp;]]
15163
15164 <!-- consistency with gallery extension -->
15165 <gallery>
15166 File:Foobar.jpg|alt=&amp;amp;
15167 </gallery>
15168 !! html/php+tidy
15169 <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>
15170 </p>
15171 <ul class="gallery mw-gallery-traditional">
15172 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15173 <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>
15174 <div class="gallerytext">
15175 </div>
15176 </div></li>
15177 </ul>
15178 !! html/parsoid
15179 <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>
15180
15181 <!-- consistency with gallery extension -->
15182 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15183 <li class="gallerybox">
15184 <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>
15185 <div class="gallerytext"></div>
15186 </li>
15187 </ul>
15188 !! end
15189
15190 !! test
15191 Italics markup in alt attribute (T206940)
15192 !! wikitext
15193 [[File:Foobar.jpg|alt=''x''|caption]]
15194
15195 <!-- consistency with gallery extension -->
15196 <gallery>
15197 File:Foobar.jpg|alt=''x''|caption
15198 </gallery>
15199 !! html/php+tidy
15200 <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>
15201 </p>
15202 <ul class="gallery mw-gallery-traditional">
15203 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15204 <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>
15205 <div class="gallerytext">
15206 <p>caption
15207 </p>
15208 </div>
15209 </div></li>
15210 </ul>
15211 !! html/parsoid
15212 <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>
15213
15214 <!-- consistency with gallery extension -->
15215 <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"}}'>
15216 <li class="gallerybox">
15217 <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>
15218 <div class="gallerytext">caption</div>
15219 </li>
15220 </ul>
15221 !! end
15222
15223 !! test
15224 Nowiki markup in alt attribute (T206940)
15225 !! wikitext
15226 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15227
15228 <!-- consistency with gallery extension -->
15229 <gallery>
15230 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15231 </gallery>
15232 !! html/php+tidy
15233 <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>
15234 </p>
15235 <ul class="gallery mw-gallery-traditional">
15236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15237 <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>
15238 <div class="gallerytext">
15239 <p>caption
15240 </p>
15241 </div>
15242 </div></li>
15243 </ul>
15244 !! html/parsoid
15245 <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>
15246
15247 <!-- consistency with gallery extension -->
15248 <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"}}'>
15249 <li class="gallerybox">
15250 <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>
15251 <div class="gallerytext">caption</div>
15252 </li>
15253 </ul>
15254 !! end
15255
15256 !! test
15257 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15258 !! options
15259 parsoid = {
15260 "nativeGallery": true
15261 }
15262 !! wikitext
15263 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15264
15265 <!-- consistency with gallery extension -->
15266 <gallery>
15267 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15268 </gallery>
15269 !! html/php+tidy
15270 <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>
15271 </p>
15272 <ul class="gallery mw-gallery-traditional">
15273 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15274 <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>
15275 <div class="gallerytext">
15276 <p>caption
15277 </p>
15278 </div>
15279 </div></li>
15280 </ul>
15281 !! html/parsoid
15282 <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>
15283
15284 <!-- consistency with gallery extension -->
15285 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15286 <li class="gallerybox">
15287 <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>
15288 <div class="gallerytext">caption</div>
15289 </li>
15290 </ul>
15291 !! end
15292
15293 !! test
15294 Ampersand in link attribute (T206940)
15295 !! wikitext
15296 [[File:Foobar.jpg|link=Foo &amp; bar]]
15297
15298 <!-- consistency with gallery extension -->
15299 <gallery>
15300 File:Foobar.jpg|link=Foo &amp; bar
15301 </gallery>
15302 !! html/php+tidy
15303 <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>
15304 </p>
15305 <ul class="gallery mw-gallery-traditional">
15306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15307 <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>
15308 <div class="gallerytext">
15309 </div>
15310 </div></li>
15311 </ul>
15312 !! html/parsoid
15313 <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>
15314
15315 <!-- consistency with gallery extension -->
15316 <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"}}'>
15317 <li class="gallerybox">
15318 <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>
15319 <div class="gallerytext"></div>
15320 </li>
15321 </ul>
15322 !! end
15323
15324 !! test
15325 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15326 !! options
15327 parsoid = {
15328 "nativeGallery": true
15329 }
15330 !! wikitext
15331 [[File:Foobar.jpg|link=Foo_&_bar]]
15332
15333 <!-- consistency with gallery extension -->
15334 <gallery>
15335 File:Foobar.jpg|link=Foo_&_bar
15336 </gallery>
15337 !! html/php+tidy
15338 <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>
15339 </p>
15340 <ul class="gallery mw-gallery-traditional">
15341 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15342 <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>
15343 <div class="gallerytext">
15344 </div>
15345 </div></li>
15346 </ul>
15347 !! html/parsoid
15348 <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>
15349
15350 <!-- consistency with gallery extension -->
15351 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15352 <li class="gallerybox">
15353 <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>
15354 <div class="gallerytext"></div>
15355 </li>
15356 </ul>
15357 !! end
15358
15359 !! test
15360 Italics markup in link attribute (T206940)
15361 !! wikitext
15362 [[Foo''s bar''s]]
15363
15364 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15365 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15366
15367 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15368
15369 <!-- consistency with gallery extension -->
15370 <gallery>
15371 File:Foobar.jpg|link=Foo''s bar''s|caption1
15372 File:Foobar.jpg|link=''Main Page''|caption2
15373 </gallery>
15374 !! html/php+tidy
15375 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15376 </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>
15377 </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>
15378 </p>
15379 <ul class="gallery mw-gallery-traditional">
15380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15381 <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>
15382 <div class="gallerytext">
15383 <p>caption1
15384 </p>
15385 </div>
15386 </div></li>
15387 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15388 <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>
15389 <div class="gallerytext">
15390 <p>caption2
15391 </p>
15392 </div>
15393 </div></li>
15394 </ul>
15395 !! html/parsoid
15396 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15397
15398 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15399 <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>
15400
15401 <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>
15402
15403 <!-- consistency with gallery extension -->
15404 <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"}}'>
15405 <li class="gallerybox">
15406 <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>
15407 <div class="gallerytext">caption1</div>
15408 </li>
15409 <li class="gallerybox">
15410 <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>
15411 <div class="gallerytext">caption2</div>
15412 </li>
15413 </ul>
15414 !! end
15415
15416 !! test
15417 Nowiki markup in link attribute (T206940)
15418 !! wikitext
15419 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15420
15421 <!-- consistency with gallery extension -->
15422 <gallery>
15423 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15424 </gallery>
15425 !! html/php+tidy
15426 <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>
15427 </p>
15428 <ul class="gallery mw-gallery-traditional">
15429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15430 <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>
15431 <div class="gallerytext">
15432 <p>caption
15433 </p>
15434 </div>
15435 </div></li>
15436 </ul>
15437 !! html/parsoid
15438 <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>
15439
15440 <!-- consistency with gallery extension -->
15441 <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"}}'>
15442 <li class="gallerybox">
15443 <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>
15444 <div class="gallerytext">caption</div>
15445 </li>
15446 </ul>
15447 !! end
15448
15449 !! test
15450 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15451 !! options
15452 parsoid = {
15453 "nativeGallery": true
15454 }
15455 !! wikitext
15456 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15457
15458 <!-- consistency with gallery extension -->
15459 <gallery>
15460 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15461 </gallery>
15462 !! html/php+tidy
15463 <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>
15464 </p>
15465 <ul class="gallery mw-gallery-traditional">
15466 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15467 <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>
15468 <div class="gallerytext">
15469 <p>caption
15470 </p>
15471 </div>
15472 </div></li>
15473 </ul>
15474 !! html/parsoid
15475 <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>
15476
15477 <!-- consistency with gallery extension -->
15478 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15479 <li class="gallerybox">
15480 <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>
15481 <div class="gallerytext">caption</div>
15482 </li>
15483 </ul>
15484 !! end
15485
15486 !! test
15487 HTML entity prefix in link markup (T209236)
15488 !! wikitext
15489 [[File:Foobar.jpg|link=https://example.com?foo&params=bar]]
15490
15491 <!-- consistency with gallery extension -->
15492 <gallery>
15493 File:Foobar.jpg|link=https://example.com?foo&params=bar
15494 </gallery>
15495 !! html/php+tidy
15496 <p><a href="https://example.com?foo&amp;params=bar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15497 </p>
15498 <ul class="gallery mw-gallery-traditional">
15499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15500 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://example.com?foo&amp;params=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>
15501 <div class="gallerytext">
15502 </div>
15503 </div></li>
15504 </ul>
15505 !! html/parsoid
15506 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="https://example.com?foo&amp;params=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>
15507
15508 <!-- consistency with gallery extension -->
15509 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=https://example.com?foo&amp;params=bar\n"}}'>
15510 <li class="gallerybox">
15511 <div class="thumb"><figure-inline typeof="mw:Image"><a href="https://example.com?foo&amp;params=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>
15512 <div class="gallerytext"></div>
15513 </li>
15514 </ul>
15515 !! end
15516
15517 !! test
15518 Image with table with attributes in caption
15519 !! options
15520 parsoid=wt2html,html2html
15521 !! wikitext
15522 [[File:Foobar.jpg|thumb|
15523 {| class="123" |
15524 |- class="456" |
15525 | ha
15526 |}
15527 ]]
15528 !! html/parsoid
15529 <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>
15530 <table class="123">
15531 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15532 <td> ha</td></tr>
15533 </tbody></table>
15534 </figcaption></figure>
15535 !! end
15536
15537 !! test
15538 Image with table with rows from templates in caption
15539 !! wikitext
15540 [[File:Foobar.jpg|thumb|
15541 {|
15542 {{echo|{{!}} hi}}
15543 |}
15544 ]]
15545 !! html/parsoid
15546 <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>
15547 <table>
15548 <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>
15549 </tbody></table>
15550 </figcaption></figure>
15551 !! end
15552
15553 !! test
15554 Image with nested tables in caption
15555 !! wikitext
15556 [[File:Foobar.jpg|thumb|Foo<br />
15557 {|
15558 |
15559 {|
15560 |z
15561 |}
15562 |}
15563 ]]
15564 !! html/parsoid
15565 <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}'/>
15566 <table>
15567 <tbody><tr><td>
15568 <table>
15569 <tbody><tr><td>z</td></tr>
15570 </tbody></table></td></tr>
15571 </tbody></table>
15572 </figcaption></figure>
15573 !! end
15574
15575 !! test
15576 Image with heading and horizontal rule in caption
15577 !! wikitext
15578 [[File:Foobar.jpg|thumb|
15579 ===Testing===
15580 123
15581 --------------
15582 ]]
15583 !! html/php
15584 <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>
15585
15586 !! html/parsoid
15587 <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>
15588 <h3 id="Testing">Testing</h3>
15589 123
15590 <hr data-parsoid='{"extra_dashes":10}'/>
15591 </figcaption></figure>
15592 !! end
15593
15594 ###################
15595 # Conflicting image format options.
15596 # First option specified should 'win'.
15597 # All three cases in each test should be identical.
15598
15599 !! test
15600 Image with 'frameless' first.
15601 !! options
15602 parsoid=wt2html,wt2wt,html2html
15603 !! wikitext
15604 [[File:Foobar.jpg|frameless|caption]]
15605
15606 [[File:Foobar.jpg|frameless|frame|caption]]
15607
15608 [[File:Foobar.jpg|frameless|thumb|caption]]
15609 !! html/php
15610 <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>
15611 </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>
15612 </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>
15613 </p>
15614 !! html/parsoid
15615 <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>
15616 <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>
15617 <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>
15618 !! end
15619
15620 !! test
15621 Image with 'frame' first.
15622 !! options
15623 parsoid=wt2html,wt2wt,html2html
15624 !! wikitext
15625 [[File:Foobar.jpg|frame|caption]]
15626 [[File:Foobar.jpg|frame|frameless|caption]]
15627 [[File:Foobar.jpg|frame|thumb|caption]]
15628 !! html/php
15629 <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>
15630 <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>
15631 <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>
15632
15633 !! html/parsoid
15634 <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>
15635 <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>
15636 <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>
15637 !! end
15638
15639 !! test
15640 Image with 'thumb' first.
15641 !! options
15642 parsoid=wt2html,wt2wt,html2html
15643 !! wikitext
15644 [[File:Foobar.jpg|thumb|caption]]
15645 [[File:Foobar.jpg|thumb|frameless|caption]]
15646 [[File:Foobar.jpg|thumb|frame|caption]]
15647 !! html/php
15648 <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>
15649 <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>
15650 <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>
15651
15652 !! html/parsoid
15653 <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>
15654 <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>
15655 <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>
15656 !! end
15657
15658 ###################
15659 # Image sizing.
15660 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15661 # and https://phabricator.wikimedia.org/T64258
15662 # Foobar has actual size of 1941x220
15663 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15664 # a scalable format.
15665 # 2. Framed images always ignore size options; always render at default size.
15666 # 3. "Unspecified format" and border are the only types which can be
15667 # enlarged.
15668
15669 !! test
15670 Image: unspecified format and border enlarge
15671 !! options
15672 parsoid=wt2html,wt2wt,html2html
15673 !! wikitext
15674 [[File:Foobar.jpg|2000px]]
15675
15676 [[File:Foobar.jpg|border|2000px]]
15677 !! html/php
15678 <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>
15679 </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>
15680 </p>
15681 !! html/parsoid
15682 <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>
15683 <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>
15684 !! end
15685
15686 !! test
15687 Image: "unspecified format" and border reduce
15688 !! options
15689 parsoid=wt2html,wt2wt,html2html
15690 !! wikitext
15691 [[File:Foobar.jpg|1000px]]
15692
15693 [[File:Foobar.jpg|border|1000px]]
15694 !! html/php
15695 <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>
15696 </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>
15697 </p>
15698 !! html/parsoid
15699 <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>
15700 <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>
15701 !! end
15702
15703 !! test
15704 Image: thumbs reduce
15705 !! options
15706 parsoid=wt2html,wt2wt,html2html
15707 !! wikitext
15708 [[File:Foobar.jpg|thumb|50px]]
15709 !! html/php
15710 <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>
15711
15712 !! html/parsoid
15713 <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>
15714 !! end
15715
15716 !! test
15717 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15718 !! options
15719 parsoid=wt2html,wt2wt,html2html
15720 !! wikitext
15721 [[File:Foobar.jpg|thumb|2000px]]
15722
15723 [[File:Foobar.svg|thumb|2000px]]
15724 !! html/php
15725 <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>
15726 <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>
15727
15728 !! html/parsoid
15729 <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>
15730 <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>
15731 !! end
15732
15733 !! test
15734 Image: frameless can reduce in size
15735 !! options
15736 parsoid=wt2html,wt2wt,html2html
15737 !! wikitext
15738 [[File:Foobar.jpg|frameless|50px]]
15739 !! html/php
15740 <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>
15741 </p>
15742 !! html/parsoid
15743 <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>
15744 !! end
15745
15746 !! test
15747 Image: bitmap frameless can't be enlarged past original size, but vector can
15748 !! options
15749 parsoid=wt2html,wt2wt,html2html
15750 !! wikitext
15751 [[File:Foobar.jpg|frameless|2000px]]
15752
15753 [[File:Foobar.svg|frameless|2000px]]
15754 !! html/php
15755 <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>
15756 </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>
15757 </p>
15758 !! html/parsoid
15759 <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>
15760 <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>
15761 !! end
15762
15763 !! test
15764 Image: framed images are always unscaled.
15765 !! options
15766 parsoid=wt2html,wt2wt,html2html
15767 !! wikitext
15768 [[File:Foobar.jpg|frame]]
15769
15770 [[File:Foobar.jpg|frame|50px]]
15771
15772 [[File:Foobar.jpg|frame|50x50px]]
15773
15774 [[File:Foobar.jpg|frame|2000px]]
15775 !! html/php
15776 <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>
15777 <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>
15778 <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>
15779 <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>
15780
15781 !! html/parsoid
15782 <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>
15783 <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>
15784 <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>
15785 <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>
15786 !! end
15787
15788 ###################
15789
15790 !! test
15791 Link to image page- image page normally doesn't exists, hence edit link
15792 Add test with existing image page
15793 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15794 !! wikitext
15795 [[:Image:test]]
15796 !! html
15797 <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>
15798 </p>
15799 !! end
15800
15801 !! test
15802 T20784 Link to non-existent image page with caption should use caption as link text
15803 !! wikitext
15804 [[:Image:test|caption]]
15805 !! html
15806 <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>
15807 </p>
15808 !! end
15809
15810 !! test
15811 Frameless image caption with a free URL
15812 !! wikitext
15813 [[File:Foobar.jpg|http://example.com]]
15814 !! html/php
15815 <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>
15816 </p>
15817 !! html/parsoid
15818 <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>
15819 !! end
15820
15821 !! test
15822 Thumbnail image caption with a free URL
15823 !! options
15824 thumbsize=220
15825 !! wikitext
15826 [[File:Foobar.jpg|thumb|http://example.com]]
15827 !! html/php
15828 <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>
15829
15830 !! html/parsoid
15831 <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>
15832 !! end
15833
15834 !! test
15835 Thumbnail image caption with a free URL and explicit alt
15836 !! options
15837 thumbsize=220
15838 parsoid=wt2html,wt2wt,html2html
15839 !! wikitext
15840 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15841 !! html/php
15842 <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>
15843
15844 !! html/parsoid
15845 <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>
15846 !! end
15847
15848 !! test
15849 SVG thumbnails with no language set
15850 !! options
15851 !! wikitext
15852 [[File:Foobar.svg|thumb|caption]]
15853 !! html/php
15854 <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>
15855
15856 !! html/parsoid
15857 <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>
15858 !! end
15859
15860 !! test
15861 SVG thumbnails with language de
15862 !! options
15863 parsoid=wt2html,wt2wt,html2html
15864 !! wikitext
15865 [[File:Foobar.svg|thumb|caption|lang=de]]
15866 !! html/php
15867 <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>
15868
15869 !! html/parsoid
15870 <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>
15871 !! end
15872
15873 !! test
15874 SVG thumbnails with invalid language code
15875 !! options
15876 parsoid=wt2html,wt2wt,html2html
15877 !! wikitext
15878 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15879 !! html/php
15880 <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>
15881
15882 !! html/parsoid
15883 <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>
15884 !! end
15885
15886 !! test
15887 SVG thumbnails in page language
15888 !! options
15889 language=ru
15890 wgMediaInTargetLanguage = true
15891 !! wikitext
15892 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15893 !! html/php
15894 <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>
15895 </p>
15896 !! end
15897
15898 !! test
15899 SVG thumbnails in page language not present in the file
15900 !! options
15901 language=de
15902 wgMediaInTargetLanguage = true
15903 !! wikitext
15904 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15905 !! html/php
15906 <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>
15907 </p>
15908 !! end
15909
15910 !! test
15911 T3887: A ISBN with a thumbnail
15912 !! wikitext
15913 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15914 !! html/php
15915 <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>
15916
15917 !! html/parsoid
15918 <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>
15919 !! end
15920
15921 !! test
15922 T3887: A RFC with a thumbnail
15923 !! wikitext
15924 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15925 !! html/php
15926 <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>
15927
15928 !! html/parsoid
15929 <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>
15930 !! end
15931
15932 !! test
15933 T3887: A mailto link with a thumbnail
15934 !! wikitext
15935 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15936 !! html/php
15937 <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>
15938
15939 !! html/parsoid
15940 <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>
15941 !! end
15942
15943 # Pending resolution to T2368
15944 !! test
15945 T2648: Frameless image caption with a link
15946 !! wikitext
15947 [[File:Foobar.jpg|text with a [[link]] in it]]
15948 !! html/php
15949 <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>
15950 </p>
15951 !! html/parsoid
15952 <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>
15953 !! end
15954
15955 !! test
15956 T2648: Frameless image caption with a link (suffix)
15957 !! wikitext
15958 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15959 !! html/php
15960 <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>
15961 </p>
15962 !! html/parsoid
15963 <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>
15964 !! end
15965
15966 !! test
15967 T2648: Frameless image caption with an interwiki link
15968 !! wikitext
15969 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15970 !! html/php
15971 <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>
15972 </p>
15973 !! html/parsoid
15974 <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>
15975 !! end
15976
15977 !! test
15978 T2648: Frameless image caption with a piped interwiki link
15979 !! wikitext
15980 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15981 !! html/php
15982 <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>
15983 </p>
15984 !! html/parsoid
15985 <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>
15986 !! end
15987
15988 !! test
15989 T107474: Frameless image caption with <nowiki>
15990 !! wikitext
15991 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15992 !! html/parsoid
15993 <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>
15994 !! end
15995
15996 !! test
15997 Escape HTML special chars in image alt text
15998 !! wikitext
15999 [[File:Foobar.jpg|& < > "]]
16000 !! html/php
16001 <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>
16002 </p>
16003 !! html/parsoid
16004 <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>
16005 !! end
16006
16007 !! test
16008 Escape HTML special chars in image alt text with LanguageConverter
16009 !! options
16010 language=zh
16011 !! wikitext
16012 [[File:Foobar.jpg|& < > "]]
16013 !! html/php
16014 <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>
16015 </p>
16016 !! html/parsoid
16017 <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>
16018 !! end
16019
16020 !! test
16021 Entities in file name and attributes
16022 !! wikitext
16023 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
16024 !! html/php
16025 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
16026 </p>
16027 !! html/parsoid
16028 <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>
16029 !! end
16030
16031 !! test
16032 T2499: Alt text should have &#1234;, not &amp;1234;
16033 !! wikitext
16034 [[File:Foobar.jpg|&#9792;]]
16035 !! html/php
16036 <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>
16037 </p>
16038 !! html/parsoid
16039 <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>
16040 !! end
16041
16042 !! test
16043 Broken image caption with link
16044 !! options
16045 parsoid=wt2html,wt2wt,html2html
16046 !! wikitext
16047 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
16048 !! html/php
16049 <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.
16050 </p>
16051 !! html/parsoid
16052 <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>
16053 !! end
16054
16055 !! test
16056 Image caption containing another image
16057 !! wikitext
16058 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
16059 !! html/php
16060 <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>
16061
16062 !! html/parsoid
16063 <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>
16064 !! end
16065
16066 !! test
16067 Image: caption containing a newline
16068 !! wikitext
16069 [[File:Foobar.jpg|This
16070 *is some text]]
16071 !! html/php
16072 <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>
16073 </p>
16074 !! html/parsoid
16075 <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>
16076 !!end
16077
16078 !!test
16079 Image: caption containing leading space
16080 (The leading space should not trigger nowiki escaping in wt2wt mode)
16081 !! wikitext
16082 [[File:Foobar.jpg|thumb| bar]]
16083 !! html/php
16084 <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>
16085
16086 !! html/parsoid
16087 <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>
16088 !!end
16089
16090 # html/php output not have newlines after table, td, th, etc. because
16091 # Linker::makeThumbLink2() replaces the newlines with spaces since
16092 # the table is inside a caption.
16093 # FIXME: Verify if that circa 2004 fix is still required.
16094 !! test
16095 Image: caption containing a table
16096 !! options
16097 parsoid=wt2html,wt2wt,html2html
16098 !! wikitext
16099 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
16100 {|
16101 !Foo!!Bar
16102 |-
16103 |Foo1||Bar1
16104 |}
16105 and some more text.]]
16106 !! html/php
16107 <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>
16108
16109 !! html/parsoid
16110 <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
16111 <table>
16112 <tbody>
16113 <tr><th>Foo</th><th>Bar</th></tr>
16114 <tr>
16115 <td>Foo1</td>
16116 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
16117 !! end
16118
16119 !! test
16120 T5090: External links other than http: in image captions
16121 !! wikitext
16122 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
16123 !! html/php
16124 <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>
16125
16126 !! html/parsoid
16127 <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>
16128 !! end
16129
16130 !! test
16131 Custom class
16132 !! options
16133 parsoid=wt2html,wt2wt,html2html
16134 !! wikitext
16135 [[Image:foobar.jpg|a|class=b]]
16136 !! html/php
16137 <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>
16138 </p>
16139 !! html/parsoid
16140 <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>
16141 !! end
16142
16143 !! test
16144 Localized image handling (1).
16145 !! options
16146 parsoid=wt2html,wt2wt,html2html
16147 language=es
16148 !! wikitext
16149 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16150 !! html/php
16151 <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>
16152
16153 !! html/parsoid
16154 <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>
16155 !! end
16156
16157 !! test
16158 Localized image handling (2).
16159 !! options
16160 thumbsize=220
16161 parsoid=wt2html,wt2wt,html2html
16162 language=es
16163 !! wikitext
16164 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16165 !! html/php
16166 <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>
16167
16168 !! html/parsoid
16169 <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>
16170 !! end
16171
16172 !! test
16173 Localized image handling (3).
16174 !! options
16175 language=fa
16176 parsoid=html2wt
16177 !! html/parsoid
16178 <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>
16179 !! wikitext
16180 [[File:Foobar.jpg|بندانگشتی]]
16181 !! end
16182
16183 !! test
16184 "border", "frameless" and "class" attributes on an image.
16185 !! options
16186 thumbsize=220
16187 parsoid=wt2html,wt2wt,html2html
16188 !! wikitext
16189 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16190 !! html/php
16191 <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>
16192 </p>
16193 !! html/parsoid
16194 <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>
16195 !! end
16196
16197 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16198 !! test
16199 Invalid image attributes (T64500)
16200 !! options
16201 thumbsize=220
16202 parsoid=wt2html,wt2wt,html2html
16203 !! wikitext
16204 [[File:Foobar.jpg|thumb|float|left|caption]]
16205
16206 [[File:Foobar.jpg|thumb|righ|caption]]
16207
16208 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16209 !! html/php
16210 <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>
16211 <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>
16212 <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>
16213
16214 !! html/parsoid
16215 <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>
16216 <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>
16217 <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>
16218 !! end
16219
16220 !! article
16221 File:Barfoo.jpg
16222 !! text
16223 #REDIRECT [[File:Barfoo.jpg]]
16224 !! endarticle
16225
16226 # FIXME: Parsoid should run this test -- but we'd need to teach the
16227 # mockAPI about the redirected Barfoo.jpg image.
16228 !! test
16229 Redirected image
16230 !! wikitext
16231 [[Image:Barfoo.jpg]]
16232 !! html/php
16233 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16234 </p>
16235 !! end
16236
16237 !! test
16238 Missing image with uploads disabled
16239 !! options
16240 wgEnableUploads=0
16241 !! wikitext
16242 [[File:Foobaz.jpg]]
16243 !! html/php
16244 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16245 </p>
16246 !! html/parsoid
16247 <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>
16248 !! end
16249
16250 # Parsoid-specific testing for images
16251 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16252 # Currently imperfect due to a flaw in the Parsoid testrunner
16253 # Work in progress
16254 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16255 # image tests.
16256
16257 !! test
16258 Parsoid-specific image handling - simple image with size and middle alignment
16259 !! wikitext
16260 [[File:Foobar.jpg|middle|50px]]
16261 !! html/parsoid
16262 <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>
16263 !! end
16264
16265 !! test
16266 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16267 !! options
16268 parsoid=wt2wt,wt2html,html2html
16269 !! wikitext
16270 [[Image:Foobar.jpg|middle|50px]]
16271 !! html/parsoid
16272 <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>
16273 !! end
16274
16275 !! test
16276 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16277 !! wikitext
16278 [[File:Foobar.jpg|50px|middle]]
16279 !! html/parsoid
16280 <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>
16281 !! end
16282
16283 !! test
16284 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16285 !! options
16286 parsoid=wt2html,wt2wt,html2html
16287 !! wikitext
16288 [[Image:Foobar.jpg|50px|middle]]
16289 !! html/parsoid
16290 <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>
16291 !! end
16292
16293 !! test
16294 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16295 !! wikitext
16296 [[File:Foobar.jpg|500x10px|baseline|caption]]
16297 !! html/parsoid
16298 <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>
16299 !! end
16300
16301 !! test
16302 Parsoid-specific image handling - simple image with border and size spec
16303 !! wikitext
16304 [[File:Foobar.jpg|50px|border|caption]]
16305 !! html/parsoid
16306 <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>
16307 !! end
16308
16309 !! test
16310 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16311 !! options
16312 parsoid=wt2html,html2html
16313 !! wikitext
16314 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16315 !! html/parsoid
16316 <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>
16317 !! end
16318
16319 !! test
16320 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16321 !! options
16322 parsoid=wt2html,html2html
16323 !! wikitext
16324 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16325 !! html/parsoid
16326 <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>
16327 !! end
16328
16329 !! test
16330 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16331 !! options
16332 parsoid=wt2html,html2html
16333 !! wikitext
16334 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16335 !! html/parsoid
16336 <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>
16337 !! end
16338
16339 !! test
16340 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16341 !! options
16342 parsoid=wt2html,html2html
16343 !! wikitext
16344 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16345 !! html/parsoid
16346 <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>
16347 !! end
16348
16349 !! test
16350 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16351 !! options
16352 parsoid=wt2html,wt2wt,html2html
16353 !! wikitext
16354 [[File:Foobar.jpg|frame|500x50px|caption]]
16355 !! html/parsoid
16356 <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>
16357 !! end
16358
16359 !! test
16360 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16361 !! options
16362 parsoid=wt2html,html2html
16363 !! wikitext
16364 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16365 !! html/parsoid
16366 <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>
16367 !! end
16368
16369 !! test
16370 Parsoid-specific image handling - frameless image with specific size, border, and caption
16371 !! wikitext
16372 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16373 !! html/parsoid
16374 <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>
16375 !! end
16376
16377 !! test
16378 Parsoid-specific image handling - simple image with a formatted caption
16379 !! wikitext
16380 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16381 !! html/parsoid
16382 <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>
16383 !! end
16384
16385 !! test
16386 Parsoid-specific image handling - caption with a template in it
16387 !! wikitext
16388 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16389 !! html/parsoid
16390 <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>
16391 !! end
16392
16393 !! test
16394 Parsoid-specific image handling - caption with unbalanced tags in it
16395 !! options
16396 parsoid=wt2html,wt2wt,html2html
16397 !! wikitext
16398 foo
16399 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16400 bar
16401 !! html/parsoid
16402 <p>foo</p>
16403 <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>
16404 <p>bar</p>
16405 !! end
16406
16407 !! test
16408 Parsoid-specific image handling - empty caption (1)
16409 !! options
16410 parsoid=wt2html,wt2wt
16411 !! wikitext
16412 [[File:Foobar.jpg|thumb|]]
16413 !! html/parsoid
16414 <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>
16415 !! end
16416
16417 # empty captions don't get serialized unless we're in the "round trip" case
16418 !! test
16419 Parsoid-specific image handling - empty caption (2)
16420 !! options
16421 parsoid=html2wt
16422 !! html/parsoid
16423 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16424 <a href="./File:Foobar.jpg">
16425 <img resource="./File:Foobar.jpg"
16426 src="//example.com/images/3/3a/Foobar.jpg"
16427 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16428 height="25" width="220"/>
16429 </a>
16430 <figcaption></figcaption>
16431 </figure>
16432 !! wikitext
16433 [[File:Foobar.jpg|thumb]]
16434 !! end
16435
16436 !! test
16437 Parsoid-specific image handling - whitespace caption
16438 !! wikitext
16439 [[File:Foobar.jpg|thumb| ]]
16440 !! html/parsoid
16441 <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>
16442 !! end
16443
16444 !! test
16445 Parsoid-specific image handling - lang option
16446 !! wikitext
16447 foo
16448 [[File:Foobar.svg|lang=de|caption]]
16449 bar
16450 !! html/parsoid
16451 <p>foo
16452 <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>
16453 bar</p>
16454 !! end
16455
16456 ## Edge case bugs in Parsoid from T93580
16457 !! test
16458 T93580: 1. Templated <ref> inside block images
16459 !! wikitext
16460 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16461
16462 <references />
16463 !! html/parsoid
16464 <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="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
16465
16466 <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="./Parser_test#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>
16467 !! end
16468
16469 !! test
16470 T93580: 2. <ref> inside inline images
16471 !! wikitext
16472 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16473
16474 <references />
16475 !! html/parsoid
16476 <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=\"./Parser_test#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>
16477
16478 <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="./Parser_test#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>
16479 !! end
16480
16481 !! test
16482 T93580: 3. Templated <ref> inside inline images
16483 !! wikitext
16484 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16485
16486 <references />
16487 !! html/parsoid
16488 <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=\"./Parser_test#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>
16489
16490 <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="./Parser_test#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>
16491 !! end
16492
16493 ###
16494 ### Subpages
16495 ###
16496 !! article
16497 Subpage test/subpage
16498 !! text
16499 foo
16500 !! endarticle
16501
16502 !! test
16503 Subpage link
16504 !! options
16505 subpage title=[[Subpage test]]
16506 !! wikitext
16507 [[/subpage]]
16508 !! html
16509 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16510 </p>
16511 !! end
16512
16513 !! test
16514 Subpage noslash link
16515 !! options
16516 subpage title=[[Subpage test]]
16517 !! wikitext
16518 [[/subpage/]]
16519 !! html
16520 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16521 </p>
16522 !! end
16523
16524 !! article
16525 Subpage test/1/2/subpage
16526 !! text
16527 blah
16528 !! endarticle
16529
16530 !! test
16531 Relative subpage noslash link
16532 !! options
16533 parsoid=wt2wt,wt2html,html2html
16534 subpage title=[[Subpage test/1/2/3/4]]
16535 !! wikitext
16536 [[../../subpage/]]
16537
16538 [[../../subpage]]
16539 !! html/php
16540 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16541 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16542 </p>
16543 !! html/parsoid
16544 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16545 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16546 !! end
16547
16548 !! test
16549 Parsoid: dot-slash prefixed wikilinks
16550 !! wikitext
16551 [[./foo]]
16552
16553 [[././bar]]
16554
16555 [[././baz/]]
16556 !! html/php
16557 <p>[[./foo]]
16558 </p><p>[[././bar]]
16559 </p><p>[[././baz/]]
16560 </p>
16561 !! html/parsoid
16562 <p>[[./foo]]
16563 </p><p>[[././bar]]
16564 </p><p>[[././baz/]]
16565 </p>
16566 !! end
16567
16568 !! test
16569 Render invalid page names as plain text (T53090)
16570 !! wikitext
16571 [[./../foo|bar]]
16572 [[foo�|bar]]
16573 [[foo/.|bar]]
16574 [[foo/..|bar]]
16575 [[foo~~~bar]]
16576 [[foo>bar]]
16577 [[foo[bar]]
16578 [[.]]
16579 [[..]]
16580 [[foo././bar]]
16581 [[foo[http://example.com]xyz]]
16582
16583 [[{{echo|./../foo}}|bar]]
16584 [[{{echo|foo/.}}|bar]]
16585 [[{{echo|foo/..}}|bar]]
16586 [[{{echo|foo~~~~bar}}]]
16587 [[{{echo|foo>bar}}]]
16588 [[{{echo|foo././bar}}]]
16589 [[{{echo|foo{bar}}]]
16590 [[{{echo|foo}bar}}]]
16591 [[{{echo|foo[bar}}]]
16592 [[{{echo|foo]bar}}]]
16593 [[{{echo|foo<bar}}]]
16594 !!html/php
16595 <p>[[./../foo|bar]]
16596 [[foo�|bar]]
16597 [[foo/.|bar]]
16598 [[foo/..|bar]]
16599 [[foo~~~bar]]
16600 [[foo&gt;bar]]
16601 [[foo[bar]]
16602 [[.]]
16603 [[..]]
16604 [[foo././bar]]
16605 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16606 </p><p>[[./../foo|bar]]
16607 [[foo/.|bar]]
16608 [[foo/..|bar]]
16609 [[foo~~~~bar]]
16610 [[foo&gt;bar]]
16611 [[foo././bar]]
16612 [[foo{bar]]
16613 [[foo}bar]]
16614 [[foo[bar]]
16615 [[foo]bar]]
16616 [[foo&lt;bar]]
16617 </p>
16618 !!html/parsoid
16619 <p>[[./../foo|bar]]
16620 [[foo�|bar]]
16621 [[foo/.|bar]]
16622 [[foo/..|bar]]
16623 [[foo~~~bar]]
16624 [[foo>bar]]
16625 [[foo[bar]]
16626 [[.]]
16627 [[..]]
16628 [[foo././bar]]
16629 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16630
16631 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16632 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16633 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16634 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16635 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16636 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16637 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16638 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16639 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16640 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16641 [[<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>
16642 !!end
16643
16644 !! test
16645 Disabled subpages
16646 !! wikitext
16647 [[/subpage]]
16648 !! html
16649 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16650 </p>
16651 !! end
16652
16653 !! test
16654 T2561: {{/Subpage}}
16655 !! options
16656 subpage title=[[Page]]
16657 !! wikitext
16658 {{/Subpage}}
16659 !! html
16660 <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>
16661 </p>
16662 !! end
16663
16664 ###
16665 ### Categories
16666 ###
16667 !! article
16668 Category:MediaWiki User's Guide
16669 !! text
16670 blah
16671 !! endarticle
16672
16673 !! test
16674 Link to category
16675 !! wikitext
16676 [[:Category:MediaWiki User's Guide]]
16677 !! html
16678 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16679 </p>
16680 !! end
16681
16682 !! test
16683 Simple category
16684 !! options
16685 cat
16686 !! wikitext
16687 [[Category:MediaWiki User's Guide]]
16688 !! html/php
16689 cat=MediaWiki_User's_Guide sort=
16690 !! html/parsoid
16691 <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"}}'/>
16692 !! end
16693
16694 !! test
16695 PAGESINCATEGORY invalid title fatal (r33546 fix)
16696 !! wikitext
16697 {{PAGESINCATEGORY:<bogus>}}
16698 !! html
16699 <p>0
16700 </p>
16701 !! end
16702
16703 !! test
16704 Category with different sort key
16705 !! options
16706 cat
16707 !! wikitext
16708 [[Category:MediaWiki User's Guide|Foo]]
16709 !! html/php
16710 cat=MediaWiki_User's_Guide sort=Foo
16711 !! html/parsoid
16712 <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"}}'/>
16713 !! end
16714
16715 !! test
16716 Category with identical sort key
16717 !! options
16718 cat
16719 !! wikitext
16720 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16721 !! html/php
16722 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16723 !! html/parsoid
16724 <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"}}'/>
16725 !! end
16726
16727 !! test
16728 Category with empty sort key
16729 !! options
16730 cat
16731 pst
16732 !! wikitext
16733 [[Category:MediaWiki User's Guide|]]
16734 !! html/php
16735 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16736 !! end
16737
16738 !! test
16739 Category with empty sort key and parentheses
16740 !! options
16741 cat
16742 pst
16743 !! wikitext
16744 [[Category:Foo (bar)|]]
16745 !! html/php
16746 [[Category:Foo (bar)|Foo]]
16747 !! end
16748
16749 !! test
16750 Category with link tail
16751 !! options
16752 cat
16753 pst
16754 !! wikitext
16755 123[[Category:Foo]]456
16756 !! html/php
16757 123[[Category:Foo]]456
16758 !! end
16759
16760 !! test
16761 Category with template
16762 !! options
16763 cat
16764 pst
16765 !! wikitext
16766 [[Category:{{echo|Foo}}]]
16767 !! html/php
16768 [[Category:{{echo|Foo}}]]
16769 !! end
16770
16771 !! test
16772 Category with template in sort key
16773 !! options
16774 cat
16775 pst
16776 !! wikitext
16777 [[Category:Foo|{{echo|Bar}}]]
16778 !! html/php
16779 [[Category:Foo|{{echo|Bar}}]]
16780 !! end
16781
16782 !! test
16783 Category with template in sort key and title
16784 !! options
16785 cat
16786 pst
16787 !! wikitext
16788 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16789 !! html/php
16790 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16791 !! end
16792
16793 ## We used to, but no longer wt2wt this test since the default serializer
16794 ## will normalize all categories to serialize on their own line.
16795 ## This wikitext usage is going to be fairly uncommon in production and
16796 ## selser will take care of preserving formatting in those scenarios.
16797 !! test
16798 Category / paragraph interactions
16799 !! options
16800 parsoid=wt2html
16801 !! wikitext
16802 Foo [[Category:Baz]] Bar
16803
16804 Foo [[Category:Baz]]
16805 Bar
16806
16807 Foo
16808 [[Category:Baz]]
16809 Bar
16810
16811 Foo
16812 [[Category:Baz]] Bar
16813
16814 Foo
16815 [[Category:Baz]]
16816 [[Category:Baz]]
16817 [[Category:Baz]]
16818 Bar
16819
16820 [[Category:Baz]]
16821 [[Category:Baz]]
16822 [[Category:Baz]]
16823
16824 [[Category:Baz]]
16825 {{echo|[[Category:Baz]]}}
16826 [[Category:Baz]]
16827 !! html/php
16828 <p>Foo Bar
16829 </p><p>Foo
16830 Bar
16831 </p><p>Foo
16832 Bar
16833 </p><p>Foo Bar
16834 </p><p>Foo
16835 Bar
16836 </p>
16837 !! html/parsoid
16838 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16839 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16840 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16841 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16842 <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>
16843 <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}}]}'/>
16844 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16845 !! end
16846
16847 ## We used to, but no longer wt2wt this test since the default serializer
16848 ## will normalize all categories to serialize on their own line.
16849 ## This wikitext usage is going to be fairly uncommon in production and
16850 ## selser will take care of preserving formatting in those scenarios.
16851 ##
16852 ## The whitespace on the empty line is part of the test. Please do not delete
16853 !! test
16854 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16855 !! options
16856 parsoid=wt2html
16857 !! wikitext
16858 This
16859
16860 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16861
16862 {{echo|[[Category:Foo]] and so should this!}}
16863 !! html/php
16864 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16865 </p>
16866 !! html/parsoid
16867 <p>This
16868
16869 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16870
16871 <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>
16872 !! end
16873
16874 ## Parsoid will not try to wt2wt this while preserving newlines because
16875 ## it suppresses excess newlines within list items -- and we don't want to
16876 ## introduce a special case just for categories, which is, in reality somewhat
16877 ## odd behavior -- categories are unlikely to be used in list items like this
16878 ## in top-level pages and are only likely to show up in template-generated
16879 ## list items where this RT-ing is a non-issue.
16880 ##
16881 ## The whitespace on the empty line is part of the test. Please do not delete
16882 !! test
16883 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16884 !! options
16885 parsoid=wt2html
16886 !! wikitext
16887 * This
16888
16889 [[Category:Foo]] and this should be part of the same list item
16890 * So should this
16891
16892 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16893 !! html/php+tidy
16894 <ul><li>This and this should be part of the same list item</li>
16895 <li>So should this and this should be part of the same list item</li></ul>
16896 !! html/parsoid
16897 <ul>
16898 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16899 <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>
16900 </ul>
16901 !! end
16902
16903 ## Newlines and categories that follow the last item of a list
16904 ## are treated differently because this (list followed by categories)
16905 ## is an extremely common pattern on wikis.
16906 !! test
16907 3. Categories and newlines: newline suppression for last list item should RT properly
16908 !! wikitext
16909 *a
16910 *b
16911
16912 [[Category:Foo]]
16913
16914 [[Category:Bar]]
16915 [[Category:Baz]]
16916
16917 :c
16918
16919 [[Category:C]]
16920
16921 ;d
16922
16923 [[Category:D]]
16924 !! html/parsoid
16925 <ul><li>a</li>
16926 <li>b</li></ul>
16927
16928 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16929
16930 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16931 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16932
16933 <dl><dd>c</dd></dl>
16934
16935 <link rel="mw:PageProp/Category" href="./Category:C"/>
16936
16937 <dl><dt>d</dt></dl>
16938
16939 <link rel="mw:PageProp/Category" href="./Category:D"/>
16940 !! end
16941
16942 !! test
16943 4. Categories and newlines: newline suppression for last list item should RT properly
16944 !! wikitext
16945 *a
16946 ****b
16947
16948 [[Category:Foo]]
16949 !! html/parsoid
16950 <ul><li>a
16951 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16952
16953 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16954 !! end
16955
16956 ## only wt2html for this to make sure the algo only applies to the rightmost path
16957 !! test
16958 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16959 !! options
16960 parsoid=wt2html
16961 !! wikitext
16962 *a
16963 **b
16964 [[Category:Foo]]
16965 *c
16966 **d
16967 [[Category:Foo]]
16968 !! html/parsoid
16969 <ul><li>a
16970 <ul><li>b
16971 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16972 <li>c
16973 <ul><li>d</li></ul></li></ul>
16974 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16975 !! end
16976
16977 ## We used to, but no longer wt2wt this test since the default serializer
16978 ## will normalize all categories to serialize on their own line.
16979 ## This wikitext usage is going to be fairly uncommon in production and
16980 ## selser will take care of preserving formatting in those scenarios.
16981 !! test
16982 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16983 !! options
16984 parsoid=wt2html
16985 !! wikitext
16986 *a [[Category:Foo]]
16987 !! html/parsoid
16988 <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>
16989 !! end
16990
16991 # This test also demonstrates because of newline+category tunneling
16992 # through the list hander, template wrapping doesn't expand to the
16993 # containing list when the list item swallows the category.
16994 !! test
16995 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16996 !! wikitext
16997 *{{echo|a
16998 [[Category:Foo]]}}
16999 !! html/parsoid
17000 <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
17001 </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>
17002 !! end
17003
17004 !! test
17005 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
17006 !! wikitext
17007 *a
17008
17009 {{echo|[[Category:Foo]]
17010 [[Category:Bar]]}}
17011 [[Category:Baz]]
17012 !! html/parsoid
17013 <ul><li>a</li></ul>
17014
17015 <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">
17016 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
17017 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
17018 !! end
17019
17020 !! test
17021 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
17022 !! wikitext
17023 *a
17024
17025 [[Category:Bar]]<!--boo1--> <!--boo2-->
17026 [[Category:Baz]]<!--boo3--> <!--boo4-->
17027 !! html/parsoid
17028 <ul><li>a</li></ul>
17029
17030 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
17031 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
17032 !! end
17033
17034 !! test
17035 Categories and newlines: should behave properly with linkprefix (T87753)
17036 !! options
17037 language=ar
17038 !! wikitext
17039 foo bar
17040 foo bar
17041 [[تصنيف:Foo]]
17042 [[تصنيف:Bar]]
17043 !! html/php
17044 <p>foo bar
17045 foo bar
17046 </p>
17047 !! html/parsoid
17048 <p>foo bar
17049 foo bar</p>
17050 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
17051 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
17052 !! end
17053
17054 !! test
17055 No regressions on internal links following category (T174639)
17056 !! options
17057 parsoid=wt2html,html2html
17058 !! wikitext
17059 [[Category:Foo]]<div>a
17060
17061 [[Foo]]</div>
17062 !! html/php
17063 <div>a
17064 <a href="/wiki/Foo" title="Foo">Foo</a></div>
17065
17066 !! html/parsoid
17067 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
17068
17069 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
17070 !! end
17071
17072 # Note that Parsoid differs slightly from PHP due to T175421
17073 !! test
17074 11. Special case where only newlines separate links (T175416)
17075 !! options
17076 parsoid=wt2html,html2html
17077 !! wikitext
17078 [[Category:Foo]]
17079
17080 [[Foo]][[es:Alimento]]
17081
17082 [[Foo]]
17083 !! html/php
17084 <p><br />
17085 <a href="/wiki/Foo" title="Foo">Foo</a>
17086 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
17087 </p>
17088 !! html/parsoid
17089 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17090
17091 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17092
17093 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
17094 !! end
17095
17096 !! test
17097 Category links with multiple namespaces
17098 !! wikitext
17099 [[Category:Project:Foo]]
17100 !! html/parsoid
17101 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
17102 !! end
17103
17104 !! test
17105 Parsoid: Serialize link to category page with colon escape
17106 !! wikitext
17107
17108 [[:Category:Foo]]
17109 [[:Category:Foo|Bar]]
17110 !! html/php+tidy
17111 <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>
17112 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
17113 </p>
17114 !! html/parsoid
17115 <p>
17116 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
17117 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
17118 </p>
17119 !! end
17120
17121 # We used to, but no longer wt2wt this test since the default serializer
17122 # will normalize all categories to serialize on their own line.
17123 # This wikitext usage is going to be fairly uncommon in production and
17124 # selser will take care of preventing whitespace insertion if this
17125 # occurs in an article.
17126 #
17127 # html2html disabled for the same reason (whitespace insertion between
17128 # x and y).
17129 #
17130 # html2wt disabled because it localizes the "Category" namespace.
17131 !! test
17132 Link prefix/suffixes aren't applied to category links
17133 !! options
17134 parsoid=wt2html
17135 language=is
17136 !! wikitext
17137 x[[Category:Foo]]y
17138 !! html/php
17139 <p>xy
17140 </p>
17141 !! html/parsoid
17142 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17143 !! end
17144
17145 !! test
17146 Link prefix/suffixes aren't applied to language links
17147 !! options
17148 parsoid=wt2html
17149 language=is
17150 !! wikitext
17151 x[[es:Foo]]y
17152 !! html/php
17153 <p>xy
17154 </p>
17155 !! html/parsoid
17156 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17157 !! end
17158
17159 !! test
17160 Parsoid: Serialize link to file page with colon escape
17161 !! wikitext
17162
17163 [[:File:Foo.png]]
17164 [[:File:Foo.png|Bar]]
17165 !! html/php+tidy
17166 <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>
17167 <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>
17168 </p>
17169 !! html/parsoid
17170 <p>
17171 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17172 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17173 </p>
17174 !! end
17175
17176 !! test
17177 Parsoid: Serialize a genuine category link without colon escape
17178 !! wikitext
17179 [[Category:Foo]]
17180 [[Category:Foo|Bar]]
17181 !! html/php+tidy
17182 !! html/parsoid
17183 <link rel="mw:PageProp/Category" href="./Category:Foo">
17184 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17185 !! end
17186
17187 !! test
17188 Normalize hrefs properly before testing for invalid link targets (T72894)
17189 !! options
17190 parsoid=html2wt
17191 !! html/parsoid
17192 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17193 !! wikitext
17194 [[Category:Toxine bactérienne]]
17195 !! end
17196
17197 !! test
17198 Parsoid: Defaultsort
17199 !! wikitext
17200 {{DEFAULTSORT:Foo}}
17201 !! html/parsoid
17202 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17203 !! end
17204
17205 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17206 # But, this is a limitation of our representation and is documented in
17207 # TemplateHandler.js in processSpecialMagicWord
17208 !! test
17209 Parsoid: Defaultsort (template-generated)
17210 !! wikitext
17211 {{{{echo|DEFAULTSORT}}:Foo}}
17212 !! html/parsoid
17213 <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"}]]}'/>
17214 !! end
17215
17216 ###
17217 ### Inter-language links
17218 ###
17219 !! test
17220 Interlanguage links
17221 !! options
17222 ill
17223 !! wikitext
17224 [[es:Alimento]]
17225 [[fr:Nourriture]]
17226 [[zh:食品]]
17227 !! html/php
17228 es:Alimento fr:Nourriture zh:食品
17229 !! html/parsoid
17230 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17231 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17232 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17233 !! end
17234
17235 !! test
17236 Duplicate interlanguage links (T26502)
17237 !! options
17238 ill
17239 !! wikitext
17240 [[es:1]]
17241 [[es:2]]
17242 [[fr:1]]
17243 [[fr:2]]
17244 !! html/php
17245 es:1 fr:1
17246 !! html/parsoid
17247 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17248 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17249 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17250 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17251 !! end
17252
17253 ###
17254 ### Sections
17255 ###
17256 !! test
17257 Basic section headings
17258 !! wikitext
17259 ==Headline 1==
17260 Some text
17261
17262 ==Headline 2==
17263 More
17264 ===Smaller headline===
17265 Blah blah
17266 !! html
17267 <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>
17268 <p>Some text
17269 </p>
17270 <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>
17271 <p>More
17272 </p>
17273 <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>
17274 <p>Blah blah
17275 </p>
17276 !! end
17277
17278 !! test
17279 Section headings with TOC
17280 !! wikitext
17281 ==Headline 1==
17282 ===Subheadline 1===
17283 =====Skipping a level=====
17284 ======Skipping a level======
17285
17286 ==Headline 2==
17287 Some text
17288 ===Another headline===
17289 !! html
17290 <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>
17291 <ul>
17292 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17293 <ul>
17294 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17295 <ul>
17296 <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>
17297 <ul>
17298 <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>
17299 </ul>
17300 </li>
17301 </ul>
17302 </li>
17303 </ul>
17304 </li>
17305 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17306 <ul>
17307 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17308 </ul>
17309 </li>
17310 </ul>
17311 </div>
17312
17313 <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>
17314 <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>
17315 <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>
17316 <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>
17317 <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>
17318 <p>Some text
17319 </p>
17320 <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>
17321
17322 !! end
17323
17324 !! test
17325 TOC anchors don't collide
17326 !! wikitext
17327 __FORCETOC__
17328 ==Headline 2==
17329 ==Headline==
17330 ==Headline 2==
17331 ==Headline==
17332 !! html/php
17333 <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>
17334 <ul>
17335 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17336 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17337 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17338 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17339 </ul>
17340 </div>
17341
17342 <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>
17343 <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>
17344 <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>
17345 <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>
17346
17347 !! end
17348
17349 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17350 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17351 !! test
17352 Handling of sections up to level 6 and beyond
17353 !! options
17354 parsoid=wt2html
17355 !! wikitext
17356 =Level 1 Heading=
17357 ==Level 2 Heading==
17358 ===Level 3 Heading===
17359 ====Level 4 Heading====
17360 =====Level 5 Heading=====
17361 ======Level 6 Heading======
17362 =======Level 7 Heading=======
17363 ========Level 8 Heading========
17364 =========Level 9 Heading=========
17365 ==========Level 10 Heading==========
17366 !! html/php
17367 <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>
17368 <ul>
17369 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17370 <ul>
17371 <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>
17372 <ul>
17373 <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>
17374 <ul>
17375 <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>
17376 <ul>
17377 <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>
17378 <ul>
17379 <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>
17380 <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>
17381 <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>
17382 <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>
17383 <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>
17384 </ul>
17385 </li>
17386 </ul>
17387 </li>
17388 </ul>
17389 </li>
17390 </ul>
17391 </li>
17392 </ul>
17393 </li>
17394 </ul>
17395 </div>
17396
17397 <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>
17398 <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>
17399 <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>
17400 <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>
17401 <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>
17402 <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>
17403 <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>
17404 <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>
17405 <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>
17406 <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>
17407
17408 !! html/parsoid
17409 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17410 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17411 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17412 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17413 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17414 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17415 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17416 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17417 <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>
17418 <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>
17419 !! end
17420
17421 !! test
17422 TOC regression (T11764)
17423 !! wikitext
17424 ==title 1==
17425 ===title 1.1===
17426 ====title 1.1.1====
17427 ===title 1.2===
17428 ==title 2==
17429 ===title 2.1===
17430 !! html
17431 <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>
17432 <ul>
17433 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17434 <ul>
17435 <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>
17436 <ul>
17437 <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>
17438 </ul>
17439 </li>
17440 <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>
17441 </ul>
17442 </li>
17443 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17444 <ul>
17445 <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>
17446 </ul>
17447 </li>
17448 </ul>
17449 </div>
17450
17451 <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>
17452 <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>
17453 <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>
17454 <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>
17455 <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>
17456 <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>
17457
17458 !! end
17459
17460 !! test
17461 TOC for heading containing <span id="..."></span> (T96153)
17462 !! wikitext
17463 __FORCETOC__
17464 ==<span id="old-anchor"></span>New title==
17465 !! html/php
17466 <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>
17467 <ul>
17468 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17469 </ul>
17470 </div>
17471
17472 <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>
17473
17474 !! end
17475
17476 !! test
17477 TOC with wgMaxTocLevel=3 (T8204)
17478 !! options
17479 wgMaxTocLevel=3
17480 !! wikitext
17481 ==title 1==
17482 ===title 1.1===
17483 ====title 1.1.1====
17484 ===title 1.2===
17485 ==title 2==
17486 ===title 2.1===
17487 !! html
17488 <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>
17489 <ul>
17490 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17491 <ul>
17492 <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>
17493 <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>
17494 </ul>
17495 </li>
17496 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17497 <ul>
17498 <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>
17499 </ul>
17500 </li>
17501 </ul>
17502 </div>
17503
17504 <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>
17505 <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>
17506 <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>
17507 <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>
17508 <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>
17509 <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>
17510
17511 !! end
17512
17513 !! test
17514 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17515 !! options
17516 wgMaxTocLevel=3
17517 !! wikitext
17518 ==Section 1==
17519 ===Section 1.1===
17520 ====Section 1.1.1====
17521 ====Section 1.1.1.1====
17522 ==Section 2==
17523 !! html
17524 <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>
17525 <ul>
17526 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17527 <ul>
17528 <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>
17529 </ul>
17530 </li>
17531 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17532 </ul>
17533 </div>
17534
17535 <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>
17536 <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>
17537 <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>
17538 <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>
17539 <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>
17540
17541 !! end
17542
17543
17544 !! test
17545 Resolving duplicate section names
17546 !! wikitext
17547 ==Foo bar==
17548 ==Foo bar==
17549 !! html
17550 <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>
17551 <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>
17552
17553 !! end
17554
17555 !! test
17556 Resolving duplicate section names with differing case (T12721)
17557 !! wikitext
17558 ==Foo bar==
17559 ==Foo Bar==
17560 !! html
17561 <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>
17562 <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>
17563
17564 !! end
17565
17566 !! article
17567 Template:sections
17568 !! text
17569 ===Section 1===
17570 ==Section 2==
17571 !! endarticle
17572
17573 !! test
17574 Template with sections, __NOTOC__
17575 !! wikitext
17576 __NOTOC__
17577 ==Section 0==
17578 {{sections}}
17579 ==Section 4==
17580 !! html
17581 <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>
17582 <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>
17583 <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>
17584 <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>
17585
17586 !! end
17587
17588 !! test
17589 __NOEDITSECTION__ keyword
17590 !! wikitext
17591 __NOEDITSECTION__
17592 ==Section 1==
17593 ==Section 2==
17594 !! html
17595 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17596 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17597
17598 !! end
17599
17600 !! test
17601 Link inside a section heading
17602 !! wikitext
17603 ==Section with a [[Main Page|link]] in it==
17604 !! html
17605 <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>
17606
17607 !! end
17608
17609 !! test
17610 TOC regression (T14077)
17611 !! wikitext
17612 __TOC__
17613 ==title 1==
17614 ===title 1.1===
17615 ==title 2==
17616 !! html
17617 <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>
17618 <ul>
17619 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17620 <ul>
17621 <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>
17622 </ul>
17623 </li>
17624 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17625 </ul>
17626 </div>
17627
17628 <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>
17629 <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>
17630 <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>
17631
17632 !! end
17633
17634 !! test
17635 T3219 URL next to image (good)
17636 !! wikitext
17637 http://example.com [[File:Foobar.jpg]]
17638 !! html/php
17639 <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>
17640 </p>
17641 !! html/parsoid
17642 <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>
17643 !!end
17644
17645 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17646 !! test
17647 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17648 !! options
17649 parsoid=wt2html,html2html
17650 !! wikitext
17651 ===
17652 The line above must have a trailing space!
17653 === <!--
17654 --> <!-- -->
17655 But just in case it doesn't...
17656 !! html/php
17657 <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>
17658 <p>The line above must have a trailing space!
17659 </p>
17660 <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>
17661 <p>But just in case it doesn't...
17662 </p>
17663 !! html/parsoid
17664 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17665 <p>The line above must have a trailing space!</p>
17666 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17667 --> <!-- -->
17668 <p>But just in case it doesn't...</p>
17669 !! end
17670
17671 !! test
17672 Header with special characters (T27462)
17673 !! wikitext
17674 The tooltips shall not show entities to the user (ie. be double escaped)
17675
17676 ==text > text==
17677 section 1
17678
17679 ==text < text==
17680 section 2
17681
17682 ==text & text==
17683 section 3
17684
17685 ==text ' text==
17686 section 4
17687
17688 ==text " text==
17689 section 5
17690 !! html/php
17691 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17692 </p>
17693 <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>
17694 <ul>
17695 <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>
17696 <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>
17697 <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>
17698 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17699 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17700 </ul>
17701 </div>
17702
17703 <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>
17704 <p>section 1
17705 </p>
17706 <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>
17707 <p>section 2
17708 </p>
17709 <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>
17710 <p>section 3
17711 </p>
17712 <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>
17713 <p>section 4
17714 </p>
17715 <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>
17716 <p>section 5
17717 </p>
17718 !! html/parsoid
17719 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17720
17721 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17722 <p>section 1</p>
17723
17724 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17725 <p>section 2</p>
17726
17727 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17728 <p>section 3</p>
17729
17730 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17731 <p>section 4</p>
17732
17733 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17734 <p>section 5</p>
17735 !! end
17736
17737 !! test
17738 Header with space, plus and underscore as entity
17739 !! wikitext
17740 Id should not contain + for spaces
17741
17742 ==Space between Text==
17743 section 1
17744
17745 ==Space-Entity&#32;between&#32;Text==
17746 section 2
17747
17748 ==Plus+between+Text==
17749 section 3
17750
17751 ==Plus-Entity&#43;between&#43;Text==
17752 section 4
17753
17754 ==Underscore_between_Text==
17755 section 5
17756
17757 ==Underscore-Entity&#95;between&#95;Text==
17758 section 6
17759
17760 [[#Space between Text]]
17761 [[#Space-Entity&#32;between&#32;Text]]
17762 [[#Plus+between+Text]]
17763 [[#Plus-Entity&#43;between&#43;Text]]
17764 [[#Underscore_between_Text]]
17765 [[#Underscore-Entity&#95;between&#95;Text]]
17766 !! html/php
17767 <p>Id should not contain + for spaces
17768 </p>
17769 <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>
17770 <ul>
17771 <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>
17772 <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>
17773 <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>
17774 <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>
17775 <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>
17776 <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>
17777 </ul>
17778 </div>
17779
17780 <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>
17781 <p>section 1
17782 </p>
17783 <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>
17784 <p>section 2
17785 </p>
17786 <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>
17787 <p>section 3
17788 </p>
17789 <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>
17790 <p>section 4
17791 </p>
17792 <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>
17793 <p>section 5
17794 </p>
17795 <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>
17796 <p>section 6
17797 </p><p><a href="#Space_between_Text">#Space between Text</a>
17798 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17799 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17800 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17801 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17802 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17803 </p>
17804 !! html/parsoid
17805 <p>Id should not contain + for spaces</p>
17806
17807 <h2 id="Space_between_Text">Space between Text</h2>
17808 <p>section 1</p>
17809
17810 <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>
17811 <p>section 2</p>
17812
17813 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17814 <p>section 3</p>
17815
17816 <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>
17817 <p>section 4</p>
17818
17819 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17820 <p>section 5</p>
17821
17822 <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>
17823 <p>section 6</p>
17824
17825 <p><a rel="mw:WikiLink" href="./Parser_test#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
17826 <a rel="mw:WikiLink" href="./Parser_test#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
17827 <a rel="mw:WikiLink" href="./Parser_test#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
17828 <a rel="mw:WikiLink" href="./Parser_test#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
17829 <a rel="mw:WikiLink" href="./Parser_test#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
17830 <a rel="mw:WikiLink" href="./Parser_test#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
17831 !! end
17832
17833 # Parsoid html2wt disabled because it adds padding spaces around =
17834 !! test
17835 Headers with excess '=' characters
17836 (Are similar tests necessary beyond the 1st level?)
17837 !! options
17838 parsoid=wt2html,wt2wt,html2html
17839 !! wikitext
17840 =foo==
17841 ==foo=
17842 =''italic'' heading==
17843 ==''italic'' heading=
17844 !! html/php
17845 <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>
17846 <ul>
17847 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17848 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17849 <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>
17850 <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>
17851 </ul>
17852 </div>
17853
17854 <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>
17855 <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>
17856 <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>
17857 <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>
17858
17859 !! html/parsoid
17860 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17861 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17862 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17863 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17864 !! end
17865
17866 !! test
17867 HTML headers vs TOC (T25393)
17868 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17869 !! wikitext
17870 <h1>Header 1</h1>
17871 ==Header 1.1==
17872 ==Header 1.2==
17873
17874 <h1>Header 2
17875 </h1>
17876 ==Header 2.1==
17877 ==Header 2.2==
17878 __NOEDITSECTION__
17879 !! html/php
17880 <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>
17881 <ul>
17882 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17883 <ul>
17884 <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>
17885 <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>
17886 </ul>
17887 </li>
17888 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17889 <ul>
17890 <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>
17891 <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>
17892 </ul>
17893 </li>
17894 </ul>
17895 </div>
17896
17897 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17898 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17899 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17900 <h1><span class="mw-headline" id="Header_2">Header 2
17901 </span></h1>
17902 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17903 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17904
17905 !! html/parsoid
17906 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17907 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17908 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17909
17910 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17911 </h1>
17912 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17913 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17914 <meta property="mw:PageProp/noeditsection"/>
17915 !! end
17916
17917 !! test
17918 Single-line or multiline-comments can follow headings
17919 !! options
17920 parsoid=wt2html,wt2wt
17921 !! wikitext
17922 ==foo==<!---->
17923 ==bar==<!--c1-->
17924 ==baz==<!--
17925 c2
17926 c3-->
17927 !! html/php
17928 <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>
17929 <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>
17930 <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>
17931
17932 !! html/parsoid
17933 <h2 id="foo">foo</h2><!---->
17934 <h2 id="bar">bar</h2><!--c1-->
17935 <h2 id="baz">baz</h2><!--
17936 c2
17937 c3-->
17938 !! end
17939
17940 !! test
17941 T3219 URL next to image (broken)
17942 !! wikitext
17943 http://example.com[[File:Foobar.jpg]]
17944 !! html/php
17945 <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>
17946 </p>
17947 !! html/parsoid
17948 <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>
17949 !!end
17950
17951 !! test
17952 T3186 news: in the middle of text
17953 !! wikitext
17954 http://en.wikinews.org/wiki/Wikinews:Workplace
17955 !! html
17956 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17957 </p>
17958 !!end
17959
17960
17961 !! test
17962 Namespaced link must have a title
17963 !! wikitext
17964 [[Project:]]
17965 !! html
17966 <p>[[Project:]]
17967 </p>
17968 !!end
17969
17970 !! test
17971 Namespaced link must have a title (bad fragment version)
17972 !! wikitext
17973 [[Project:#fragment]]
17974 !! html
17975 <p>[[Project:#fragment]]
17976 </p>
17977 !!end
17978
17979
17980 ###
17981 ### HTML tags and HTML attributes
17982 ###
17983
17984 !! test
17985 div with no attributes
17986 !! wikitext
17987 <div>HTML rocks</div>
17988 !! html
17989 <div>HTML rocks</div>
17990
17991 !! end
17992
17993 !! test
17994 div with double-quoted attribute
17995 !! wikitext
17996 <div id="rock">HTML rocks</div>
17997 !! html
17998 <div id="rock">HTML rocks</div>
17999
18000 !! end
18001
18002 !! test
18003 div with single-quoted attribute
18004 !! wikitext
18005 <div id='rock'>HTML rocks</div>
18006 !! html
18007 <div id="rock">HTML rocks</div>
18008
18009 !! end
18010
18011 !! test
18012 div with unquoted attribute
18013 !! wikitext
18014 <div id=rock>HTML rocks</div>
18015 !! html
18016 <div id="rock">HTML rocks</div>
18017
18018 !! end
18019
18020 !! test
18021 div with illegal double attributes
18022 !! wikitext
18023 <div id="a" id="b">HTML rocks</div>
18024 !! html
18025 <div id="b">HTML rocks</div>
18026
18027 !!end
18028
18029 !! test
18030 div with empty attribute value, space before equals
18031 !! options
18032 parsoid=wt2html,html2html
18033 !! wikitext
18034 <div class =>HTML rocks</div>
18035 !! html/php
18036 <div class="">HTML rocks</div>
18037
18038 !! html/parsoid
18039 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18040 !! end
18041
18042 !! test
18043 div with multiple empty attribute values
18044 !! config
18045 wgFragmentMode=[ 'html5', 'legacy' ]
18046 !! options
18047 parsoid=wt2html,html2html
18048 !! wikitext
18049 <div id= title=>HTML rocks</div>
18050 !! html/php
18051 <div id="title=">HTML rocks</div>
18052
18053 !! html/parsoid
18054 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18055 !! end
18056
18057 # FIXME Parsoid doesn't actually match PHP here.
18058 # Probably we should use the synthetic <foo /> or <indicator>
18059 # extensions for this test, which are enabled when running parser tests.
18060 !! test
18061 Extension tag in attribute value
18062 !! wikitext
18063 <span title="<translate>123</translate>">ok</span>
18064 !! html/php+disabled
18065 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
18066 </p>
18067 !! html/parsoid
18068 <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>
18069 !! end
18070
18071 !! test
18072 table with multiple empty attribute values
18073 !! options
18074 parsoid=wt2html,html2html
18075 !! wikitext
18076 {| title= id=
18077 |hi
18078 |}
18079 !! html/php
18080 <table title="id=">
18081 <tr>
18082 <td>hi
18083 </td></tr></table>
18084
18085 !! html/parsoid
18086 <table title="id=">
18087 <tbody><tr><td>hi</td></tr>
18088 </tbody></table>
18089 !! end
18090
18091 !! test
18092 div with braces in attribute value
18093 !! wikitext
18094 <div title="{}">Foo</div>
18095 !! html/php
18096 <div title="&#123;&#125;">Foo</div>
18097
18098 !! html/parsoid
18099 <div title="{}">Foo</div>
18100 !! end
18101
18102 !! test
18103 div with empty attribute value, no space before equals
18104 !! options
18105 parsoid=wt2html,html2html
18106 !! wikitext
18107 <div class=>HTML rocks</div>
18108 !! html/php
18109 <div class="">HTML rocks</div>
18110
18111 !! html/parsoid
18112 <div class="">HTML rocks</div>
18113 !! end
18114
18115 !! test
18116 HTML multiple attributes correction
18117 !! wikitext
18118 <p class="error" class="awesome">Awesome!</p>
18119 !! html
18120 <p class="awesome">Awesome!</p>
18121
18122 !!end
18123
18124 !! test
18125 Table multiple attributes correction
18126 !! wikitext
18127 {|
18128 !+ class="error" class="awesome"|status
18129 |}
18130 !! html
18131 <table>
18132 <tr>
18133 <th class="awesome">status
18134 </th></tr></table>
18135
18136 !!end
18137
18138 !! test
18139 DIV IN UPPERCASE
18140 !! wikitext
18141 <DIV ID="x">HTML ROCKS</DIV>
18142 !! html
18143 <div id="x">HTML ROCKS</div>
18144
18145 !!end
18146
18147 !! test
18148 Non-ASCII pseudo-tags are rendered as text
18149 !! wikitext
18150 <khyô>
18151 !! html
18152 <p>&lt;khyô&gt;
18153 </p>
18154 !! end
18155
18156 !! test
18157 Pseudo-tag with URL 'name' renders as url link
18158 !! wikitext
18159 <http://example.com/>
18160 !! html
18161 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
18162 </p>
18163 !! end
18164
18165 !! test
18166 text with amp in the middle of nowhere
18167 !! wikitext
18168 Remember AT&T?
18169 !! html
18170 <p>Remember AT&amp;T?
18171 </p>
18172 !! end
18173
18174 !! test
18175 text with character entity: eacute
18176 !! wikitext
18177 I always thought &eacute; was a cute letter.
18178 !! html+tidy
18179 <p>I always thought &#233; was a cute letter.
18180 </p>
18181 !! end
18182
18183 !! test
18184 text with entity-escaped character entity-like string: eacute
18185 !! wikitext
18186 I always thought &amp;eacute; was a cute letter.
18187 !! html
18188 <p>I always thought &amp;eacute; was a cute letter.
18189 </p>
18190 !! end
18191
18192 !! test
18193 text with undefined character entity: xacute
18194 !! wikitext
18195 I always thought &xacute; was a cute letter.
18196 !! html
18197 <p>I always thought &amp;xacute; was a cute letter.
18198 </p>
18199 !! end
18200
18201 !! test
18202 HTML5 tags
18203 !! wikitext
18204 <data value="5">five</data>
18205 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18206 <mark>This highlighted text</mark>
18207 !! html
18208 <p><data value="5">five</data>
18209 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18210 <mark>This highlighted text</mark>
18211 </p>
18212 !! end
18213
18214 !! test
18215 HTML tag with leading space is parsed as text
18216 !! wikitext
18217 < div>foo< /div>
18218 !! html
18219 <p>&lt; div&gt;foo&lt; /div&gt;
18220 </p>
18221 !! end
18222
18223 ## FIXME: The untrimmed attribute in Parsoid is T205737
18224 !! test
18225 Element with broken attribute syntax
18226 !! options
18227 parsoid=wt2html
18228 !! wikitext
18229 <div style=" style="123">hi</div>
18230 <div =>ho</div>
18231 !! html/php
18232 <div style="style=">hi</div>
18233 <div>ho</div>
18234
18235 !! html/parsoid
18236 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18237 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18238 !! end
18239
18240 ###
18241 ### Nesting tests (see T43545, T52604, T53081)
18242 ###
18243
18244 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18245 # Note that html2wt is considerably more difficult if we use <b> in
18246 # the test case, instead of <small>
18247 !! test
18248 Ensure that HTML adoption agency algorithm is properly implemented.
18249 !! wikitext
18250 <small>X<small>Y</small>Z</small>
18251 !! html
18252 <p><small>X<small>Y</small>Z</small>
18253 </p>
18254 !! end
18255
18256 # This was T43545 in the PHP parser.
18257 !! test
18258 Nesting of <kbd>
18259 !! wikitext
18260 <kbd>X<kbd>Y</kbd>Z</kbd>
18261 !! html+tidy
18262 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18263 </p>
18264 !! end
18265
18266 # The following cases were T53081 in the PHP parser.
18267 # Note that there are some other nestable tags (b, i, etc) which are
18268 # not covered; see T53081 for discussion.
18269
18270 !! test
18271 Nesting of <em>
18272 !! wikitext
18273 <em>X<em>Y</em>Z</em>
18274 !! html+tidy
18275 <p><em>X<em>Y</em>Z</em>
18276 </p>
18277 !! end
18278
18279 !! test
18280 Nesting of <strong>
18281 !! wikitext
18282 <strong>X<strong>Y</strong>Z</strong>
18283 !! html+tidy
18284 <p><strong>X<strong>Y</strong>Z</strong>
18285 </p>
18286 !! end
18287
18288 !! test
18289 Nesting of <q>
18290 !! wikitext
18291 <q>X<q>Y</q>Z</q>
18292 !! html+tidy
18293 <p><q>X<q>Y</q>Z</q>
18294 </p>
18295 !! end
18296
18297 !! test
18298 Nesting of <ruby>
18299 !! wikitext
18300 <ruby>X<ruby>Y</ruby>Z</ruby>
18301 !! html
18302 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18303 </p>
18304 !! end
18305
18306 !! test
18307 Nesting of <bdo>
18308 !! wikitext
18309 <bdo>X<bdo>Y</bdo>Z</bdo>
18310 !! html
18311 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18312 </p>
18313 !! end
18314
18315
18316 ###
18317 ### Media links
18318 ###
18319
18320 !! test
18321 Media link
18322 !! wikitext
18323 [[Media:Foobar.jpg]]
18324 [[Media:Video.ogv]]
18325 [[:Media:Video.ogv]]
18326 !! html/php
18327 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18328 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18329 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18330 </p>
18331 !! html/parsoid
18332 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18333 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18334 <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>
18335 !! end
18336
18337 !! test
18338 Media link with text
18339 !! wikitext
18340 [[Media:Foobar.jpg|A neat file to look at]]
18341 !! html/php
18342 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18343 </p>
18344 !! html/parsoid
18345 <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>
18346 !! end
18347
18348 !! test
18349 Localized media link
18350 !! options
18351 language=is
18352 !! wikitext
18353 [[Miðill:Foobar.jpg]]
18354
18355 [[Miðill:Foobar.jpg|Icelandic]]
18356 !! html/php
18357 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18358 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18359 </p>
18360 !! html/parsoid
18361 <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>
18362 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18363 !! end
18364
18365 # FIXME: this is still bad HTML tag nesting
18366 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18367 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18368 !! test
18369 Media link with nasty text
18370 !! options
18371 parsoid=wt2html,html2html
18372 !! wikitext
18373 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18374 !! html/php
18375 <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>
18376
18377 !! html/php+tidy
18378 <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>
18379 !! html/parsoid
18380 <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>
18381 !! end
18382
18383 !! test
18384 Media link from missing resource (parsoid-only)
18385 !! options
18386 parsoid=html2wt
18387 !! html/parsoid
18388 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18389 !! wikitext
18390 [[Media:Foobar.jpg|Bat!]]
18391 !! end
18392
18393 !! test
18394 Media link from missing resource, localized (parsoid-only)
18395 !! options
18396 parsoid=html2wt
18397 language=is
18398 !! html/parsoid
18399 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18400 !! wikitext
18401 [[Miðill:Foobar.jpg|Bat!]]
18402 !! end
18403
18404 # This is a sanity test to ensure we don't crash or choke when given
18405 # old cached 1.7.0 HTML for media links; we don't require that the
18406 # result be "valid" because wt2wt was completely broken in 1.7.0
18407 !! test
18408 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18409 !! options
18410 parsoid=html2wt
18411 !! html/parsoid
18412 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18413 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18414 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18415 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18416 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18417 !! wikitext
18418 This is what Parsoid would emit (and we still handle this HTML fine):
18419
18420 [[Media:Foobar.jpg|A neat file to look at]]
18421
18422 But VisualEditor would mangle the rel attribute, and give us back this:
18423
18424 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18425
18426 But at least we don't crash when trying to handle the mangled HTML!
18427 !! end
18428
18429 !! test
18430 Media link to nonexistent file (T3702)
18431 !! wikitext
18432 [[Media:No such.jpg]]
18433 [[Media:No_such file.jpg]]
18434 !! html/php
18435 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18436 <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>
18437 </p>
18438 !! html/parsoid
18439 <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>
18440 <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>
18441 !! end
18442
18443 !! test
18444 Image link to nonexistent file (T3850 - good)
18445 !! wikitext
18446 [[File:No_such.jpg]]
18447 !! html/php
18448 <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>
18449 </p>
18450 !! html/parsoid
18451 <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>
18452 !! end
18453
18454 !! test
18455 :Image link to nonexistent file (T3850 - bad)
18456 !! wikitext
18457 [[:Image:No such.jpg]]
18458 !! html/php
18459 <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>
18460 </p>
18461 !! html/parsoid
18462 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18463 !! end
18464
18465 !! test
18466 Character reference normalization in link text (T3938)
18467 !! wikitext
18468 [[Main Page|this&that]]
18469 !! html
18470 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18471 </p>
18472 !!end
18473
18474 !! article
18475 אַ
18476 !! text
18477 Test for unicode normalization
18478
18479 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18480 !! endarticle
18481
18482 !! test
18483 (T21451) Links should refer to the normalized form.
18484 !! wikitext
18485 [[&#xFB2E;]]
18486 [[&#x5d0;&#x5b7;]]
18487 [[&#x5d0;ַ]]
18488 [[א&#x5b7;]]
18489 [[אַ]]
18490 !! html
18491 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18492 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18493 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18494 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18495 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18496 </p>
18497 !! end
18498
18499 !! test
18500 Empty attribute crash test (T4067)
18501 !! wikitext
18502 <font color="">foo</font>
18503 !! html
18504 <p><font color="">foo</font>
18505 </p>
18506 !! end
18507
18508 !! test
18509 Empty attribute crash test single-quotes (T4067)
18510 !! wikitext
18511 <font color=''>foo</font>
18512 !! html
18513 <p><font color="">foo</font>
18514 </p>
18515 !! end
18516
18517 !! test
18518 Attribute test: equals, then nothing
18519 !! options
18520 parsoid=wt2html,html2html
18521 !! wikitext
18522 <font color=>foo</font>
18523 !! html/php
18524 <p><font color="">foo</font>
18525 </p>
18526 !! html/parsoid
18527 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18528 !! end
18529
18530 !! test
18531 Attribute test: unquoted value
18532 !! options
18533 parsoid=wt2html,html2html
18534 !! wikitext
18535 <font color=x>foo</font>
18536 !! html/php
18537 <p><font color="x">foo</font>
18538 </p>
18539 !! html/parsoid
18540 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18541 !! end
18542
18543 !! test
18544 Attribute test: unquoted but illegal value (hash)
18545 !! wikitext
18546 <font color=#x>foo</font>
18547 !! html
18548 <p><font color="#x">foo</font>
18549 </p>
18550 !! end
18551
18552 # Parsoid does not serialize to empty attribute syntax,
18553 # so wt2wt and html2wt cases are skipped
18554 !! test
18555 Attribute test: no value (T54330)
18556 !! options
18557 parsoid=wt2html,html2html
18558 !! wikitext
18559 <font color>foo</font>
18560 !! html/php
18561 <p><font color="">foo</font>
18562 </p>
18563 !! html/parsoid
18564 <p><font color="">foo</font></p>
18565 !! end
18566
18567 !! test
18568 T4095: link with three closing brackets
18569 !! wikitext
18570 [[Main Page]]]
18571 !! html/php
18572 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18573 </p>
18574 !! html/parsoid
18575 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18576 !! end
18577
18578 !! test
18579 T4095: link with pipe and three closing brackets
18580 !! wikitext
18581 [[Main Page|link]]]
18582 !! html/php
18583 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18584 </p>
18585 !! html/parsoid
18586 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18587 !! end
18588
18589 !! test
18590 T4095: link with pipe and three closing brackets, version 2
18591 !! wikitext
18592 [[Main Page|[http://example.com/]]]
18593 !! html/php
18594 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18595 </p>
18596 !! html/parsoid
18597 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18598 !! end
18599
18600
18601 ###
18602 ### Safety
18603 ###
18604
18605 !! article
18606 Template:Dangerous attribute
18607 !! text
18608 " onmouseover="alert(document.cookie)
18609 !! endarticle
18610
18611 !! article
18612 Template:Dangerous style attribute
18613 !! text
18614 border-size: expression(alert(document.cookie))
18615 !! endarticle
18616
18617 !! article
18618 Template:Div style
18619 !! text
18620 <div style="float: right; {{{1}}}">Magic div</div>
18621 !! endarticle
18622
18623 !! test
18624 T4304: HTML attribute safety (safe template; regression T4309)
18625 !! wikitext
18626 <div title="{{test}}"></div>
18627 !! html/php
18628 <div title="This is a test template"></div>
18629
18630 !! html/parsoid
18631 <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>
18632 !! end
18633
18634 # Parsoid has enough context to handle this case
18635 !! test
18636 T4304: HTML attribute safety (dangerous template; 2309)
18637 !! wikitext
18638 <div title="{{dangerous attribute}}"></div>
18639 !! html/php
18640 <div title=""></div>
18641
18642 !! html/parsoid
18643 <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>
18644 !! end
18645
18646 !! test
18647 T4304: HTML attribute safety (dangerous style template; 2309)
18648 !! wikitext
18649 <div style="{{dangerous style attribute}}"></div>
18650 !! html/php
18651 <div style="/* insecure input */"></div>
18652
18653 !! html/parsoid
18654 <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>
18655 !! end
18656
18657 !! test
18658 T4304: HTML attribute safety (safe parameter; 2309)
18659 !! wikitext
18660 {{div style|width: 200px}}
18661 !! html/php
18662 <div style="float: right; width: 200px">Magic div</div>
18663
18664 !! html/parsoid
18665 <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>
18666 !! end
18667
18668 !! test
18669 T4304: HTML attribute safety (unsafe parameter; 2309)
18670 !! wikitext
18671 {{div style|width: expression(alert(document.cookie))}}
18672 !! html/php
18673 <div style="/* insecure input */">Magic div</div>
18674
18675 !! html/parsoid
18676 <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>
18677 !! end
18678
18679 ## Parsoid output here differs; needs investigation.
18680 !! test
18681 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18682 !! wikitext
18683 {{div style|"><script>alert(document.cookie)</script>}}
18684 !! html
18685 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18686
18687 !! end
18688
18689 ## Parsoid output here differs; needs investigation.
18690 !! test
18691 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18692 !! wikitext
18693 {{div style|" ><script>alert(document.cookie)</script>}}
18694 !! html
18695 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18696
18697 !! end
18698
18699 !! test
18700 T4304: HTML attribute safety (link)
18701 !! wikitext
18702 <div title="[[Main Page]]"></div>
18703 !! html/php
18704 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18705
18706 !! html/parsoid
18707 <div title="[[Main Page]]"></div>
18708 !! end
18709
18710 !! test
18711 T4304: HTML attribute safety (italics)
18712 !! wikitext
18713 <div title="''foobar''"></div>
18714 !! html
18715 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18716
18717 !! end
18718
18719 !! test
18720 T4304: HTML attribute safety (bold)
18721 !! wikitext
18722 <div title="'''foobar'''"></div>
18723 !! html
18724 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18725
18726 !! end
18727
18728 !! test
18729 T4304: HTML attribute safety (ISBN)
18730 !! wikitext
18731 <div title="ISBN 1234567890"></div>
18732 !! html
18733 <div title="&#73;SBN 1234567890"></div>
18734
18735 !! end
18736
18737 !! test
18738 T4304: HTML attribute safety (RFC)
18739 !! wikitext
18740 <div title="RFC 1234"></div>
18741 !! html
18742 <div title="&#82;FC 1234"></div>
18743
18744 !! end
18745
18746 !! test
18747 T4304: HTML attribute safety (PMID)
18748 !! wikitext
18749 <div title="PMID 1234567890"></div>
18750 !! html
18751 <div title="&#80;MID 1234567890"></div>
18752
18753 !! end
18754
18755 !! test
18756 T4304: HTML attribute safety (web link)
18757 !! wikitext
18758 <div title="http://example.com/"></div>
18759 !! html
18760 <div title="http&#58;//example.com/"></div>
18761
18762 !! end
18763
18764 !! test
18765 T4304: HTML attribute safety (named web link)
18766 !! wikitext
18767 <div title="[http://example.com/ link]"></div>
18768 !! html/php
18769 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18770
18771 !! html/parsoid
18772 <div title="[http://example.com/ link]"></div>
18773 !! end
18774
18775 !! test
18776 T5244: HTML attribute safety (extension; safe)
18777 !! wikitext
18778 <div style="<nowiki>background:blue</nowiki>"></div>
18779 !! html/php
18780 <div style="background:blue"></div>
18781
18782 !! html/parsoid
18783 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18784 !! end
18785
18786 !! test
18787 T5244: HTML attribute safety (extension; unsafe)
18788 !! wikitext
18789 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18790 !! html/php
18791 <div style="/* insecure input */"></div>
18792
18793 !! html/parsoid
18794 <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>
18795 !! end
18796
18797 # More MSIE fun discovered by Tom Gilder
18798
18799 !! test
18800 MSIE CSS safety test: spurious slash
18801 !! wikitext
18802 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18803 !! html/php
18804 <div style="/* insecure input */">evil</div>
18805
18806 !! html/parsoid
18807 <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>
18808 !! end
18809
18810 !! test
18811 MSIE CSS safety test: hex code
18812 !! wikitext
18813 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18814 !! html/php
18815 <div style="/* insecure input */">evil</div>
18816
18817 !! html/parsoid
18818 <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>
18819 !! end
18820
18821 !! test
18822 MSIE CSS safety test: comment in url
18823 !! wikitext
18824 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18825 !! html/php
18826 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18827
18828 !! html/parsoid
18829 <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>
18830 !! end
18831
18832 !! test
18833 MSIE CSS safety test: comment in expression
18834 !! wikitext
18835 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18836 !! html/php
18837 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18838
18839 !! html/parsoid
18840 <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>
18841 !! end
18842
18843 !! test
18844 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18845 !! wikitext
18846 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18847 !! html/php
18848 <p style="/* invalid control char */">A</p>
18849
18850 !! html/parsoid
18851 <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>
18852 !! end
18853
18854 !! test
18855 MSIE 6 CSS safety test: Fullwidth (T57332)
18856 !! wikitext
18857 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18858 <div style="top:EXPRESSION(alert())">B</div>
18859 !! html/php
18860 <p style="/* insecure input */">A</p>
18861 <div style="/* insecure input */">B</div>
18862
18863 !! html/parsoid
18864 <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>
18865 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18866 !! end
18867
18868 !! test
18869 MSIE 6 CSS safety test: IPA extensions (T57332)
18870 !! wikitext
18871 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18872 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18873 !! html/php
18874 <div style="/* insecure input */">A</div>
18875 <p style="/* insecure input */">B</p>
18876
18877 !! html/parsoid
18878 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18879 <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>
18880 !! end
18881
18882 !! test
18883 MSIE 6 CSS safety test: sup/sub script (T57332)
18884 !! wikitext
18885 <div style="background-image:url⁽javascript:alert())">A</div>
18886 <div style="background-image:url₍javascript:alert())">B</div>
18887 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18888 !! html/php
18889 <div style="/* insecure input */">A</div>
18890 <div style="/* insecure input */">B</div>
18891 <p style="/* insecure input */">C</p>
18892
18893 !! html/parsoid
18894 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18895 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18896 <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>
18897 !! end
18898
18899 !! test
18900 Opera -o-link CSS
18901 !! options
18902 parsoid=wt2html,html2html
18903 !! wikitext
18904 <div
18905 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;"
18906 style="-o-link:attr(title);-o-link-source:current">X</div>
18907 !! html/php
18908 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18909
18910 !! html/parsoid
18911 <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>
18912 !! end
18913
18914 !! test
18915 MSIE 6 CSS safety test: Repetition markers (T57332)
18916 !! wikitext
18917 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18918 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18919 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18920 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18921 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18922 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18923 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18924 !! html/php
18925 <p style="/* insecure input */">A</p>
18926 <p style="/* insecure input */">B</p>
18927 <p style="/* insecure input */">C</p>
18928 <p style="/* insecure input */">D</p>
18929 <p style="/* insecure input */">E</p>
18930 <p style="/* insecure input */">F</p>
18931 <p style="/* insecure input */">G</p>
18932
18933 !! html/parsoid
18934 <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>
18935 <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>
18936 <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>
18937 <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>
18938 <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>
18939 <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>
18940 <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>
18941 !! end
18942
18943 !! test
18944 Table attribute legitimate extension
18945 !! wikitext
18946 {|
18947 !+ style="<nowiki>color:blue</nowiki>"|status
18948 |}
18949 !! html
18950 <table>
18951 <tr>
18952 <th style="color:blue">status
18953 </th></tr></table>
18954
18955 !!end
18956
18957 !! test
18958 Table attribute safety
18959 !! wikitext
18960 {|
18961 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18962 |}
18963 !! html
18964 <table>
18965 <tr>
18966 <th style="/* insecure input */">status
18967 </th></tr></table>
18968
18969 !! end
18970
18971 !! test
18972 CSS line continuation 1
18973 !! wikitext
18974 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18975 !! html
18976 <div style="/* insecure input */"></div>
18977
18978 !! end
18979
18980 !! test
18981 CSS line continuation 2
18982 !! wikitext
18983 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18984 !! html
18985 <div style="/* invalid control char */"></div>
18986
18987 !! end
18988
18989 !! article
18990 Template:Identity
18991 !! text
18992 {{{1}}}
18993 !! endarticle
18994
18995 !! test
18996 Expansion of multi-line templates in attribute values (T8255)
18997 !! wikitext
18998 <div style="background: {{identity|#00FF00}}">-</div>
18999 !! html
19000 <div style="background: #00FF00">-</div>
19001
19002 !! end
19003
19004 !! test
19005 Expansion of multi-line templates in attribute values (T8255 sanity check)
19006 !! wikitext
19007 <div style="background:
19008 #00FF00">-</div>
19009 !! html/php
19010 <div style="background: #00FF00">-</div>
19011
19012 !! html/parsoid
19013 <div style="background:
19014 #00FF00">-</div>
19015 !! end
19016
19017 !! test
19018 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
19019 !! wikitext
19020 <div style="background: &#10;#00FF00">-</div>
19021 !! html
19022 <div style="background: &#10;#00FF00">-</div>
19023
19024 !! end
19025
19026 !! test
19027 Tags which are hidden from tidiers cannot pass through the Sanitizer
19028 !! wikitext
19029 <mw:toc><script>alert();</script></mw:toc>
19030 !! html+tidy
19031 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
19032 </p>
19033 !! end
19034
19035 ###
19036 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
19037 ###
19038
19039 !! test
19040 Parser hook: empty input
19041 !! wikitext
19042 <tag></tag>
19043 !! html/php
19044 <pre>
19045 ''
19046 array (
19047 )
19048 </pre>
19049
19050 !! html/parsoid
19051 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19052 !! end
19053
19054 ## Don't expect parsoid to rt this form.
19055 !! test
19056 Parser hook: empty input using terminated empty elements
19057 !! options
19058 parsoid=wt2html,html2html
19059 !! wikitext
19060 <tag/>
19061 !! html/php
19062 <pre>
19063 NULL
19064 array (
19065 )
19066 </pre>
19067
19068 !! html/parsoid
19069 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19070 !! end
19071
19072 !! test
19073 Parser hook: empty input using terminated empty elements (space before)
19074 !! wikitext
19075 <tag />
19076 !! html/php
19077 <pre>
19078 NULL
19079 array (
19080 )
19081 </pre>
19082
19083 !! html/parsoid
19084 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19085 !! end
19086
19087 !! test
19088 Parser hook: basic input
19089 !! wikitext
19090 <tag>input</tag>
19091 !! html/php
19092 <pre>
19093 'input'
19094 array (
19095 )
19096 </pre>
19097
19098 !! html/parsoid
19099 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19100 !! end
19101
19102 ## Don't expect parsoid to rt this form.
19103 !! test
19104 Parser hook: case insensitive
19105 !! options
19106 parsoid=wt2html,html2html
19107 !! wikitext
19108 <TAG>input</TAG>
19109 !! html/php
19110 <pre>
19111 'input'
19112 array (
19113 )
19114 </pre>
19115
19116 !! html/parsoid
19117 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19118 !! end
19119
19120 ## Don't expect parsoid to rt this form.
19121 !! test
19122 Parser hook: case insensitive, redux
19123 !! options
19124 parsoid=wt2html,html2html
19125 !! wikitext
19126 <TaG>input</TAg>
19127 !! html/php
19128 <pre>
19129 'input'
19130 array (
19131 )
19132 </pre>
19133
19134 !! html/parsoid
19135 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19136 !! end
19137
19138 !! test
19139 Parser hook: nested tags
19140 !! options
19141 parsoid=wt2html
19142 !! wikitext
19143 <tag><tag></tag></tag>
19144 !! html/php
19145 <pre>
19146 '<tag>'
19147 array (
19148 )
19149 </pre>&lt;/tag&gt;
19150
19151 !! html/php+tidy
19152 <pre>'<tag>'
19153 array (
19154 )
19155 </tag></pre><p>&lt;/tag&gt;
19156 </p>
19157 !! html/parsoid
19158 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
19159 !! end
19160
19161 !! test
19162 Parser hook: basic arguments
19163 !! wikitext
19164 <tag width="200" height="100" depth="50" square=""></tag>
19165 !! html/php
19166 <pre>
19167 ''
19168 array (
19169 'width' => '200',
19170 'height' => '100',
19171 'depth' => '50',
19172 'square' => '',
19173 )
19174 </pre>
19175
19176 !! html/parsoid
19177 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19178 !! end
19179
19180 ## Don't expect parsoid to rt this form.
19181 !! test
19182 Parser hook: basic arguments, variations
19183 !! options
19184 parsoid=wt2html,html2html
19185 !! wikitext
19186 <tag width=200 height = "100" depth = '50' square></tag>
19187 !! html/php
19188 <pre>
19189 ''
19190 array (
19191 'width' => '200',
19192 'height' => '100',
19193 'depth' => '50',
19194 'square' => '',
19195 )
19196 </pre>
19197
19198 !! html/parsoid
19199 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19200 !! end
19201
19202 !! test
19203 Parser hook: argument containing a forward slash (T7344)
19204 !! wikitext
19205 <tag filename="/tmp/bla"></tag>
19206 !! html/php
19207 <pre>
19208 ''
19209 array (
19210 'filename' => '/tmp/bla',
19211 )
19212 </pre>
19213
19214 !! html/parsoid
19215 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19216 !! end
19217
19218 ## Don't expect parsoid to rt this form.
19219 !! test
19220 Parser hook: empty input using terminated empty elements (T4374)
19221 !! options
19222 parsoid=wt2html,html2html
19223 !! wikitext
19224 <tag foo=bar/>text
19225 !! html/php
19226 <pre>
19227 NULL
19228 array (
19229 'foo' => 'bar',
19230 )
19231 </pre>text
19232
19233 !! html/parsoid
19234 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19235 !! end
19236
19237 ## </tag> should be output literally since there is no matching tag that begins it
19238 ## Don't expect parsoid to rt this form.
19239 !! test
19240 Parser hook: basic arguments using terminated empty elements (T4374)
19241 !! options
19242 parsoid=wt2html
19243 !! wikitext
19244 <tag width=200 height = "100" depth = '50' square/>
19245 other stuff
19246 </tag>
19247 !! html/php
19248 <pre>
19249 NULL
19250 array (
19251 'width' => '200',
19252 'height' => '100',
19253 'depth' => '50',
19254 'square' => '',
19255 )
19256 </pre>
19257 <p>other stuff
19258 &lt;/tag&gt;
19259 </p>
19260 !! html/parsoid
19261 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19262 &lt;/tag></p>
19263 !! end
19264
19265 ## Don't expect parsoid to rt this form.
19266 !! test
19267 Parser hook: Don't allow unclosed extension tags
19268 !! options
19269 parsoid=wt2html
19270 !! wikitext
19271 test <tag>123
19272
19273 this is a '''test'''
19274 !! html/php
19275 <p>test &lt;tag&gt;123
19276 </p><p>this is a <b>test</b>
19277 </p>
19278 !! html/parsoid
19279 <p>test &lt;tag>123</p>
19280
19281 <p>this is a <b>test</b></p>
19282 !! end
19283
19284 !! test
19285 Parser hook: horizontal rule inside extension tag that outputs <pre>
19286 !! wikitext
19287 <tag>
19288 Hello
19289 <hr/>
19290 Goodbye
19291 </tag>
19292 !! html/php
19293 <pre>
19294 '
19295 Hello
19296 <hr/>
19297 Goodbye
19298 '
19299 array (
19300 )
19301 </pre>
19302
19303 !! end
19304
19305 ###
19306 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
19307 ###
19308
19309 !! test
19310 Parser hook: static parser hook not inside a comment
19311 !! wikitext
19312 <statictag>hello, world</statictag>
19313
19314 <statictag action="flush" />
19315 !! html/php
19316 <p><br />
19317 hello, world
19318 </p>
19319 !! html/parsoid
19320 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
19321 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
19322 !! end
19323
19324 !! test
19325 Parser hook: static parser hook inside a comment
19326 !! wikitext
19327 <!-- <statictag>hello, world</statictag> -->
19328 <statictag action="flush" />
19329 !! html/php
19330 <p><br />
19331 </p>
19332 !! html/parsoid
19333 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19334 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
19335 !! end
19336
19337 # Nested template calls; this case was broken by Parser.php rev 1.506,
19338 # since reverted.
19339
19340 !! article
19341 Template:One-parameter
19342 !! text
19343 (My parameter is: {{{1}}})
19344 !! endarticle
19345
19346 !! article
19347 Template:Map-one-parameter
19348 !! text
19349 {{{{{1}}}|{{{2}}}}}
19350 !! endarticle
19351
19352 !! test
19353 Nested template calls
19354 !! wikitext
19355 {{Map-one-parameter|One-parameter|param}}
19356 !! html
19357 <p>(My parameter is: param)
19358 </p>
19359 !! end
19360
19361
19362 ###
19363 ### Sanitizer
19364 ###
19365
19366 !! test
19367 Sanitizer: Closing of open tags
19368 !! wikitext
19369 <s></s><table></table>
19370 !! html/php+tidy
19371 <p><s></s></p><table></table>
19372 !! html/parsoid
19373 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19374 !! end
19375
19376 !! test
19377 Sanitizer: Closing of open but not closed tags
19378 !! wikitext
19379 <s>foo
19380 !! html
19381 <p><s>foo</s>
19382 </p>
19383 !! end
19384
19385 !! test
19386 Sanitizer: Closing of closed but not open tags
19387 !! options
19388 parsoid=wt2html
19389 !! wikitext
19390 </s>
19391 !! html+tidy
19392 <p class="mw-empty-elt">
19393 </p>
19394 !! end
19395
19396 !! test
19397 Sanitizer: Closing of closed but not open table tags
19398 !! options
19399 parsoid=wt2html
19400 !! wikitext
19401 Table not started</td></tr></table>
19402 !! html+tidy
19403 <p>Table not started
19404 </p>
19405 !! end
19406
19407 !! test
19408 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19409 !! options
19410 title=[[Main Page]]
19411 !! config
19412 wgFragmentMode=[ 'html5', 'legacy' ]
19413 !! wikitext
19414 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19415 !! html/php
19416 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19417 </p>
19418 !! html/parsoid
19419 <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>
19420 !! end
19421
19422 !! test
19423 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19424 !! config
19425 wgFragmentMode=[ 'legacy' ]
19426 !! wikitext
19427 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19428 !! html/php
19429 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19430 </p>
19431 !! end
19432
19433 # In HTML5, the restrictions are that id must contain at least one character,
19434 # and must not contain any space characters.
19435 !! test
19436 Sanitizer: Validating the contents of the id attribute (T6515)
19437 !! options
19438 disabled
19439 !! wikitext
19440 <br id="" /><br id="a space" />
19441 !! html
19442 Something ...
19443 !! end
19444
19445 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19446 !! test
19447 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19448 !! options
19449 disabled
19450 !! wikitext
19451 <br id="foo" /><br id="foo" />
19452 !! html
19453 Something need to be done. foo-2 ?
19454 !! end
19455
19456 !! test
19457 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19458 !! wikitext
19459 <div itemscope>
19460 <meta itemprop="hello" content="world">
19461 <meta http-equiv="refresh" content="5">
19462 <meta itemprop="hello" http-equiv="refresh" content="5">
19463 <link itemprop="hello" href="{{SERVER}}">
19464 <link rel="stylesheet" href="{{SERVER}}">
19465 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19466 </div>
19467 !! html
19468 <div itemscope="">
19469 <p> <meta itemprop="hello" content="world" />
19470 &lt;meta http-equiv="refresh" content="5"&gt;
19471 <meta itemprop="hello" content="5" />
19472 <link itemprop="hello" href="http&#58;//example.org" />
19473 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19474 <link itemprop="hello" href="http&#58;//example.org" />
19475 </p>
19476 </div>
19477
19478 !! end
19479
19480 !! test
19481 Sanitizer: Strip comments from CSS attributes
19482 !! options
19483 parsoid=wt2html,wt2wt
19484 !! wikitext
19485 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19486 !! html/php
19487 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19488 </p>
19489 !! html/parsoid
19490 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19491 !! end
19492
19493 !! test
19494 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19495 !! wikitext
19496 [[meatball:Soft"Security]]
19497 !! html/php
19498 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19499 </p>
19500 !! html/parsoid
19501 <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>
19502 !! end
19503
19504 !! test
19505 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19506 !! wikitext
19507 [[meatball:Foo<Bar]]
19508 [[meatball:Foo>Bar]]
19509 [[meatball:Foo&lt;bar]]
19510 [[meatball:Foo&gt;bar]]
19511 !! html/php
19512 <p>[[meatball:Foo&lt;Bar]]
19513 [[meatball:Foo&gt;Bar]]
19514 [[meatball:Foo&lt;bar]]
19515 [[meatball:Foo&gt;bar]]
19516 </p>
19517 !! html/parsoid
19518 <p>[[meatball:Foo&lt;Bar]]
19519 [[meatball:Foo>Bar]]
19520 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19521 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19522 !! end
19523
19524 !! test
19525 Language converter: output gets cut off unexpectedly (T7757)
19526 !! options
19527 language=zh
19528 !! wikitext
19529 this bit is safe: }-
19530
19531 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19532
19533 then we get cut off here: }-
19534
19535 all additional text is vanished
19536 !! html/php
19537 <p>this bit is safe: }-
19538 </p><p>but if we add a conversion instance: xxx
19539 </p><p>then we get cut off here: }-
19540 </p><p>all additional text is vanished
19541 </p>
19542 !! html/parsoid
19543 <p>this bit is safe: }-</p>
19544 <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>
19545 <p>then we get cut off here: }-</p>
19546 <p>all additional text is vanished</p>
19547 !! end
19548
19549 !! test
19550 Language converter glossary rules inside attributes (T119158)
19551 !! options
19552 language=sr variant=sr-el
19553 !! wikitext
19554 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19555
19556 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19557 !! html/php
19558 <p>
19559 </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>
19560 </p>
19561 !! html/parsoid
19562 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19563
19564 <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>
19565 !! end
19566
19567 !! test
19568 Self closed html pairs (T7487)
19569 !! wikitext
19570 <center><font id="bug" />Centered text</center>
19571 <div><font id="bug2" />In div text</div>
19572 !! html+tidy
19573 <center><font id="bug"></font>Centered text</center>
19574 <div><font id="bug2"></font>In div text</div>
19575 !! end
19576
19577 !! test
19578 Punctuation: nbsp before exclamation
19579 !! wikitext
19580 C'est grave !
19581 !! html
19582 <p>C'est grave&#160;!
19583 </p>
19584 !! end
19585
19586 !! test
19587 Punctuation: CSS !important (T13874)
19588 !! wikitext
19589 <div style="width:50% !important">important</div>
19590 !! html
19591 <div style="width:50% !important">important</div>
19592
19593 !!end
19594
19595 !! test
19596 Punctuation: CSS ! important (T13874; with space after)
19597 !! wikitext
19598 <div style="width:50% ! important">important</div>
19599 !! html
19600 <div style="width:50%&#32;! important">important</div>
19601
19602 !!end
19603
19604 !! test
19605 HTML bullet list, closed tags (T7497)
19606 !! wikitext
19607 <ul>
19608 <li>One</li>
19609 <li>Two</li>
19610 </ul>
19611 !! html/php
19612 <ul>
19613 <li>One</li>
19614 <li>Two</li>
19615 </ul>
19616
19617 !! html/parsoid
19618 <ul data-parsoid='{"stx":"html"}'>
19619 <li data-parsoid='{"stx":"html"}'>One</li>
19620 <li data-parsoid='{"stx":"html"}'>Two</li>
19621 </ul>
19622
19623 !! end
19624
19625 !! test
19626 HTML bullet list, unclosed tags (T7497)
19627 !! wikitext
19628 <ul>
19629 <li>One
19630 <li>Two
19631 </ul>
19632 !! html/php+tidy
19633 <ul>
19634 <li>One
19635 </li><li>Two
19636 </li></ul>
19637 !! html/parsoid
19638 <ul data-parsoid='{"stx":"html"}'>
19639 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19640 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19641 </ul>
19642
19643 !! end
19644
19645 !! test
19646 HTML ordered list, closed tags (T7497)
19647 !! wikitext
19648 <ol>
19649 <li>One</li>
19650 <li>Two</li>
19651 </ol>
19652 !! html/php
19653 <ol>
19654 <li>One</li>
19655 <li>Two</li>
19656 </ol>
19657
19658 !! html/parsoid
19659 <ol data-parsoid='{"stx":"html"}'>
19660 <li data-parsoid='{"stx":"html"}'>One</li>
19661 <li data-parsoid='{"stx":"html"}'>Two</li>
19662 </ol>
19663
19664 !! end
19665
19666 !! test
19667 HTML ordered list, unclosed tags (T7497)
19668 !! options
19669 !! wikitext
19670 <ol>
19671 <li>One
19672 <li>Two
19673 </ol>
19674 !! html/php+tidy
19675 <ol>
19676 <li>One
19677 </li><li>Two
19678 </li></ol>
19679 !! html/parsoid
19680 <ol data-parsoid='{"stx":"html"}'>
19681 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19682 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19683 </ol>
19684
19685 !! end
19686
19687 !! test
19688 HTML nested bullet list, closed tags (T7497)
19689 !! wikitext
19690 <ul>
19691 <li>One</li>
19692 <li>Two:
19693 <ul>
19694 <li>Sub-one</li>
19695 <li>Sub-two</li>
19696 </ul>
19697 </li>
19698 </ul>
19699 !! html/php
19700 <ul>
19701 <li>One</li>
19702 <li>Two:
19703 <ul>
19704 <li>Sub-one</li>
19705 <li>Sub-two</li>
19706 </ul>
19707 </li>
19708 </ul>
19709
19710 !! html/parsoid
19711 <ul data-parsoid='{"stx":"html"}'>
19712 <li data-parsoid='{"stx":"html"}'>One</li>
19713 <li data-parsoid='{"stx":"html"}'>Two:
19714 <ul data-parsoid='{"stx":"html"}'>
19715 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19716 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19717 </ul>
19718 </li>
19719 </ul>
19720 !! end
19721
19722 !! test
19723 HTML nested bullet list, open tags (T7497)
19724 !! wikitext
19725 <ul>
19726 <li>One
19727 <li>Two:
19728 <ul>
19729 <li>Sub-one
19730 <li>Sub-two
19731 </ul>
19732 </ul>
19733 !! html+tidy
19734 <ul>
19735 <li>One
19736 </li><li>Two:
19737 <ul>
19738 <li>Sub-one
19739 </li><li>Sub-two
19740 </li></ul>
19741 </li></ul>
19742 !! end
19743
19744 !! test
19745 HTML nested ordered list, closed tags (T7497)
19746 !! wikitext
19747 <ol>
19748 <li>One</li>
19749 <li>Two:
19750 <ol>
19751 <li>Sub-one</li>
19752 <li>Sub-two</li>
19753 </ol>
19754 </li>
19755 </ol>
19756 !! html
19757 <ol>
19758 <li>One</li>
19759 <li>Two:
19760 <ol>
19761 <li>Sub-one</li>
19762 <li>Sub-two</li>
19763 </ol>
19764 </li>
19765 </ol>
19766
19767 !! end
19768
19769 !! test
19770 HTML nested ordered list, open tags (T7497)
19771 !! wikitext
19772 <ol>
19773 <li>One
19774 <li>Two:
19775 <ol>
19776 <li>Sub-one
19777 <li>Sub-two
19778 </ol>
19779 </ol>
19780 !! html/php
19781 <ol>
19782 <li>One
19783 <li>Two:
19784 <ol>
19785 <li>Sub-one
19786 <li>Sub-two
19787 </ol>
19788 </ol>
19789
19790 !! html/parsoid
19791 <ol>
19792 <li>One
19793 </li>
19794 <li>Two:
19795 <ol>
19796 <li>Sub-one
19797 </li>
19798 <li>Sub-two
19799 </li>
19800 </ol>
19801 </li>
19802 </ol>
19803
19804 !! end
19805
19806 !! test
19807 HTML ordered list item with parameters oddity
19808 !! wikitext
19809 <ol><li id="fragment">One</li>
19810 </ol>
19811 !! html
19812 <ol><li id="fragment">One</li>
19813 </ol>
19814
19815 !! end
19816
19817 # parsoid doesn't explicitly mark autonumbered links, see T55505
19818 !!test
19819 T7918: autonumbering
19820 !! wikitext
19821 [http://first/] [http://second] [ftp://ftp]
19822
19823 ftp://inlineftp
19824
19825 [mailto:enclosed@mail.tld With target]
19826
19827 [mailto:enclosed@mail.tld]
19828
19829 mailto:inline@mail.tld
19830 !! html/php
19831 <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>
19832 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19833 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19834 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19835 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19836 </p>
19837 !! html/parsoid
19838 <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>
19839 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19840 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19841 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19842 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19843 !! end
19844
19845
19846 #
19847 # Security and HTML correctness
19848 # From Nick Jenkins' fuzz testing
19849 #
19850
19851 !! test
19852 Fuzz testing: Parser13
19853 !! wikitext
19854 {|
19855 | http://a|
19856 !! html
19857 <table>
19858 <tr>
19859 <td>
19860 </td>
19861 </tr>
19862 </table>
19863
19864 !! end
19865
19866 # Note that Parsoid output differs from the PHP parser here: the PHP
19867 # parser breaks the URL for the magic word, while in Parsoid the URL
19868 # production takes precedence.
19869 !! test
19870 Fuzz testing: Parser14
19871 !! wikitext
19872 ==onmouseover===
19873 http://__TOC__
19874 !! html/php
19875 <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>
19876 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>
19877 <ul>
19878 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19879 </ul>
19880 </div>
19881
19882
19883 !! html/php+tidy
19884 <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>
19885 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>
19886 <ul>
19887 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19888 </ul>
19889 </div>
19890 !! html/parsoid
19891 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19892 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19893 !! end
19894
19895 !! test
19896 Fuzz testing: Parser14-table
19897 !! options
19898 parsoid=wt2html,html2html
19899 !! wikitext
19900 ==a==
19901 {| STYLE=__TOC__
19902 !! html/php
19903 <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>
19904 <table style="&#95;_TOC&#95;_">
19905 <tr><td></td></tr>
19906 </table>
19907
19908 !! html/php+tidy
19909 <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>
19910 <table style="&#95;_TOC&#95;_">
19911 <tbody><tr><td></td></tr>
19912 </tbody></table>
19913 !! html/parsoid
19914 <h2 id="a">a</h2>
19915 <table style="__TOC__"></table>
19916 !! end
19917
19918 # Known to produce bogus xml (extra </td>)
19919 # Don't add the html/php section since it generates broken HTML
19920 !! test
19921 Fuzz testing: Parser16
19922 !! wikitext
19923 {|
19924 !https://||||||
19925 !! html+tidy
19926 <table>
19927 <tbody><tr>
19928 <th>https://</th>
19929 <th></th>
19930 <th></th>
19931 <th>
19932
19933 </th></tr>
19934 </tbody></table>
19935 !! end
19936
19937 !! test
19938 Fuzz testing: Parser21
19939 !! wikitext
19940 {|
19941 !irc://{{ftp://a" onmouseover="alert('hello world');"
19942 |
19943 !! html
19944 <table>
19945 <tr>
19946 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19947 </th>
19948 <td>
19949 </td>
19950 </tr>
19951 </table>
19952
19953 !! end
19954
19955 !! test
19956 Fuzz testing: Parser22
19957 !! wikitext
19958 http://===r:::https://b
19959
19960 {|
19961 !! html
19962 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19963 </p>
19964 <table>
19965 <tr><td></td></tr>
19966 </table>
19967
19968 !! end
19969
19970 ## Remex doesn't account for fostered content.
19971 ## Known to produce bad XML for now
19972 !! test
19973 Fuzz testing: Parser24
19974 !! options
19975 parsoid=wt2html
19976 !! wikitext
19977 {|
19978 {{{|
19979 <u CLASS=
19980 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19981 <br style="onmouseover='alert(document.cookie);' " />
19982
19983 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19984 |
19985 !! html/php
19986 <table>
19987 {{{|
19988 <u class="&#124;">}}}} &gt;
19989 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19990
19991 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19992 <tr>
19993 <td></u>
19994 </td>
19995 </tr>
19996 </table>
19997
19998 !! html/php+tidy
19999
20000 {{{|
20001 <u class="&#124;">}}}} &gt;
20002 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
20003
20004 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
20005 </u><table><tbody><tr>
20006 <td>
20007 </td>
20008 </tr>
20009 </tbody></table><p><u class="&#124;">
20010 </u></p>
20011 !! html/parsoid
20012 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
20013 {{{|
20014 <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>"}'/>}}}} >
20015 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
20016
20017 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
20018 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
20019 !! end
20020
20021 # Note: the current result listed for this is not what the original one was,
20022 # but the original bug was JavaScript injection, which is fixed in any case.
20023 # It's not clear that the original result listed was any more correct than the
20024 # current one. Original result:
20025 # <p>{{{|
20026 # </p>
20027 # <li class="&#124;&#124;">
20028 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
20029 !!test
20030 Fuzz testing: Parser25 (T8055)
20031 !! wikitext
20032 {{{
20033 |
20034 <LI CLASS=||
20035 >
20036 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
20037 !! html/php
20038 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
20039 </p>
20040 !! html/parsoid
20041 <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"]}'>
20042 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
20043 !! end
20044
20045 !!test
20046 Fuzz testing: URL adjacent extension (with space, clean)
20047 !! wikitext
20048 http://example.com <nowiki>junk</nowiki>
20049 !! html/php
20050 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
20051 </p>
20052 !! html/parsoid
20053 <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>
20054 !! end
20055
20056 !!test
20057 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
20058 !! wikitext
20059 http://example.com<nowiki>junk</nowiki>
20060 !! html/php
20061 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
20062 </p>
20063 !! html/parsoid
20064 <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>
20065 !! end
20066
20067 !! test
20068 Fuzz testing: URL adjacent extension (no space, dirty; pre)
20069 !! wikitext
20070 http://example.com<pre>junk</pre>
20071 !! html/php
20072 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
20073
20074 !! html/php+tidy
20075 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
20076 !! html/parsoid
20077 <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>
20078 !! end
20079
20080 !! test
20081 Fuzz testing: image with bogus manual thumbnail
20082 !! wikitext
20083 [[Image:foobar.jpg|thumbnail= ]]
20084 !! html/php
20085 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
20086
20087 !! html/parsoid
20088 <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>
20089 !! end
20090
20091 # Parsoid will emit the newline literally in wt2wt; see next test case.
20092 !! test
20093 Fuzz testing: encoded newline in generated HTML replacements (T8577)
20094 !! options
20095 parsoid=wt2html
20096 !! wikitext
20097 <pre dir="&#10;"></pre>
20098 !! html/php
20099 <pre dir="&#10;"></pre>
20100
20101 !! html/parsoid
20102 <pre dir="
20103 " typeof="mw:Extension/pre" about="#mwt2"data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20104 !! end
20105
20106 !! test
20107 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
20108 !! options
20109 parsoid=html2wt
20110 !! html/parsoid
20111 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20112 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20113 !! wikitext
20114 <pre dir="
20115 "></pre>
20116 !! html/php
20117 <pre dir=""></pre>
20118
20119 !! end
20120
20121 !! test
20122 Templates in extension attributes are not expanded
20123 !! wikitext
20124 <pre dir="{{echo|ltr}}"></pre>
20125 !! html/php
20126 <pre dir="{{echo|ltr}}"></pre>
20127
20128 !! html/parsoid
20129 <pre dir="{{echo|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
20130 !! end
20131
20132 !! test
20133 Parsing optional HTML elements (T8171)
20134 !! options
20135 !! wikitext
20136 <table>
20137 <tr>
20138 <td> Some tabular data</td>
20139 <td> More tabular data ...
20140 <td> And yet som tabular data</td>
20141 </tr>
20142 </table>
20143 !! html
20144 <table>
20145 <tr>
20146 <td> Some tabular data</td>
20147 <td> More tabular data ...
20148 </td><td> And yet som tabular data</td>
20149 </tr>
20150 </table>
20151
20152 !! end
20153
20154 !! test
20155 Correct handling of <td>, <tr> (T8171)
20156 !! options
20157 !! wikitext
20158 <table>
20159 <tr>
20160 <td> Some tabular data</td>
20161 <td> More tabular data ...</td>
20162 <td> And yet som tabular data</td>
20163 </tr>
20164 </table>
20165 !! html
20166 <table>
20167 <tr>
20168 <td> Some tabular data</td>
20169 <td> More tabular data ...</td>
20170 <td> And yet som tabular data</td>
20171 </tr>
20172 </table>
20173
20174 !! end
20175
20176
20177 !! test
20178 Parsing crashing regression (fr:JavaScript)
20179 !! wikitext
20180 </body></x>
20181 !! html
20182 <p>&lt;/body&gt;&lt;/x&gt;
20183 </p>
20184 !! end
20185
20186 !! test
20187 Inline wiki vs wiki block nesting
20188 !! wikitext
20189 '''Bold paragraph
20190
20191 New wiki paragraph
20192 !! html
20193 <p><b>Bold paragraph</b>
20194 </p><p>New wiki paragraph
20195 </p>
20196 !! end
20197
20198 # FIXME: The current php output is documented
20199 # and desired output is the parsoid target.
20200 !! test
20201 Inline HTML vs wiki block nesting
20202 !! wikitext
20203 <b>Bold paragraph
20204
20205 New wiki paragraph
20206 !! html/php
20207 <p><b>Bold paragraph
20208 </p><p>New wiki paragraph</b>
20209 </p>
20210 !! html/php+tidy
20211 <p><b>Bold paragraph
20212 </b></p><p><b>New wiki paragraph
20213 </b></p>
20214 !! html/parsoid
20215 <p><b>Bold paragraph</b>
20216 </p><p>New wiki paragraph
20217 </p>
20218 !! end
20219
20220 # Original result was this:
20221 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20222 # </p>
20223 # While that might be marginally more intuitive, maybe, the six-apostrophe
20224 # construct is clearly pathological and the result stated here (which is what
20225 # the parser actually does) is about as reasonable as anything.
20226 !!test
20227 Mixing markup for italics and bold
20228 !! options
20229 !! wikitext
20230 '''bold''''''bold''bolditalics'''''
20231 !! html
20232 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20233 </p>
20234 !! end
20235
20236
20237 !! article
20238 Xyzzyx
20239 !! text
20240 Article for special page transclusion test
20241 !! endarticle
20242
20243 !! test
20244 Special page transclusion
20245 !! options
20246 !! wikitext
20247 {{Special:Prefixindex/Xyzzyx}}
20248 !! html
20249 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20250 </ul>
20251
20252 !! end
20253
20254 !! test
20255 Special page transclusion twice (T7021)
20256 !! options
20257 !! wikitext
20258 {{Special:Prefixindex/Xyzzyx}}
20259 {{Special:Prefixindex/Xyzzyx}}
20260 !! html
20261 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20262 </ul>
20263 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20264 </ul>
20265
20266 !! end
20267
20268 !! test
20269 Transclusion of default MediaWiki message
20270 !! wikitext
20271 {{MediaWiki:Mainpage}}
20272 !! html
20273 <p>Main Page
20274 </p>
20275 !! end
20276
20277 !! test
20278 Transclusion of nonexistent MediaWiki message
20279 !! wikitext
20280 {{MediaWiki:Mainpagexxx}}
20281 !! html
20282 <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>
20283 </p>
20284 !! end
20285
20286 !! test
20287 Transclusion of MediaWiki message with underscore
20288 !! wikitext
20289 {{MediaWiki:history_short}}
20290 !! html
20291 <p>History
20292 </p>
20293 !! end
20294
20295 !! test
20296 Transclusion of MediaWiki message with space
20297 !! wikitext
20298 {{MediaWiki:history short}}
20299 !! html
20300 <p>History
20301 </p>
20302 !! end
20303
20304 !! test
20305 Invalid header with following text
20306 !! wikitext
20307 = x = y
20308 !! html
20309 <p>= x = y
20310 </p>
20311 !! end
20312
20313
20314 !! test
20315 Section extraction test (section 0)
20316 !! options
20317 section=0
20318 !! wikitext
20319 start
20320 ==a==
20321 ===aa===
20322 ====aaa====
20323 ==b==
20324 ===ba===
20325 ===bb===
20326 ====bba====
20327 ===bc===
20328 ==c==
20329 ===ca===
20330 !! html/php
20331 start
20332 !! end
20333
20334 !! test
20335 Section extraction test (section 1)
20336 !! options
20337 section=1
20338 !! wikitext
20339 start
20340 ==a==
20341 ===aa===
20342 ====aaa====
20343 ==b==
20344 ===ba===
20345 ===bb===
20346 ====bba====
20347 ===bc===
20348 ==c==
20349 ===ca===
20350 !! html/php
20351 ==a==
20352 ===aa===
20353 ====aaa====
20354 !! end
20355
20356 !! test
20357 Section extraction test (section 2)
20358 !! options
20359 section=2
20360 !! wikitext
20361 start
20362 ==a==
20363 ===aa===
20364 ====aaa====
20365 ==b==
20366 ===ba===
20367 ===bb===
20368 ====bba====
20369 ===bc===
20370 ==c==
20371 ===ca===
20372 !! html/php
20373 ===aa===
20374 ====aaa====
20375 !! end
20376
20377 !! test
20378 Section extraction test (section 3)
20379 !! options
20380 section=3
20381 !! wikitext
20382 start
20383 ==a==
20384 ===aa===
20385 ====aaa====
20386 ==b==
20387 ===ba===
20388 ===bb===
20389 ====bba====
20390 ===bc===
20391 ==c==
20392 ===ca===
20393 !! html/php
20394 ====aaa====
20395 !! end
20396
20397 !! test
20398 Section extraction test (section 4)
20399 !! options
20400 section=4
20401 !! wikitext
20402 start
20403 ==a==
20404 ===aa===
20405 ====aaa====
20406 ==b==
20407 ===ba===
20408 ===bb===
20409 ====bba====
20410 ===bc===
20411 ==c==
20412 ===ca===
20413 !! html/php
20414 ==b==
20415 ===ba===
20416 ===bb===
20417 ====bba====
20418 ===bc===
20419 !! end
20420
20421 !! test
20422 Section extraction test (section 5)
20423 !! options
20424 section=5
20425 !! wikitext
20426 start
20427 ==a==
20428 ===aa===
20429 ====aaa====
20430 ==b==
20431 ===ba===
20432 ===bb===
20433 ====bba====
20434 ===bc===
20435 ==c==
20436 ===ca===
20437 !! html/php
20438 ===ba===
20439 !! end
20440
20441 !! test
20442 Section extraction test (section 6)
20443 !! options
20444 section=6
20445 !! wikitext
20446 start
20447 ==a==
20448 ===aa===
20449 ====aaa====
20450 ==b==
20451 ===ba===
20452 ===bb===
20453 ====bba====
20454 ===bc===
20455 ==c==
20456 ===ca===
20457 !! html/php
20458 ===bb===
20459 ====bba====
20460 !! end
20461
20462 !! test
20463 Section extraction test (section 7)
20464 !! options
20465 section=7
20466 !! wikitext
20467 start
20468 ==a==
20469 ===aa===
20470 ====aaa====
20471 ==b==
20472 ===ba===
20473 ===bb===
20474 ====bba====
20475 ===bc===
20476 ==c==
20477 ===ca===
20478 !! html/php
20479 ====bba====
20480 !! end
20481
20482 !! test
20483 Section extraction test (section 8)
20484 !! options
20485 section=8
20486 !! wikitext
20487 start
20488 ==a==
20489 ===aa===
20490 ====aaa====
20491 ==b==
20492 ===ba===
20493 ===bb===
20494 ====bba====
20495 ===bc===
20496 ==c==
20497 ===ca===
20498 !! html/php
20499 ===bc===
20500 !! end
20501
20502 !! test
20503 Section extraction test (section 9)
20504 !! options
20505 section=9
20506 !! wikitext
20507 start
20508 ==a==
20509 ===aa===
20510 ====aaa====
20511 ==b==
20512 ===ba===
20513 ===bb===
20514 ====bba====
20515 ===bc===
20516 ==c==
20517 ===ca===
20518 !! html/php
20519 ==c==
20520 ===ca===
20521 !! end
20522
20523 !! test
20524 Section extraction test (section 10)
20525 !! options
20526 section=10
20527 !! wikitext
20528 start
20529 ==a==
20530 ===aa===
20531 ====aaa====
20532 ==b==
20533 ===ba===
20534 ===bb===
20535 ====bba====
20536 ===bc===
20537 ==c==
20538 ===ca===
20539 !! html/php
20540 ===ca===
20541 !! end
20542
20543 !! test
20544 Section extraction test (nonexistent section 11)
20545 !! options
20546 section=11
20547 !! wikitext
20548 start
20549 ==a==
20550 ===aa===
20551 ====aaa====
20552 ==b==
20553 ===ba===
20554 ===bb===
20555 ====bba====
20556 ===bc===
20557 ==c==
20558 ===ca===
20559 !! html/php
20560 !! end
20561
20562 !! test
20563 Section extraction test with bogus heading (section 1)
20564 !! options
20565 section=1
20566 !! wikitext
20567 ==a==
20568 ==bogus== not a legal section
20569 ==b==
20570 !! html/php
20571 ==a==
20572 ==bogus== not a legal section
20573 !! end
20574
20575 !! test
20576 Section extraction test with bogus heading (section 2)
20577 !! options
20578 section=2
20579 !! wikitext
20580 ==a==
20581 ==bogus== not a legal section
20582 ==b==
20583 !! html/php
20584 ==b==
20585 !! end
20586
20587 !! test
20588 Section extraction test with comment after heading (section 1)
20589 !! options
20590 section=1
20591 !! wikitext
20592 ==a==
20593 ==b== <!-- -->
20594 ==c==
20595 !! html/php
20596 ==a==
20597 !! end
20598
20599 !! test
20600 Section extraction test with comment after heading (section 2)
20601 !! options
20602 section=2
20603 !! wikitext
20604 ==a==
20605 ==b== <!-- -->
20606 ==c==
20607 !! html/php
20608 ==b== <!-- -->
20609 !! end
20610
20611 !! test
20612 Section extraction test with bogus <nowiki> heading (section 1)
20613 !! options
20614 section=1
20615 !! wikitext
20616 ==a==
20617 ==bogus== <nowiki>not a legal section</nowiki>
20618 ==b==
20619 !! html/php
20620 ==a==
20621 ==bogus== <nowiki>not a legal section</nowiki>
20622 !! end
20623
20624 !! test
20625 Section extraction test with bogus <nowiki> heading (section 2)
20626 !! options
20627 section=2
20628 !! wikitext
20629 ==a==
20630 ==bogus== <nowiki>not a legal section</nowiki>
20631 ==b==
20632 !! html/php
20633 ==b==
20634 !! end
20635
20636 # Formerly testing for T4587, now resolved by the use of unmarked sections
20637 # instead of respecting commented sections
20638 !! test
20639 Section extraction prefixed by comment (section 1)
20640 !! options
20641 section=1
20642 !! wikitext
20643 <!-- -->==sec1==
20644 ==sec2==
20645 !! html/php
20646 ==sec2==
20647 !!end
20648
20649 !! test
20650 Section extraction prefixed by comment (section 2)
20651 !! options
20652 section=2
20653 !! wikitext
20654 <!-- -->==sec1==
20655 ==sec2==
20656 !! html/php
20657
20658 !!end
20659
20660 # Formerly testing for T4607, now resolved by the use of unmarked sections
20661 # instead of respecting HTML-style headings
20662 !! test
20663 Section extraction, mixed wiki and html (section 1)
20664 !! options
20665 section=1
20666 !! wikitext
20667 <h2>unmarked</h2>
20668 unmarked
20669 ==1==
20670 one
20671 ==2==
20672 two
20673 !! html/php
20674 ==1==
20675 one
20676 !! end
20677
20678 !! test
20679 Section extraction, mixed wiki and html (section 2)
20680 !! options
20681 section=2
20682 !! wikitext
20683 <h2>unmarked</h2>
20684 unmarked
20685 ==1==
20686 one
20687 ==2==
20688 two
20689 !! html/php
20690 ==2==
20691 two
20692 !! end
20693
20694
20695 # Formerly testing for T5342
20696 !! test
20697 Section extraction, heading surrounded by <noinclude>
20698 !! options
20699 section=1
20700 !! wikitext
20701 <noinclude>==unmarked==</noinclude>
20702 ==marked==
20703 !! html/php
20704 ==marked==
20705 !!end
20706
20707 # Test behavior of T21910
20708 !! test
20709 Sectiion with all-equals
20710 !! options
20711 section=2
20712 !! wikitext
20713 ===
20714 The line above must have a trailing space
20715 === <!--
20716 --> <!-- -->
20717 But just in case it doesn't...
20718 !! html/php
20719 === <!--
20720 --> <!-- -->
20721 But just in case it doesn't...
20722 !! end
20723
20724 !! test
20725 Section replacement test (section 0)
20726 !! options
20727 replace=0,"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 xxx
20742
20743 ==a==
20744 ===aa===
20745 ====aaa====
20746 ==b==
20747 ===ba===
20748 ===bb===
20749 ====bba====
20750 ===bc===
20751 ==c==
20752 ===ca===
20753 !! end
20754
20755 !! test
20756 Section replacement test (section 1)
20757 !! options
20758 replace=1,"xxx"
20759 !! wikitext
20760 start
20761 ==a==
20762 ===aa===
20763 ====aaa====
20764 ==b==
20765 ===ba===
20766 ===bb===
20767 ====bba====
20768 ===bc===
20769 ==c==
20770 ===ca===
20771 !! html/php
20772 start
20773 xxx
20774
20775 ==b==
20776 ===ba===
20777 ===bb===
20778 ====bba====
20779 ===bc===
20780 ==c==
20781 ===ca===
20782 !! end
20783
20784 !! test
20785 Section replacement test (section 2)
20786 !! options
20787 replace=2,"xxx"
20788 !! wikitext
20789 start
20790 ==a==
20791 ===aa===
20792 ====aaa====
20793 ==b==
20794 ===ba===
20795 ===bb===
20796 ====bba====
20797 ===bc===
20798 ==c==
20799 ===ca===
20800 !! html/php
20801 start
20802 ==a==
20803 xxx
20804
20805 ==b==
20806 ===ba===
20807 ===bb===
20808 ====bba====
20809 ===bc===
20810 ==c==
20811 ===ca===
20812 !! end
20813
20814 !! test
20815 Section replacement test (section 3)
20816 !! options
20817 replace=3,"xxx"
20818 !! wikitext
20819 start
20820 ==a==
20821 ===aa===
20822 ====aaa====
20823 ==b==
20824 ===ba===
20825 ===bb===
20826 ====bba====
20827 ===bc===
20828 ==c==
20829 ===ca===
20830 !! html/php
20831 start
20832 ==a==
20833 ===aa===
20834 xxx
20835
20836 ==b==
20837 ===ba===
20838 ===bb===
20839 ====bba====
20840 ===bc===
20841 ==c==
20842 ===ca===
20843 !! end
20844
20845 !! test
20846 Section replacement test (section 4)
20847 !! options
20848 replace=4,"xxx"
20849 !! wikitext
20850 start
20851 ==a==
20852 ===aa===
20853 ====aaa====
20854 ==b==
20855 ===ba===
20856 ===bb===
20857 ====bba====
20858 ===bc===
20859 ==c==
20860 ===ca===
20861 !! html/php
20862 start
20863 ==a==
20864 ===aa===
20865 ====aaa====
20866 xxx
20867
20868 ==c==
20869 ===ca===
20870 !! end
20871
20872 !! test
20873 Section replacement test (section 5)
20874 !! options
20875 replace=5,"xxx"
20876 !! wikitext
20877 start
20878 ==a==
20879 ===aa===
20880 ====aaa====
20881 ==b==
20882 ===ba===
20883 ===bb===
20884 ====bba====
20885 ===bc===
20886 ==c==
20887 ===ca===
20888 !! html/php
20889 start
20890 ==a==
20891 ===aa===
20892 ====aaa====
20893 ==b==
20894 xxx
20895
20896 ===bb===
20897 ====bba====
20898 ===bc===
20899 ==c==
20900 ===ca===
20901 !! end
20902
20903 !! test
20904 Section replacement test (section 6)
20905 !! options
20906 replace=6,"xxx"
20907 !! wikitext
20908 start
20909 ==a==
20910 ===aa===
20911 ====aaa====
20912 ==b==
20913 ===ba===
20914 ===bb===
20915 ====bba====
20916 ===bc===
20917 ==c==
20918 ===ca===
20919 !! html/php
20920 start
20921 ==a==
20922 ===aa===
20923 ====aaa====
20924 ==b==
20925 ===ba===
20926 xxx
20927
20928 ===bc===
20929 ==c==
20930 ===ca===
20931 !! end
20932
20933 !! test
20934 Section replacement test (section 7)
20935 !! options
20936 replace=7,"xxx"
20937 !! wikitext
20938 start
20939 ==a==
20940 ===aa===
20941 ====aaa====
20942 ==b==
20943 ===ba===
20944 ===bb===
20945 ====bba====
20946 ===bc===
20947 ==c==
20948 ===ca===
20949 !! html/php
20950 start
20951 ==a==
20952 ===aa===
20953 ====aaa====
20954 ==b==
20955 ===ba===
20956 ===bb===
20957 xxx
20958
20959 ===bc===
20960 ==c==
20961 ===ca===
20962 !! end
20963
20964 !! test
20965 Section replacement test (section 8)
20966 !! options
20967 replace=8,"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 xxx
20990
20991 ==c==
20992 ===ca===
20993 !!end
20994
20995 !! test
20996 Section replacement test (section 9)
20997 !! options
20998 replace=9,"xxx"
20999 !! wikitext
21000 start
21001 ==a==
21002 ===aa===
21003 ====aaa====
21004 ==b==
21005 ===ba===
21006 ===bb===
21007 ====bba====
21008 ===bc===
21009 ==c==
21010 ===ca===
21011 !! html/php
21012 start
21013 ==a==
21014 ===aa===
21015 ====aaa====
21016 ==b==
21017 ===ba===
21018 ===bb===
21019 ====bba====
21020 ===bc===
21021 xxx
21022 !! end
21023
21024 !! test
21025 Section replacement test (section 10)
21026 !! options
21027 replace=10,"xxx"
21028 !! wikitext
21029 start
21030 ==a==
21031 ===aa===
21032 ====aaa====
21033 ==b==
21034 ===ba===
21035 ===bb===
21036 ====bba====
21037 ===bc===
21038 ==c==
21039 ===ca===
21040 !! html/php
21041 start
21042 ==a==
21043 ===aa===
21044 ====aaa====
21045 ==b==
21046 ===ba===
21047 ===bb===
21048 ====bba====
21049 ===bc===
21050 ==c==
21051 xxx
21052 !! end
21053
21054 !! test
21055 Section replacement test with initial whitespace (T15728)
21056 !! options
21057 replace=2,"xxx"
21058 !! wikitext
21059 Preformatted initial line
21060 ==a==
21061 ===a===
21062 !! html/php
21063 Preformatted initial line
21064 ==a==
21065 xxx
21066 !! end
21067
21068
21069 !! test
21070 Section extraction, heading followed by pre with 20 spaces (T8398)
21071 !! options
21072 section=1
21073 !! wikitext
21074 ==a==
21075 a
21076 !! html/php
21077 ==a==
21078 a
21079 !! end
21080
21081 !! test
21082 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
21083 !! options
21084 section=1
21085 !! wikitext
21086 ==a==
21087 a
21088 !! html/php
21089 ==a==
21090 a
21091 !! end
21092
21093
21094 !! test
21095 Section extraction, <pre> around bogus header (T12309)
21096 !! options
21097 section=2
21098 !! wikitext
21099 == Section One ==
21100 <pre>
21101 =======
21102 </pre>
21103
21104 == Section Two ==
21105 stuff
21106 !! html/php
21107 == Section Two ==
21108 stuff
21109 !! end
21110
21111 !! test
21112 Section replacement, <pre> around bogus header (T12309)
21113 !! options
21114 replace=2,"xxx"
21115 !! wikitext
21116 == Section One ==
21117 <pre>
21118 =======
21119 </pre>
21120
21121 == Section Two ==
21122 stuff
21123 !! html/php
21124 == Section One ==
21125 <pre>
21126 =======
21127 </pre>
21128
21129 xxx
21130 !! end
21131
21132 !! test
21133 Handling of &#x0A; in URLs
21134 !! wikitext
21135 *irc://&#x0A;a
21136 !! html/php
21137 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21138
21139 !! html/parsoid
21140 <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>
21141 !! end
21142
21143 !! test
21144 Handling of %0A in URLs
21145 !! wikitext
21146 *irc://%0Aa
21147 !! html/php
21148 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21149
21150 !! html/parsoid
21151 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21152 !! end
21153
21154 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
21155 !! test
21156 5 quotes, code coverage +1 line
21157 !! options
21158 parsoid=wt2html
21159 !! wikitext
21160 '''''
21161 !! html/php
21162 !! html/parsoid
21163 <p><b><i></i></b></p>
21164 !! end
21165
21166 # same html as previous, but wikitext adjusted to match parsoid html2wt
21167 # note that wt2html and html2html will put the <i> before the <b>
21168 !! test
21169 5 quotes, code coverage +1 line w/ nowiki (1)
21170 !! options
21171 parsoid=wt2wt,html2wt
21172 !! wikitext
21173 '''''<nowiki/>'''''
21174 !! html/php
21175 <p><i></i>
21176 </p>
21177 !! html/parsoid
21178 <p><b><i></i></b></p>
21179 !! end
21180
21181 # same as previous, just swapping the <i> and <b>
21182 !! test
21183 5 quotes, code coverage +1 line w/ nowiki (2)
21184 !! wikitext
21185 '''''<nowiki/>'''''
21186 !! html/php
21187 <p><i></i>
21188 </p>
21189 !! html/parsoid
21190 <p><i><b></b></i></p>
21191 !! end
21192
21193 !! test
21194 Special:Search page linking.
21195 !! wikitext
21196 {{Special:search}}
21197 !! html
21198 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21199 </p>
21200 !! end
21201
21202 !! test
21203 {{!}} is a magic word
21204 !! wikitext
21205 {{!}} is a magic word there and {{!}} is still a magic word here
21206 | is not a magic word here but {{!}} is still a magic word here
21207 !! html/php
21208 <p>| is a magic word there and | is still a magic word here
21209 | is not a magic word here but | is still a magic word here
21210 </p>
21211 !! html/parsoid
21212 <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
21213 | 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>
21214 !! end
21215
21216 !! test
21217 Say the magic word
21218 !! options
21219 title=[[Parser test]]
21220 !! wikitext
21221 *{{PAGENAME}}
21222 *{{PAGENAMEE}}
21223 *{{FULLPAGENAME}}
21224 *{{FULLPAGENAMEE}}
21225 *{{BASEPAGENAME}}
21226 *{{BASEPAGENAMEE}}
21227 *{{SUBPAGENAME}}
21228 *{{SUBPAGENAMEE}}
21229 *{{ROOTPAGENAME}}
21230 *{{ROOTPAGENAMEE}}
21231 *{{TALKPAGENAME}}
21232 *{{TALKPAGENAMEE}}
21233 *{{SUBJECTPAGENAME}}
21234 *{{SUBJECTPAGENAMEE}}
21235 *{{NAMESPACEE}}
21236 *{{NAMESPACE}}
21237 *{{NAMESPACENUMBER}}
21238 *{{TALKSPACE}}
21239 *{{TALKSPACEE}}
21240 *{{SUBJECTSPACE}}
21241 *{{SUBJECTSPACEE}}
21242 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21243 !! html
21244 <ul><li>Parser test</li>
21245 <li>Parser_test</li>
21246 <li>Parser test</li>
21247 <li>Parser_test</li>
21248 <li>Parser test</li>
21249 <li>Parser_test</li>
21250 <li>Parser test</li>
21251 <li>Parser_test</li>
21252 <li>Parser test</li>
21253 <li>Parser_test</li>
21254 <li>Talk:Parser test</li>
21255 <li>Talk:Parser_test</li>
21256 <li>Parser test</li>
21257 <li>Parser_test</li>
21258 <li></li>
21259 <li></li>
21260 <li>0</li>
21261 <li>Talk</li>
21262 <li>Talk</li>
21263 <li></li>
21264 <li></li>
21265 <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>
21266
21267 !! end
21268 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21269
21270 !! test
21271 Gallery with valid attributes
21272 !! wikitext
21273 <gallery type="123" summary="345">
21274 File:File:Foobar.jpg
21275 </gallery>
21276 !! html/php
21277 <ul class="gallery mw-gallery-traditional" type="123">
21278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21279 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21280 <div class="gallerytext">
21281 </div>
21282 </div></li>
21283 </ul>
21284
21285 !! html/parsoid
21286 <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"}}'>
21287 <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>
21288 </ul>
21289 !! end
21290
21291 ## Parsoid thinks the "centre" here is a property, not a caption.
21292 !! test
21293 Gallery
21294 !! options
21295 parsoid={
21296 "modes": ["wt2html"],
21297 "nativeGallery": true
21298 }
21299 !! wikitext
21300 <gallery>
21301 image1.png |
21302 image2.gif|||||
21303
21304 image3|
21305 image4 |300px| centre
21306 image5.svg| http://///////
21307 [[x|xx]]]]
21308 * image6
21309 </gallery>
21310 !! html/php
21311 <ul class="gallery mw-gallery-traditional">
21312 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21313 <div class="thumb" style="height: 150px;">Image1.png</div>
21314 <div class="gallerytext">
21315 </div>
21316 </div></li>
21317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21318 <div class="thumb" style="height: 150px;">Image2.gif</div>
21319 <div class="gallerytext">
21320 </div>
21321 </div></li>
21322 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21323 <div class="thumb" style="height: 150px;">Image3</div>
21324 <div class="gallerytext">
21325 </div>
21326 </div></li>
21327 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21328 <div class="thumb" style="height: 150px;">Image4</div>
21329 <div class="gallerytext">
21330 <pre>centre
21331 </pre>
21332 </div>
21333 </div></li>
21334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21335 <div class="thumb" style="height: 150px;">Image5.svg</div>
21336 <div class="gallerytext">
21337 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21338 </p>
21339 </div>
21340 </div></li>
21341 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21342 <div class="thumb" style="height: 150px;">* image6</div>
21343 <div class="gallerytext">
21344 </div>
21345 </div></li>
21346 </ul>
21347
21348 !! html/parsoid
21349 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21350 <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>
21351 <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>
21352 <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>
21353 <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>
21354 <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>
21355 <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>
21356 </ul>
21357 !! end
21358
21359 !! test
21360 Gallery (with options, html)
21361 !! options
21362 parsoid={
21363 "modes": ["wt2html", "html2html"],
21364 "nativeGallery": true
21365 }
21366 !! wikitext
21367 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21368 File:Nonexistent.jpg|caption
21369 File:Nonexistent.jpg
21370 image:foobar.jpg|some '''caption''' [[Main Page]]
21371 image:foobar.jpg
21372 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21373 </gallery>
21374 !! html/php
21375 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21376 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21377 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21378 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21379 <div class="gallerytext">
21380 <p>caption
21381 </p>
21382 </div>
21383 </div></li>
21384 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21385 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21386 <div class="gallerytext">
21387 </div>
21388 </div></li>
21389 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21390 <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>
21391 <div class="gallerytext">
21392 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21393 </p>
21394 </div>
21395 </div></li>
21396 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21397 <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>
21398 <div class="gallerytext">
21399 </div>
21400 </div></li>
21401 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21402 <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>
21403 <div class="gallerytext">
21404 <p>blabla.
21405 </p>
21406 </div>
21407 </div></li>
21408 </ul>
21409
21410 !! html/parsoid
21411 <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":{}}'>
21412 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21413 <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>
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"></div></li>
21415 <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>
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"></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 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>
21418 </ul>
21419 !! end
21420
21421 !! test
21422 Gallery (with options, extsrc)
21423 !! options
21424 parsoid={
21425 "nativeGallery": false
21426 }
21427 !! wikitext
21428 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21429 File:Nonexistent.jpg|caption
21430 File:Nonexistent.jpg
21431 image:foobar.jpg|some '''caption''' [[Main Page]]
21432 image:foobar.jpg
21433 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21434 </gallery>
21435 !! html/php
21436 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21437 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21438 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21439 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21440 <div class="gallerytext">
21441 <p>caption
21442 </p>
21443 </div>
21444 </div></li>
21445 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21446 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21447 <div class="gallerytext">
21448 </div>
21449 </div></li>
21450 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21451 <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>
21452 <div class="gallerytext">
21453 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21454 </p>
21455 </div>
21456 </div></li>
21457 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21458 <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>
21459 <div class="gallerytext">
21460 </div>
21461 </div></li>
21462 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21463 <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>
21464 <div class="gallerytext">
21465 <p>blabla.
21466 </p>
21467 </div>
21468 </div></li>
21469 </ul>
21470
21471 !! html/parsoid
21472 <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"}}'>
21473 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21474 <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>
21475 <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>
21476 <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>
21477 <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>
21478 <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>
21479 </ul>
21480 !! end
21481
21482 !! test
21483 Gallery (without px units)
21484 !! wikitext
21485 <gallery widths="70" heights="40">
21486 File:Foobar.jpg
21487 </gallery>
21488 !! html/php
21489 <ul class="gallery mw-gallery-traditional">
21490 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21491 <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>
21492 <div class="gallerytext">
21493 </div>
21494 </div></li>
21495 </ul>
21496
21497 !! html/parsoid
21498 <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"}}'>
21499 <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>
21500 </ul>
21501 !! end
21502
21503 !! test
21504 Gallery (with invalid units)
21505 !! wikitext
21506 <gallery widths="70em" heights="40em">
21507 File:Foobar.jpg
21508 </gallery>
21509 !! html/php
21510 <ul class="gallery mw-gallery-traditional">
21511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21512 <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>
21513 <div class="gallerytext">
21514 </div>
21515 </div></li>
21516 </ul>
21517
21518 !! html/parsoid
21519 <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"}}'>
21520 <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>
21521 </ul>
21522 !! end
21523
21524 !! test
21525 Gallery with link that has fragment
21526 !! options
21527 parsoid={
21528 "modes": ["wt2html", "html2html"],
21529 "nativeGallery": true
21530 }
21531 !! wikitext
21532 <gallery>
21533 image:foobar.jpg|link=Main_Page
21534 image:foobar.jpg|link=Main_Page#section
21535 image:foobar.jpg|link=Main Page#section|caption
21536 </gallery>
21537 !! html/php
21538 <ul class="gallery mw-gallery-traditional">
21539 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21540 <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>
21541 <div class="gallerytext">
21542 </div>
21543 </div></li>
21544 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21545 <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>
21546 <div class="gallerytext">
21547 </div>
21548 </div></li>
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/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>
21551 <div class="gallerytext">
21552 <p>caption
21553 </p>
21554 </div>
21555 </div></li>
21556 </ul>
21557
21558 !! html/parsoid
21559 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21560 <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>
21561 <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>
21562 <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>
21563 </ul>
21564 !! end
21565
21566 !! test
21567 Gallery with template inside caption
21568 !! options
21569 parsoid={
21570 "nativeGallery": true
21571 }
21572 !! wikitext
21573 <gallery caption="{{echo|hi}}">
21574 File:Foobar.jpg|{{echo|ho}}
21575 </gallery>
21576 !! html/php
21577 <ul class="gallery mw-gallery-traditional">
21578 <li class='gallerycaption'>hi</li>
21579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21580 <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>
21581 <div class="gallerytext">
21582 <p>ho
21583 </p>
21584 </div>
21585 </div></li>
21586 </ul>
21587
21588 !! html/parsoid
21589 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21590 <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>
21591 <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>
21592 </ul>
21593 !! end
21594
21595 !! test
21596 Gallery with wikitext inside gallery caption
21597 !! wikitext
21598 <gallery caption="# List item
21599
21600 Text '''bold''' [[link]] {{ns:-1}}
21601
21602 [[File:Foobar.jpg|thumb|File in gallery caption]]">
21603 File:Foobar.jpg|Image caption
21604 </gallery>
21605 !! html/php
21606 <ul class="gallery mw-gallery-traditional">
21607 <li class='gallerycaption'># List item Text <b>bold</b> <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">link</a> Special <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>File in gallery caption</div></div></div></li>
21608 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21609 <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>
21610 <div class="gallerytext">
21611 <p>Image caption
21612 </p>
21613 </div>
21614 </div></li>
21615 </ul>
21616
21617 !! end
21618
21619 !! test
21620 Gallery with wikitext inside caption
21621 !! options
21622 parsoid={
21623 "nativeGallery": true
21624 }
21625 !! wikitext
21626 <gallery>
21627 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21628 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21629 </gallery>
21630 !! html/php
21631 <ul class="gallery mw-gallery-traditional">
21632 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21633 <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>
21634 <div class="gallerytext">
21635 <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>
21636 </p>
21637 </div>
21638 </div></li>
21639 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21640 <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>
21641 <div class="gallerytext">
21642 <p>This is a test template
21643 </p>
21644 </div>
21645 </div></li>
21646 </ul>
21647
21648 !! html/parsoid
21649 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21650 <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>
21651 <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>
21652 </ul>
21653 !! end
21654
21655 !! test
21656 Gallery (with showfilename option)
21657 !! options
21658 parsoid={
21659 "nativeGallery": true
21660 }
21661 !! wikitext
21662 <gallery showfilename="">
21663 File:Nonexistent.jpg|caption
21664 File:Nonexistent.jpg
21665 File:Foobar.jpg|some '''caption''' [[Main Page]]
21666 File:Foobar.jpg
21667 </gallery>
21668 !! html/php
21669 <ul class="gallery mw-gallery-traditional">
21670 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21671 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21672 <div class="gallerytext">
21673 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21674 caption
21675 </p>
21676 </div>
21677 </div></li>
21678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21679 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21680 <div class="gallerytext">
21681 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21682 </p>
21683 </div>
21684 </div></li>
21685 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21686 <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>
21687 <div class="gallerytext">
21688 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21689 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21690 </p>
21691 </div>
21692 </div></li>
21693 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21694 <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>
21695 <div class="gallerytext">
21696 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21697 </p>
21698 </div>
21699 </div></li>
21700 </ul>
21701
21702 !! html/parsoid
21703 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21704 <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>
21705 <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>
21706 <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>
21707 <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>
21708 </ul>
21709 !! end
21710
21711 ## Should Parsoid be preserving these variations? See T151367
21712 !! test
21713 Gallery (with namespace-less filenames)
21714 !! options
21715 parsoid={
21716 "modes": ["wt2html", "html2html"],
21717 "nativeGallery": true
21718 }
21719 !! wikitext
21720 <gallery>
21721 File:Nonexistent.jpg
21722 Nonexistent.jpg
21723 image:foobar.jpg
21724 foobar.jpg
21725 </gallery>
21726 !! html/php
21727 <ul class="gallery mw-gallery-traditional">
21728 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21729 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21730 <div class="gallerytext">
21731 </div>
21732 </div></li>
21733 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21734 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21735 <div class="gallerytext">
21736 </div>
21737 </div></li>
21738 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21739 <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>
21740 <div class="gallerytext">
21741 </div>
21742 </div></li>
21743 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21744 <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>
21745 <div class="gallerytext">
21746 </div>
21747 </div></li>
21748 </ul>
21749
21750 !! html/parsoid
21751 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21752 <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>
21753 <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>
21754 <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>
21755 <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>
21756 </ul>
21757 !! end
21758
21759 !! test
21760 Gallery override link with wikilink (T36852)
21761 !! options
21762 parsoid={
21763 "nativeGallery": true
21764 }
21765 !! wikitext
21766 <gallery>
21767 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21768 </gallery>
21769 !! html/php
21770 <ul class="gallery mw-gallery-traditional">
21771 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21772 <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>
21773 <div class="gallerytext">
21774 </div>
21775 </div></li>
21776 </ul>
21777
21778 !! html/parsoid
21779 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21780 <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>
21781 </ul>
21782 !! end
21783
21784 !! test
21785 Gallery override link with absolute external link (T36852)
21786 !! options
21787 parsoid={
21788 "nativeGallery": true
21789 }
21790 !! wikitext
21791 <gallery>
21792 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21793 </gallery>
21794 !! html/php
21795 <ul class="gallery mw-gallery-traditional">
21796 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21797 <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>
21798 <div class="gallerytext">
21799 </div>
21800 </div></li>
21801 </ul>
21802
21803 !! html/parsoid
21804 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21805 <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>
21806 </ul>
21807 !! end
21808
21809 !! test
21810 Gallery override link with absolute external link with LanguageConverter
21811 !! options
21812 language=zh
21813 !! wikitext
21814 <gallery>
21815 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21816 </gallery>
21817 !! html/php
21818 <ul class="gallery mw-gallery-traditional">
21819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21820 <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>
21821 <div class="gallerytext">
21822 <p>caption
21823 </p>
21824 </div>
21825 </div></li>
21826 </ul>
21827
21828 !! html/parsoid
21829 <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"}}'>
21830 <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>
21831 </ul>
21832 !! end
21833
21834 !! test
21835 Gallery override link with malicious javascript (T36852)
21836 !! options
21837 parsoid={
21838 "modes": ["wt2html", "html2html"],
21839 "nativeGallery": true
21840 }
21841 !! wikitext
21842 <gallery>
21843 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21844 </gallery>
21845 !! html/php
21846 <ul class="gallery mw-gallery-traditional">
21847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21848 <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>
21849 <div class="gallerytext">
21850 </div>
21851 </div></li>
21852 </ul>
21853
21854 !! html/parsoid
21855 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21856 <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>
21857 </ul>
21858 !! end
21859
21860 # Note that parsoid uses the invalid link as a caption, PHP does not.
21861 !! test
21862 Gallery with invalid title as link (T45964)
21863 !! options
21864 parsoid={
21865 "modes": ["wt2html", "html2html"],
21866 "nativeGallery": true
21867 }
21868 !! wikitext
21869 <gallery>
21870 File:Foobar.jpg|link=<
21871 </gallery>
21872 !! html/php
21873 <ul class="gallery mw-gallery-traditional">
21874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21875 <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>
21876 <div class="gallerytext">
21877 </div>
21878 </div></li>
21879 </ul>
21880
21881 !! html/parsoid
21882 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21883 <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>
21884 </ul>
21885 !! end
21886
21887 !! test
21888 Serialize gallery without attrs in data-mw
21889 !! options
21890 parsoid={
21891 "modes": ["html2wt"],
21892 "nativeGallery": true
21893 }
21894 !! html/parsoid
21895 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21896 <li class="gallerycaption">123</li>
21897 <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>
21898 </ul>
21899 !! wikitext
21900 <gallery caption="123">
21901 File:Test.png
21902 </gallery>
21903 !! end
21904
21905 !! test
21906 Gallery with class and style attributes
21907 !! options
21908 parsoid={
21909 "nativeGallery": true
21910 }
21911 !! wikitext
21912 <gallery class="center" style="text-align: center;">
21913 File:Foobar.jpg
21914 </gallery>
21915 !! html/php
21916 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21918 <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>
21919 <div class="gallerytext">
21920 </div>
21921 </div></li>
21922 </ul>
21923
21924 !! html/parsoid
21925 <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":{}}'>
21926 <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>
21927 </ul>
21928 !! end
21929
21930 !! test
21931 Gallery in slideshow mode
21932 !! options
21933 parsoid={
21934 "nativeGallery": true
21935 }
21936 !! wikitext
21937 <gallery mode="slideshow" showthumbnails="">
21938 File:Foobar.jpg
21939 </gallery>
21940 !! html/php
21941 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21943 <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>
21944 <div class="gallerytext">
21945 </div>
21946 </div></li>
21947 </ul>
21948
21949 !! html/parsoid
21950 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21951 <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>
21952 </ul>
21953 !! end
21954
21955 !! test
21956 Serialize gallery image captions on a line
21957 !! options
21958 parsoid={
21959 "modes": ["html2wt"],
21960 "nativeGallery": true
21961 }
21962 !! html/parsoid
21963 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21964 <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>
21965 <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>
21966 </ul>
21967 !! wikitext
21968 <gallery>
21969 File:Foobar.jpg| hi ho
21970 File:Foobar.jpg|hi<br />ho
21971 </gallery>
21972 !! end
21973
21974 !! test
21975 HTML Hex character encoding (spells the word "JavaScript")
21976 !! options
21977 parsoid=wt2html,wt2wt,html2html
21978 !! wikitext
21979 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21980 !! html/php
21981 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21982 </p>
21983 !! html/parsoid
21984 <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>
21985 !! end
21986
21987 !! test
21988 HTML Hex character encoding bogus encoding (T28437 regression check)
21989 !! wikitext
21990 &#xsee;&#XSEE;
21991 !! html
21992 <p>&amp;#xsee;&amp;#XSEE;
21993 </p>
21994 !! end
21995
21996 !! test
21997 HTML Hex character encoding mixed case
21998 !! options
21999 parsoid=wt2html,wt2wt,html2html
22000 !! wikitext
22001 &#xEE;&#Xee;
22002 !! html/php
22003 <p>&#xee;&#xee;
22004 </p>
22005 !! html/parsoid
22006 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
22007 !! end
22008
22009 # See: https://www.w3.org/TR/html5/syntax.html#character-references
22010 # Note that U+000C (form feed) is not a valid XML character, so
22011 # it is banned even though allowed in HTML5.
22012 !! test
22013 Illegal character references (T106578)
22014 !! wikitext
22015 ; Null: &#00;
22016 ; FF: &#xC;
22017 ; CR: &#xD;
22018 ; Control (low): &#8;
22019 ; Control (high): &#x7F; &#x9F;
22020 ; Surrogate: &#xD83D;&#xDCA9;
22021 ; This is an okay astral character: &#x1F4A9;
22022 !! html+tidy
22023 <dl><dt>Null</dt>
22024 <dd>&amp;#00;</dd>
22025 <dt>FF</dt>
22026 <dd>&amp;#xC;</dd>
22027 <dt>CR</dt>
22028 <dd>&amp;#xD;</dd>
22029 <dt>Control (low)</dt>
22030 <dd>&amp;#8;</dd>
22031 <dt>Control (high)</dt>
22032 <dd>&amp;#x7F; &amp;#x9F;</dd>
22033 <dt>Surrogate</dt>
22034 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
22035 <dt>This is an okay astral character</dt>
22036 <dd>&#x1f4a9;</dd></dl>
22037 !! end
22038
22039 !! test
22040 __FORCETOC__ override
22041 !! wikitext
22042 __NEWSECTIONLINK__
22043 __FORCETOC__
22044 !! html/php
22045 <p><br />
22046 </p>
22047 !! end
22048
22049 !! test
22050 ISBN code coverage
22051 !! wikitext
22052 ISBN 978-0-1234-56&#x20;789
22053 !! html/php
22054 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
22055 </p>
22056 !! html/parsoid
22057 <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>
22058 !! end
22059
22060 !! test
22061 ISBN followed by 5 spaces
22062 !! wikitext
22063 ISBN
22064 !! html
22065 <p>ISBN
22066 </p>
22067 !! end
22068
22069 !! test
22070 Double ISBN
22071 !! wikitext
22072 ISBN ISBN 1234567890
22073 !! html/php
22074 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22075 </p>
22076 !! html/parsoid
22077 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22078 !! end
22079
22080 # Uppercase X and lowercase x as well
22081 !! test
22082 ISBN with an X
22083 !! wikitext
22084 ISBN 3-462-04561-X
22085 ISBN 3-462-04561-x
22086 ISBN 080442957X
22087 ISBN 080442957x
22088 ISBN 978080442957X
22089 ISBN 978080442957x
22090 !! html/php
22091 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
22092 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
22093 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
22094 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
22095 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
22096 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
22097 </p>
22098 !! html/parsoid
22099 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
22100 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
22101 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
22102 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
22103 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
22104 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
22105 !! end
22106
22107 !! test
22108 ISBN with empty prefix (parsoid test)
22109 !! wikitext
22110 ISBN 1234567890
22111 !! html/php
22112 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22113 </p>
22114 !! html/parsoid
22115 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
22116 !! end
22117
22118 !! test
22119 T24905: <abbr> followed by ISBN followed by </a>
22120 !! wikitext
22121 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
22122 !! html/php
22123 <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>
22124 </p>
22125 !! html/parsoid
22126 <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>
22127 !! end
22128
22129 !! test
22130 Double RFC
22131 !! wikitext
22132 RFC RFC 1234
22133 !! html/php
22134 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
22135 </p>
22136 !! html/parsoid
22137 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
22138 !! end
22139
22140 !! test
22141 Double RFC with a wiki link
22142 !! wikitext
22143 RFC [[RFC 1234]]
22144 !! html/php
22145 <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>
22146 </p>
22147 !! html/parsoid
22148 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
22149 !! end
22150
22151 !! test
22152 RFC code coverage
22153 !! wikitext
22154 RFC 983&#x20;987
22155 !! html/php
22156 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
22157 </p>
22158 !! html/parsoid
22159 <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>
22160 !! end
22161
22162 !! test
22163 Centre-aligned image
22164 !! wikitext
22165 [[Image:foobar.jpg|centre]]
22166 !! html/php
22167 <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>
22168
22169 !! html/parsoid
22170 <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>
22171 !! end
22172
22173 !! test
22174 None-aligned image
22175 !! wikitext
22176 [[Image:foobar.jpg|none]]
22177 !! html/php
22178 <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>
22179
22180 !! html/parsoid
22181 <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>
22182 !! end
22183
22184 !! test
22185 Width + Height sized image (using px) (height is ignored)
22186 !! wikitext
22187 [[Image:foobar.jpg|640x480px]]
22188 !! html/php
22189 <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>
22190 </p>
22191 !! html/parsoid
22192 <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>
22193 !! end
22194
22195 !! test
22196 Width-sized image (using px, no following whitespace)
22197 !! wikitext
22198 [[Image:foobar.jpg|640px]]
22199 !! html/php
22200 <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>
22201 </p>
22202 !! html/parsoid
22203 <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>
22204 !! end
22205
22206 !! test
22207 Width-sized image (using px, with following whitespace - test regression from r39467)
22208 !! wikitext
22209 [[Image:foobar.jpg|640px ]]
22210 !! html/php
22211 <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>
22212 </p>
22213 !! html/parsoid
22214 <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>
22215 !!end
22216
22217 !! test
22218 Width-sized image (using px, with preceding whitespace - test regression from r39467)
22219 !! wikitext
22220 [[Image:foobar.jpg| 640px]]
22221 !! html/php
22222 <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>
22223 </p>
22224 !! html/parsoid
22225 <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>
22226 !! end
22227
22228 !! test
22229 Image with page parameter
22230 !! options
22231 djvu
22232 !! wikitext
22233 [[File:LoremIpsum.djvu|page=2]]
22234 !! html/php
22235 <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>
22236 </p>
22237 !! html/parsoid
22238 <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>
22239 !! end
22240
22241 !! test
22242 Another italics / bold test
22243 !! wikitext
22244 ''' ''x'
22245 !! html
22246 <pre>'<i> </i>x'
22247 </pre>
22248 !!end
22249
22250 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22251 !! test
22252 dt/dd/dl test
22253 !! wikitext
22254 :;;;::
22255 !! html/php
22256 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22257
22258 !! html/parsoid
22259 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22260
22261 !!end
22262
22263 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22264 !! test
22265 Images with the "|" character in the comment
22266 !! wikitext
22267 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22268 !! html/php
22269 <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>
22270
22271 !! html/parsoid
22272 <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>
22273 !! end
22274
22275 !! test
22276 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22277 !! wikitext
22278 <html><script>alert(1);</script></html>
22279 !! html
22280 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22281 </p>
22282 !! end
22283
22284 !! test
22285 HTML with raw HTML ($wgRawHtml==true)
22286 !! options
22287 wgRawHtml=1
22288 !! wikitext
22289 <html><script>alert(1);</script></html>
22290 !! html/php
22291 <p><script>alert(1);</script>
22292 </p>
22293 !! html/parsoid
22294 <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>
22295 !! end
22296
22297 !! test
22298 Parents of subpages, one level up
22299 !! options
22300 subpage title=[[Subpage test/L1/L2/L3]]
22301 !! wikitext
22302 [[../|L2]]
22303 !! html
22304 <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>
22305 </p>
22306 !! end
22307
22308
22309 !! test
22310 Parents of subpages, one level up, not named
22311 !! options
22312 subpage title=[[Subpage test/L1/L2/L3]]
22313 !! wikitext
22314 [[../]]
22315 !! html
22316 <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>
22317 </p>
22318 !! end
22319
22320
22321
22322 !! test
22323 Parents of subpages, two levels up
22324 !! options
22325 subpage title=[[Subpage test/L1/L2/L3]]
22326 !! wikitext
22327 [[../../|L1]]2
22328
22329 [[../../|L1]]l
22330 !! html
22331 <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
22332 </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>
22333 </p>
22334 !! end
22335
22336 !! test
22337 Parents of subpages, two levels up, without trailing slash or name.
22338 !! options
22339 subpage title=[[Subpage test/L1/L2/L3]]
22340 !! wikitext
22341 [[../..]]
22342 !! html
22343 <p>[[../..]]
22344 </p>
22345 !! end
22346
22347 !! test
22348 Parents of subpages, two levels up, with lots of extra trailing slashes.
22349 !! options
22350 subpage title=[[Subpage test/L1/L2/L3]]
22351 !! wikitext
22352 [[../../////]]
22353 !! html
22354 <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>
22355 </p>
22356 !! end
22357
22358 !! article
22359 Subpage test/L1/L2/L3Sibling
22360 !! text
22361 Sibling article
22362 !! endarticle
22363
22364 !! test
22365 Transclusion of a sibling page (one level up)
22366 !! options
22367 subpage title=[[Subpage test/L1/L2/L3]]
22368 !! wikitext
22369 {{../L3Sibling}}
22370 !! html
22371 <p>Sibling article
22372 </p>
22373 !! end
22374
22375 !! test
22376 Transclusion of a child page
22377 !! options
22378 subpage title=[[Subpage test/L1/L2]]
22379 !! wikitext
22380 {{/L3Sibling}}
22381 !! html
22382 <p>Sibling article
22383 </p>
22384 !! end
22385
22386 # This is wt2html only in Parsoid because we add <nowiki>
22387 # because of {{..}} and we don't expect to fix that to
22388 # eliminate the nowikis selective for {{..}} markup.
22389 !! test
22390 Non-transclusion because of too many up levels
22391 !! options
22392 subpage title=[[Subpage test/L1/L2/L3]]
22393 parsoid=wt2html
22394 !! wikitext
22395 {{../../../../More than parent}}
22396 !! html/php
22397 <p>{{../../../../More than parent}}
22398 </p>
22399 !! html/parsoid
22400 <p>{{../../../../More than parent}}</p>
22401 !! end
22402
22403 !! test
22404 Definition list code coverage
22405 !! wikitext
22406 ;title :def
22407 ;title :def
22408 ;title:def
22409 !! html/php
22410 <dl><dt>title</dt>
22411 <dd>def</dd>
22412 <dt>title</dt>
22413 <dd>def</dd>
22414 <dt>title</dt>
22415 <dd>def</dd></dl>
22416
22417 !! html/parsoid
22418 <dl><dt>title </dt><dd>def</dd>
22419 <dt>title </dt><dd>def</dd>
22420 <dt>title</dt><dd>def</dd></dl>
22421 !! end
22422
22423 !! test
22424 Don't fall for the self-closing div
22425 !! wikitext
22426 <div>hello world</div/>
22427 !! html
22428 <div>hello world</div>
22429
22430 !! end
22431
22432 !! test
22433 MSGNW magic word
22434 !! wikitext
22435 {{MSGNW:msg}}
22436 !! html/php
22437 <p>&#91;&#91;:Template:Msg&#93;&#93;
22438 </p>
22439 !! end
22440
22441 !! test
22442 RAW magic word
22443 !! wikitext
22444 {{RAW:QUERTY}}
22445 !! html
22446 <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>
22447 </p>
22448 !! end
22449
22450 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22451 !! test
22452 Always escape literal '>' in output, not just after '<'
22453 !! wikitext
22454 ><>
22455 !! html
22456 <p>&gt;&lt;&gt;
22457 </p>
22458 !! end
22459
22460 !! test
22461 Template caching
22462 !! wikitext
22463 {{Test}}
22464 {{Test}}
22465 !! html
22466 <p>This is a test template
22467 This is a test template
22468 </p>
22469 !! end
22470
22471
22472 !! article
22473 MediaWiki:Fake
22474 !! text
22475 ==header==
22476 !! endarticle
22477
22478 !! test
22479 Inclusion of !userCanEdit() content
22480 !! wikitext
22481 {{MediaWiki:Fake}}
22482 !! html
22483 <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>
22484
22485 !! end
22486
22487
22488 !! test
22489 Out-of-order TOC heading levels
22490 !! wikitext
22491 ==2==
22492 ======6======
22493 ===3===
22494 =1=
22495 =====5=====
22496 ==2==
22497 !! html
22498 <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>
22499 <ul>
22500 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22501 <ul>
22502 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22503 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22504 </ul>
22505 </li>
22506 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22507 <ul>
22508 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22509 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22510 </ul>
22511 </li>
22512 </ul>
22513 </div>
22514
22515 <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>
22516 <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>
22517 <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>
22518 <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>
22519 <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>
22520 <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>
22521
22522 !! end
22523
22524
22525 !! test
22526 ISBN with a dummy number
22527 !! wikitext
22528 ISBN ---
22529 !! html
22530 <p>ISBN ---
22531 </p>
22532 !! end
22533
22534
22535 !! test
22536 ISBN with space-delimited number
22537 !! wikitext
22538 ISBN 92 9017 032 8
22539 !! html/php
22540 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22541 </p>
22542 !! html/parsoid
22543 <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>
22544 !! end
22545
22546
22547 !! test
22548 ISBN with multiple spaces, no number
22549 !! wikitext
22550 ISBN foo
22551 !! html
22552 <p>ISBN foo
22553 </p>
22554 !! end
22555
22556
22557 !! test
22558 ISBN length
22559 !! wikitext
22560 ISBN 123456789
22561
22562 ISBN 1234567890
22563
22564 ISBN 12345678901
22565 !! html/php
22566 <p>ISBN 123456789
22567 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22568 </p><p>ISBN 12345678901
22569 </p>
22570 !! html/parsoid
22571 <p>ISBN 123456789</p>
22572
22573 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22574
22575 <p>ISBN 12345678901</p>
22576 !! end
22577
22578
22579 !! test
22580 ISBN with trailing year (T9110)
22581 !! wikitext
22582 ISBN 1-234-56789-0 - 2006
22583
22584 ISBN 1 234 56789 0 - 2006
22585 !! html/php
22586 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22587 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22588 </p>
22589 !! html/parsoid
22590 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22591
22592 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22593 !! end
22594
22595
22596 !! test
22597 anchorencode
22598 !! config
22599 wgFragmentMode=[ 'html5', 'legacy' ]
22600 !! wikitext
22601 {{anchorencode:foo bar©#%n}}
22602 !! html/php
22603 <p>foo_bar©#%n
22604 </p>
22605 !! html/parsoid
22606 <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>
22607 !! end
22608
22609 !! test
22610 anchorencode (legacy)
22611 !! config
22612 wgFragmentMode=[ 'legacy' ]
22613 !! wikitext
22614 {{anchorencode:foo bar©#%n}}
22615 !! html/php
22616 <p>foo_bar.C2.A9.23.25n
22617 </p>
22618 !! end
22619
22620 !! test
22621 anchorencode trims spaces
22622 !! config
22623 wgFragmentMode=[ 'html5', 'legacy' ]
22624 !! wikitext
22625 {{anchorencode: __pretty__please__}}
22626 !! html/php
22627 <p>pretty_please
22628 </p>
22629 !! html/parsoid
22630 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22631 !! end
22632
22633 !! test
22634 anchorencode deals with links
22635 !! config
22636 wgFragmentMode=[ 'html5', 'legacy' ]
22637 !! wikitext
22638 {{anchorencode: [[hello|world]] [[hi]]}}
22639 !! html/php
22640 <p>world_hi
22641 </p>
22642 !! html/parsoid
22643 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22644 !! end
22645
22646 !! test
22647 anchorencode deals with templates
22648 !! config
22649 wgFragmentMode=[ 'html5', 'legacy' ]
22650 !! wikitext
22651 {{anchorencode: {{Foo}} x}}
22652 !! html/php
22653 <p>FOO_x
22654 </p>
22655 !! html/parsoid
22656 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22657 !! end
22658
22659 !! test
22660 anchorencode encodes like the TOC generator: (T20431)
22661 !! config
22662 wgFragmentMode=[ 'html5', 'legacy' ]
22663 !! wikitext
22664 ===_ +:.3A%3A _ &&amp;]] x===
22665 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22666 __NOEDITSECTION__
22667 !! html/php
22668 <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>
22669 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22670 </p>
22671 !! html/parsoid
22672 <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>
22673 <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>
22674 <meta property="mw:PageProp/noeditsection"/>
22675 !! end
22676
22677 !! test
22678 anchorencode encodes like the TOC generator: (T20431) (legacy)
22679 !! config
22680 wgFragmentMode=[ 'legacy' ]
22681 !! wikitext
22682 ===_ +:.3A%3A&&amp;]]===
22683 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22684 __NOEDITSECTION__
22685 !! html/php
22686 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22687 <p>.2B:.3A.253A.26.26.5D.5D
22688 </p>
22689 !! end
22690
22691 !! test
22692 T8200: blockquotes and paragraph formatting
22693 !! wikitext
22694 <blockquote>
22695 foo
22696 </blockquote>
22697
22698 bar
22699
22700 baz
22701 !! html
22702 <blockquote>
22703 <p>foo
22704 </p>
22705 </blockquote>
22706 <p>bar
22707 </p>
22708 <pre>baz
22709 </pre>
22710 !! end
22711
22712 !! test
22713 T10293: Use of center tag ruins paragraph formatting
22714 !! wikitext
22715 <center>
22716 foo
22717 </center>
22718
22719 bar
22720
22721 baz
22722 !! html
22723 <center>
22724 <p>foo
22725 </p>
22726 </center>
22727 <p>bar
22728 </p>
22729 <pre>baz
22730 </pre>
22731 !! end
22732
22733 !!test
22734 Parsing of overlapping (improperly nested) inline html tags
22735 !! wikitext
22736 <span><s>x</span></s>
22737 !! html/php
22738 <p><span><s>x&lt;/span&gt;</s></span>
22739 </p>
22740 !! html/parsoid
22741 <p><span><s>x</s></span>
22742 </p>
22743 !!end
22744
22745 ###
22746 ### Language variants related tests
22747 ###
22748
22749 # Parsoid does not mark self-links.
22750 # Parsoid does not convert links; PHP will do any necessary redirects.
22751
22752 !! test
22753 Self-link in language variants
22754 !! options
22755 title=[[Dunav]] language=sr
22756 !! wikitext
22757 Both [[Dunav]] and [[Дунав]] are names for this river.
22758 !! html/php
22759 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22760 </p>
22761 !! html/parsoid
22762 <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>
22763 !! end
22764
22765 !! article
22766 Дуна
22767 !! text
22768 content
22769 !! endarticle
22770
22771 !! test
22772 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22773 !! options
22774 title=[[Duna]] language=sr
22775 !! wikitext
22776 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22777 !! html/php
22778 <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.
22779 </p>
22780 !! html/parsoid
22781 <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>
22782 !! end
22783
22784 !! test
22785 Link to a section of a variant of this title shouldn't be parsed as self-link
22786 !! options
22787 title=[[Duna]] language=sr
22788 !! wikitext
22789 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22790 !! html/php
22791 <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.
22792 </p>
22793 !! html/parsoid
22794 <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>
22795 !! end
22796
22797 !! test
22798 Link to pages in language variants
22799 !! options
22800 language=sr
22801 !! wikitext
22802 Main Page can be written as [[Маин Паге]]
22803 !! html/php
22804 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22805 </p>
22806 !! html/parsoid
22807 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22808 !! end
22809
22810
22811 !! test
22812 Multiple links to pages in language variants
22813 !! options
22814 language=sr
22815 !! wikitext
22816 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22817 !! html/php
22818 <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>.
22819 </p>
22820 !! html/parsoid
22821 <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>
22822 !! end
22823
22824
22825 !! test
22826 Simple template in language variants
22827 !! options
22828 language=sr
22829 !! wikitext
22830 {{тест}}
22831 !! html/php
22832 <p>This is a test template
22833 </p>
22834 !! end
22835
22836
22837 !! test
22838 Template with explicit namespace in language variants
22839 !! options
22840 language=sr
22841 !! wikitext
22842 {{Template:тест}}
22843 !! html/php
22844 <p>This is a test template
22845 </p>
22846 !! end
22847
22848
22849 !! test
22850 Basic test for template parameter in language variants
22851 !! options
22852 language=sr
22853 !! wikitext
22854 {{парамтест|param=foo}}
22855 !! html/php
22856 <p>This is a test template with parameter foo
22857 </p>
22858 !! end
22859
22860 !! test
22861 Simple category in language variants
22862 !! options
22863 language=sr cat
22864 !! wikitext
22865 [[Category:МедиаWики Усер'с Гуиде]]
22866 !! html/php
22867 cat=МедиаWики_Усер'с_Гуиде sort=
22868 !! html/parsoid
22869 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22870 !! end
22871
22872 !! article
22873 Category:分类
22874 !! text
22875 blah
22876 !! endarticle
22877
22878 !! article
22879 Category:分類
22880 !! text
22881 blah
22882 !! endarticle
22883
22884 ## We used to, but no longer wt2wt this test since the default serializer
22885 ## will normalize all categories to serialize on their own line.
22886 ## This wikitext usage is going to be fairly uncommon in production and
22887 ## selser will take care of preserving formatting in those scenarios.
22888 !! test
22889 Don't convert blue categorylinks to another variant (T35210)
22890 !! options
22891 cat
22892 language=zh
22893 parsoid=wt2html
22894 !! wikitext
22895 [[A]][[Category:分类]]
22896 !! html/php
22897 cat=分类 sort=
22898 !! html/parsoid
22899 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22900 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22901 !! end
22902
22903 !! test
22904 Stripping -{}- tags (language variants)
22905 !! options
22906 language=sr
22907 !! wikitext
22908 Latin proverb: -{Ne nuntium necare}-
22909 !! html/php
22910 <p>Latin proverb: Ne nuntium necare
22911 </p>
22912 !! html/parsoid
22913 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22914 !! end
22915
22916
22917 !! test
22918 Prevent conversion with -{}- tags (language variants)
22919 !! options
22920 language=sr variant=sr-ec
22921 !! wikitext
22922 Latinski: -{Ne nuntium necare}-
22923 !! html/php
22924 <p>Латински: Ne nuntium necare
22925 </p>
22926 !! html/parsoid
22927 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22928 !! end
22929
22930
22931 !! test
22932 Prevent conversion of text with -{}- tags (language variants)
22933 !! options
22934 language=sr variant=sr-ec
22935 !! wikitext
22936 Latinski: -{Ne nuntium necare}-
22937 !! html/php
22938 <p>Латински: Ne nuntium necare
22939 </p>
22940 !! html/parsoid
22941 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22942 !! end
22943
22944
22945 !! test
22946 Prevent conversion of links with -{}- tags (language variants)
22947 !! options
22948 language=sr variant=sr-ec
22949 !! wikitext
22950 -{[[Main Page]]}-
22951 !! html/php
22952 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22953 </p>
22954 !! html/parsoid
22955 <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>
22956 !! end
22957
22958
22959 !! test
22960 -{}- tags within headlines (within html for parserConvert())
22961 !! config
22962 wgFragmentMode=[ 'html5', 'legacy' ]
22963 !! options
22964 language=sr variant=sr-ec
22965 !! wikitext
22966 ==-{Naslov}-==
22967
22968 Note that even an unprotected headline ID is not affected by language
22969 conversion:
22970
22971 ==Latinski==
22972 !! html/php
22973 <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>
22974 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22975 цонверсион:
22976 </p>
22977 <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>
22978
22979 !! html/parsoid
22980 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22981
22982 <p>Note that even an unprotected headline ID is not affected by language
22983 conversion:</p>
22984
22985 <h2 id="Latinski">Latinski</h2>
22986 !! end
22987
22988 !! test
22989 Explicit definition of language variant alternatives
22990 !! options
22991 language=zh variant=zh-tw
22992 !! wikitext
22993 -{zh:China;zh-tw:Taiwan}-, not China
22994 !! html/php
22995 <p>Taiwan, not China
22996 </p>
22997 !! html/parsoid
22998 <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>
22999 !! end
23000
23001 !! test
23002 Explicit definition of language variant alternatives (BCP 47 codes)
23003 !! options
23004 language=zh variant=zh-tw
23005 !! wikitext
23006 -{zh:China;zh-Hant-TW:Taiwan}-, not China
23007 !! html/php
23008 <p>Taiwan, not China
23009 </p>
23010 !! html/parsoid
23011 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-Hant-TW","t":"Taiwan"}]}'></span>, not China</p>
23012 !! end
23013
23014 !! test
23015 Filter syntax for language variants
23016 !! options
23017 language=zh variant=zh-tw
23018 !! wikitext
23019 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
23020 !! html/php
23021 <p>fooblog, WEBJOURNAL, WEBLOGquux
23022 </p>
23023 !! html/parsoid
23024 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
23025 !! end
23026
23027 # Note that Parsoid post-processing for language variants needs to
23028 # update the `title` attribute here, based on the mw:ExpandedAttrs property
23029 !! test
23030 Conversion around HTML tags
23031 !! options
23032 language=sr variant=sr-ec
23033 !! wikitext
23034 -{H|span=>sr-ec:script;title=>sr-ec:src}-
23035 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
23036 !! html/php
23037 <p>
23038 <span title="ЛаCтин">ски</span>
23039 </p>
23040 !! html/parsoid
23041 <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"}]}'/>
23042 <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>
23043 !! end
23044
23045 !! test
23046 Explicit session-wise two-way language variant mapping (A flag and - flag)
23047 !! options
23048 language=zh variant=zh-tw
23049 !! wikitext
23050 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
23051
23052 Taiwan is not China.
23053
23054 But -{A|zh:China; zh-tw:Taiwan}- is China,
23055
23056 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
23057
23058 and -{China}- is China.
23059 !! html/php
23060 <p>This is Taiwan, but we'll forget that now.
23061 </p><p>Taiwan is not China.
23062 </p><p>But Taiwan is Taiwan,
23063 </p><p>(This should be stripped!)
23064 </p><p>and China is China.
23065 </p>
23066 !! html/parsoid
23067 <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>
23068 <p>Taiwan is not China.</p>
23069 <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>
23070 <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>
23071 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
23072 !! end
23073
23074 !! test
23075 Explicit session-wise one-way language variant mapping (A flag and - flag)
23076 !! options
23077 language=zh variant=zh-tw
23078 !! wikitext
23079 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
23080
23081 COUNTRY is China or Taiwan.
23082
23083 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
23084
23085 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23086
23087 and -{COUNTRY}- is COUNTRY.
23088 !! html/php
23089 <p>This is Taiwan, but we'll forget that now.
23090 </p><p>COUNTRY is China or Taiwan.
23091 </p><p>But Taiwan is Taiwan,
23092 </p><p>(This should be stripped!)
23093 </p><p>and COUNTRY is COUNTRY.
23094 </p>
23095 !! html/parsoid
23096 <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>
23097 <p>COUNTRY is China or Taiwan.</p>
23098 <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>
23099 <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>
23100 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
23101 !! end
23102
23103 !! test
23104 Explicit session-wise two-way language variant mapping (H flag for hide)
23105 !! options
23106 language=zh variant=zh-tw
23107 !! wikitext
23108 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
23109
23110 Taiwan is China.
23111 !! html/php
23112 <p>(This should be stripped!)
23113 </p><p>Taiwan is Taiwan.
23114 </p>
23115 !! html/parsoid
23116 <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>
23117 <p>Taiwan is China.</p>
23118 !! end
23119
23120 !! test
23121 Explicit session-wise one-way language variant mapping (H flag for hide)
23122 !! options
23123 language=zh variant=zh-tw
23124 !! wikitext
23125 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23126
23127 COUNTRY is Taiwan or China.
23128 !! html/php
23129 <p>(This should be stripped!)
23130 </p><p>Taiwan is Taiwan or China.
23131 </p>
23132 !! html/parsoid
23133 <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>
23134 <p>COUNTRY is Taiwan or China.</p>
23135 !! end
23136
23137 ## Note that parsoid test runner does not support 'showtitle' option.
23138 !! test
23139 Adding explicit conversion rule for title (T flag)
23140 !! options
23141 language=zh variant=zh-tw showtitle
23142 !! wikitext
23143 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
23144
23145 Taiwan is China.
23146 !! html/php
23147 Taiwan
23148 <p>Should be stripped!
23149 </p><p>Taiwan is China.
23150 </p>
23151 !! html/parsoid
23152 <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>
23153 <p>Taiwan is China.</p>
23154 !! end
23155
23156 !! test
23157 Code coverage: T combined with H flag
23158 !! options
23159 language=zh variant=zh-tw showtitle
23160 !! wikitext
23161 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
23162
23163 Taiwan is China.
23164 !! html/php
23165 Taiwan
23166 <p>Should be stripped!
23167 </p><p>Taiwan is Taiwan.
23168 </p>
23169 !! html/parsoid
23170 <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>
23171 <p>Taiwan is China.</p>
23172 !! end
23173
23174 !! test
23175 Code coverage: T with no variants
23176 !! options
23177 language=zh variant=zh-tw showtitle
23178 !! wikitext
23179 -{H|zh:China; zh-tw:Taiwan}-
23180 Taiwan is China.-{T|Taiwan is China}-
23181 !! html/php
23182 Taiwan is China
23183 <p>
23184 Taiwan is Taiwan.
23185 </p>
23186 !! html/parsoid
23187 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23188 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
23189 !! end
23190
23191 !! test
23192 Code coverage: rules with no variants
23193 !! options
23194 language=zh variant=zh-tw
23195 !! wikitext
23196 -{H|zh:China; zh-tw:Taiwan}-
23197 Taiwan is China.
23198 -{H|China}-
23199 Taiwan is China.
23200 !! html/php
23201 <p>
23202 Taiwan is Taiwan.
23203
23204 Taiwan is China.
23205 </p>
23206 !! html/parsoid
23207 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23208 Taiwan is China.
23209 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23210 Taiwan is China.</p>
23211 !! end
23212
23213
23214 !! test
23215 Code coverage: D flag for conversion rule
23216 !! options
23217 language=zh variant=zh-tw
23218 !! wikitext
23219 -{D|zh-cn:XA; zh-tw:YA}-
23220 -{A;D|zh-cn:XB; zh-tw:YB}-
23221 -{D;H|zh-cn:XC; zh-tw:YC}-
23222
23223 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23224
23225 -{D|0=>zh-tw:1}-
23226 -{A;D|2=>zh-tw:3}-
23227 -{D;H|4=>zh-tw:5}-
23228
23229 XA XB XC YA YB YC FOO BAR BAT 012345
23230 !! html/php
23231 <p>大陆:XA;台灣:YA;
23232
23233 大陆:XC;台灣:YC;
23234 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23235 </p><p>0⇒台灣:1;
23236
23237 4⇒台灣:5;
23238 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23239 </p>
23240 !! html/parsoid
23241 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23242 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23243 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23244 <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>
23245 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23246 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23247 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23248 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23249 !! end
23250
23251 !! test
23252 Code coverage: N flag for conversion rule
23253 !! options
23254 language=zh variant=zh-cn
23255 !! wikitext
23256 -{N|zh-cn}-
23257
23258 -{N|zh-tw}-
23259
23260 -{N|sr-ec}-
23261 !! html/php
23262 <p>大陆
23263 </p><p>台灣
23264 </p><p>српски (ћирилица)‎
23265 </p>
23266 !! html/parsoid
23267 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23268 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23269 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23270 !! end
23271
23272 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23273 !! test
23274 Code coverage: N flag for conversion rule (wt2html only)
23275 !! options
23276 language=zh variant=zh-cn
23277 parsoid=wt2html,html2html
23278 !! wikitext
23279 -{D;N|en}-
23280 !! html/php
23281 <p>English
23282 </p>
23283 !! html/parsoid
23284 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23285 !! end
23286
23287 !! test
23288 Testing that changing the language variant here in the tests actually works
23289 !! options
23290 language=zh variant=zh showtitle
23291 !! wikitext
23292 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23293 !! html/php
23294 China
23295 <p>Should be stripped!
23296 </p>
23297 !! html/parsoid
23298 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23299 !! end
23300
23301 !! test
23302 Recursive conversion of alt and title attrs shouldn't clear converter state
23303 !! options
23304 language=zh variant=zh-cn
23305 showtitle
23306 !! wikitext
23307 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23308 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23309 !! html/php
23310 China
23311 <p>
23312 Should be stripped<span title="Exclamation">!</span>
23313 </p>
23314 !! html/parsoid
23315 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23316 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>
23317 !! end
23318
23319 !! test
23320 T26072: more test on conversion rule for title
23321 !! options
23322 language=zh variant=zh-tw showtitle
23323 !! wikitext
23324 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23325
23326 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23327 !! html/php
23328 Taiwan
23329 <p>This should be stripped!
23330 </p><p>This won't take interferes with the title rule.
23331 </p>
23332 !! html/parsoid
23333 <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>
23334 <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>
23335 !! end
23336
23337 !! test
23338 Partly disable title conversion if variant == main language code
23339 !! options
23340 language=zh variant=zh title=[[ZH]] showtitle
23341 !! wikitext
23342 -{T|zh-cn:CN;zh-tw:TW}-
23343 !! html/php
23344 ZH
23345 <p>
23346 </p>
23347 !! html/parsoid
23348 <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>
23349 !! end
23350
23351 !! test
23352 Partly disable title conversion if variant == main language code, more
23353 !! options
23354 language=zh variant=zh title=[[ZH]] showtitle
23355 !! wikitext
23356 -{T|TW}-
23357 !! html/php
23358 ZH
23359 <p>
23360 </p>
23361 !! html/parsoid
23362 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23363 !! end
23364
23365 !! test
23366 Raw output of variant escape tags (R flag)
23367 !! options
23368 language=zh variant=zh-tw
23369 !! wikitext
23370 Raw: -{R|zh:China;zh-tw:Taiwan}-
23371 !! html/php
23372 <p>Raw: zh:China;zh-tw:Taiwan
23373 </p>
23374 !! html/parsoid
23375 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23376 !! end
23377
23378 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23379 !! test
23380 Raw output of variant escape tags (R flag) (wt2html only)
23381 !! options
23382 language=zh variant=zh-tw
23383 parsoid=wt2html,html2html
23384 !! wikitext
23385 -{Variant}- -{D|syntax}- -{D;R|options}-
23386 !! html/php
23387 <p>Variant syntax options
23388 </p>
23389 !! html/parsoid
23390 <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>
23391 !! end
23392
23393 !! test
23394 Nested markup inside raw output of variant escape tags (R flag)
23395 !! options
23396 language=zh variant=zh-tw
23397 !! wikitext
23398 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23399 !! html/php
23400 <p>Nested raw: nested Taiwan nested
23401 </p>
23402 !! html/parsoid
23403 <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>
23404 !! end
23405
23406 !! test
23407 Nested markup and spaces inside raw output of variant escape tags (R flag)
23408 !! options
23409 language=zh variant=zh-tw
23410 !! wikitext
23411 X-{ outer -{ inner }- outer }-X
23412 !! html/php
23413 <p>X outer inner outer X
23414 </p>
23415 !! html/parsoid
23416 <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>
23417 !! end
23418
23419 !! test
23420 Templates inside raw output of variant escape tags (R flag)
23421 !! options
23422 language=zh variant=zh-tw
23423 !! wikitext
23424 Nested raw: -{R|nested {{echo|hi}} templates}-
23425 !! html/php
23426 <p>Nested raw: nested hi templates
23427 </p>
23428 !! html/parsoid
23429 <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>
23430 !! end
23431
23432 !! test
23433 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23434 !! options
23435 language=zh variant=zh-cn
23436 !! wikitext
23437 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23438 !! html/php
23439 <p>0
23440 </p>
23441 !! html/parsoid
23442 <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>
23443 !! end
23444
23445 !! test
23446 Conversion rules from [numeric-only string] to [something else] (T48634)
23447 !! options
23448 language=zh variant=zh-cn
23449 !! wikitext
23450 -{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
23451 !! html/php
23452 <p>D12345EE12345
23453 </p>
23454 !! html/parsoid
23455 <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>
23456 !! end
23457
23458 !! test
23459 Two-way converter rule entries with an empty value should be ignored (T53551)
23460 !! options
23461 language=zh variant=zh-cn
23462 !! wikitext
23463 -{H|zh-cn:foo;zh-tw:;}-foobar
23464 !! html/php
23465 <p>foobar
23466 </p>
23467 !! html/parsoid
23468 <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>
23469 !! end
23470
23471 !! test
23472 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23473 !! options
23474 language=zh variant=zh-cn
23475 !! wikitext
23476 -{H|=>zh-cn:foo;}-foobar
23477 !! html/php
23478 <p>foobar
23479 </p>
23480 !! html/parsoid
23481 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23482 !! end
23483
23484 !! test
23485 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23486 !! options
23487 language=zh variant=zh-cn
23488 !! wikitext
23489 -{H|}-foobar
23490 !! html/php
23491 <p>foobar
23492 </p>
23493 !! html/parsoid
23494 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23495 !! end
23496
23497 !! test
23498 Nested using of manual convert syntax
23499 !! options
23500 language=zh variant=zh-hk
23501 !! wikitext
23502 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23503 !! html/php
23504 <p>Nested: Hello Hong Kong!
23505 </p>
23506 !! html/parsoid
23507 <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>
23508 !! end
23509
23510 !! test
23511 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23512 !! options
23513 language=zh variant=zh-cn
23514 !! wikitext
23515 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23516 !! html/php
23517 <p><span title="X">A</span>
23518 </p>
23519 !! html/parsoid
23520 <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>
23521 !! end
23522
23523 !! test
23524 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23525 !! options
23526 language=zh variant=zh-cn
23527 !! wikitext
23528 -{<span title="-{X}-">A</span>}-
23529 !! html/php+disabled
23530 <p><span title="X">A</span>
23531 </p>
23532 !! html/parsoid
23533 <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>
23534 !! end
23535
23536 # Parsoid and PHP disagree on how to parse this example: Parsoid
23537 # insists that the content of a language converter element be a valid
23538 # DOM fragment or attribute string
23539 !! test
23540 Language converter markup with block content
23541 !! options
23542 language=zh variant=zh-cn
23543 !! wikitext
23544 <span>a-{b<div>c}-d
23545
23546 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23547
23548 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23549 !! html/php+tidy
23550 <span>ab<div>cd
23551 <span>ab<div>cd
23552 <span>ad
23553 </span></div></span></div></span>
23554 !! html/parsoid
23555 <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
23556
23557 <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
23558
23559 <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>
23560 !! end
23561
23562 !! test
23563 LanguageConverter selser (1)
23564 !! options
23565 language=zh variant=zh-cn
23566 parsoid={
23567 "modes": ["wt2wt", "selser"],
23568 "changes": [
23569 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23570 ]
23571 }
23572 !! wikitext
23573 -{raw}-
23574 !! wikitext/edited
23575 -{edited}-
23576 !! end
23577
23578 !! test
23579 LanguageConverter selser (2)
23580 !! options
23581 language=zh variant=zh-cn
23582 parsoid={
23583 "modes": ["wt2wt", "selser"],
23584 "changes": [
23585 ["span[class='x']", "contents", "text", "-{foo}-"],
23586 ["a", "contents", "text", "-{"],
23587 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23588 ]
23589 }
23590 !! wikitext
23591 <span class="x">TEXT1</span>
23592 [http://example.com TEXT2]
23593 [[Foo|TEXT3]]
23594 {{echo|TEXT4}}
23595 !! wikitext/edited
23596 <span class="x"><nowiki>-{foo}-</nowiki></span>
23597 [http://example.com -{]
23598 [[Foo|<nowiki>-{</nowiki>]]
23599 {{1x|<nowiki>-{</nowiki>}}
23600 !! end
23601
23602 # Tests LanguageVariantText in ConstrainedText
23603 !! test
23604 LanguageConverter selser (3)
23605 !! options
23606 language=zh variant=zh-cn
23607 parsoid={
23608 "modes": ["wt2wt", "selser"],
23609 "changes": [
23610 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23611 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23612 ]
23613 }
23614 !! wikitext
23615 {|
23616 |-
23617 |<span>Foo</span>
23618 |}
23619 !! wikitext/edited
23620 {|
23621 |-
23622 |<nowiki/>-{edited}-
23623 |}
23624 !! end
23625
23626 # Tests LanguageVariantText._fromSelSer
23627 !! test
23628 LanguageConverter selser (4)
23629 !! options
23630 language=zh variant=zh-cn
23631 parsoid={
23632 "modes": ["wt2wt", "selser"],
23633 "changes": [
23634 ["td > span.x", "remove"]
23635 ]
23636 }
23637 !! wikitext
23638 {|
23639 |-
23640 |<span class="x">Foo</span>-{Bar}-
23641 ||<span class="x">Foo</span>-{Bar}-
23642 |}
23643 !! wikitext/edited
23644 {|
23645 |-
23646 |<nowiki/>-{Bar}-
23647 ||-{Bar}-
23648 |}
23649 !! end
23650
23651 # Since Parsoid is starting to emit canonical wikitext for links,
23652 # [http://example.com http://example.com] will not RT back to that
23653 # form anymore.
23654 # Parsoid does not language-convert links (it is done in a
23655 # post-processing step)
23656 !! test
23657 Proper conversion of text in external links
23658 !! options
23659 language=sr variant=sr-ec
23660 parsoid=wt2html
23661 !! wikitext
23662 http://www.google.com
23663 gopher://www.google.com
23664 [http://www.google.com http://www.google.com]
23665 [gopher://www.google.com gopher://www.google.com]
23666 [https://www.google.com irc://www.google.com]
23667 [ftp://www.google.com www.google.com/ftp://dir]
23668 [//www.google.com www.google.com]
23669 !! html/php
23670 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23671 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23672 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23673 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23674 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23675 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23676 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23677 </p>
23678 !! html/parsoid
23679 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23680 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23681 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23682 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23683 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23684 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23685 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23686 !! end
23687
23688 !! test
23689 Do not convert roman numbers to language variants
23690 !! options
23691 language=sr variant=sr-ec
23692 !! wikitext
23693 Fridrih IV je car.
23694 !! html/php
23695 <p>Фридрих IV је цар.
23696 </p>
23697 !! html/parsoid
23698 <p>Fridrih IV je car.</p>
23699 !! end
23700
23701 !! test
23702 Unclosed language converter markup "-{"
23703 !! options
23704 language=sr
23705 !! wikitext
23706 -{T|hello
23707 !! html
23708 <p>-{T|hello
23709 </p>
23710 !! end
23711
23712 !! test
23713 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23714 !! options
23715 language=sr
23716 !! wikitext
23717 -{R|=&gt;}-
23718 !! html/php
23719 <p>=&gt;
23720 </p>
23721 !! html/parsoid
23722 <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>
23723 !!end
23724
23725 !! test
23726 Don't break link parsing if language converter markup is in the caption.
23727 !! options
23728 language=sr variant=sr-ec
23729 !! wikitext
23730 [[Main Page|-{R|main page}-]]
23731 !! html/php
23732 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23733 </p>
23734 !! html/parsoid
23735 <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>
23736 !! end
23737
23738 !! test
23739 T146304: Don't break template parsing if language converter markup is in the parameter.
23740 !! options
23741 language=sr variant=sr-ec
23742 !! wikitext
23743 {{echo|-{R|foo}-}}
23744 !! html/php
23745 <p>foo
23746 </p>
23747 !! html/parsoid
23748 <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>
23749 !! end
23750
23751 !! test
23752 T146305: Don't break image parsing if language converter markup is in the caption.
23753 !! options
23754 language=sr
23755 !! wikitext
23756 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23757 !! html/php
23758 <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>
23759
23760 !! html/parsoid
23761 <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>
23762 !! end
23763
23764 !! test
23765 T146305: Don't break image parsing if nested language converter markup is in the caption.
23766 !! options
23767 language=zh variant=zh-cn
23768 !! wikitext
23769 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23770 !! html/php
23771 <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>
23772
23773 !! html/parsoid
23774 <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>
23775 !! end
23776
23777 # XXX html2wt disabled because rich markup in alt is not preserved.
23778 !! test
23779 Don't break gallery if language converter markup is inside.
23780 !! options
23781 language=zh
23782 !! wikitext
23783 <gallery>
23784 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23785 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23786 </gallery>
23787 !! html/php
23788 <ul class="gallery mw-gallery-traditional">
23789 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23790 <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>
23791 <div class="gallerytext">
23792 <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>
23793 </p>
23794 </div>
23795 </div></li>
23796 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23797 <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>
23798 <div class="gallerytext">
23799 <p>This is a test template
23800 </p>
23801 </div>
23802 </div></li>
23803 </ul>
23804
23805 !! html/parsoid
23806 <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"}}'>
23807 <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>
23808 <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>
23809 </ul>
23810 !! end
23811
23812 !! test
23813 T153135: Don't break list handling if language converter markup is in the item.
23814 !! options
23815 language=zh variant=zh-cn
23816 !! wikitext
23817 ;-{zh-cn:AAA;zh-tw:BBB}-
23818 ;-{R|foo:bar}-
23819 !! html/php
23820 <dl><dt>AAA</dt>
23821 <dt>foo:bar</dt></dl>
23822
23823 !! html/parsoid
23824 <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>
23825 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23826 </dl>
23827 !! end
23828
23829 // Note that parsoid does not protect colons unless language converter
23830 // markup is properly nested, because it is a backtracking parser.
23831 !! test
23832 T153135: Unclosed markup in definition list (code coverage)
23833 !! options
23834 language=zh variant=zh-cn
23835 !! wikitext
23836 ;<b>foo:bar
23837 ;-{zh-cn:AAA
23838 !! html/php+tidy
23839 <dl><dt><b>foo:bar</b></dt><b>
23840 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23841 </b></p>
23842 !! html/parsoid
23843 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23844 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23845 !! end
23846
23847 !! test
23848 T153135: Nested language converter markup in definition list (code coverage)
23849 !! options
23850 language=zh variant=zh-cn
23851 !! wikitext
23852 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23853 !! html/php
23854 <dl><dt>AAA foo:bar bat:baz</dt>
23855 <dd>def</dd></dl>
23856
23857 !! html/parsoid
23858 <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>
23859 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23860 </dl>
23861 !! end
23862
23863 # html2wt mode disabled due to <nowiki> insertion.
23864 !! test
23865 T153140: Don't break table handling if language converter markup is in the cell.
23866 !! options
23867 language=sr variant=sr-ec
23868 parsoid=wt2html,wt2wt,html2html
23869 !! wikitext
23870 {|
23871 |-
23872 | -{R|B}-
23873 |}
23874 !! html/php
23875 <table>
23876
23877 <tr>
23878 <td>B
23879 </td></tr></table>
23880
23881 !! html/parsoid
23882 <table>
23883 <tbody>
23884 <tr>
23885 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23886 </tr>
23887 </tbody>
23888 </table>
23889 !! end
23890
23891 !! test
23892 Language converter tricky html2wt cases (1)
23893 !! options
23894 language=sr
23895 parsoid=html2wt,wt2wt
23896 !! html/parsoid
23897 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23898 !! wikitext
23899 -{<nowiki>}-</nowiki>}-
23900 !! html/php
23901 <p>&#125;-
23902 </p>
23903 !! end
23904
23905 !! test
23906 Language converter tricky html2wt cases (2)
23907 !! options
23908 language=sr
23909 parsoid=html2wt,wt2wt
23910 !! html/parsoid
23911 <p>-{foo}-</p>
23912 !! wikitext
23913 <nowiki>-{foo}-</nowiki>
23914 !! html/php
23915 <p>-&#123;foo&#125;-
23916 </p>
23917 !! end
23918
23919 !! test
23920 Language converter tricky html2wt cases (3)
23921 !! options
23922 language=sr
23923 parsoid=html2wt,wt2wt
23924 !! html/parsoid
23925 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23926 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23927 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23928 !! wikitext
23929 -{R||}-
23930
23931 -{R|R|raw}-
23932
23933 -{<nowiki>-{foo}-</nowiki>}-
23934 !! html/php
23935 <p>|
23936 </p><p>R|raw
23937 </p><p>-&#123;foo&#125;-
23938 </p>
23939 !! end
23940
23941 !! test
23942 Language converter tricky html2wt cases (4)
23943 !! options
23944 language=sr
23945 parsoid=html2wt,wt2wt
23946 !! html/parsoid
23947 <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>
23948 !! wikitext
23949 -{R|{{echo|hey}}}-
23950 !! html/php
23951 <p>hey
23952 </p>
23953 !! end
23954
23955 # Note that the <nowiki> escaping added by parsoid for source text,
23956 # destination text, and language names only works on the PHP side
23957 # for *destination text*. (HTML entity escaping wouldn't work
23958 # any better.) This is probably a bug, at least for source texts.
23959 # (For language names PHP uses a precise regexp based on the languages
23960 # it currently knows have variants, which is fragile since this set
23961 # can grow/shrink over time.)
23962 !! test
23963 Language converter tricky html2wt cases (5)
23964 !! options
23965 language=zh variant=zh-cn
23966 !! html/parsoid
23967 <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>
23968 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23969 <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>
23970 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23971 <p>a:b=>c xyz</p>
23972 !! wikitext
23973 -{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
23974
23975 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23976
23977 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23978
23979 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23980
23981 a:b=>c xyz
23982 !! html/php+disabled
23983 <p>foobat;xyz=&gt;zh-cn:abc
23984 </p><p>A
23985 </p><p>0;zh-tw:bar
23986 </p><p>abc
23987 </p><p>a:b=&gt;c 0;zh-tw:bar
23988 </p>
23989 !! end
23990
23991 !! test
23992 T179579: Nowiki and lc interaction
23993 !! options
23994 parsoid=wt2html
23995 language=sr
23996 !! wikitext
23997 -{</nowiki>123}-
23998
23999 -{123<nowiki>|</nowiki>456}-
24000 !! html/parsoid
24001 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
24002
24003 <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>
24004 !! end
24005
24006 !! test
24007 T2529: Uncovered bullet
24008 !! wikitext
24009 *Foo {{bullet}}
24010 !! html
24011 <ul><li>Foo</li>
24012 <li>Bar</li></ul>
24013
24014 !! end
24015
24016 !! test
24017 T2529: Uncovered bullet in a deeply nested list
24018 !! wikitext
24019 *******Foo {{bullet}}
24020 !! html
24021 <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>
24022 <li>Bar</li></ul>
24023
24024 !! end
24025
24026 !! test
24027 T2529: Uncovered table already at line-start
24028 !! wikitext
24029 x
24030
24031 {{table}}
24032 y
24033 !! html
24034 <p>x
24035 </p>
24036 <table>
24037 <tr>
24038 <td>1</td>
24039 <td>2
24040 </td></tr>
24041 <tr>
24042 <td>3</td>
24043 <td>4
24044 </td></tr></table>
24045 <p>y
24046 </p>
24047 !! end
24048
24049 !! test
24050 T2529: Uncovered bullet in parser function result
24051 !! wikitext
24052 *Foo {{lc:{{bullet}} }}
24053 !! html
24054 <ul><li>Foo</li>
24055 <li>bar</li></ul>
24056
24057 !! end
24058
24059 !! test
24060 T7678: Double-parsed template argument
24061 !! wikitext
24062 {{lc:{{{1}}}|hello}}
24063 !! html
24064 <p>{{{1}}}
24065 </p>
24066 !! end
24067
24068 !! test
24069 T7678: Double-parsed template invocation
24070 !! wikitext
24071 {{lc:{{paramtest {{!}} param = hello }} }}
24072 !! html
24073 <p>{{paramtest | param = hello }}
24074 </p>
24075 !! end
24076
24077 !! test
24078 Case insensitivity of parser functions for non-ASCII characters (T10143)
24079 !! options
24080 language=cs
24081 title=[[Main Page]]
24082 !! wikitext
24083 {{PRVNÍVELKÉ:ěščř}}
24084 {{prvnívelké:ěščř}}
24085 {{PRVNÍMALÉ:ěščř}}
24086 {{prvnímalé:ěščř}}
24087 {{MALÁ:ěščř}}
24088 {{malá:ěščř}}
24089 {{VELKÁ:ěščř}}
24090 {{velká:ěščř}}
24091 !! html
24092 <p>Ěščř
24093 Ěščř
24094 ěščř
24095 ěščř
24096 ěščř
24097 ěščř
24098 ĚŠČŘ
24099 ĚŠČŘ
24100 </p>
24101 !! end
24102
24103 !! test
24104 Morwen/13: Unclosed link followed by heading
24105 !! wikitext
24106 [[link
24107 ==heading==
24108 !! html
24109 <p>[[link
24110 </p>
24111 <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>
24112
24113 !! end
24114
24115 !! test
24116 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
24117 !! wikitext
24118 {{foo|
24119 =heading=
24120 !! html
24121 <p>{{foo|
24122 </p>
24123 <h1><span class="mw-headline" id="heading">heading</span></h1>
24124
24125 !! end
24126
24127 !! test
24128 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
24129 !! wikitext
24130 {{foo|
24131 ==heading==
24132 !! html
24133 <p>{{foo|
24134 </p>
24135 <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>
24136
24137 !! end
24138
24139 !! test
24140 Tildes in comments
24141 !! options
24142 pst
24143 !! wikitext
24144 <!-- ~~~~ -->
24145 !! html/php
24146 <!-- ~~~~ -->
24147 !! end
24148
24149 !! test
24150 Paragraphs inside divs (no extra line breaks)
24151 !! wikitext
24152 <div>Line one
24153
24154 Line two</div>
24155 !! html
24156 <div>Line one
24157 Line two</div>
24158
24159 !! end
24160
24161 !! test
24162 Paragraphs inside divs (extra line break on open)
24163 !! wikitext
24164 <div>
24165 Line one
24166
24167 Line two</div>
24168 !! html
24169 <div>
24170 <p>Line one
24171 </p>
24172 Line two</div>
24173
24174 !! end
24175
24176 !! test
24177 Paragraphs inside divs (extra line break on close)
24178 !! wikitext
24179 <div>Line one
24180
24181 Line two
24182 </div>
24183 !! html
24184 <div>Line one
24185 <p>Line two
24186 </p>
24187 </div>
24188
24189 !! end
24190
24191 !! test
24192 Paragraphs inside divs (extra line break on open and close)
24193 !! wikitext
24194 <div>
24195 Line one
24196
24197 Line two
24198 </div>
24199 !! html
24200 <div>
24201 <p>Line one
24202 </p><p>Line two
24203 </p>
24204 </div>
24205
24206 !! end
24207
24208 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24209 !! test
24210 Nesting tags, paragraphs on lines which begin with <div>
24211 !! wikitext
24212 <div></div><strong>A
24213 B</strong>
24214 !! html/php+tidy
24215 <div></div><p><strong>A
24216 </strong></p><strong></strong><p><strong>B</strong>
24217 </p>
24218 !! html/parsoid
24219 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24220 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24221 !! end
24222
24223 # T8200: <blockquote> should behave like <div> with respect to line breaks
24224 !! test
24225 T8200: paragraphs inside blockquotes (no extra line breaks)
24226 !! wikitext
24227 <blockquote>Line one
24228
24229 Line two</blockquote>
24230 !! html
24231 <blockquote>Line one
24232 Line two</blockquote>
24233
24234 !! html+tidy
24235 <blockquote><p>Line one
24236 Line two</p></blockquote>
24237 !! end
24238
24239 !! test
24240 T8200: paragraphs inside blockquotes (extra line break on open)
24241 !! wikitext
24242 <blockquote>
24243 Line one
24244
24245 Line two</blockquote>
24246 !! html
24247 <blockquote>
24248 <p>Line one
24249 </p>
24250 Line two</blockquote>
24251
24252 !! html+tidy
24253 <blockquote>
24254 <p>Line one
24255 </p><p>
24256 Line two</p></blockquote>
24257 !! end
24258
24259 !! test
24260 T8200: paragraphs inside blockquotes (extra line break on close)
24261 !! wikitext
24262 <blockquote>Line one
24263
24264 Line two
24265 </blockquote>
24266 !! html
24267 <blockquote>Line one
24268 <p>Line two
24269 </p>
24270 </blockquote>
24271
24272 !! html+tidy
24273 <blockquote><p>Line one
24274 </p><p>Line two
24275 </p>
24276 </blockquote>
24277 !! end
24278
24279 !! test
24280 T8200: paragraphs inside blockquotes (extra line break on open and close)
24281 !! wikitext
24282 <blockquote>
24283 Line one
24284
24285 Line two
24286 </blockquote>
24287 !! html
24288 <blockquote>
24289 <p>Line one
24290 </p><p>Line two
24291 </p>
24292 </blockquote>
24293
24294 !! end
24295
24296 ## This is a corner case interaction between the paragraph wrapping in the
24297 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24298 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24299 ## of which "div" is one, but do p-wrapping inside them. These are referred
24300 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24301 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24302 !! test
24303 Paragraphs inside blockquotes/divs (no extra line breaks)
24304 !! wikitext
24305 <blockquote><div>Line one
24306
24307 Line two</div></blockquote>
24308 !! html
24309 <blockquote><div>Line one
24310 Line two</div></blockquote>
24311
24312 !! end
24313
24314 !! test
24315 Paragraphs inside blockquotes/divs (extra line break on open)
24316 !! wikitext
24317 <blockquote><div>
24318 Line one
24319
24320 Line two</div></blockquote>
24321 !! html
24322 <blockquote><div>
24323 <p>Line one
24324 </p>
24325 Line two</div></blockquote>
24326
24327 !! end
24328
24329 !! test
24330 Paragraphs inside blockquotes/divs (extra line break on close)
24331 !! wikitext
24332 <blockquote><div>Line one
24333
24334 Line two
24335 </div></blockquote>
24336 !! html
24337 <blockquote><div>Line one
24338 <p>Line two
24339 </p>
24340 </div></blockquote>
24341
24342 !! end
24343
24344 !! test
24345 Paragraphs inside blockquotes/divs (extra line break on open and close)
24346 !! wikitext
24347 <blockquote><div>
24348 Line one
24349
24350 Line two
24351 </div></blockquote>
24352 !! html
24353 <blockquote><div>
24354 <p>Line one
24355 </p><p>Line two
24356 </p>
24357 </div></blockquote>
24358
24359 !! end
24360
24361 !! test
24362 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24363 !! options
24364 wgLinkHolderBatchSize=0
24365 !! wikitext
24366 [[meatball:1]]
24367 [[meatball:2]]
24368 [[meatball:3]]
24369 !! html
24370 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24371 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24372 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24373 </p>
24374 !! end
24375
24376 !! test
24377 Free external link invading image caption
24378 !! wikitext
24379 [[Image:Foobar.jpg|thumb|http://x|hello]]
24380 !! html/php
24381 <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>
24382
24383 !! html/parsoid
24384 <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>
24385 !! end
24386
24387 !! test
24388 T17196: localised external link numbers
24389 !! options
24390 language=fa
24391 !! wikitext
24392 [http://en.wikipedia.org/]
24393 !! html/php
24394 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24395 </p>
24396 !! html/parsoid
24397 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24398 !! end
24399
24400 !! test
24401 Multibyte character in padleft
24402 !! wikitext
24403 {{padleft:-Hello|7|Æ}}
24404 !! html/php
24405 <p>Æ-Hello
24406 </p>
24407 !! html/parsoid
24408 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24409 !! end
24410
24411 !! test
24412 Multibyte character in padright
24413 !! wikitext
24414 {{padright:Hello-|7|Æ}}
24415 !! html/php
24416 <p>Hello-Æ
24417 </p>
24418 !! html/parsoid
24419 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24420 !! end
24421
24422 !!test
24423 formatdate parser function
24424 !! wikitext
24425 {{#formatdate:2009-03-24}}
24426 !! html
24427 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24428 </p>
24429 !! end
24430
24431 !!test
24432 formatdate parser function, with default format
24433 !! wikitext
24434 {{#formatdate:2009-03-24|mdy}}
24435 !! html
24436 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24437 </p>
24438 !! end
24439
24440 !! test
24441 Spacing of numbers in formatted dates
24442 !! wikitext
24443 {{#formatdate:January 15}}
24444 !! html
24445 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24446 </p>
24447 !! end
24448
24449 !! test
24450 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
24451 !! options
24452 language=nl title=[[MediaWiki:Common.css]]
24453 !! wikitext
24454 {{#formatdate:2009-03-24|dmy}}
24455 !! html
24456 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24457 </p>
24458 !! end
24459
24460 #
24461 #
24462 #
24463
24464 #
24465 # Edit comments
24466 #
24467
24468 !! test
24469 Edit comment with link
24470 !! options
24471 comment
24472 !! wikitext
24473 I like the [[Main Page]] a lot
24474 !! html/php
24475 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24476 !!end
24477
24478 !! test
24479 Edit comment with link and link text
24480 !! options
24481 comment
24482 !! wikitext
24483 I like the [[Main Page|best pages]] a lot
24484 !! html/php
24485 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24486 !!end
24487
24488 !! test
24489 Edit comment with link and link text with suffix
24490 !! options
24491 comment
24492 !! wikitext
24493 I like the [[Main Page|best page]]s a lot
24494 !! html/php
24495 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24496 !!end
24497
24498 !! test
24499 Edit comment with section link (non-local, eg in history list)
24500 !! options
24501 comment title=[[Main Page]]
24502 !! wikitext
24503 /* External links */ removed bogus entries
24504 !! html/php
24505 <a href="/wiki/Main_Page#External_links" title="Main Page">→External links</a>‎<span dir="auto"><span class="autocomment">: </span> removed bogus entries</span>
24506 !!end
24507
24508 !! test
24509 Edit comment with section link and text before it (non-local, eg in history list)
24510 !! options
24511 comment title=[[Main Page]]
24512 !! wikitext
24513 pre-comment text /* External links */ removed bogus entries
24514 !! html/php
24515 pre-comment text <a href="/wiki/Main_Page#External_links" title="Main Page">→External links</a>‎<span dir="auto"><span class="autocomment">: </span> removed bogus entries</span>
24516 !!end
24517
24518 !! test
24519 Edit comment with section link (local, eg in diff view)
24520 !! options
24521 comment local title=[[Main Page]]
24522 !! wikitext
24523 /* External links */ removed bogus entries
24524 !! html/php
24525 <a href="#External_links">→External links</a>‎<span dir="auto"><span class="autocomment">: </span> removed bogus entries</span>
24526 !!end
24527
24528 !! test
24529 Edit comment with subpage link (T16080)
24530 !! options
24531 comment
24532 subpage
24533 title=[[Subpage test]]
24534 !! wikitext
24535 Poked at a [[/subpage]] here...
24536 !! html/php
24537 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24538 !!end
24539
24540 !! test
24541 Edit comment with subpage link and link text (T16080)
24542 !! options
24543 comment
24544 subpage
24545 title=[[Subpage test]]
24546 !! wikitext
24547 Poked at a [[/subpage|neat little page]] here...
24548 !! html/php
24549 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24550 !!end
24551
24552 !! test
24553 Edit comment with bogus subpage link in non-subpage NS (T16080)
24554 !! options
24555 comment
24556 title=[[Subpage test]]
24557 !! wikitext
24558 Poked at a [[/subpage]] here...
24559 !! html/php
24560 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...
24561 !!end
24562
24563 !! test
24564 Edit comment with bare anchor link (local, as on diff)
24565 !! options
24566 comment
24567 local
24568 title=[[Main Page]]
24569 !! wikitext
24570 [[#section]]
24571 !! html/php
24572 <a href="#section">#section</a>
24573 !! end
24574
24575 !! test
24576 Edit comment with bare anchor link (non-local, as on history)
24577 !! options
24578 comment
24579 title=[[Main Page]]
24580 !! wikitext
24581 [[#section]]
24582 !! html/php
24583 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24584 !! end
24585
24586 !! test
24587 Anchor starting with underscore
24588 !! options
24589 title=[[Foo]]
24590 !! wikitext
24591 [[#_ref|One]]
24592 !! html/php
24593 <p><a href="#_ref">One</a>
24594 </p>
24595 !! html/parsoid
24596 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24597 !! end
24598
24599 !! test
24600 Id starting with underscore
24601 !! wikitext
24602 <div id="_ref"></div>
24603 !! html/*
24604 <div id="_ref"></div>
24605
24606 !! end
24607
24608 !! test
24609 Edit comment with link with more than one pipe (T99346)
24610 !! options
24611 comment
24612 !! wikitext
24613 [[Main Page|Many|pipes]]
24614 !! html/php
24615 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24616 !! end
24617
24618 !! test
24619 Complex edit comment with link with more than one pipe (T99346)
24620 !! options
24621 comment
24622 !! wikitext
24623 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24624 !! html/php
24625 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;
24626 !! end
24627
24628 !! test
24629 Space normalisation on autocomment (T24784)
24630 !! options
24631 comment
24632 title=[[Main Page]]
24633 !! wikitext
24634 /* __hello__world__ */
24635 !! html/php
24636 <a href="/wiki/Main_Page#hello_world" title="Main Page">→__hello__world__</a>‎
24637 !! end
24638
24639 !! test
24640 percent-encoding and + signs in comments (T28410)
24641 !! options
24642 comment
24643 !! wikitext
24644 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24645 !! html/php
24646 <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>
24647 !! end
24648
24649 # Parsoid doesn't support this yet: see T75581
24650 # but it *should* omit the 'src' attribute if the image is bad.
24651 # PHP side of tests was disabled in
24652 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24653 # because of issues in the PHP parserTests infrastructure
24654 # (but the output below is indeed what the PHP side emits)
24655 !! test
24656 Bad images - basic functionality
24657 !! wikitext
24658 [[File:Bad.jpg]]
24659 !! html/php+disabled
24660 !! html/parsoid
24661 <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>
24662 !! end
24663
24664 !! test
24665 Bad images - T18039: text after bad image disappears
24666 !! wikitext
24667 Foo bar
24668 [[File:Bad.jpg]]
24669 Bar foo
24670 !! html/php+disabled
24671 <p>Foo bar
24672 </p><p>Bar foo
24673 </p>
24674 !! html/parsoid
24675 <p>Foo bar
24676 <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>
24677 Bar foo</p>
24678 !! end
24679
24680 !! test
24681 Verify that displaytitle works (T24501) no displaytitle
24682 !! options
24683 showtitle
24684 !! config
24685 wgAllowDisplayTitle=true
24686 wgRestrictDisplayTitle=false
24687 !! wikitext
24688 this is not the the title
24689 !! html/php
24690 Parser test
24691 <p>this is not the the title
24692 </p>
24693 !! end
24694
24695 !! test
24696 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24697 !! options
24698 showtitle
24699 title=[[Screen]]
24700 !! config
24701 wgAllowDisplayTitle=true
24702 wgRestrictDisplayTitle=false
24703 !! wikitext
24704 this is not the the title
24705 {{DISPLAYTITLE:whatever}}
24706 !! html/php
24707 whatever
24708 <p>this is not the the title
24709 </p>
24710 !! end
24711
24712 !! test
24713 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24714 !! options
24715 showtitle
24716 title=[[Screen]]
24717 !! config
24718 wgAllowDisplayTitle=true
24719 wgRestrictDisplayTitle=true
24720 !! wikitext
24721 this is not the the title
24722 {{DISPLAYTITLE:whatever}}
24723 !! html/php
24724 Screen
24725 <p>this is not the the title
24726 </p>
24727 !! end
24728
24729 !! test
24730 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24731 !! options
24732 showtitle
24733 title=[[Screen]]
24734 !! config
24735 wgAllowDisplayTitle=true
24736 wgRestrictDisplayTitle=true
24737 !! wikitext
24738 this is not the the title
24739 {{DISPLAYTITLE:screen}}
24740 !! html/php
24741 screen
24742 <p>this is not the the title
24743 </p>
24744 !! end
24745
24746 !! test
24747 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24748 !! options
24749 showtitle
24750 title=[[Screen]]
24751 !! config
24752 wgAllowDisplayTitle=false
24753 !! wikitext
24754 this is not the the title
24755 {{DISPLAYTITLE:screen}}
24756 !! html/php
24757 Screen
24758 <p>this is not the the title
24759 <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>
24760 </p>
24761 !! end
24762
24763 !! test
24764 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24765 !! options
24766 showtitle
24767 title=[[Screen]]
24768 !! config
24769 wgAllowDisplayTitle=false
24770 !! wikitext
24771 this is not the the title
24772 !! html/php
24773 Screen
24774 <p>this is not the the title
24775 </p>
24776 !! end
24777
24778 !! test
24779 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24780 !! options
24781 showtitle
24782 title=[[Screen]]
24783 !! config
24784 wgAllowDisplayTitle=true
24785 wgRestrictDisplayTitle=true
24786 !! wikitext
24787 this is not the the title
24788 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24789 !! html/php
24790 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24791 <p>this is not the the title
24792 </p>
24793 !! end
24794
24795 !! test
24796 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24797 !! options
24798 showtitle
24799 title=[[Screen]]
24800 !! config
24801 wgAllowDisplayTitle=true
24802 wgRestrictDisplayTitle=true
24803 !! wikitext
24804 this is not the the title
24805 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24806 !! html/php
24807 <span style="color: red;">s</span>creen
24808 <p>this is not the the title
24809 </p>
24810 !! end
24811
24812 !! test
24813 Page status indicators: Empty name is invalid
24814 !! options
24815 showindicators
24816 !! wikitext
24817 <indicator name=" "></indicator>
24818 <indicator></indicator>
24819 !! html/php
24820 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24821 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24822 </p>
24823 !! end
24824
24825 !! test
24826 Page status indicators: Weird syntaxes that are okay
24827 !! options
24828 showindicators
24829 !! wikitext
24830 <indicator name="empty" />
24831 <indicator name="name"></indicator>
24832 !! html/php
24833 empty=
24834 name=
24835 <p><br />
24836 </p>
24837 !! end
24838
24839 !! test
24840 Page status indicators: Torture test
24841 !! options
24842 showindicators
24843 !! wikitext
24844 <indicator name="01">hello world</indicator>
24845 <indicator name="02">[[Main Page]]</indicator>
24846 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24847 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24848 <indicator name="05">*foo
24849 *bar</indicator>
24850 <indicator name="06"><nowiki>foo</nowiki></indicator>
24851 <indicator name="07"> Preformatted</indicator>
24852 <indicator name="08"><div>Broken tag</indicator>
24853 <indicator name="09">{| class=wikitable
24854 |cell
24855 |}</indicator>
24856 <indicator name="10">Two
24857
24858 paragraphs</indicator>
24859 !! html/php
24860 01=hello world
24861 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24862 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" />
24863 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>
24864 05=<ul><li>foo</li>
24865 <li>bar</li></ul>
24866
24867 06=foo
24868 07=<pre>Preformatted
24869 </pre>
24870 08=<div>Broken tag</div>
24871
24872 09=<table class="wikitable">
24873 <tr>
24874 <td>cell
24875 </td></tr></table>
24876
24877 10=<p>Two
24878 </p><p>paragraphs
24879 </p>
24880 <p><br />
24881 </p><p><br />
24882 </p><p><br />
24883 </p><p><br />
24884 </p><p><br />
24885 </p>
24886 !! end
24887
24888 !! test
24889 preload: check <noinclude> and <includeonly>
24890 !! options
24891 preload
24892 !! wikitext
24893 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24894 !! html/php
24895 Hello kind world.
24896 !! end
24897
24898 !! test
24899 preload: check <onlyinclude>
24900 !! options
24901 preload
24902 !! wikitext
24903 Goodbye <onlyinclude>Hello world</onlyinclude>
24904 !! html/php
24905 Hello world
24906 !! end
24907
24908 !! test
24909 preload: can pass tags through if we want to
24910 !! options
24911 preload
24912 !! wikitext
24913 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24914 !! html/php
24915 <includeonly>Hello world</includeonly>
24916 !! end
24917
24918 !! test
24919 preload: check that it doesn't try to do tricks
24920 !! options
24921 preload
24922 !! wikitext
24923 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24924 !! html/php
24925 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24926 !! end
24927
24928 !! test
24929 Play a bit with r67090 and T5158
24930 !! wikitext
24931 <div style="width:50% !important">&nbsp;</div>
24932 <div style="width:50%&nbsp;!important">&nbsp;</div>
24933 <div style="width:50%&#160;!important">&nbsp;</div>
24934 <div style="border : solid;">&nbsp;</div>
24935 !! html/php
24936 <div style="width:50% !important">&#160;</div>
24937 <div style="width:50% !important">&#160;</div>
24938 <div style="width:50% !important">&#160;</div>
24939 <div style="border&#32;: solid;">&#160;</div>
24940
24941 !! html/parsoid
24942 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24943 <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>
24944 <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>
24945 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24946
24947 !! end
24948
24949 !! test
24950 French spaces in wikitext
24951 !! wikitext
24952 foo ! bar ? bat 50 % is less than 75 %.
24953
24954 Hello : this ; is « something ‹ else › again »
24955 !! html
24956 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24957 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24958 </p>
24959 !! end
24960
24961 # It would be reasonable for Parsoid and PHP to differ here.
24962 # The PHP behavior is arguably a bug.
24963 !! test
24964 Corner case: french spaces in definition list
24965 !! wikitext
24966 ;foo : bar
24967 !! html+tidy
24968 <dl><dt>foo&#160;</dt>
24969 <dd>bar</dd></dl>
24970 !! end
24971
24972 !! test
24973 T5158: Test for French spaces in attributes
24974 !! wikitext
24975 <br style=" clear : both ; " />
24976 !! html/php
24977 <p><br style="clear&#32;: both&#32;;" />
24978 </p>
24979 !! end
24980
24981 !! test
24982 HTML5 data attributes
24983 !! wikitext
24984 <span data-foo="bar">Baz</span>
24985 <p data-abc-def_hij="">Quuz</p>
24986 !! html/php
24987 <p><span data-foo="bar">Baz</span>
24988 </p>
24989 <p data-abc-def_hij="">Quuz</p>
24990
24991 !! html/parsoid
24992 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24993 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24994 !! end
24995
24996 !! test
24997 Strip reserved data attributes
24998 !! wikitext
24999 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
25000 !! html/php
25001 <div data-ok="fred">d</div>
25002
25003 !! html/parsoid
25004 <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>
25005 !! end
25006
25007 !! test
25008 percent-encoding and + signs in internal links (T28410)
25009 !! wikitext
25010 [[User:+%]] [[Page+title%]]
25011 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
25012 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
25013 [[%33%45]] [[%33%45+]]
25014 !! html/php
25015 <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>
25016 <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>
25017 <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>
25018 <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>
25019 </p>
25020 !! html/parsoid
25021 <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>
25022 <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>
25023 <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>
25024 <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>
25025 !! end
25026
25027 !! test
25028 Special characters in embedded file links (T29679)
25029 !! wikitext
25030 [[File:Contains & ampersand.jpg]]
25031 [[File:Does not exist.jpg|Title with & ampersand]]
25032 !! html/php
25033 <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>
25034 <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>
25035 </p>
25036 !! html/parsoid
25037 <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>
25038 <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>
25039 !! end
25040
25041 !! test
25042 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
25043 !! wikitext
25044 Text&apos;s been normalized?
25045 !! html
25046 <p>Text&#39;s been normalized?
25047 </p>
25048 !! end
25049
25050 !! test
25051 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
25052 !! wikitext
25053 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
25054 !! html
25055 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
25056 </p>
25057 !! end
25058
25059 !! test
25060 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
25061 !! wikitext
25062 [http://www.example.org/ ideograms]
25063 !! html
25064 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
25065 </p>
25066 !! end
25067
25068 !! test
25069 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
25070 !! wikitext
25071 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
25072 !! html
25073 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
25074 </p>
25075 !! end
25076
25077 !! article
25078 Mediawiki:loop1
25079 !! text
25080 {{Identical|A}}
25081 !! endarticle
25082
25083 !! article
25084 Mediawiki:loop2
25085 !! text
25086 {{Identical|B}}
25087 !! endarticle
25088
25089 !! article
25090 Template:Identical
25091 !! text
25092 {{int:loop1}}
25093 {{int:loop2}}
25094 !! endarticle
25095
25096 !! test
25097 T33098 Template which includes system messages which includes the template
25098 !! wikitext
25099 {{Identical}}
25100 !! html
25101 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25102 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25103 </p>
25104 !! end
25105
25106 !! test
25107 T33490 Turkish: ucfirst 'blah'
25108 !! options
25109 language=tr
25110 !! wikitext
25111 {{ucfirst:blah}}
25112 !! html
25113 <p>Blah
25114 </p>
25115 !! end
25116
25117 !! test
25118 T33490 Turkish: ucfirst 'ix'
25119 !! options
25120 language=tr
25121 !! wikitext
25122 {{ucfirst:ix}}
25123 !! html
25124 <p>İx
25125 </p>
25126 !! end
25127
25128 !! test
25129 T33490 Turkish: lcfirst 'BLAH'
25130 !! options
25131 language=tr
25132 !! wikitext
25133 {{lcfirst:BLAH}}
25134 !! html
25135 <p>bLAH
25136 </p>
25137 !! end
25138
25139 !! test
25140 T33490 Turkish: ucfırst (with a dotless i)
25141 !! options
25142 language=tr
25143 !! wikitext
25144 {{ucfırst:blah}}
25145 !! html
25146 <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>
25147 </p>
25148 !! end
25149
25150 !! test
25151 T33490 ucfırst (with a dotless i) with English language
25152 !! options
25153 language=en
25154 !! wikitext
25155 {{ucfırst:blah}}
25156 !! html
25157 <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>
25158 </p>
25159 !! end
25160
25161 # Note that Parsoid doesn't emit an explicit TOC.
25162 # Note also that the html2wt direction tends to emit an extra newline
25163 # between the __TOC__ magicword and the first heading unless *both*
25164 # the <meta> and the <h2> have a data-parsoid attribute set (even if
25165 # it's "{}").
25166
25167 !! test
25168 T28375: TOC with italics
25169 !! options
25170 title=[[Main Page]]
25171 !! wikitext
25172 __TOC__
25173 ==''Lost'' episodes==
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="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
25178 </ul>
25179 </div>
25180
25181 <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>
25182
25183 !! html/parsoid
25184 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25185 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
25186 !! end
25187
25188 !! test
25189 T28375: TOC with bold
25190 !! options
25191 title=[[Main Page]]
25192 !! wikitext
25193 __TOC__
25194 =='''should be bold''' then normal text==
25195 !! html/php
25196 <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>
25197 <ul>
25198 <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>
25199 </ul>
25200 </div>
25201
25202 <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>
25203
25204 !! html/parsoid
25205 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25206 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25207 !! end
25208
25209 !! test
25210 T35845: Headings become cursive in TOC when they contain an image
25211 !! options
25212 title=[[Main Page]]
25213 !! wikitext
25214 __TOC__
25215 ==Image [[Image:foobar.jpg]]==
25216 !! html/php
25217 <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>
25218 <ul>
25219 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25220 </ul>
25221 </div>
25222
25223 <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>
25224
25225 !! html/parsoid
25226 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25227 <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>
25228 !! end
25229
25230 !! test
25231 T35845 (2): Headings become bold in TOC when they contain a blockquote
25232 !! options
25233 title=[[Main Page]]
25234 !! wikitext
25235 __TOC__
25236 ==<blockquote>Quote</blockquote>==
25237 !! html/php
25238 <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>
25239 <ul>
25240 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25241 </ul>
25242 </div>
25243
25244 <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>
25245
25246 !! html/php+tidy
25247 <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>
25248 <ul>
25249 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25250 </ul>
25251 </div>
25252
25253 <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>
25254 !! html/parsoid
25255 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25256 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25257 !! end
25258
25259 !! test
25260 Unclosed tags in TOC
25261 !! config
25262 wgFragmentMode=[ 'html5', 'legacy' ]
25263 !! options
25264 title=[[Main Page]]
25265 !! wikitext
25266 __TOC__
25267 ==Proof: 2 < 3==
25268 <small>Hanc marginis exiguitas non caperet.</small>
25269 QED
25270 !! html/php
25271 <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>
25272 <ul>
25273 <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>
25274 </ul>
25275 </div>
25276
25277 <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>
25278 <p><small>Hanc marginis exiguitas non caperet.</small>
25279 QED
25280 </p>
25281 !! html/parsoid
25282 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25283 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25284 <p><small>Hanc marginis exiguitas non caperet.</small>
25285 QED</p>
25286 !! end
25287
25288 !! test
25289 Multiple tags in TOC
25290 !! wikitext
25291 __TOC__
25292 ==<i>Foo</i> <b>Bar</b>==
25293
25294 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25295 !! html/php
25296 <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>
25297 <ul>
25298 <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>
25299 <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>
25300 </ul>
25301 </div>
25302
25303 <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>
25304 <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>
25305
25306 !! html/php+tidy
25307 <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>
25308 <ul>
25309 <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>
25310 <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>
25311 </ul>
25312 </div>
25313
25314 <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>
25315 <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>
25316 !! html/parsoid
25317 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25318 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25319
25320 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25321 !! end
25322
25323 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25324 # html5 tag parsing.
25325 !! test
25326 Tags with parameters in TOC
25327 !! options
25328 parsoid=wt2html
25329 !! wikitext
25330 __TOC__
25331 ==<sup class="in-h2">Hello</sup>==
25332
25333 ==<sup class="a > b">Evilbye</sup>==
25334 !! html/php
25335 <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>
25336 <ul>
25337 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25338 <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>
25339 </ul>
25340 </div>
25341
25342 <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>
25343 <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>
25344
25345 !! html/parsoid
25346 <meta property="mw:PageProp/toc" />
25347 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25348
25349 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25350 !! end
25351
25352 !! test
25353 span tags with directionality in TOC
25354 !! wikitext
25355 __TOC__
25356 ==<span dir="ltr">C++</span>==
25357
25358 ==<span dir="rtl">זבנג!</span>==
25359
25360 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25361
25362 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25363
25364 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25365 !! html/php
25366 <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>
25367 <ul>
25368 <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>
25369 <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>
25370 <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>
25371 <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>
25372 <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>
25373 </ul>
25374 </div>
25375
25376 <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>
25377 <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>
25378 <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>
25379 <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>
25380 <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>
25381
25382 !! html/parsoid
25383 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25384 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25385 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25386 <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>
25387 <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>
25388 <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>
25389 !! end
25390
25391 !! test
25392 T74884: bdi element in ToC
25393 !! wikitext
25394 __TOC__
25395 ==<bdi>test</bdi>==
25396 !! html/php
25397 <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>
25398 <ul>
25399 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25400 </ul>
25401 </div>
25402
25403 <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>
25404
25405 !! html/parsoid
25406 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25407 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25408 !! end
25409
25410 !! test
25411 T35715: s/strike element in ToC
25412 !! wikitext
25413 __TOC__
25414 ==<s>test</s> test <strike>test</strike>==
25415 !! html/php
25416 <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>
25417 <ul>
25418 <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>
25419 </ul>
25420 </div>
25421
25422 <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>
25423
25424 !! html/parsoid
25425 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25426 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25427 !! end
25428
25429 !! test
25430 T198618: style element in ToC
25431 !! options
25432 styletag=1
25433 !! wikitext
25434 __TOC__
25435 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25436 !! html/php
25437 <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>
25438 <ul>
25439 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25440 </ul>
25441 </div>
25442
25443 <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>
25444
25445 !! html/parsoid
25446 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25447 <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>
25448 !! end
25449
25450 !! test
25451 T198618: script element in ToC
25452 !! options
25453 wgRawHtml=1
25454 !! wikitext
25455 __TOC__
25456 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25457 !! html/php
25458 <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>
25459 <ul>
25460 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25461 </ul>
25462 </div>
25463
25464 <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>
25465
25466 !! html/parsoid
25467 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25468 <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>
25469 !! end
25470
25471 !! test
25472 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25473 !! wikitext
25474 __TOC__
25475 ==x==
25476 !! html/php
25477 <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>
25478 <ul>
25479 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25480 </ul>
25481 </div>
25482
25483 <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>
25484
25485 !! html/parsoid
25486 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25487 <h2 id="x" data-parsoid='{}'>x</h2>
25488 !! end
25489
25490 !! article
25491 MediaWiki:T34057
25492 !! text
25493 == {{int:headline_sample}} ==
25494 !! endarticle
25495
25496 !! test
25497 T34057: Title needed when expanding <h> nodes.
25498 !! options
25499 title=[[Main Page]]
25500 !! wikitext
25501 {{int:T34057}}
25502 !! html
25503 <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>
25504
25505 !! end
25506
25507 !! test
25508 Strip marker in urlencode
25509 !! wikitext
25510 {{urlencode:x<nowiki/>y}}
25511 {{urlencode:x<nowiki/>y|wiki}}
25512 {{urlencode:x<nowiki/>y|path}}
25513 {{urlencode:x<pre id="one">two</pre>y}}
25514 !! html/php
25515 <p>xy
25516 xy
25517 xy
25518 xy
25519 </p>
25520 !! end
25521
25522 !! test
25523 Strip marker in lc
25524 !! wikitext
25525 {{lc:x<nowiki/>y}}
25526 !! html
25527 <p>xy
25528 </p>
25529 !! end
25530
25531 !! test
25532 Strip marker in uc
25533 !! wikitext
25534 {{uc:x<nowiki/>y}}
25535 !! html
25536 <p>XY
25537 </p>
25538 !! end
25539
25540 !! test
25541 Strip marker in formatNum
25542 !! wikitext
25543 {{formatnum:1<nowiki/>2}}
25544 {{formatnum:1<nowiki/>2|R}}
25545 !! html
25546 <p>12
25547 12
25548 </p>
25549 !! end
25550
25551 !! test
25552 Check noCommafy in formatNum
25553 !! options
25554 language=be-tarask
25555 !! wikitext
25556 {{formatnum:123456.78}}
25557 {{formatnum:123456.78|NOSEP}}
25558 !! html
25559 <p>123 456,78
25560 123456.78
25561 </p>
25562 !! end
25563
25564 !! test
25565 Wrong option for formatNum (T58199)
25566 !! wikitext
25567 {{formatnum:1,234.56|Random}}
25568 {{formatnum:1,234.56|EVERYTHING}}
25569 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25570 !! html
25571 <p>1,234.56
25572 1,234.56
25573 1,234.56
25574 </p>
25575 !! end
25576
25577 !! test
25578 Strip marker in grammar
25579 !! options
25580 language=fi
25581 !! wikitext
25582 {{grammar:elative|foo<nowiki/>bar}}
25583 !! html
25584 <p>foobarista
25585 </p>
25586 !! end
25587
25588 !! test
25589 Strip marker in padleft
25590 !! wikitext
25591 {{padleft:|2|x<nowiki/>y}}
25592 !! html
25593 <p>xy
25594 </p>
25595 !! end
25596
25597 !! test
25598 Strip marker in padright
25599 !! wikitext
25600 {{padright:|2|x<nowiki/>y}}
25601 !! html
25602 <p>xy
25603 </p>
25604 !! end
25605
25606 !! test
25607 Strip marker in anchorencode
25608 !! wikitext
25609 {{anchorencode:x<nowiki/>y}}
25610 !! html/php
25611 <p>xy
25612 </p>
25613 !! html/parsoid
25614 <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>
25615 !! end
25616
25617 !! test
25618 nowiki inside link inside heading (T20295)
25619 !! wikitext
25620 ==[[foo|x<nowiki>y</nowiki>z]]==
25621 !! html
25622 <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>
25623
25624 !! end
25625
25626 !! test
25627 new support for bdi element (T33817)
25628 !! wikitext
25629 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25630 !! html
25631 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25632
25633 !!end
25634
25635 !! test
25636 Ignore pipe between table row attributes
25637 !! wikitext
25638 {|
25639 |quux
25640 |- id=foo | style='color: red'
25641 |bar
25642 |}
25643 !! html
25644 <table>
25645 <tr>
25646 <td>quux
25647 </td></tr>
25648 <tr id="foo" style="color: red">
25649 <td>bar
25650 </td></tr></table>
25651
25652 !! end
25653
25654 !!test
25655 Language parser function
25656 !! wikitext
25657 {{#language:ar}}
25658 !! html
25659 <p>العربية
25660 </p>
25661 !! end
25662
25663 !!test
25664 Padleft and padright (default 0-padding)
25665 !! wikitext
25666 {{padleft:xyz|5}}
25667 {{padright:xyz|5}}
25668 !! html/php
25669 <p>00xyz
25670 xyz00
25671 </p>
25672 !! html/parsoid
25673 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25674 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25675 !! end
25676
25677 !!test
25678 Padleft and padright (partial fill)
25679 !! wikitext
25680 {{padleft:xyz|6|ab}}
25681 {{padright:xyz|6|ab}}
25682 !! html/php
25683 <p>abaxyz
25684 xyzaba
25685 </p>
25686 !! html/parsoid
25687 <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>
25688 <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>
25689 !! end
25690
25691 !!test
25692 Padleft and padright as substr
25693 !! wikitext
25694 {{padleft:|3|abcde}}
25695 {{padright:|3|abcde}}
25696 !! html/php
25697 <p>abc
25698 abc
25699 </p>
25700 !! html/parsoid
25701 <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>
25702 <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>
25703 !! end
25704
25705 !! test
25706 Padleft and padright with non-numerical length (T180403)
25707 !! wikitext
25708 {{padleft:abcdef|junk}}
25709 {{padright:abcdef|junk}}
25710 !! html/php
25711 <p>abcdef
25712 abcdef
25713 </p>
25714 !! end
25715
25716 !!test
25717 Special parser function
25718 !! wikitext
25719 {{#special:RandomPage}}
25720 {{#special:BaDtItLe}}
25721 {{#special:Foobar}}
25722 !! html
25723 <p>Special:Random
25724 Special:Badtitle
25725 Special:Foobar
25726 </p>
25727 !! end
25728
25729 !!test
25730 T36939 - Case insensitive link parsing ([HttP://])
25731 !! wikitext
25732 [HttP://MediaWiki.Org/]
25733 !! html/php
25734 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25735 </p>
25736 !! html/parsoid
25737 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25738 !! end
25739
25740 !!test
25741 T36939 - Case insensitive link parsing ([HttP:// title])
25742 !! wikitext
25743 [HttP://MediaWiki.Org/ MediaWiki]
25744 !! html
25745 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25746 </p>
25747 !! end
25748
25749 !!test
25750 T36939 - Case insensitive link parsing (HttP://)
25751 !! wikitext
25752 HttP://MediaWiki.Org/
25753 !! html/php
25754 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25755 </p>
25756 !! html/parsoid
25757 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25758 !! end
25759
25760 !!test
25761 Disable TOC
25762 !! options
25763 notoc
25764 !! wikitext
25765 Lead
25766 ==Section 1==
25767 ==Section 2==
25768 ==Section 3==
25769 ==Section 4==
25770 ==Section 5==
25771 !! html
25772 <p>Lead
25773 </p>
25774
25775 <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>
25776 <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>
25777 <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>
25778 <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>
25779 <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>
25780
25781 !! end
25782
25783
25784 ###
25785 ### Parsoid-specific tests
25786 ### Parsoid-PHP parser incompatibilities
25787 ###
25788 !!test
25789 1. SOL-sensitive wikitext tokens as template-args
25790 !! options
25791 parsoid=wt2html,wt2wt
25792 !! wikitext
25793 {{echo|*a}}
25794 {{echo|#a}}
25795 {{echo|:a}}
25796 !! html/php+tidy
25797 <ul><li>a</li></ul>
25798 <ol><li>a</li></ol>
25799 <dl><dd>a</dd></dl>
25800 !! html/parsoid
25801 <span about="#mwt1" typeof="mw:Transclusion">
25802 </span><ul about="#mwt1"><li>a</li>
25803 </ul>
25804 <span about="#mwt2" typeof="mw:Transclusion">
25805 </span><ol about="#mwt2"><li>a</li>
25806 </ol>
25807 <span about="#mwt3" typeof="mw:Transclusion">
25808 </span><dl about="#mwt3"><dd>a</dd>
25809 </dl>
25810 !!end
25811
25812 #### -----------------------------------------------------------------
25813 #### Parsoid-specific functionality tests
25814 #### -----------------------------------------------------------------
25815
25816 # T65642/T68749: Formatting elt fixup around images.
25817 # We know wt2wt will fail, but we expect selser to pass.
25818 # Due to the nature of our testing, wt2wt and selser tests will enter the
25819 # blacklist and we'll catch selser regressions based on changes to the
25820 # blacklist entries for selser tests.
25821 !! test
25822 1. Treebuilder fixup of formatting elt
25823 !! options
25824 parsoid=wt2html,wt2wt
25825 !! wikitext
25826 {|
25827 |
25828 <small>
25829 [[Image:Foobar.jpg|right|Test]]
25830 </small>
25831 |}
25832 !! html/php+tidy
25833 <table>
25834 <tbody><tr>
25835 <td>
25836 <p><small>
25837 </small></p><small>
25838 <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>
25839 </small><p><small></small>
25840 </p>
25841 </td></tr></tbody></table>
25842 !! html/parsoid
25843 <table>
25844 <tbody><tr><td>
25845 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25846 <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>
25847 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25848 </tbody></table>
25849 !! end
25850
25851 !! test
25852 2. Treebuilder fixup of formatting elt
25853 !! options
25854 parsoid=wt2html,wt2wt
25855 !! wikitext
25856 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25857
25858 <small>[[Image:Foobar.jpg|right|300px]]</small>
25859 !! html/php+tidy
25860 <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>
25861 </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>
25862 !! html/parsoid
25863 <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>
25864
25865 <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>
25866 !! end
25867
25868 !! test
25869 3. Treebuilder fixup of formatting elt
25870 !! options
25871 parsoid=wt2html,wt2wt
25872 !! wikitext
25873 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25874 !! html/php+tidy
25875 <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>
25876 </p>
25877 !! html/parsoid
25878 <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>
25879 !! end
25880
25881 !! test
25882 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25883 !! options
25884 parsoid=wt2html,wt2wt
25885 !! wikitext
25886 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25887 !! html/php+tidy
25888 <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>
25889 !! html/parsoid
25890 <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>
25891 !! end
25892
25893 #### ----------------------------------------------------------------
25894 #### Parsoid-only testing of Parsoid's impl of LST
25895 #### Not implemented yet, see
25896 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25897 #### ----------------------------------------------------------------
25898
25899 ## We still need to support serializing the older format while content is stored.
25900 !! test
25901 LST Sections: Backwards compatibility
25902 !! options
25903 parsoid={
25904 "suppressErrors": true,
25905 "modes": ["html2wt"]
25906 }
25907 !! wikitext
25908 <section begin="2011-05-16" />
25909 <section end="2014-04-10 (MW 1.23wmf22)" />
25910 !! html/parsoid
25911 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25912 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25913 !! end
25914
25915 !! test
25916 LST Sections: Newfangled approach
25917 !! wikitext
25918 <section begin="2011-05-16" />
25919 <section end="2014-04-10 (MW 1.23wmf22)" />
25920 !! html/parsoid
25921 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25922 </span>
25923 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25924 </span></p>
25925 !! end
25926
25927 #--------- Test stripping of empty nodes in template content ----------
25928
25929 !! test
25930 Empty LI and TR nodes should be stripped from template content
25931 !! wikitext
25932 {{EmptyLITest}}
25933 {{EmptyTRTest}}
25934 !! html/parsoid
25935 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25936 <li>a</li>
25937 <li>b</li>
25938 </ul>
25939 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25940 <tbody>
25941 <tr>
25942 <td>foo</td>
25943 </tr>
25944 <tr>
25945 <td>bar</td>
25946 </tr>
25947 </tbody>
25948 </table>
25949 !! end
25950
25951 !! test
25952 Empty LI and TR nodes should not be stripped from top-level content
25953 !! wikitext
25954 *a
25955 *
25956 *b
25957
25958 {|
25959 |-
25960 |-
25961 |foo
25962 |}
25963 !! html/parsoid
25964 <ul>
25965 <li>a</li>
25966 <li class='mw-empty-elt'></li>
25967 <li>b</li>
25968 </ul>
25969 <table>
25970 <tbody>
25971 <tr class='mw-empty-elt'></tr>
25972 <tr>
25973 <td>foo</td>
25974 </tr>
25975 </tbody>
25976 </table>
25977 !! end
25978
25979 !! test
25980 Empty TR nodes should not be stripped if they have any attributes set
25981 !! wikitext
25982 {{EmptyTRWithHTMLAttrTest}}
25983 !! html/parsoid
25984 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25985 <tr align='center'></tr>
25986 <tr><td>foo</td></tr>
25987 <tr align='center'></tr>
25988 <tr><td>bar</td></tr>
25989 </table>
25990 !! end
25991
25992 #### ----------------------------------------------------------------
25993 #### The following section of tests are primarily to test
25994 #### wikitext escaping capabilities of Parsoid. Given that
25995 #### escaping can be done any number of ways, the wikitext (input)
25996 #### is always adjusted to reflect how Parsoid adds nowiki
25997 #### escape tags.
25998 ####
25999 #### We are marking several tests as parsoid-only since the
26000 #### HTML in the result section is different from what the
26001 #### PHP parser generates for it.
26002 #### ----------------------------------------------------------------
26003
26004
26005 #### --------------- Headings ---------------
26006 #### 0. Unnested
26007 #### 1. Nested inside html <h1>=foo=</h1>
26008 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
26009 #### 3. Nested inside html with wikitext split by html tags
26010 #### 4. No escape needed
26011 #### 5. Empty headings <h1></h1>
26012 #### 6. Heading chars in SOL context
26013 #### ----------------------------------------
26014 !! test
26015 Headings: 0. Unnested
26016 !! options
26017 parsoid=html2wt
26018 !! html/parsoid
26019 <p>=foo=</p>
26020
26021 <p> =foo=
26022 <!--cmt-->
26023 =foo=</p>
26024
26025 <p>=foo<i>a</i>=</p>
26026 !! wikitext
26027 <nowiki>=foo=</nowiki>
26028
26029 <nowiki> </nowiki>=foo=
26030 <!--cmt-->
26031 <nowiki>=foo=</nowiki>
26032
26033 =foo''a''<nowiki>=</nowiki>
26034 !!end
26035
26036 # New headings and existing headings are handled differently
26037 !! test
26038 Headings: 1. Nested inside html
26039 !! options
26040 parsoid=html2wt
26041 !! html/parsoid
26042 <h1>=foo=</h1>
26043 <h2>=foo=</h2>
26044 <h3>=foo=</h3>
26045
26046 <h1 data-parsoid=''>=foo=</h1>
26047 <h2 data-parsoid=''>=foo=</h2>
26048 <h3 data-parsoid=''>=foo=</h3>
26049 <h4 data-parsoid=''>=foo=</h4>
26050 <h5 data-parsoid=''>=foo=</h5>
26051 <h6 data-parsoid=''>=foo=</h6>
26052 !! wikitext
26053 = =foo= =
26054
26055 == =foo= ==
26056
26057 === =foo= ===
26058
26059 =<nowiki>=foo=</nowiki>=
26060 ==<nowiki>=foo=</nowiki>==
26061 ===<nowiki>=foo=</nowiki>===
26062 ====<nowiki>=foo=</nowiki>====
26063 =====<nowiki>=foo=</nowiki>=====
26064 ======<nowiki>=foo=</nowiki>======
26065
26066 !!end
26067
26068 !! test
26069 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
26070 !! options
26071 parsoid=html2wt
26072 !! html/parsoid
26073 <h1>foo</h1>*bar
26074 <h1>foo</h1>=bar
26075 <h1>foo</h1>=bar=
26076 !! wikitext
26077 = foo =
26078 <nowiki>*</nowiki>bar
26079
26080 = foo =
26081 =bar
26082
26083 = foo =
26084 <nowiki>=bar=</nowiki>
26085 !!end
26086
26087 !! test
26088 Headings: 3. Nested inside html with wikitext split by html tags
26089 !! options
26090 parsoid=html2wt
26091 !! html/parsoid
26092 <h1>=<b>bold</b>foo=</h1>
26093 !! wikitext
26094 = ='''bold'''foo= =
26095 !!end
26096
26097 !! test
26098 Headings: 4a. No escaping needed (testing just h1 and h2)
26099 !! options
26100 parsoid=html2wt
26101 !! html/parsoid
26102 <h1>=foo</h1>
26103 <h1>foo=</h1>
26104 <h1> =foo= </h1>
26105 <h1>=foo= bar</h1>
26106 <h2>=foo</h2>
26107 <h2>foo=</h2>
26108 <h1>=</h1>
26109 <h1><i>=</i>foo=</h1>
26110 !! wikitext
26111 = =foo =
26112
26113 = foo= =
26114
26115 = =foo= =
26116
26117 = =foo= bar =
26118
26119 == =foo ==
26120
26121 == foo= ==
26122
26123 = = =
26124
26125 = ''=''foo= =
26126 !!end
26127
26128 !! test
26129 Headings: 4b. No escaping needed (inside p-tags)
26130 !! options
26131 parsoid=html2wt
26132 !! html/parsoid
26133 <p>=foo= x
26134 =foo= <s></s>
26135 </p>
26136 !! wikitext
26137 =foo= x
26138 =foo= <s></s>
26139 !! html/php
26140 <p>=foo= x
26141 =foo= <s></s>
26142 </p>
26143 !!end
26144
26145 !! test
26146 Headings: 4c. Short headings (1)
26147 !! options
26148 parsoid=html2wt
26149 !! html/parsoid
26150 <p>===
26151 </p>
26152 !! wikitext
26153 <nowiki>===</nowiki>
26154 !! html/php
26155 <p>===
26156 </p>
26157 !! end
26158
26159 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
26160 !! test
26161 Headings: 4d. Short headings (2)
26162 !! options
26163 parsoid=wt2html,html2html
26164 !! wikitext
26165 =
26166 ==
26167 ===
26168 ====
26169 =====
26170 !! html/php
26171 <p>=
26172 ==
26173 </p>
26174 <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>
26175 <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>
26176 <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>
26177
26178 !! html/parsoid
26179 <p>=
26180 ==</p>
26181 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
26182 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
26183 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
26184 !! end
26185
26186 !! test
26187 Headings: 5. Empty headings
26188 !! options
26189 parsoid=html2wt
26190 !! html/parsoid
26191 <h1 data-parsoid='{}'></h1>
26192
26193 <h2 data-parsoid='{}'></h2>
26194
26195 <h3 data-parsoid='{}'></h3>
26196
26197 <h4 data-parsoid='{}'></h4>
26198
26199 <h5 data-parsoid='{}'></h5>
26200
26201 <h6 data-parsoid='{}'></h6>
26202 !! wikitext
26203 =<nowiki/>=
26204
26205 ==<nowiki/>==
26206
26207 ===<nowiki/>===
26208
26209 ====<nowiki/>====
26210
26211 =====<nowiki/>=====
26212
26213 ======<nowiki/>======
26214 !!end
26215
26216 !! test
26217 Headings: 6a. Heading chars in SOL context (with trailing spaces)
26218 !! options
26219 parsoid=html2wt
26220 !! html/parsoid
26221 <p>=a=</p>
26222
26223 <p>=a=</p>
26224
26225 <p>=a=</p>
26226 !! wikitext
26227 <nowiki>=a=</nowiki>
26228
26229 <nowiki>=a=</nowiki>
26230
26231 <nowiki>=a=</nowiki>
26232 !!end
26233
26234 !! test
26235 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26236 !! options
26237 parsoid=html2wt
26238 !! html/parsoid
26239 <p>=a=
26240 b</p>
26241
26242 <p>=a=
26243 b</p>
26244
26245 <p>=a=
26246 b</p>
26247 !! wikitext
26248 <nowiki>=a=</nowiki>
26249 b
26250
26251 <nowiki>=a=</nowiki>
26252 b
26253
26254 <nowiki>=a=</nowiki>
26255 b
26256 !!end
26257
26258 !! test
26259 Headings: 6c. Heading chars in SOL context (leading newline break)
26260 !! options
26261 parsoid=html2wt
26262 !! html/parsoid
26263 <p>a
26264 =b=</p>
26265 !! wikitext
26266 a
26267 <nowiki>=b=</nowiki>
26268 !!end
26269
26270 !! test
26271 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26272 !! options
26273 parsoid=html2wt
26274 !! html/parsoid
26275 <!--c0--><p>=a=</p>
26276
26277 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26278 !! wikitext
26279 <!--c0--><nowiki>=a=</nowiki>
26280
26281 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26282 !!end
26283
26284 !! test
26285 Headings: 6d. Heading chars in SOL context (No escaping needed)
26286 !! options
26287 parsoid=html2wt
26288 !! html/parsoid
26289 =a=<div>b</div>
26290 !! wikitext
26291 =a=<div>b</div>
26292 !!end
26293
26294 !! test
26295 Headings: 7. Insert a newline between new content and headings
26296 !! options
26297 parsoid=html2wt
26298 !! html/parsoid
26299 <h2>NEW</h2>
26300 <p>new</p>
26301 <h2 data-parsoid='{}'>A</h2>
26302 <p data-parsoid='{}'>a</p>
26303 !! wikitext
26304 == NEW ==
26305 new
26306
26307 ==A==
26308 a
26309
26310 !! end
26311
26312 !! test
26313 Headings: Used as horizontal rule
26314 !! config
26315 wgFragmentMode=[ 'html5', 'legacy' ]
26316 !! options
26317 parsoid=wt2html
26318 !! wikitext
26319 ===============
26320 !! html/php
26321 <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>
26322
26323 !! html/parsoid
26324 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26325 !! end
26326
26327 #### --------------- Lists ---------------
26328 #### 0. Outside nests (*foo, etc.)
26329 #### 1. Nested inside html <ul><li>*foo</li></ul>
26330 #### 2. Inside definition lists
26331 #### 3. Only bullets at start should be escaped
26332 #### 4. No escapes needed
26333 #### 5. No unnecessary escapes
26334 #### 6. Escape bullets in SOL position
26335 #### 7. Escape bullets in a multi-line context
26336 #### ----------------------------------------
26337
26338 !! test
26339 Lists: 0. Outside nests
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <p>*foo</p>
26344
26345 <p>#foo</p>
26346
26347 <p>;Foo:bar</p>
26348 !! wikitext
26349 <nowiki>*</nowiki>foo
26350
26351 <nowiki>#</nowiki>foo
26352
26353 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26354 !!end
26355
26356 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26357 ## to test wikitext escaping, and insignificant whitespace diffs
26358 ## cause PHP parser tests to barf
26359 !! test
26360 Lists: 1. Nested inside html (No unnecessary escapes)
26361 !! options
26362 parsoid=html2wt
26363 !! html/parsoid
26364 <ul>
26365 <li>*foo</li>
26366 <li>#foo</li>
26367 <li>:foo</li>
26368 <li>;foo</li>
26369 <li data-parsoid='{}'>*foo</li>
26370 <li data-parsoid='{}'>#foo</li>
26371 <li data-parsoid='{}'>:foo</li>
26372 <li data-parsoid='{}'>;foo</li>
26373 </ul>
26374
26375 <ol>
26376 <li>*foo</li>
26377 <li>#foo</li>
26378 <li>:foo</li>
26379 <li>;foo</li>
26380 <li data-parsoid='{}'>*foo</li>
26381 <li data-parsoid='{}'>#foo</li>
26382 <li data-parsoid='{}'>:foo</li>
26383 <li data-parsoid='{}'>;foo</li>
26384 </ol>
26385 !! wikitext
26386 * *foo
26387 * #foo
26388 * :foo
26389 * ;foo
26390 *<nowiki>*foo</nowiki>
26391 *<nowiki>#foo</nowiki>
26392 *<nowiki>:foo</nowiki>
26393 *<nowiki>;foo</nowiki>
26394
26395 # *foo
26396 # #foo
26397 # :foo
26398 # ;foo
26399 #<nowiki>*foo</nowiki>
26400 #<nowiki>#foo</nowiki>
26401 #<nowiki>:foo</nowiki>
26402 #<nowiki>;foo</nowiki>
26403 !!end
26404
26405 !! test
26406 Lists: 2. Inside definition lists
26407 !! options
26408 parsoid=html2wt
26409 !! html/parsoid
26410 <dl><dt>;foo</dt></dl>
26411 <dl><dt>:foo</dt></dl>
26412 <dl><dt>:foo</dt>
26413 <dd>bar</dd></dl>
26414 <dl><dd>:foo</dd></dl>
26415 !! wikitext
26416 ; ;foo
26417
26418 ; <nowiki>:foo</nowiki>
26419
26420 ; <nowiki>:foo</nowiki>
26421 : bar
26422
26423 : :foo
26424 !!end
26425
26426 !! test
26427 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26428 !! options
26429 parsoid=html2wt
26430 !! html/parsoid
26431 <ul>
26432 <li>*foo*bar</li>
26433 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26434 </ul>
26435 !! wikitext
26436 * *foo*bar
26437 *<nowiki>*foo</nowiki>''it''*bar
26438 !!end
26439
26440 !! test
26441 Lists: 4. No escapes needed
26442 !! options
26443 parsoid=html2wt
26444 !! html/parsoid
26445 <ul>
26446 <li>foo*bar
26447 </li>
26448 </ul>
26449 <ul>
26450 <li><i>foo</i>*bar
26451 </li>
26452 </ul>
26453 <ul>
26454 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26455 </li>
26456 </ul>
26457 <ul>
26458 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26459 </li>
26460 </ul>
26461 !! wikitext
26462 *foo*bar
26463
26464 *''foo''*bar
26465
26466 *[[Foo]]: bar
26467
26468 *[[Foo]]*bar
26469 !!end
26470
26471 !! test
26472 Lists: 5. No unnecessary escapes
26473 !! options
26474 parsoid=html2wt
26475 !! html/parsoid
26476 <ul><li> bar <span>[[foo]]</span></li></ul>
26477 <ul><li> =bar <span>[[foo]]</span></li></ul>
26478 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26479 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26480 <ul><li> =bar <span>foo]]</span>=</li></ul>
26481 <ul><li> <s></s>: a</li></ul>
26482 <ul><li> <i>* foo</i></li></ul>
26483
26484 !! wikitext
26485 * bar <span><nowiki>[[foo]]</nowiki></span>
26486
26487 * =bar <span><nowiki>[[foo]]</nowiki></span>
26488
26489 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26490
26491 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26492
26493 * =bar <span>foo]]</span>=
26494
26495 * <s></s>: a
26496
26497 * ''* foo''
26498 !!end
26499
26500 !! test
26501 Lists: 6. Escape bullets in SOL position
26502 !! options
26503 parsoid=html2wt
26504 !! html/parsoid
26505 <p><!--cmt-->*foo</p>
26506 !! wikitext
26507 <!--cmt--><nowiki>*</nowiki>foo
26508 !!end
26509
26510 !! test
26511 Lists: 7. Escape bullets in a multi-line context
26512 !! options
26513 parsoid=html2wt
26514 !! html/parsoid
26515 <p>a
26516 *b
26517 </p>
26518 !! wikitext
26519 a
26520 <nowiki>*</nowiki>b
26521 !!end
26522
26523 !! test
26524 Lists: 8. Escape colons only if not present in tags
26525 !! options
26526 parsoid=html2wt
26527 !! html/parsoid
26528 <dl><dt>a:b<i>c:d</i></dt></dl>
26529 !! wikitext
26530 ; <nowiki>a:b</nowiki>''c:d''
26531 !! end
26532
26533 #### --------------- HRs ---------------
26534 #### 1. Single line
26535 #### -----------------------------------
26536
26537 !! test
26538 HRs: 1. Single line
26539 !! options
26540 parsoid=html2wt
26541 !! html/parsoid
26542 <hr />----
26543 <hr />=foo=
26544 <hr />*foo
26545 !! wikitext
26546 ----<nowiki>----</nowiki>
26547 ----=foo=
26548 ----*foo
26549 !! end
26550
26551 #### --------------- Tables ---------------
26552 #### 1a. Simple example
26553 #### 1b. No escaping needed (!foo)
26554 #### 1c. No escaping needed (|foo)
26555 #### 1d. No escaping needed (|}foo)
26556 ####
26557 #### 2a. Nested in td (<td>foo|bar</td>)
26558 #### 2b. Nested in td (<td>foo||bar</td>)
26559 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26560 ####
26561 #### 3a. Nested in th (<th>foo!bar</th>)
26562 #### 3b. Nested in th (<th>foo!!bar</th>)
26563 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26564 ####
26565 #### 4a. Escape -
26566 #### 4b. Escape +
26567 #### 4c. No escaping needed
26568 #### --------------------------------------
26569
26570 !! test
26571 Tables: 1a. Simple example
26572 !! options
26573 parsoid=html2wt
26574 !! html/parsoid
26575 <p>{|
26576 |}
26577 </p>
26578 !! wikitext
26579 <nowiki>{|</nowiki>
26580 |}
26581 !! end
26582
26583 !! test
26584 Tables: 1b. No escaping needed
26585 !! options
26586 parsoid=html2wt
26587 !! html/parsoid
26588 <p>!foo
26589 </p>
26590 !! wikitext
26591 !foo
26592 !! end
26593
26594 !! test
26595 Tables: 1c. No escaping needed
26596 !! options
26597 parsoid=html2wt
26598 !! html/parsoid
26599 <p>|foo
26600 </p>
26601 !! wikitext
26602 |foo
26603 !! end
26604
26605 !! test
26606 Tables: 1d. No escaping needed
26607 !! options
26608 parsoid=html2wt
26609 !! html/parsoid
26610 <p>|}foo
26611 </p>
26612 !! wikitext
26613 |}foo
26614 !! end
26615
26616 !! test
26617 Tables: 2a. Nested in td
26618 !! options
26619 parsoid=html2wt
26620 !! html/parsoid
26621 <table><tbody><tr>
26622 <td>foo|bar</td></tr>
26623 <tr><td>x<div>a|b</div></td>
26624 </tbody></table>
26625 !! wikitext
26626 {|
26627 |<nowiki>foo|bar</nowiki>
26628 |-
26629 |x<div><nowiki>a|b</nowiki></div>
26630 |}
26631 !! html/php+tidy
26632 <table>
26633 <tbody><tr>
26634 <td>foo|bar
26635 </td></tr>
26636 <tr>
26637 <td>x<div>a|b</div>
26638 </td></tr></tbody></table>
26639 !! end
26640
26641 !! test
26642 Tables: 2b. Nested in td
26643 !! options
26644 parsoid=html2wt
26645 !! html/parsoid
26646 <table><tbody><tr>
26647 <td>foo||bar</td>
26648 <td>a<i>b||c</i></td>
26649 <td>a<i><div>b||c</div></i></td>
26650 </tr></tbody></table>
26651 !! wikitext
26652 {|
26653 |<nowiki>foo||bar</nowiki>
26654 |a''<nowiki>b||c</nowiki>''
26655 |a''<div><nowiki>b||c</nowiki></div>''
26656 |}
26657 !! html/php
26658 <table>
26659 <tr>
26660 <td>foo||bar
26661 </td>
26662 <td>a<i>b||c</i>
26663 </td>
26664 <td>a<i><div>b||c</div></i>
26665 </td></tr></table>
26666
26667 !! end
26668
26669 !! test
26670 Tables: 2c. Nested in td -- no escaping needed
26671 !! options
26672 parsoid=html2wt
26673 !! html/*
26674 <table>
26675 <tr>
26676 <td>foo!!bar
26677 </td></tr></table>
26678
26679 !! wikitext
26680 {|
26681 |foo!!bar
26682 |}
26683 !! end
26684
26685 !! test
26686 Tables: 3a. Nested in th
26687 !! options
26688 parsoid=html2wt
26689 !! html/*
26690 <table>
26691 <tr>
26692 <th>foo!bar
26693 </th></tr></table>
26694
26695 !! wikitext
26696 {|
26697 !foo!bar
26698 |}
26699 !! end
26700
26701 !! test
26702 Tables: 3b. Nested in th
26703 !! options
26704 parsoid=html2wt
26705 !! html/parsoid
26706 <table><tbody>
26707 <tr><th>foo!!bar</th>
26708 <th><i>foo|bar</i></th>
26709 <th><i>foo!!bar</i></th>
26710 <th><i><span>foo!!bar</span></i></th>
26711 </tr></tbody></table>
26712 !! wikitext
26713 {|
26714 !<nowiki>foo!!bar</nowiki>
26715 !''<nowiki>foo|bar</nowiki>''
26716 !''<nowiki>foo!!bar</nowiki>''
26717 !''<span><nowiki>foo!!bar</nowiki></span>''
26718 |}
26719 !! html/php
26720 <table>
26721 <tr>
26722 <th>foo!!bar
26723 </th>
26724 <th><i>foo|bar</i>
26725 </th>
26726 <th><i>foo!!bar</i>
26727 </th>
26728 <th><i><span>foo!!bar</span></i>
26729 </th></tr></table>
26730
26731 !! end
26732
26733 !! test
26734 Tables: 3c. Nested in th
26735 !! options
26736 parsoid=html2wt
26737 !! html/parsoid
26738 <table><tbody>
26739 <tr><th>foo||bar</th>
26740 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26741 </tr></tbody></table>
26742 !! wikitext
26743 {|
26744 !<nowiki>foo||bar</nowiki>
26745 !<nowiki>foo||bar</nowiki>
26746 |}
26747 !! html/php
26748 <table>
26749 <tr>
26750 <th>foo||bar
26751 </th>
26752 <th>foo||bar
26753 </th></tr></table>
26754
26755 !! end
26756
26757 !! test
26758 Tables: 4a. Escape -
26759 !! options
26760 parsoid=html2wt
26761 !! html/*
26762 <table>
26763 <tr>
26764 <th>-bar
26765 </th></tr>
26766 <tr>
26767 <td>-bar
26768 </td></tr></table>
26769
26770 !! wikitext
26771 {|
26772 !-bar
26773 |-
26774 |<nowiki>-bar</nowiki>
26775 |}
26776 !! end
26777
26778 !! test
26779 Tables: 4b. Escape +
26780 !! options
26781 parsoid=html2wt
26782 !! html/*
26783 <table>
26784 <tr>
26785 <th>+bar
26786 </th></tr>
26787 <tr>
26788 <td>+bar
26789 </td></tr></table>
26790
26791 !! wikitext
26792 {|
26793 !+bar
26794 |-
26795 |<nowiki>+bar</nowiki>
26796 |}
26797 !! end
26798
26799 !! test
26800 Tables: 4c. No escaping needed
26801 !! options
26802 parsoid=html2wt
26803 !! html/parsoid
26804 <table><tbody>
26805 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26806 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26807 <tr><td>foo
26808 <p>bar|baz
26809 +bar
26810 -bar</p></td></tr>
26811 <tr><td>x
26812 <div>a|b</div></td>
26813 </tbody></table>
26814 !! wikitext
26815 {|
26816 |foo-bar
26817 |foo+bar
26818 |-
26819 |''foo''-bar
26820 |''foo''+bar
26821 |-
26822 |foo
26823 bar|baz
26824 +bar
26825 -bar
26826 |-
26827 |x
26828 <div>a|b</div>
26829 |}
26830 !! html/php
26831 <table>
26832 <tr>
26833 <td>foo-bar
26834 </td>
26835 <td>foo+bar
26836 </td></tr>
26837 <tr>
26838 <td><i>foo</i>-bar
26839 </td>
26840 <td><i>foo</i>+bar
26841 </td></tr>
26842 <tr>
26843 <td>foo
26844 <p>bar|baz
26845 +bar
26846 -bar
26847 </p>
26848 </td></tr>
26849 <tr>
26850 <td>x
26851 <div>a|b</div>
26852 </td></tr></table>
26853
26854 !! end
26855
26856 !! test
26857 Tables: 4d. No escaping needed
26858 !! options
26859 parsoid=html2wt
26860 !! html/parsoid
26861 <table>
26862 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26863 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26864 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26865 </tbody></table>
26866 !! wikitext
26867 {|
26868 |[[Foo]]-bar
26869 ||+1
26870 ||-2
26871 |}
26872 !! html/php
26873 <table>
26874 <tr>
26875 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26876 </td>
26877 <td>+1
26878 </td>
26879 <td>-2
26880 </td></tr></table>
26881
26882 !! end
26883
26884 !! test
26885 Tables: 4e. Escape }
26886 !! options
26887 parsoid=html2wt
26888 !! html/parsoid
26889 <table>
26890 <tr><td>}</td></tr>
26891 <tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table>
26892 </table>
26893 !! wikitext
26894 {|
26895 |<nowiki>}</nowiki>
26896 |-
26897 |x||}
26898 |}
26899 !! html/php
26900 <table>
26901 <tr>
26902 <td>}
26903 </td></tr>
26904 <tr>
26905 <td>x</td>
26906 <td>}
26907 </td></tr></table>
26908
26909 !! end
26910
26911 !! test
26912 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26913 !! options
26914 parsoid=html2wt
26915 !! html/parsoid
26916 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26917
26918 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26919
26920 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26921
26922 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26923 !! wikitext
26924 {|
26925 | || align="center" | ||
26926 |}
26927
26928 {|
26929 |
26930 | align="center" |
26931 |
26932 |}
26933
26934 {|
26935 | {{!}}{{!}} align="center" | ||
26936 |}
26937
26938 {|
26939 ! !! align="center" | !!
26940 |}
26941 !! html/php+tidy
26942 <table>
26943 <tbody><tr>
26944 <td></td>
26945 <td align="center"></td>
26946 <td>
26947 </td></tr></tbody></table>
26948 <table>
26949 <tbody><tr>
26950 <td>
26951 </td>
26952 <td align="center">
26953 </td>
26954 <td>
26955 </td></tr></tbody></table>
26956 <table>
26957 <tbody><tr>
26958 <td></td>
26959 <td align="center"></td>
26960 <td>
26961 </td></tr></tbody></table>
26962 <table>
26963 <tbody><tr>
26964 <th></th>
26965 <th align="center"></th>
26966 <th>
26967 </th></tr></tbody></table>
26968 !! end
26969
26970 !! test
26971 T97430: Don't emit empty nowiki pairs around marker meta tags
26972 !! options
26973 parsoid=html2wt
26974 !! html/parsoid
26975 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26976 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26977 !! wikitext
26978 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26979 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26980 !! end
26981
26982 !! test
26983 Unclosed xmlish element in table line shouldn't eat end delimiters
26984 !! options
26985 parsoid=html2wt
26986 !! html/parsoid
26987 <table>
26988 <tbody><tr><td> &lt;foo</td>
26989 <td> bar></td></tr>
26990 </tbody></table>
26991 !! wikitext
26992 {|
26993 | <foo
26994 | bar>
26995 |}
26996 !! html/php
26997 <table>
26998 <tr>
26999 <td>&lt;foo
27000 </td>
27001 <td>bar&gt;
27002 </td></tr></table>
27003
27004 !! end
27005
27006 #### --------------- Links ----------------
27007 #### 1. Quote marks in link text
27008 #### 2. Wikilinks: Escapes needed
27009 #### 3. Wikilinks: No escapes needed
27010 #### 4. Extlinks: Escapes needed
27011 #### 5. Extlinks: No escapes needed
27012 #### --------------------------------------
27013 !! test
27014 Links 1. WikiLinks: No escapes needed
27015 !! options
27016 parsoid=html2wt
27017 !! html/parsoid
27018 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
27019 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
27020 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
27021 !! wikitext
27022 [[Foo|Foo''boo'']]
27023 [[Foo|[Foobar]]]
27024 [[Foo|x [Foobar] x]]
27025 !! html/php
27026 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
27027 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
27028 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
27029 </p>
27030 !! end
27031
27032 !! test
27033 Links 2. WikiLinks: Escapes needed
27034 !! options
27035 parsoid=html2wt
27036 !! html/parsoid
27037 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
27038 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
27039 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
27040 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
27041 <a href="Foo" rel="mw:WikiLink">|Bar</a>
27042 <a href="Foo" rel="mw:WikiLink">]]bar</a>
27043 <a href="Foo" rel="mw:WikiLink">[[bar</a>
27044 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
27045 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
27046 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
27047 !! wikitext
27048 [[Foo|<nowiki>Foobar]</nowiki>]]
27049 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
27050 [[Foo|<nowiki>[[Bar]]</nowiki>]]
27051 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
27052 [[Foo|<nowiki>|Bar</nowiki>]]
27053 [[Foo|<nowiki>]]bar</nowiki>]]
27054 [[Foo|<nowiki>[[bar</nowiki>]]
27055 [[Foo|<nowiki>x [[ y</nowiki>]]
27056 [[Foo|<nowiki>x ]] y</nowiki>]]
27057 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
27058 !! html/php
27059 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
27060 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
27061 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
27062 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
27063 <a href="/wiki/Foo" title="Foo">|Bar</a>
27064 <a href="/wiki/Foo" title="Foo">]]bar</a>
27065 <a href="/wiki/Foo" title="Foo">[[bar</a>
27066 <a href="/wiki/Foo" title="Foo">x [[ y</a>
27067 <a href="/wiki/Foo" title="Foo">x ]] y</a>
27068 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
27069 </p>
27070 !! end
27071
27072 !! test
27073 Links 3. WikiLinks: No escapes needed
27074 !! options
27075 parsoid=html2wt
27076 !! html/parsoid
27077 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
27078 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
27079 !! wikitext
27080 [[Foo|[Foobar]]
27081 [[Foo|foo|bar]]
27082 !! html/php
27083 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
27084 <a href="/wiki/Foo" title="Foo">foo|bar</a>
27085 </p>
27086 !! end
27087
27088 !! test
27089 Links 4. ExtLinks: Escapes needed
27090 !! options
27091 parsoid=html2wt
27092 !! html/parsoid
27093 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
27094 <a rel="mw:ExtLink" href="http://google.com">google]</a>
27095 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
27096 <p>[http://google.com]</p>
27097 <p>[http://google.com google]</p>
27098 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
27099 <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>
27100 !! wikitext
27101 [http://google.com <nowiki>[google]</nowiki>]
27102 [http://google.com <nowiki>google]</nowiki>]
27103 [http://google.com <nowiki>goog] le</nowiki>]
27104
27105 <nowiki>[http://google.com]</nowiki>
27106
27107 <nowiki>[http://google.com google]</nowiki>
27108
27109 [http://google.com<nowiki>]</nowiki>
27110
27111 [{{echo|http://google.com}}<nowiki>]</nowiki>
27112 !! html/php
27113 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
27114 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
27115 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
27116 </p><p>[http://google.com]
27117 </p><p>[http://google.com google]
27118 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
27119 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
27120 </p>
27121 !! end
27122
27123 !! test
27124 Links 5. ExtLinks: No escapes needed
27125 !! options
27126 parsoid=html2wt
27127 !! html/parsoid
27128 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
27129 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
27130 !! wikitext
27131 [http://google.com [google]
27132
27133 [[http://google.com]]
27134 !! html/php
27135 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
27136 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
27137 </p>
27138 !! end
27139
27140 !! test
27141 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
27142 !! options
27143 parsoid=html2wt
27144 !! html/parsoid
27145 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
27146 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
27147 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
27148 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
27149 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
27150 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
27151 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27152 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
27153 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27154 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
27155 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
27156 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
27157 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
27158 </p>
27159 !! wikitext
27160 x<nowiki/>http://example.com<nowiki/>y
27161 http://example.com<nowiki/>?x
27162 http://example.com<nowiki/>&x
27163 http://example.com<nowiki/>'x
27164 http://example.com<nowiki/>,x
27165 http://example.com<nowiki/>.x
27166 http://example.com<nowiki/>;x
27167 http://example.com<nowiki/>:x
27168 http://example.com<nowiki/>;x
27169 http://example.com<nowiki/>!x
27170 http://example.com<nowiki/>=x
27171 http://example.com<nowiki/>(x)
27172 http://example.com(x<nowiki/>)
27173 !! end
27174
27175 !! test
27176 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27177 !! options
27178 parsoid=html2wt
27179 !! html/parsoid
27180 <p>x
27181 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
27182 y
27183 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
27184 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
27185 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
27186 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
27187 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
27188 </p>
27189 !! wikitext
27190 x
27191 http://example.com
27192 y
27193 "http://example.com"
27194 (http://example.com)
27195 (http://example.com) foo
27196 http://example.com,
27197 http://example.com, foo
27198 !! html/php
27199 <p>x
27200 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
27201 y
27202 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
27203 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
27204 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
27205 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
27206 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
27207 </p>
27208 !! end
27209
27210 !! test
27211 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27212 !! options
27213 parsoid=html2wt
27214 !! html/parsoid
27215 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
27216 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
27217 !! wikitext
27218 http://example.com.,;:!?\
27219 -http://example.com:
27220 !! html/php
27221 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
27222 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
27223 </p>
27224 !! end
27225
27226 !! test
27227 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
27228 !! options
27229 parsoid=html2wt
27230 !! html/parsoid
27231 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
27232 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
27233 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
27234 !! wikitext
27235 RFC 123<nowiki/>4
27236 RFC 123<nowiki/>y
27237 X<nowiki/>RFC 123<nowiki/>y
27238 !! end
27239
27240 !! test
27241 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
27242 !! options
27243 parsoid=html2wt
27244 !! html/parsoid
27245 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
27246 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
27247 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
27248 </p>
27249 !! wikitext
27250 RFC 123?foo
27251 RFC 123&foo
27252 -RFC 123-
27253 !! html/php
27254 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
27255 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
27256 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
27257 </p>
27258 !! end
27259
27260 !! test
27261 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27262 !! options
27263 parsoid=html2wt
27264 !! html/parsoid
27265 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27266 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27267 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27268 !! wikitext
27269 PMID 123<nowiki/>4
27270 PMID 123<nowiki/>y
27271 X<nowiki/>PMID 123<nowiki/>y
27272 !! end
27273
27274 !! test
27275 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27276 !! options
27277 parsoid=html2wt
27278 !! html/parsoid
27279 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27280 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27281 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27282 </p>
27283 !! wikitext
27284 PMID 123?foo
27285 PMID 123&foo
27286 -PMID 123-
27287 !! html/php
27288 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27289 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27290 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27291 </p>
27292 !! end
27293
27294 !! test
27295 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27296 !! options
27297 parsoid=html2wt
27298 !! html/parsoid
27299 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27300 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27301 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27302 </p>
27303 !! wikitext
27304 ISBN 1234567890<nowiki/>1
27305 ISBN 1234567890<nowiki/>x
27306 a<nowiki/>ISBN 1234567890<nowiki/>b
27307 !! end
27308
27309 !! test
27310 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27311 !! options
27312 parsoid=html2wt
27313 !! html/parsoid
27314 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27315 !! wikitext
27316 -ISBN 1234567890's
27317 !! html/php
27318 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27319 </p>
27320 !! end
27321
27322 !! test
27323 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27324 !! options
27325 parsoid=html2wt
27326 !! html/*
27327 <p>this is not a link: http://example.com
27328 </p>
27329 !! wikitext
27330 this is not a link: <nowiki>http://example.com</nowiki>
27331 !! end
27332
27333 !! test
27334 Links 15. Link trails can't become link prefixes.
27335 !! options
27336 language=is
27337 parsoid=html2wt
27338 !! html/parsoid
27339 <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>
27340 !! wikitext
27341 [[Söfnuður]]-[[00]]
27342 !! html/php
27343 <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>
27344 </p>
27345 !! end
27346
27347 #### --------------- Quotes ---------------
27348 #### 1. Quotes inside <b> and <i>
27349 #### 2. Link fragments separated by <i> and <b> tags
27350 #### 3. Link fragments inside <i> and <b>
27351 #### 4. No escaping needed
27352 #### --------------------------------------
27353 !! test
27354 1a. Quotes inside <b> and <i>
27355 !! options
27356 parsoid=html2wt
27357 !! html/*
27358 <p><i>'foo'</i>
27359 <i>''foo''</i>
27360 <i>'''foo'''</i>
27361 <i>foo</i>'s
27362 <b>'foo'</b>
27363 <b>''foo''</b>
27364 <b>'''foo'''</b>
27365 <b>foo'<i>bar'</i>baz</b>
27366 <b>foo</b>'s
27367 '<i>foo</i>
27368 <i>foo</i>'
27369 <i>foo'</i>'
27370 '<i>foo</i>'
27371 '<b>foo</b>
27372 <b>foo</b>'
27373 '<b>foo</b>'
27374 <i>fools'<span> errand</span></i>
27375 <i><span>fool</span>'s errand</i>
27376 '<i>foo</i> bar '<i>baz</i>
27377 a|!*#-:;+-~[]{}b'<i>x</i>
27378 </p>
27379 !! wikitext
27380 ''<nowiki/>'foo'''
27381 ''<nowiki>''foo''</nowiki>''
27382 ''<nowiki>'''foo'''</nowiki>''
27383 ''foo''<nowiki/>'s
27384 '''<nowiki/>'foo''''
27385 '''<nowiki>''foo''</nowiki>'''
27386 '''<nowiki>'''foo'''</nowiki>'''
27387 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27388 '''foo'''<nowiki/>'s
27389 '''foo''
27390 ''foo''<nowiki/>'
27391 ''foo'''<nowiki/>'
27392 '''foo''<nowiki/>'
27393 ''''foo'''
27394 '''foo'''<nowiki/>'
27395 ''''foo'''<nowiki/>'
27396 ''fools'<span> errand</span>''
27397 ''<span>fool</span>'s errand''
27398 '<nowiki/>''foo'' bar '''baz''
27399 a|!*#-:;+-~[]{}b'''x''
27400 !! end
27401
27402 !! test
27403 1b. Quotes inside <b> and <i> with other tags on same line
27404 !! options
27405 parsoid=html2wt
27406 !! html/parsoid
27407 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27408 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27409 <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>
27410 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27411 '<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>
27412 '<i>foo</i> <div title="name">test</div>
27413 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27414 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27415 <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>
27416 </ol>
27417 !! wikitext
27418 '''a'' foo ''[[bar]]''
27419 ''a''' foo ''[[bar]]''
27420 ''a''' foo '''{{echo|[[bar]]}}'''
27421 [[foo]] x'''[[bar]]''
27422 '''foo'' <ref>test</ref>
27423 '''foo'' <div title="name">test</div>
27424 '''foo'' and <br> bar
27425 <references />
27426 !! end
27427
27428 !! test
27429 2. Link fragments separated by <i> and <b> tags
27430 !! options
27431 parsoid=html2wt
27432 !! html/parsoid
27433 <p>[[<i>foo</i>hello]]</p>
27434 <p>[[<b>foo</b>hello]]</p>
27435 !! wikitext
27436 [[''foo''<nowiki>hello]]</nowiki>
27437
27438 [['''foo'''<nowiki>hello]]</nowiki>
27439 !! end
27440
27441 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27442 # this is one of the shortcomings of this format
27443 !! test
27444 3. Link fragments inside <i> and <b>
27445 !! options
27446 parsoid=html2wt
27447 !! html/parsoid
27448 <p><i>[[foo</i>]]</p>
27449 <p><b>[[foo</b>]]</p>
27450 !! wikitext
27451 ''[[foo''<nowiki>]]</nowiki>
27452
27453 '''[[foo'''<nowiki>]]</nowiki>
27454 !! end
27455
27456 !! test
27457 4. No escaping needed
27458 !! options
27459 parsoid=html2wt
27460 !! html/parsoid
27461 <p>'<span><i>bar</i></span>'
27462 '<span><b>bar</b></span>'
27463 'a:b'foo
27464 </p>
27465 !! wikitext
27466 '<span>''bar''</span>'
27467 '<span>'''bar'''</span>'
27468 'a:b'foo
27469 !! end
27470
27471 #### ----------- Paragraphs ---------------
27472 #### 1. No unnecessary escapes
27473 #### --------------------------------------
27474
27475 !! test
27476 1. No unnecessary escapes
27477 !! options
27478 parsoid=html2wt
27479 !! html/parsoid
27480 <p>bar <span>[[foo]]</span>
27481 </p><p>=bar <span>[[foo]]</span>
27482 </p><p>[[bar <span>[[foo]]</span>
27483 </p><p>]]bar <span>[[foo]]</span>
27484 </p><p>=bar <span>foo]]</span>=
27485 </p>
27486 !! wikitext
27487 bar <span><nowiki>[[foo]]</nowiki></span>
27488
27489 =bar <span><nowiki>[[foo]]</nowiki></span>
27490
27491 [[bar <span><nowiki>[[foo]]</nowiki></span>
27492
27493 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27494
27495 =bar <span>foo]]</span><nowiki>=</nowiki>
27496 !!end
27497
27498 #### ----------------------- PRE --------------------------
27499 !! test
27500 1. Leading whitespace in SOL context should be escaped
27501 !! options
27502 parsoid=html2wt
27503 !! html/parsoid
27504 <p> a</p>
27505
27506 <p> a</p>
27507
27508 <p> a(tab)</p>
27509
27510 <p> a
27511 <!--cmt-->
27512 a</p>
27513
27514 <p>a
27515 b</p>
27516
27517 <p>a
27518 b</p>
27519
27520 <p>a
27521 b</p>
27522 !! wikitext
27523 <nowiki> </nowiki>a
27524
27525 <nowiki> </nowiki> a
27526
27527 a(tab)
27528
27529 <nowiki> </nowiki> a
27530 <!--cmt-->
27531 <nowiki> </nowiki>a
27532
27533 a
27534 <nowiki> </nowiki>b
27535
27536 a
27537 b
27538
27539 a
27540 b
27541 !! html/php
27542 <p> a
27543 </p><p> a
27544 </p><p> a(tab)
27545 </p><p> a
27546 a
27547 </p><p>a
27548 b
27549 </p><p>a
27550 b
27551 </p><p>a
27552 b
27553 </p>
27554 !! end
27555
27556 !! test
27557 2. Leading whitespace in non-indent-pre contexts should not be escaped
27558 !! options
27559 parsoid=html2wt
27560 !! html/parsoid
27561 <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>
27562 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27563 <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>
27564 b</span></li>
27565 </ol>
27566 !! wikitext
27567 foo <ref>''a''
27568 b</ref>
27569 <references />
27570 !! end
27571
27572 !! test
27573 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27574 !! options
27575 parsoid=html2wt
27576 !! html/parsoid
27577 <blockquote>
27578 <p>
27579 a
27580 <span>b</span>
27581 c</p>
27582 </blockquote>
27583 !! wikitext
27584 <blockquote>
27585 a
27586 <span>b</span>
27587 c
27588 </blockquote>
27589 !! end
27590
27591 !! test
27592 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27593 !! options
27594 parsoid=html2wt
27595 !! html/parsoid
27596 <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>
27597 !! wikitext
27598 [[File:Foobar.jpg|thumb|caption]]
27599 !! end
27600
27601 !! test
27602 5. Nowiki escaping should account for indent-pres
27603 !! options
27604 parsoid=html2wt
27605 !! html/parsoid
27606 <pre>==foo==</pre>
27607 !! wikitext
27608 ==foo==
27609 !! end
27610
27611 !! test
27612 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27613 !! options
27614 parsoid=html2wt
27615 !! html/parsoid
27616 <pre>
27617 * foo
27618 * bar
27619 </pre>
27620 !! wikitext
27621 * foo
27622 * bar
27623 !! end
27624
27625 !! test
27626 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27627 !! options
27628 parsoid = {
27629 "modes": ["html2wt"],
27630 "scrubWikitext": true
27631 }
27632 !! html/parsoid
27633 <p> foo</p>
27634 <p> %foo</p>
27635 <p> *foo</p>
27636 <p> #foo</p>
27637 <p> =foo=</p>
27638 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27639 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27640 <p> <!--boo-->*foo</p>
27641 <p><!--boo--> *foo</p>
27642 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27643 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27644 !! wikitext
27645 foo
27646
27647 %foo
27648
27649 <nowiki/>*foo
27650
27651 <nowiki/>#foo
27652
27653 <nowiki/>=foo=
27654
27655 [[Category:Foo]]
27656 <nowiki/>*foo
27657
27658 [[Category:Foo]]
27659 <nowiki>*</nowiki>foo
27660
27661 <nowiki/><!--boo-->*foo
27662
27663 <!--boo--><nowiki/>*foo
27664
27665 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27666
27667 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27668 !! end
27669
27670 #### --------------- Behavior Switches --------------------
27671
27672 !! test
27673 1. Valid behavior switches should be escaped
27674 !! options
27675 parsoid=html2wt
27676 !! html/parsoid
27677 __TOC__
27678 <i>__TOC__</i>
27679 !! wikitext
27680 <nowiki>__TOC__</nowiki>
27681 ''<nowiki>__TOC__</nowiki>''
27682 !! end
27683
27684 !! test
27685 2. Invalid behavior switches should not be escaped
27686 !! options
27687 parsoid=html2wt
27688 !! html/parsoid
27689 __TOO__
27690 __|__
27691 !! wikitext
27692 __TOO__
27693 __|__
27694 !! end
27695
27696 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27697 !! test
27698 Behavior switches should be SOL-transparent
27699 !! options
27700 parsoid=html2wt
27701 !! html/parsoid
27702 <meta property="mw:PageProp/toc" />
27703
27704 <!-- this one's bogus -->
27705 <pre>__TOO__</pre>
27706
27707 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27708
27709 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27710 !! wikitext
27711 __TOC__
27712
27713 <!-- this one's bogus -->
27714 __TOO__
27715
27716 __TOC__ foo
27717
27718 __TOC__
27719 bar
27720 !! end
27721
27722 #### --------------- HTML tags ---------------
27723 #### 1. a tags
27724 #### 2. other tags
27725 #### 3. multi-line html tag
27726 #### 4. extension tags
27727 #### -----------------------------------------
27728 !! test
27729 1. a tags
27730 !! options
27731 parsoid=html2wt
27732 !! html/parsoid
27733 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27734 !! wikitext
27735 <a href="http://google.com">google</a>
27736 !! end
27737
27738 !! test
27739 2. other tags
27740 !! options
27741 parsoid=html2wt
27742 !! html/parsoid
27743 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27744 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27745 <li> &lt;td&gt;</li></ul>
27746
27747 !! wikitext
27748 * <nowiki><div>foo</div></nowiki>
27749 * <nowiki><div style="color:red">foo</div></nowiki>
27750 * <nowiki><td></nowiki>
27751 !! end
27752
27753 !! test
27754 3. multi-line html tag
27755 !! options
27756 parsoid=html2wt
27757 !! html/parsoid
27758 <p>&lt;div
27759 &gt;foo&lt;/div
27760 &gt;
27761 </p>
27762 !! wikitext
27763 <nowiki><div
27764 >foo</div
27765 ></nowiki>
27766 !! end
27767
27768 !! test
27769 4. extension tags
27770 !! options
27771 parsoid=html2wt
27772 !! html/parsoid
27773 <p>&lt;ref&gt;foo&lt;/ref&gt;
27774 </p><p>&lt;ref&gt;bar
27775 </p><p>baz&lt;/ref&gt;
27776 </p>
27777 !! wikitext
27778 <nowiki><ref>foo</ref></nowiki>
27779
27780 <nowiki><ref>bar</nowiki>
27781
27782 baz<nowiki></ref></nowiki>
27783 !! end
27784
27785 !! test
27786 Parsoid: newline inducing block nodes don't suppress <nowiki>
27787 !! options
27788 parsoid=html2wt
27789 !! html/parsoid
27790 a<h1>foo</h1>
27791 !! wikitext
27792 <nowiki> </nowiki>a
27793
27794 = foo =
27795 !! end
27796
27797 #### --------------- Others ---------------
27798 !! test
27799 Escaping nowikis
27800 !! options
27801 parsoid=html2wt
27802 !! html/parsoid
27803 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27804 </p>
27805 !! wikitext
27806 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27807 !! end
27808
27809 ## The quote-char in the input is necessary for triggering the bug
27810 !! test
27811 (T54035) Nowiki-escaping should not get tripped by " :" in text
27812 !! options
27813 parsoid=html2wt
27814 !! html/parsoid
27815 <p>foo's bar :</p>
27816 !! wikitext
27817 foo's bar :
27818 !! end
27819
27820 #----------- End of wikitext escaping tests --------------
27821
27822 !! test
27823
27824 Tag-like HTML structures are passed through as text
27825 !! wikitext
27826 <x y>
27827
27828 <x.y>
27829
27830 <x-y>
27831
27832 1>2
27833
27834 x<y
27835
27836 a>b
27837
27838 1<d e>f
27839 !! html
27840 <p>&lt;x y&gt;
27841 </p><p>&lt;x.y&gt;
27842 </p><p>&lt;x-y&gt;
27843 </p><p>1&gt;2
27844 </p><p>x&lt;y
27845 </p><p>a&gt;b
27846 </p><p>1&lt;d e&gt;f
27847 </p>
27848 !! end
27849
27850 !! test
27851 HTML tag with necessary entities in attributes
27852 !! wikitext
27853 <span title="&amp;amp;">foo</span>
27854 !! html
27855 <p><span title="&amp;amp;">foo</span>
27856 </p>
27857 !! end
27858
27859 !! test
27860 HTML tag with 'unnecessary' entity encoding in attributes
27861 !! wikitext
27862 <span title="&amp;">foo</span>
27863 !! html
27864 <p><span title="&amp;">foo</span>
27865 </p>
27866 !! end
27867
27868 !! test
27869 HTML tag with broken attribute value quoting
27870 !! options
27871 parsoid=wt2html,html2html
27872 !! wikitext
27873 <span title="Hello world>Foo</span>
27874 !! html/php
27875 <p><span title="Hello world">Foo</span>
27876 </p>
27877 !! html/parsoid
27878 <p><span title="Hello world">Foo</span></p>
27879 !! end
27880
27881 !! test
27882 Self-closed tag with broken attribute value quoting
27883 !! options
27884 parsoid=wt2html,html2html
27885 !! wikitext
27886 <div title="Hello world />Foo
27887 !! html/php+tidy
27888 <div title="Hello world"></div><p>Foo
27889 </p>
27890 !! html/parsoid
27891 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27892 !! end
27893
27894 !! test
27895 Table with broken attribute value quoting
27896 !! options
27897 parsoid=wt2html,html2html
27898 !! wikitext
27899 {|
27900 | title="Hello world|Foo
27901 |}
27902 !! html/php
27903 <table>
27904 <tr>
27905 <td title="Hello world">Foo
27906 </td></tr></table>
27907
27908 !! html/parsoid
27909 <table>
27910 <tr>
27911 <td title="Hello world">Foo
27912 </td></tr></table>
27913
27914 !! end
27915
27916 !! test
27917 Table with broken attribute value quoting on consecutive lines
27918 !! options
27919 parsoid=wt2html,html2html
27920 !! wikitext
27921 {|
27922 | title="Hello world|Foo
27923 | style="color:red|Bar
27924 |}
27925 !! html/php
27926 <table>
27927 <tr>
27928 <td title="Hello world">Foo
27929 </td>
27930 <td style="color:red">Bar
27931 </td></tr></table>
27932
27933 !! html/parsoid
27934 <table><tbody>
27935 <tr>
27936 <td title="Hello world">Foo
27937 </td><td style="color: red">Bar
27938 </td></tr></tbody></table>
27939
27940 !! end
27941
27942 !!test
27943 Accept empty td cell attribute
27944 !! wikitext
27945 {|
27946 | align="center" |foo|| |
27947 |}
27948 !! html
27949 <table>
27950 <tr>
27951 <td align="center">foo</td>
27952 <td>
27953 </td></tr></table>
27954
27955 !!end
27956
27957 !!test
27958 Non-empty attributes in th-cells
27959 !! wikitext
27960 {|
27961 !Foo!! style="color: red" |Bar
27962 |}
27963 !! html
27964 <table>
27965 <tr>
27966 <th>Foo</th>
27967 <th style="color: red">Bar
27968 </th></tr></table>
27969
27970 !!end
27971
27972 !!test
27973 Accept empty attributes in th-cells
27974 !! wikitext
27975 {|
27976 !|foo!!|bar
27977 |}
27978 !! html
27979 <table>
27980 <tr>
27981 <th>foo</th>
27982 <th>bar
27983 </th></tr></table>
27984
27985 !!end
27986
27987 !!test
27988 Empty table rows go away
27989 !! wikitext
27990 {|
27991 |Hello
27992 |there
27993 |- class="foo"
27994 |-
27995 |}
27996 !! html
27997 <table>
27998 <tr>
27999 <td>Hello
28000 </td>
28001 <td>there
28002 </td></tr>
28003
28004 </table>
28005
28006 !! end
28007
28008 ###
28009 ### Parsoid-centric tests for testing RTing of inter-element separators
28010 ### Edge cases not tested by existing parser tests and specific to
28011 ### Parsoid-specific serialization strategies.
28012 ###
28013
28014 !!test
28015 RT-ed inter-element separators should be valid separators
28016 !! wikitext
28017 {|
28018 |- [[foo]]
28019 |}
28020 !! html/php
28021 <table>
28022
28023 </table>
28024
28025 !! html/parsoid
28026 <table>
28027 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
28028 </tbody></table>
28029 !!end
28030
28031 # Parsoid-only test of a DOM pass
28032 !!test
28033 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
28034 !! wikitext
28035 {|
28036 |<small>foo
28037 bar
28038 |}
28039
28040 {|
28041 |<small>foo<small>
28042 |}
28043 !! html/parsoid
28044 <table>
28045 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
28046 <p>bar</p></small></td></tr>
28047 </tbody></table>
28048
28049 <table>
28050 <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>
28051 </tbody></table>
28052 !!end
28053
28054 # Note that the "style" attribute is really a template parameter here.
28055 # The = would have to be {{=}} if you wanted the literal.
28056 !!test
28057 Empty TD followed by TD with tpl-generated attribute
28058 !! wikitext
28059 {|
28060 |-
28061 |
28062 |{{echo|style='color:red'}}|foo
28063 |}
28064 !! html
28065 <table>
28066
28067 <tr>
28068 <td>
28069 </td>
28070 <td>foo
28071 </td></tr></table>
28072
28073 !!end
28074
28075 !!test
28076 Indented table with an empty td
28077 !! wikitext
28078 {|
28079 |-
28080 |
28081 |foo
28082 |}
28083 !! html
28084 <table>
28085
28086 <tr>
28087 <td>
28088 </td>
28089 <td>foo
28090 </td></tr></table>
28091
28092 !!end
28093
28094 !! test
28095 Indented table with blank lines in between (T85627)
28096 !! wikitext
28097 {|
28098 |foo
28099
28100
28101 |}
28102 !! html/php
28103 <table>
28104 <tr>
28105 <td>foo
28106 <p><br />
28107 </p>
28108 </td></tr></table>
28109
28110 !! html/parsoid
28111 <table>
28112 <tbody><tr><td>foo
28113 <p>
28114 <br /></p></td></tr>
28115 </tbody></table>
28116 !! end
28117
28118 !!test
28119 Indented block & table
28120 !! wikitext
28121 <div>foo</div>
28122 {|
28123 |foo
28124 |}
28125 !! html/php
28126 <div>foo</div>
28127 <table>
28128 <tr>
28129 <td>foo
28130 </td></tr></table>
28131
28132 !! html/parsoid
28133 <div data-parsoid='{"stx":"html"}'>foo</div>
28134 <table><tbody>
28135 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
28136 </tbody></table>
28137 !!end
28138
28139 !! test
28140 Indent and comment before table row
28141 !! wikitext
28142 {|
28143 <!--hi-->|-
28144 |there
28145 |}
28146 !! html/php
28147 <table>
28148
28149 <tr>
28150 <td>there
28151 </td></tr></table>
28152
28153 !! html/parsoid
28154 <table>
28155 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
28156 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
28157 </tbody></table>
28158 !! end
28159
28160 # PHP parser omits empty TR
28161 !!test
28162 Empty TR followed by a template-generated TR
28163 !! wikitext
28164 {|
28165 |-
28166 {{echo|<tr><td>foo</td></tr>}}
28167 |}
28168 !! html/php+tidy
28169 <table>
28170
28171 <tbody><tr><td>foo</td></tr>
28172 </tbody></table>
28173 !! html/parsoid
28174 <table>
28175 <tbody>
28176 <tr class='mw-empty-elt'></tr>
28177 <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}}]}'>
28178 <td>foo</td></tr>
28179 </tbody></table>
28180 !!end
28181
28182 ## PHP and parsoid output differ for this; as usual PHP omits empty
28183 ## elements, and since it strips the comments the TR is empty.
28184 !!test
28185 Empty TR followed by mixed-ws-comment line should RT correctly
28186 !! wikitext
28187 {|
28188 |-
28189 <!--c-->
28190 |-
28191 <!--c--> <!--d-->
28192 |}
28193 !! html/php+tidy
28194 <table>
28195
28196
28197 </table>
28198 !! html/parsoid
28199 <table>
28200 <tbody>
28201 <tr class='mw-empty-elt'></tr>
28202 <!--c-->
28203 <tr>
28204 <!--c--> </tr><!--d-->
28205 </tbody></table>
28206
28207 !!end
28208
28209 !!test
28210 Multi-line image caption generated by templates with/without trailing newlines
28211 !! wikitext
28212 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
28213 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
28214 !! html/parsoid
28215 <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>
28216 <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>
28217 !!end
28218
28219 !! test
28220 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
28221 !! options
28222 parsoid=html2wt
28223 !! html/parsoid
28224 <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>
28225
28226 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
28227 !! wikitext
28228 <includeonly>foo</includeonly>
28229 new para
28230
28231 [[Category:Foo]]
28232
28233 = new heading =
28234 !! end
28235
28236 ## PHP emits broken html for this, and since this is primarily
28237 ## a Parsoid serializer test, marking this Parsoid only
28238 !!test
28239 Improperly nested inline or quotes tags with whitespace in between
28240 !! wikitext
28241 <span> <s>x</span> </s>
28242 ''' ''x''' ''
28243 !! html/parsoid
28244 <p><span> <s>x</s></span><s> </s>
28245 <b> <i>x</i></b><i> </i>
28246 </p>
28247 !!end
28248
28249 !!test
28250 Encapsulate protected attributes from wt
28251 !! wikitext
28252 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
28253
28254 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
28255 |ok
28256 |}
28257 !! html/parsoid
28258 <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>
28259
28260 <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">
28261 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
28262 </tbody></table>
28263 !!end
28264
28265 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28266 ## Having nested or stray pre tags results in the attempt to add duplicates,
28267 ## causing an assertion fail. This test tries to prevent that situation.
28268 !! test
28269 Ensure ParagraphWrapper can deal with stray closing pre tags
28270 !! options
28271 parsoid=wt2html
28272 !! wikitext
28273 plain text</pre>
28274 !! html/parsoid
28275 <p>plain text</p>
28276 !! end
28277
28278 ## Remex doesn't account for fostered content.
28279 !! test
28280 1. Ensure fostered text content is wrapped in element nodes
28281 !! options
28282 parsoid=wt2html
28283 !! wikitext
28284 <table>hi</table><table>ho</table>
28285 !! html/php+tidy
28286 hi<table></table>ho<table></table>
28287 !! html/parsoid
28288 <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>
28289 !! end
28290
28291 ## Remex doesn't account for fostered content.
28292 !! test
28293 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28294 !! options
28295 parsoid=wt2html,wt2wt
28296 !! wikitext
28297 <table>
28298 <tr> || ||
28299 <td> a
28300 </table>
28301 !! html/php+tidy
28302 || ||
28303 <table>
28304 <tbody><tr><td> a
28305 </td></tr></tbody></table>
28306 !! html/parsoid
28307 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28308 <table data-parsoid='{"stx":"html"}'>
28309 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28310 </td></tr></tbody></table>
28311 !! end
28312
28313 ## Remex doesn't account for fostered content.
28314 !! test
28315 Encapsulation properly handles null DSR information from foster box
28316 !! options
28317 parsoid=wt2html,wt2wt
28318 !! wikitext
28319 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28320 !! html/parsoid
28321 <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>
28322 !! end
28323
28324 ## Remex doesn't account for fostered content.
28325 !! test
28326 1. Encapsulate foster-parented transclusion content
28327 !! options
28328 parsoid=wt2wt,wt2html
28329 !! wikitext
28330 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28331 !! html/php+tidy
28332 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28333 !! html/parsoid
28334 <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>
28335 !! end
28336
28337 !! test
28338 2. Encapsulate foster-parented transclusion content
28339 !! options
28340 parsoid=wt2wt,wt2html
28341 !! wikitext
28342 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28343 !! html/parsoid
28344 <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>
28345 <table>
28346 <tbody>
28347 <tr>
28348 <td>bar</td>
28349 </tr>
28350 </tbody>
28351 </table>
28352 !! end
28353
28354 !! test
28355 3. Encapsulate foster-parented transclusion content
28356 !! options
28357 parsoid=wt2wt,wt2html
28358 !! wikitext
28359 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28360 !! html/parsoid
28361 <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;]}">
28362 <p>foo</p>
28363 </div>
28364 <table>
28365 <tbody>
28366 <tr>
28367 <td>bar</td>
28368 </tr>
28369 </tbody>
28370 </table>
28371 !! end
28372
28373 !! test
28374 4. Encapsulate foster-parented transclusion content
28375 !! options
28376 parsoid=wt2wt,wt2html
28377 !! wikitext
28378 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28379 !! html/parsoid
28380 <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;]}">
28381 <p>foo</p>
28382 </div>
28383 <table>
28384 <tbody>
28385 <tr>
28386 <td>bar</td>
28387 </tr>
28388 </tbody>
28389 </table>
28390 !! end
28391
28392 ## Remex doesn't account for fostered content.
28393 !! test
28394 5. Encapsulate foster-parented transclusion content
28395 !!options
28396 parsoid=wt2wt,wt2html
28397 !! wikitext
28398 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28399 !! html/php+tidy
28400 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28401 !! html/parsoid
28402 <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>
28403 !! end
28404
28405 ## Remex doesn't account for fostered content.
28406 !! test
28407 6. Encapsulate foster-parented transclusion content
28408 !! options
28409 parsoid=wt2wt,wt2html
28410 !! wikitext
28411 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28412 !! html/php+tidy
28413 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28414 !! html/parsoid
28415 <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>
28416 !! end
28417
28418 !! test
28419 7. Encapsulate foster-parented transclusion content
28420 !!options
28421 parsoid=wt2wt,wt2html
28422 !! wikitext
28423 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28424 !! html/parsoid
28425 <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>
28426 <table>
28427 <tbody>
28428 <tr>
28429 <td>bar</td>
28430 </tr>
28431 </tbody>
28432 </table>
28433 !! end
28434
28435 ## Remex doesn't account for fostered content.
28436 # Note that the wt is broken on purpose: the = should be {{=}} if you
28437 # don't want it to be a template parameter key.
28438 !! test
28439 8. Encapsulate foster-parented transclusion content
28440 !! options
28441 parsoid=wt2wt,wt2html
28442 !! wikitext
28443 {{echo|a
28444 }}{|{{echo|style='color:red'}}
28445 |-
28446 |b
28447 |}
28448 !! html/php+tidy
28449 <p>a
28450 </p>
28451 <table>
28452
28453 <tbody><tr>
28454 <td>b
28455 </td></tr></tbody></table>
28456 !! html/parsoid
28457 <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">
28458 </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">
28459 <tbody><tr>
28460 <td>b
28461 </td></tr></tbody></table>
28462 !! end
28463
28464 ## Remex doesn't account for fostered content.
28465 !! test
28466 9. Encapsulate foster-parented transclusion content
28467 !!options
28468 parsoid=wt2wt,wt2html
28469 !! wikitext
28470 <table>{{echo|hi</table>hello}}
28471 !! html/php+tidy
28472 hi<table></table><p>hello
28473 </p>
28474 !! html/parsoid
28475 <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>
28476 !! end
28477
28478 !! test
28479 Table in fosterable position
28480 !!options
28481 parsoid=wt2html
28482 !! wikitext
28483 {{OpenTable}}
28484 <div>
28485 {|
28486 |}
28487 </div>
28488 |}
28489 !! html/parsoid
28490 <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">
28491 </span>
28492 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28493
28494 <table>
28495 </table>
28496 !! end
28497
28498 # Parsoid only for T66747
28499 !! test
28500 Properly encapsulate empty-content transclusions in fosterable positions
28501 !! wikitext
28502 <table>
28503 {{#if:|
28504 <td>foo</td>
28505 }}
28506 </table>
28507 !! html/parsoid
28508 <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"}]]}'>
28509
28510 </table>
28511 !! end
28512
28513 ## No longer captures its original intention
28514 !! test
28515 Always encapsulate foster box when template range is expanded to table
28516 !! options
28517 disabled
28518 parsoid=wt2wt
28519 !! wikitext
28520 {|
28521 hello
28522 {{OpenTable}}
28523 |}
28524 !! html/parsoid
28525
28526 !! end
28527
28528 !! test
28529 T115289: Unclosed table
28530 !! wikitext
28531 {{echo|<table>}}<!--c-->[[Category:Two]]
28532 !! html/parsoid
28533 <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>
28534 !! end
28535
28536 !! test
28537 T115289: Don't migrate newlines out of tables with fostered content
28538 !! wikitext
28539 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28540 !! html/parsoid
28541 <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>
28542 !! end
28543
28544 !! test
28545 T73074: More fostering fun
28546 !! wikitext
28547 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28548 !! html/parsoid
28549 <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>
28550 !! end
28551
28552 !!test
28553 Support <object> element with .data attribute
28554 !!options
28555 parsoid=html2wt
28556 !! html/parsoid
28557 <object data="test.swf"></object>
28558 !! wikitext
28559 <object data="test.swf"></object>
28560 !!end
28561
28562 !! test
28563 Don't block XML namespace declaration
28564 !! wikitext
28565 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28566 !! html/php
28567 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28568 </p>
28569 !! html/parsoid
28570 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28571 !! end
28572
28573 # -----------------------------------------------------------------
28574 # The following section of tests are primarily to spec requirements
28575 # around Parsoid's serialization (old, new, edited content)
28576 #
28577 # All these tests are marked Parsoid html2wt and html2html only
28578 # ----------------------------------------------------------------
28579
28580 !! test
28581 Ignore rel attribute in a-tags during serialization to url-links
28582 !! options
28583 parsoid=html2wt
28584 !! html/parsoid
28585 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28586 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28587 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28588 !! wikitext
28589 http://en.wikipedia.org/wiki/Foobar
28590 http://en.wikipedia.org/wiki/Foobar
28591 http://en.wikipedia.org/wiki/Foobar
28592 !! end
28593
28594 # 'mi' is a localinterwiki prefix as well as a language
28595 !! test
28596 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28597 !! options
28598 parsoid=html2wt
28599 !! html/parsoid
28600 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28601 !! wikitext
28602 [[Foo]]
28603 !! end
28604
28605 !! test
28606 Parsoid should accept interwiki shortcuts
28607 !! options
28608 parsoid=html2wt
28609 !! html/parsoid
28610 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28611 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28612 <a href='./fr:Foo'>Foo</a></p>
28613 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28614 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28615 <a href='fr%3AFoo'>Foo</a></p>
28616 <p><a href='FR%3AFoo'>Foo</a>
28617 <a href='./FR:Foo'>Foo</a></p>
28618 !! wikitext
28619 [[:fr:Foo|Foo]]
28620 [[:fr:Foo|Foo]]
28621 [[:fr:Foo|Foo]]
28622
28623 [[:fr:Foo|Foo]]
28624 [[:fr:Foo|Foo]]
28625 [[:fr:Foo|Foo]]
28626
28627 [[:fr:Foo|Foo]]
28628 [[:fr:Foo|Foo]]
28629 !! end
28630
28631 !! test
28632 Parsoid should not accept invalid interwiki shortcuts
28633 !! options
28634 parsoid=html2wt
28635 !! html/parsoid
28636 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28637 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28638 <a href='news:Foo'>Foo</a></p>
28639 !! wikitext
28640 [news:Foo Foo]
28641 [news:Foo Foo]
28642 [news:Foo Foo]
28643 !! end
28644
28645 # See T93839
28646 !! test
28647 New wikilinks should be serialized properly
28648 !! options
28649 parsoid=html2wt
28650 !! html/parsoid
28651 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28652 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28653 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28654 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28655 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28656 !! wikitext
28657 [[Foo]]
28658 [[Foo]]
28659 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28660 http://en.wikipedia.org/wiki/Foo
28661 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28662 !! end
28663
28664 !! test
28665 New wiki links (href variations)
28666 !! options
28667 parsoid=html2wt
28668 !! html/parsoid
28669 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28670 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28671 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28672 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28673 !! wikitext
28674 [[Foo_bar]]
28675 [[Foo_bar]]
28676 [[Foo_bar]]
28677 [[Toxine bactérienne]]
28678 !! end
28679
28680 !! test
28681 New wiki links (content string variations)
28682 !! options
28683 parsoid=html2wt
28684 !! html/parsoid
28685 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28686 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28687 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28688 !! wikitext
28689 [[Foo_bar]]
28690 [[Foo bar]]
28691 [[Foo_bar|./Foo_bar]]
28692 !! end
28693
28694 !! test
28695 New category links (href variations)
28696 !! options
28697 parsoid=html2wt
28698 !! html/parsoid
28699 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28700 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28701 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28702 !! wikitext
28703 [[Category:Toxine bactérienne]]
28704 [[Category:Toxine bactérienne]]
28705 [[Category:Toxine bactérienne]]
28706 !! end
28707
28708 !! test
28709 New sol transparent links don't need indent-pre nowiki protection
28710 !! options
28711 parsoid=html2wt
28712 language=de
28713 !! html/parsoid
28714 <link rel="mw:PageProp/redirect" href="./Main_Page">
28715 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28716 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28717 !! wikitext
28718 #WEITERLEITUNG [[Main Page]]
28719 <!-- this is good --> [[Category:Good]]
28720 <!-- this is great --> [[Kategorie:Great]]
28721 !! end
28722
28723 !! test
28724 New interlanguage links (href variations)
28725 !! options
28726 parsoid=html2wt
28727 !! html/parsoid
28728 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28729 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28730 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28731 !! wikitext
28732 [[es:Toxine bactérienne]]
28733 [[es:Toxine_bactérienne]]
28734 [[es:Toxine_bactérienne]]
28735 !! end
28736
28737 !! test
28738 Image: Modifying size of an image (1)
28739 !! options
28740 parsoid={
28741 "modes": ["wt2wt"],
28742 "changes": [
28743 ["img[height]", "attr", "height", "22"],
28744 ["img[width]", "attr", "width", "200"]
28745 ]
28746 }
28747 !! wikitext
28748 [[Image:Foobar.jpg|230x230px]]
28749 !! wikitext/edited
28750 [[Image:Foobar.jpg|200x200px]]
28751 !!end
28752
28753 !! test
28754 Image: Modifying size of an image (2)
28755 !! options
28756 parsoid={
28757 "modes": ["wt2wt"],
28758 "changes": [
28759 ["img[height]", "attr", "height", "100"],
28760 ["img[width]", "attr", "width", "500"]
28761 ]
28762 }
28763 !! wikitext
28764 [[Image:Foobar.jpg|230x230px]]
28765 !! wikitext/edited
28766 [[Image:Foobar.jpg|500x500px]]
28767 !!end
28768
28769 # Change in size is ignored so long as class='mw-default-size'
28770 !! test
28771 Image: Modifying size of an image (3)
28772 !! options
28773 parsoid={
28774 "modes": ["wt2wt"],
28775 "changes": [
28776 ["figure[class]", "removeClass", "mw-default-size"],
28777 ["figure img", "attr", "height", "19"],
28778 ["figure img", "attr", "width", "170"]
28779 ]
28780 }
28781 !! wikitext
28782 [[Image:Foobar.jpg|thumb]]
28783 !! wikitext/edited
28784 [[Image:Foobar.jpg|thumb|170x170px]]
28785 !!end
28786
28787 !! test
28788 Image: Modifying alignment of an image (T50665)
28789 !! options
28790 parsoid={
28791 "modes": ["wt2wt"],
28792 "changes": [
28793 ["figure[class]", "removeClass", "mw-halign-right"],
28794 ["figure[class]", "addClass", "mw-halign-left"]
28795 ]
28796 }
28797 !! wikitext
28798 [[Image:Foobar.jpg|thumb|caption|right]]
28799 !! wikitext/edited
28800 [[Image:Foobar.jpg|thumb|caption|left]]
28801 !! end
28802
28803 !! test
28804 Image: Modifying mw-default-size of an frameless image (T64805)
28805 !! options
28806 parsoid={
28807 "modes": ["wt2wt"],
28808 "changes": [
28809 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28810 ]
28811 }
28812 !! wikitext
28813 [[Image:Foobar.jpg|frameless|right]]
28814 !! wikitext/edited
28815 [[Image:Foobar.jpg|frameless|right|220x220px]]
28816 !! end
28817
28818 !! test
28819 Image: Modifying valign of an image (T51221)
28820 !! options
28821 parsoid={
28822 "modes": ["wt2wt"],
28823 "changes": [
28824 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28825 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28826 ]
28827 }
28828 !! wikitext
28829 [[File:Foobar.jpg|20px|middle]]
28830 !! wikitext/edited
28831 [[File:Foobar.jpg|20px|text-top]]
28832 !! end
28833
28834 !! test
28835 Image: Modifying alt attribute of an image (T58400)
28836 !! options
28837 parsoid={
28838 "modes": ["wt2wt"],
28839 "changes": [
28840 ["img[alt]", "attr", "alt", "some alternate edited text"]
28841 ]
28842 }
28843 !! wikitext
28844 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28845 !! wikitext/edited
28846 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28847 !!end
28848
28849 !! test
28850 Image: Modifying caption of an image
28851 !! options
28852 parsoid={
28853 "modes": ["wt2wt"],
28854 "changes": [
28855 ["figcaption", "text", "new caption"]
28856 ]
28857 }
28858 !! wikitext
28859 [[Image:Foobar.jpg|thumb|original caption]]
28860 !! wikitext/edited
28861 [[Image:Foobar.jpg|thumb|new caption]]
28862 !!end
28863
28864 !! test
28865 Image: empty alt attribute (T50924)
28866 !! wikitext
28867 [[File:Foobar.jpg|thumb|alt=|bar]]
28868 !! html/php+tidy
28869 <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>
28870 !! html/parsoid
28871 <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>
28872 !! end
28873
28874 !! test
28875 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28876 !! options
28877 parsoid=html2wt
28878 language=ar
28879 disabled
28880 !! html/parsoid
28881 <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>
28882 !! wikitext
28883 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28884 !! end
28885
28886 !! test
28887 Image: Block level image should have \n before and after
28888 !! wikitext
28889 123
28890 [[File:Foobar.jpg|right|thumb|150x150px]]
28891 456
28892 !! html/parsoid
28893 <p>123</p>
28894 <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>
28895 <p>456</p>
28896 !! end
28897
28898 !! test
28899 Image: New block level image should have \n before and after (existing content)
28900 !! wikitext
28901 123
28902 [[File:Foobar.jpg|right|thumb|150x150px]]
28903 456
28904 !! html/parsoid
28905 <p>123</p>
28906 <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>
28907 <p>456</p>
28908 !! end
28909
28910 !! test
28911 Image: upright option (parsoid)
28912 !! wikitext
28913 [[File:Foobar.jpg|thumb|upright|caption]]
28914 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28915 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28916 !! html/parsoid
28917 <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>
28918 <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>
28919 <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>
28920 !! end
28921
28922 !! test
28923 Image: upright option is ignored on inline and frame images (parsoid)
28924 !! wikitext
28925 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28926 !! html/parsoid
28927 <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>
28928 !! end
28929
28930 !! test
28931 Image: in template parameter with empty parameter
28932 !! wikitext
28933 {{echo|[[File:Foobar.jpg|link=]]}}
28934 !! html/parsoid
28935 <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>
28936 !! end
28937
28938 !! test
28939 Image: from basic HTML (1)
28940 !! options
28941 parsoid=html2wt
28942 !! html/parsoid
28943 <span typeof="mw:Image">
28944 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28945 </span>
28946 !! wikitext
28947 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28948 !! end
28949
28950 !! test
28951 Image: from basic HTML (2)
28952 !! options
28953 parsoid=html2wt
28954 !! html/parsoid
28955 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28956 !! wikitext
28957 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28958 !! end
28959
28960 !! test
28961 Image: from basic HTML (3)
28962 !! options
28963 parsoid=html2wt
28964 !! html/parsoid
28965 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28966 !! wikitext
28967 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28968 !! end
28969
28970 !! test
28971 Image: from basic HTML (4)
28972 !! options
28973 parsoid=html2wt
28974 !! html/parsoid
28975 <img src="./File:Foobar.jpg">
28976 !! wikitext
28977 [[File:Foobar.jpg|link=]]
28978 !! end
28979
28980 !! test
28981 Image: Invalid title as link
28982 !! wikitext
28983 [[File:Foobar.jpg|link=<]]
28984 !! html/php
28985 <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>
28986 </p>
28987 !! html/parsoid
28988 <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>
28989 !! end
28990
28991 !! test
28992 Various link types in alt and link options
28993 !! wikitext
28994 [[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
28995
28996 [[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
28997
28998 [[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
28999 !! html/php+tidy
29000 <p><a href="/wiki/Main_Page" title="caption"><img alt="Main Page" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
29001 </p><p><a href="/wiki/Media:Thumb.png" title="caption"><img alt="Media:Thumb.png" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
29002 </p><p><a href="http://en.wikipedia.org/wiki/Foo" title="caption"><img alt="wikipedia:Foo" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
29003 </p>
29004 !! html/parsoid
29005 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./Main_Page" data-parsoid='{"a":{"href":"./Main_Page"},"sa":{"href":"link=[[Main Page]]"}}'><img alt="Main Page" resource="./File:Foobar.jpg" 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":"Main Page","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=[[Main Page]]","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
29006
29007 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./Media:Thumb.png" data-parsoid='{"a":{"href":"./Media:Thumb.png"},"sa":{"href":"link=[[Media:Thumb.png]]"}}'><img alt="Media:Thumb.png" resource="./File:Foobar.jpg" 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":"Media:Thumb.png","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=[[Media:Thumb.png]]","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
29008
29009 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"link=[[wikipedia:Foo]]"}}'><img alt="wikipedia:Foo" resource="./File:Foobar.jpg" 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":"wikipedia:Foo","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=[[wikipedia:Foo]]","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
29010 !! end
29011
29012 !! test
29013 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
29014 !! options
29015 parsoid=html2wt
29016 !! html/parsoid
29017 <ul>
29018 <li><p>foo</p></li>
29019 </ul>
29020 !! wikitext
29021 * foo
29022 !! end
29023
29024 !! test
29025 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
29026 !! options
29027 parsoid=html2wt
29028 !! html/parsoid
29029 <ul> <li>foo</li></ul>
29030 !! wikitext
29031 * foo
29032 !! end
29033
29034 !! test
29035 Don't strip leading whitespace when handling indent-pre suppressing tags
29036 !! options
29037 parsoid=html2wt
29038 !! html/parsoid
29039 <table>
29040 <tr><td> indented row</td></tr>
29041 </table>
29042 <blockquote><p>
29043 <b>This is very bold of you!</b>
29044 </p>
29045 <table><tr><td>
29046 indented cell (no pre-wrapping!)
29047 </td></tr></table>
29048 </blockquote>
29049 <p>foo</p>
29050 <div>bar</div>
29051 !! wikitext
29052 {|
29053 | indented row
29054 |}
29055 <blockquote>
29056 '''This is very bold of you!'''
29057
29058 {|
29059 |
29060 indented cell (no pre-wrapping!)
29061 |}
29062 </blockquote>
29063 foo
29064 <div>bar</div>
29065 !! end
29066
29067 !! test
29068 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
29069 !! options
29070 parsoid=html2wt
29071 !! html/parsoid
29072 <p>foo</p>
29073 <span>bar</span>
29074
29075 <span>foo2
29076 </span>bar2
29077
29078 <div>foo</div>
29079 <span>bar</span>
29080
29081 <div>
29082 <span>foo</span>
29083 </div>
29084 !! wikitext
29085 foo
29086
29087 <span>bar</span>
29088
29089 <span>foo2
29090 <nowiki> </nowiki></span>bar2
29091
29092 <div>foo</div>
29093 <nowiki> </nowiki><span>bar</span>
29094
29095 <div>
29096 <nowiki> </nowiki><span>foo</span>
29097 </div>
29098 !! end
29099
29100 !! test
29101 Lists: Dont insert newlines in a serialized list item.
29102 !! options
29103 parsoid=html2wt
29104 !! html/parsoid
29105 <ul><li>a<br>b</li><li>c</li></ul>
29106 !! wikitext
29107 * a<br />b
29108 * c
29109 !! end
29110
29111 !! test
29112 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
29113 !! options
29114 parsoid={
29115 "modes": ["html2wt"],
29116 "scrubWikitext": false
29117 }
29118 !! html/parsoid
29119 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29120 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29121
29122 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29123 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29124
29125 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
29126
29127 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29128 !! wikitext
29129 == hello there [[Category:A1]] ==
29130
29131 == [[Category:A2]] hi pal ==
29132
29133 == <!--foo--> [[Category:A3]] how goes it ==
29134
29135 == it goes well [[Category:A4]] <!--bar--> ==
29136
29137 ==howdy [[Category:A5]]==
29138
29139 == __TOC__ ok ==
29140 !! end
29141
29142 !! test
29143 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
29144 !! options
29145 parsoid={
29146 "modes": ["html2wt"],
29147 "scrubWikitext": true
29148 }
29149 !! html/parsoid
29150 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29151 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29152
29153 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29154 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29155
29156 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29157 !! wikitext
29158 == hello there ==
29159 [[Category:A1]]
29160 [[Category:A2]]
29161
29162 == hi pal ==
29163
29164 <!--foo-->[[Category:A3]]
29165
29166 == how goes it ==
29167
29168 == it goes well ==
29169 [[Category:A4]] <!--bar-->
29170
29171 __TOC__
29172
29173 == ok ==
29174 !! end
29175
29176 !! test
29177 Headings: Don't hoist metas that come from templates
29178 !! options
29179 parsoid={
29180 "modes": ["html2wt"],
29181 "scrubWikitext": true
29182 }
29183 !! html/parsoid
29184 <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>
29185 !! wikitext
29186 == {{echo|foo [[Category:Foo]]}} ==
29187 !! end
29188
29189 !! test
29190 Headings: Category in ref isn't hoisted
29191 !! options
29192 parsoid={
29193 "modes": ["html2wt"],
29194 "scrubWikitext": true
29195 }
29196 !! html/parsoid
29197 <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>
29198
29199 <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>
29200 !! wikitext
29201 == foo <ref>bar
29202 [[Category:Baz]] </ref> ==
29203
29204 <references />
29205 !! end
29206
29207 !! test
29208 Parsoid: Serialize positional parameters with = in them as named parameter
29209 !! options
29210 parsoid=html2wt
29211 !! html/parsoid
29212 <p about="#mwt1" typeof="mw:Transclusion"
29213 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
29214
29215 <p about="#mwt1" typeof="mw:Transclusion"
29216 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
29217
29218 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29219 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29220 <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>
29221 !! wikitext
29222 {{echo|1=f=oo}}
29223
29224 {{echo|1=f=oo|2=bar}}
29225
29226 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29227 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29228 {{echo|<nowiki>f=oo</nowiki>|bar}}
29229 !! end
29230
29231 !! test
29232 Parsoid: Serialize positional parameters with = in extlink as named parameter
29233 !! options
29234 parsoid=html2wt
29235 !! html/parsoid
29236 <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>
29237 !! wikitext
29238 {{echo|1=http://stuff?is=ok}}
29239 !! end
29240
29241 !! test
29242 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
29243 !! options
29244 parsoid=html2wt
29245 !! html/parsoid
29246 <div>a<p>b</p></div>
29247 <div>a
29248 <p>b</p></div>
29249 <div>
29250 a
29251 <p>b</p></div>
29252 !! wikitext
29253 <div>a
29254 b
29255 </div>
29256 <div>a
29257 b
29258 </div>
29259 <div>
29260 a
29261
29262 b
29263 </div>
29264 !! end
29265
29266 !! test
29267 Substrings resembling wikitext in hrefs should not get nowiki escapes
29268 !! options
29269 parsoid=html2wt
29270 !! html/parsoid
29271 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
29272 !! wikitext
29273 [[Foo''bar''baz]]
29274 !! end
29275
29276 !! test
29277 Enforce single-line context in the serializer
29278 !! options
29279 parsoid=html2wt
29280 !! html/parsoid
29281 <h2>testing
29282 123</h2>
29283
29284 <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">
29285 </span><span about="#mwt1">you</span> </h2>
29286
29287 <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>
29288
29289 <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
29290 there</span></li></ol>
29291
29292 <ul><li>asd
29293 sdf</li></ul>
29294
29295 <ul><li>foo
29296 bar
29297 baz</li>
29298 <li>foo <b>bar</b>
29299 baz</li></ul>
29300
29301 <dl><dt>hi
29302 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29303 ho</dd></dl>
29304
29305 <dl><dd> <table>
29306 <tbody><tr><td> ha
29307 ha
29308 ha</td></tr>
29309 </tbody></table></dd></dl>
29310 !! wikitext
29311 == testing 123 ==
29312
29313 == hi {{bogus|there
29314 you}} ==
29315
29316 == foo <ref>hello
29317 there</ref> ==
29318
29319 <references />
29320
29321 * asd sdf
29322
29323 * foo bar baz
29324 * foo '''bar''' baz
29325
29326 ; hi ho : hi ho
29327
29328 : {|
29329 | ha
29330 ha
29331 ha
29332 |}
29333 !! end
29334
29335 !! test
29336 Serialize new placeholder space without spans
29337 !! options
29338 parsoid=html2wt
29339 !! html/parsoid
29340 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29341
29342 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29343
29344 <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>
29345 !! wikitext
29346 foo : bar
29347
29348 foo : bar
29349
29350 <ref>foo : bar</ref>ok
29351 !! end
29352
29353
29354 #-----------------------
29355 # Tag minimization tests
29356 #-----------------------
29357
29358 !! test
29359 1. I/B quote minimization: wikitext-only tags should be combined
29360 !! options
29361 parsoid=html2wt
29362 !! html/parsoid
29363 <p><i>A</i><i>B</i></p>
29364 <p><b>A</b><b>B</b></p>
29365 <p><i>A</i><b><i>B</i></b></p>
29366 <p><b>A</b><i><b>B</b></i></p>
29367 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29368 <p><i><b>A</b></i><i><b>B</b></i></p>
29369 <p><i><b>A</b></i><b><i>B</i></b></p>
29370 <p><b><i>A</i></b><i><b>B</b></i></p>
29371 !! wikitext
29372 ''AB''
29373
29374 '''AB'''
29375
29376 ''A'''B'''''
29377
29378 '''A''B'''''
29379
29380 '''A''BC''D'''
29381
29382 '''''AB'''''
29383
29384 '''''AB'''''
29385
29386 '''''AB'''''
29387 !! end
29388
29389 !! test
29390 2. I/B quote minimization: wikitext and html tags should not be combined
29391 !! options
29392 parsoid=html2wt
29393 !! html/parsoid
29394 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29395 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29396 !! wikitext
29397 ''A''<i>B</i>
29398
29399 ''A''<nowiki/>'''<i>B</i>'''
29400 !! end
29401
29402 !! test
29403 3. I/B quote minimization: templated content stops minimization
29404 !! options
29405 parsoid=html2wt
29406 !! html/parsoid
29407 <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>
29408 <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>
29409 !! wikitext
29410 ''A''{{echo|''B''}}
29411
29412 ''A''{{echo|'''''B'''''}}
29413 !! end
29414
29415 !! test
29416 4. I/B quote minimization: new content should be mimimized with adjacent old content
29417 !! options
29418 parsoid=html2wt
29419 !! html/parsoid
29420 <p><i>A</i><i>B</i></p>
29421 <p><b>A</b><b>B</b></p>
29422 <p><i>A</i><b><i>B</i></b></p>
29423 !! wikitext
29424 ''AB''
29425
29426 '''AB'''
29427
29428 ''A'''B'''''
29429 !! end
29430
29431 !! test
29432 5a. Merge adjacent quote nodes if they've been edited
29433 !! options
29434 parsoid={
29435 "modes": ["wt2wt", "selser"],
29436 "changes": [
29437 ["p", "contents", "remove", ":contains('b')"]
29438 ]
29439 }
29440 !! wikitext
29441 ''a''b''c''
29442 !! wikitext/edited
29443 ''ac''
29444 !! end
29445
29446 !! test
29447 5b. Merge adjacent quote nodes if they've been edited
29448 !! options
29449 parsoid={
29450 "modes": ["wt2wt", "selser"],
29451 "changes": [
29452 ["#x", "remove"]
29453 ]
29454 }
29455 !! wikitext
29456 ''a''<span id="x">b</span>''c''
29457 !! wikitext/edited
29458 ''ac''
29459 !! end
29460
29461 !! test
29462 1. Merge adjacent link nodes as long as at least one element is new
29463 !! options
29464 parsoid={
29465 "modes": ["html2wt"],
29466 "scrubWikitext": true
29467 }
29468 !! html/parsoid
29469 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29470 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29471 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29472 !! wikitext
29473 [[Football]]
29474 [[Football]]
29475 [[Football|Foot]][[Football|ball]]
29476 !! end
29477
29478 !! test
29479 2. Merge adjacent link nodes and enable additional normalizations
29480 !! options
29481 parsoid={
29482 "modes": ["html2wt"],
29483 "scrubWikitext": true
29484 }
29485 !! html/parsoid
29486 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29487 !! wikitext
29488 ''[[Football]]''
29489 !! end
29490
29491 !! test
29492 3. Don't merge adjacent link nodes if scrubWikitext is false
29493 !! options
29494 parsoid={
29495 "modes": ["html2wt"],
29496 "scrubWikitext": false
29497 }
29498 !! html/parsoid
29499 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29500 !! wikitext
29501 [[Football|Foot]][[Football|ball]]
29502 !! end
29503
29504 !! test
29505 1. Move format tags outside of WikiLink
29506 !! options
29507 parsoid={
29508 "modes": ["html2wt"],
29509 "scrubWikitext": true
29510 }
29511 !! html/parsoid
29512 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29513 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29514 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29515 !! wikitext
29516 ''[[Football]]''
29517 '''''[[Football]]'''''
29518 <u>'''''[[Football]]'''''</u>
29519 !! end
29520
29521 !! test
29522 2. Move format tags outside of WikiLink with mergable A tags
29523 !! options
29524 parsoid={
29525 "modes": ["html2wt"],
29526 "scrubWikitext": true
29527 }
29528 !! html/parsoid
29529 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29530 !! wikitext
29531 '''''[[Football]]'''''
29532 !! end
29533
29534 !! test
29535 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29536 !! options
29537 parsoid={
29538 "modes": ["html2wt"],
29539 "scrubWikitext": true
29540 }
29541 !! html/parsoid
29542 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29543 !! wikitext
29544 <font color="red"><u>'''[[Foo]]'''</u></font>
29545 !! end
29546
29547 !! test
29548 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29549 !! options
29550 parsoid={
29551 "modes": ["html2wt"],
29552 "scrubWikitext": true
29553 }
29554 !! html/parsoid
29555 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29556 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29557 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29558 !! wikitext
29559 [[Foo|<font color="red">Foo</font>]]
29560 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29561 [[Foo|<span class="Bar">Foo</span>]]
29562 !! end
29563
29564 !! test
29565 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29566 !! options
29567 parsoid={
29568 "modes": ["selser"],
29569 "scrubWikitext": true,
29570 "changes": [
29571 ["a", "html", "<i>Foo</i>"]
29572 ]
29573 }
29574 !! wikitext
29575 [[Foo]]
29576 !! wikitext/edited
29577 ''[[Foo]]''
29578 !! end
29579
29580 !! test
29581 6. Regression test: Manual edit test to ensure diff markers are not lost
29582 !! options
29583 parsoid={
29584 "modes": ["selser"],
29585 "scrubWikitext": true,
29586 "changes": [
29587 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29588 ]
29589 }
29590 !! wikitext
29591 ''Foo''
29592 !! wikitext/edited
29593 ''[[Foo]]''
29594 !! end
29595
29596 !! test
29597 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29598 !! options
29599 parsoid={
29600 "modes": ["selser"],
29601 "scrubWikitext": true,
29602 "changes": [
29603 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29604 ]
29605 }
29606 !! wikitext
29607 <div>placeholder</div>
29608 !! wikitext/edited
29609 <div>placeholder</div>
29610 [[Foo]] , placeholder
29611 !! end
29612
29613 #------------------------------
29614 # End of tag minimization tests
29615 #------------------------------
29616
29617 !!test
29618 T56262: New entities
29619 !! options
29620 parsoid=html2wt
29621 !! html/parsoid
29622 <span typeof="mw:Entity">&nbsp;</span>
29623 !! wikitext
29624 &nbsp;
29625 !! end
29626
29627 ## Note that there is no wikitext output for 'unknownproperty' ##
29628 ## Unknown magic words are silently dropped ##
29629
29630 !! test
29631 Magic words
29632 !! options
29633 parsoid=html2wt
29634 !! html/parsoid
29635 <meta property='mw:PageProp/toc' />
29636 <meta property='mw:PageProp/notoc' />
29637 <meta property='mw:PageProp/forcetoc' />
29638 <meta property='mw:PageProp/index' />
29639 <meta property='mw:PageProp/noindex' />
29640 <meta property='mw:PageProp/nogallery' />
29641 <meta property='mw:PageProp/noeditsection' />
29642 <meta property='mw:PageProp/notitleconvert' />
29643 <meta property='mw:PageProp/nocontentconvert' />
29644 <meta property='mw:PageProp/unknownproperty' />
29645 !! wikitext
29646 __TOC__
29647 __NOTOC__
29648 __FORCETOC__
29649 __INDEX__
29650 __NOINDEX__
29651 __NOGALLERY__
29652 __NOEDITSECTION__
29653 __NOTITLECONVERT__
29654 __NOCONTENTCONVERT__
29655 !! end
29656
29657 !! test
29658 Consecutive <pre>s should not get merged
29659 !! options
29660 parsoid=html2wt,html2html
29661 !! html/parsoid
29662 <pre>a</pre><pre>b</pre>
29663
29664 <pre>c
29665 </pre><pre>
29666 d</pre>
29667
29668 <pre>e
29669
29670 </pre><pre>
29671
29672 f</pre>
29673 !! wikitext
29674 a
29675
29676 b
29677
29678 c
29679
29680 d
29681
29682 e
29683
29684
29685
29686 f
29687 !! end
29688
29689 !! test
29690 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29691 !! options
29692 parsoid=html2wt
29693 !! html/parsoid
29694 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29695 !! wikitext
29696 [[Special:BookSources/1234567890|ISBN 1234567895]]
29697 !! end
29698
29699 !! test
29700 Edited RFC links not serializable as RFC links should serialize as extlinks
29701 !! options
29702 parsoid=html2wt
29703 !! html/parsoid
29704 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29705 !! wikitext
29706 [https://tools.ietf.org/html/rfc123 New RFC]
29707 !! end
29708
29709 !! test
29710 Edited PMID links not serializable as PMID links should serialize as extlinks
29711 !! options
29712 parsoid=html2wt
29713 !! html/parsoid
29714 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29715 !! wikitext
29716 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29717 !! end
29718
29719 !! test
29720 WTS of autolinks with trailing/surrounding context
29721 !! options
29722 parsoid=html2wt
29723 !! html/parsoid
29724 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29725 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29726 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29727 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29728 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29729 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29730 !! wikitext
29731 http://cscott.net'''foo'''
29732
29733 http://cscott.net<b>foo</b>
29734
29735 '''http://cscott.net'''
29736
29737 '''http://cscott.net '''
29738
29739 '''http://cscott.net<nowiki/>x'''
29740
29741 http://cscott.net<nowiki/>x
29742 !! end
29743
29744 !! test
29745 WTS of autolinks with nowikis (round-trip)
29746 !! wikitext
29747 x<nowiki/>http://cscott.net<nowiki/>x
29748 !! html/parsoid
29749 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29750 !! end
29751
29752 # this is the "easy" test because it leaves in place all the
29753 # data-parsoid information indicating this is an autolink
29754 !! test
29755 WTS of autolinks with escapes (editing)
29756 !! options
29757 parsoid={
29758 "modes": ["wt2wt"],
29759 "changes": [
29760 [ "span", "remove" ]
29761 ]
29762 }
29763 !! wikitext
29764 x<nowiki/>http://cscott.net<nowiki/>x
29765 !! wikitext/edited
29766 x<nowiki/>http://cscott.net<nowiki/>x
29767 !! end
29768
29769 !! test
29770 WTS of edited autolink-like text (T103364)
29771 !! options
29772 parsoid={
29773 "modes": ["wt2wt"],
29774 "changes": [
29775 [ "span[typeof]", "removeAttr", "typeof" ]
29776 ]
29777 }
29778 !! wikitext
29779 Not a link: <nowiki>http://example.com</nowiki>.
29780 !! wikitext/edited
29781 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29782 !! end
29783
29784 !! test
29785 WTS of newly-authored autolink-like text (T103364)
29786 !! options
29787 parsoid=html2wt
29788 !! html/parsoid
29789 <p>http://example.com is not a link.</p>
29790 !! wikitext
29791 <nowiki>http://example.com</nowiki> is not a link.
29792 !! end
29793
29794 !! test
29795 WTS of autolink-like text after an autolink (T108563)
29796 !! options
29797 parsoid=html2wt
29798 !! html/parsoid
29799 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29800 !! wikitext
29801 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29802 !! end
29803
29804 !! test
29805 Magic links inside links (not autolinked)
29806 !! wikitext
29807 [[Foo|http://example.com]]
29808 [[Foo|RFC 1234]]
29809 [[Foo|PMID 1234]]
29810 [[Foo|ISBN 123456789x]]
29811
29812 [http://foo.com http://example.com]
29813 [http://foo.com RFC 1234]
29814 [http://foo.com PMID 1234]
29815 [http://foo.com ISBN 123456789x]
29816 !! html+tidy
29817 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29818 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29819 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29820 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29821 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29822 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29823 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29824 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29825 </p>
29826 !! html/parsoid
29827 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29828 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29829 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29830 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29831
29832 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29833 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29834 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29835 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29836 !! end
29837
29838 !! test
29839 Magic links inside image captions (autolinked)
29840 !! wikitext
29841 [[File:Foobar.jpg|thumb|http://example.com]]
29842 [[File:Foobar.jpg|thumb|RFC 1234]]
29843 [[File:Foobar.jpg|thumb|PMID 1234]]
29844 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29845 !! html+tidy
29846 <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>
29847 <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>
29848 <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>
29849 <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>
29850 !! html/parsoid
29851 <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>
29852 <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>
29853 <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>
29854 <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>
29855 !! end
29856
29857 !! test
29858 WTS of magic word text (T109371)
29859 !! options
29860 parsoid=html2wt
29861 !! html/parsoid
29862 <p>RFC 1234</p>
29863 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29864 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29865 !! wikitext
29866 <nowiki>RFC 1234</nowiki>
29867
29868 [http://foo.com RFC 1234]
29869
29870 [[Foo|RFC 1234]]
29871 !! end
29872
29873 !! test
29874 Edited Redirect link should emit a non-piped wikitext link
29875 !! options
29876 parsoid=html2wt
29877 !! html/parsoid
29878 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29879 !! wikitext
29880 #REDIRECT [[Bar]]
29881 !! end
29882
29883 !! test
29884 T75121: Infer extension name from typeOf if data-mw is not present
29885 !! options
29886 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29887 !! html/parsoid
29888 <div typeOf="mw:Extension/foo"></div>
29889 !! wikitext
29890 <foo />
29891 !! end
29892
29893 # Note that the <p> wrapping isn't present in PHP parser output
29894 # The important thing for this test is that P-wrapping doesn't
29895 # interfere with the <nowiki> protection for leading - in <td>
29896 # (which isn't necessary for <th>).
29897 !! test
29898 T88318: p-wrapped dash in table.
29899 !! options
29900 parsoid=html2wt,wt2wt
29901 !! html/parsoid
29902 <table><tbody>
29903 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29904 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29905 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29906 </tbody></table>
29907 !! wikitext
29908 {|
29909 !-
29910 !-
29911 |-
29912 |<nowiki>-</nowiki>
29913 |<nowiki>- </nowiki>
29914 |-
29915 |<small>-</small>
29916 |<br />
29917 -
29918 |<br />-
29919 |}
29920 !! html/php+tidy
29921 <table>
29922 <tbody><tr>
29923 <th>-
29924 </th>
29925 <th>-
29926 </th></tr>
29927 <tr>
29928 <td>-
29929 </td>
29930 <td>-
29931 </td></tr>
29932 <tr>
29933 <td><small>-</small>
29934 </td>
29935 <td><br />
29936 <p>-
29937 </p>
29938 </td>
29939 <td><br />-
29940 </td></tr></tbody></table>
29941 !! end
29942
29943 !! test
29944 T149209: WTS: Handle newlines in table cells properly
29945 !! options
29946 parsoid=html2wt
29947 !! html/parsoid
29948 <table>
29949 <tbody>
29950 <tr><td>a
29951 b
29952 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29953 <tr><td><p>x</p>
29954 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29955 </tbody></table>
29956 <table>
29957 <tbody>
29958 <tr><th>a
29959 b
29960 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29961 <tr><th><p>x</h>
29962 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29963 </tbody></table>
29964 !! wikitext
29965 {|
29966 |a
29967 b
29968 |c
29969 |-
29970 |x
29971 {{!}}y
29972 |}
29973 {|
29974 !a
29975 b
29976 !c
29977 |-
29978 !x
29979 !y
29980 |}
29981 !! end
29982
29983 !! test
29984 T149209: Selser: Handle newlines in table cells properly
29985 !! options
29986 parsoid={
29987 "modes": ["selser"],
29988 "changes": [
29989 [ "#h1", "html", "a\nb\n" ],
29990 [ "#h2", "html", "a\nb\n" ],
29991 [ "#c1", "html", "a\nb\n" ],
29992 [ "#c2", "html", "<p>a</p>" ],
29993 [ "#c3", "html", "<p>a</p>" ],
29994 [ "#c4", "html", "edit-me<p>a</p>" ]
29995 ]
29996 }
29997 !! wikitext
29998 {|
29999 ! id="h1" |edit-me!!1
30000 |-
30001 ! id="h2" |edit-me||2
30002 |-
30003 | id="c1" |edit-me||3
30004 |-
30005 | id="c2" |edit-me||4
30006 |-
30007 | id="c3" |edit-me||p||q||r
30008 |-
30009 | id="c4" |edit-me||p||q||r
30010 |}
30011 !! wikitext/edited
30012 {|
30013 ! id="h1" |a
30014 b
30015 !1
30016 |-
30017 ! id="h2" |a
30018 b
30019 !2
30020 |-
30021 | id="c1" |a
30022 b
30023 |3
30024 |-
30025 | id="c2" |a
30026 |4
30027 |-
30028 | id="c3" |a
30029 |p||q||r
30030 |-
30031 | id="c4" |edit-me
30032 a
30033 |p||q||r
30034 |}
30035 !! end
30036
30037 !! test
30038 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
30039 !! options
30040 parsoid=html2wt
30041 !! html/parsoid
30042 <table id='mwAb'>
30043 <td id='mwAc'>foo</td>
30044 <td id='serialize-this'>bar</td>
30045 </table>
30046 !! wikitext
30047 {|
30048 |foo
30049 | id="serialize-this" |bar
30050 |}
30051 !! end
30052
30053 !! test
30054 Parsoid-like element ids should not be serialized to wikitext unless shadowed
30055 !! options
30056 parsoid=html2wt
30057 !! html/parsoid
30058 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
30059 !! wikitext
30060 <div id="hello">ok</div>
30061 !! end
30062
30063 !! test
30064 Testing serialization after deletion in references
30065 !! options
30066 parsoid={
30067 "modes": ["wt2wt"],
30068 "changes": [
30069 ["#x", "remove"]
30070 ]
30071 }
30072 !! wikitext
30073 hi <ref><div id="x">ho</div></ref>
30074
30075 <references />
30076 !! wikitext/edited
30077 hi <ref></ref>
30078
30079 <references />
30080 !! end
30081
30082 !!test
30083 Testing serialization after deletion of table cells
30084 !!options
30085 parsoid={
30086 "modes": ["wt2wt", "selser"],
30087 "changes": [
30088 ["#x", "remove"]
30089 ]
30090 }
30091 !!wikitext
30092 {|
30093 !h1 !!h2 !!h3
30094 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
30095 |}
30096 !! wikitext/edited
30097 {|
30098 !h1!!h2!!h3
30099 |c2|||c3
30100 |}
30101 !!end
30102
30103 !! test
30104 Testing selser after addition of new row before first row (T125419)
30105 !! options
30106 parsoid={
30107 "modes": ["wt2wt", "selser"],
30108 "changes": [
30109 [ "tr", "before", "<tr><td>X</td></tr>" ]
30110 ]
30111 }
30112 !! wikitext
30113 {|
30114 |a
30115 |}
30116 !! wikitext/edited
30117 {|
30118 |X
30119 |-
30120 |a
30121 |}
30122 !! end
30123
30124 !! test
30125 Serialize new table rows in a HTML table using HTML tags
30126 !! options
30127 parsoid={
30128 "modes": ["wt2wt", "selser"],
30129 "changes": [
30130 [ "tr", "before", "<tr><td>X</td></tr>" ]
30131 ]
30132 }
30133 !! wikitext
30134 <table><tr><td>a</td></tr></table>
30135 !! wikitext/edited
30136 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
30137 !! end
30138
30139 !! test
30140 Serialize new table cells in a HTML row using HTML tags
30141 !! options
30142 parsoid={
30143 "modes": ["wt2wt", "selser"],
30144 "changes": [
30145 [ "td", "before", "<td>X</td>" ]
30146 ]
30147 }
30148 !! wikitext
30149 <table><tr><td>a</td></tr></table>
30150 !! wikitext/edited
30151 <table><tr><td>X</td><td>a</td></tr></table>
30152 !! end
30153
30154 !! test
30155 Serialize wikitext list items as HTML list items when embedded in a HTML list
30156 !! options
30157 parsoid=html2wt
30158 !! html/parsoid
30159 <ul data-parsoid='{"stx": "html"}'>
30160 <li data-parsoid='{}'>a</li>
30161 <li>b</li>
30162 </ul>
30163 !! wikitext
30164 <ul>
30165 <li>a</li>
30166 <li>b</li>
30167 </ul>
30168 !! html/php+tidy
30169 <ul>
30170 <li>a</li>
30171 <li>b</li>
30172 </ul>
30173 !! end
30174
30175 # Nested list should be inside <li>, that is
30176 # <ul><li>foo<ul>..</ul></li></ul> instead of
30177 # <ul><li>foo</li><ul>..</ul></ul>
30178 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
30179 !! test
30180 Wikitext lists can be nested inside HTML lists
30181 !! options
30182 parsoid=html2wt
30183 !! html/parsoid
30184 <ul data-parsoid='{"stx": "html"}'>
30185 <li data-parsoid='{"stx": "html"}'>a
30186 <ul><li>b</li></ul>
30187 </li>
30188 </ul>
30189
30190 <ul data-parsoid='{"stx": "html"}'>
30191 <li>x
30192 <ul><li>y</li></ul>
30193 </li>
30194 </ul>
30195 !! wikitext
30196 <ul>
30197 <li>a
30198 * b
30199 </li>
30200 </ul>
30201
30202 <ul>
30203 <li>x
30204 * y
30205 </li>
30206 </ul>
30207 !! html/php+tidy
30208 <ul>
30209 <li>a
30210 <ul><li>b</li></ul>
30211 </li>
30212 </ul>
30213 <ul>
30214 <li>x
30215 <ul><li>y</li></ul>
30216 </li>
30217 </ul>
30218 !! end
30219
30220 !! test
30221 WTS change modes
30222 !! options
30223 parsoid={
30224 "modes": ["wt2wt"],
30225 "changes": [
30226 [ "#xyz", "before", "<b>before</b> stuff " ],
30227 [ "#xyz", "after", " stuff <i>after</i>" ],
30228 [ "#xyz", "html", "x <b>y</b> z" ]
30229 ]
30230 }
30231 !! wikitext
30232 <span id="xyz">hello</span>
30233 !! wikitext/edited
30234 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
30235 !! end
30236
30237 !! test
30238 Never serialize a-tag as html, regardless of what data-parsoid has to say
30239 !! options
30240 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30241 !! html/parsoid
30242 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
30243 !! wikitext
30244 [[Foo]]
30245 !! end
30246
30247 ## SSS FIXME: This is broken output nevertheless.
30248 ## What might be a reasonable non-broken output for this?
30249 ## This is an edge case unlikely to be seen in production
30250 ## that I am not wasting more time on this right now.
30251 !! test
30252 Never serialize a-tag as html, no matter what attributes it has
30253 !! options
30254 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30255 !! html/parsoid
30256 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
30257 !! wikitext
30258 [http://boo.org http://boohoo.org]
30259 !! end
30260
30261 # Misnested is an indication that selser can reuse the source but these have
30262 # shown to sneak through on occasion. See T101768.
30263 # The original wikitext here is: [http://test.com [[one]] two three]
30264 !! test
30265 Strip span tags added to mark misnested links
30266 !! options
30267 parsoid=html2wt
30268 !! html/parsoid
30269 <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>
30270 !! wikitext
30271 [http://test.com][[one]] two three
30272 !! end
30273
30274 !! test
30275 Catch regression when unpacking misnested links
30276 !! options
30277 parsoid=wt2html
30278 !! wikitext
30279 {{echo|hi}}[http://example.com [[ho]]]
30280 !! html/parsoid
30281 <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>
30282 !! end
30283
30284 !! test
30285 Catch regression when unpacking with trailing content
30286 !! wikitext
30287 {{echo|Foo <references/> bar}}
30288 !! html/parsoid
30289 <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>
30290 !! end
30291
30292 !! test
30293 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
30294 !! options
30295 parsoid=html2wt
30296 !! html/parsoid
30297 <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|}"]}'>
30298 <tbody><tr><td>d
30299 </td></tr>
30300 </tbody></table>
30301 !! wikitext
30302 {{echo|a}}
30303 {|{{echo|c
30304 {{!}}d
30305 }}
30306 |}
30307 !! end
30308
30309 ## This test verifies the presence and computation of this attribute indirectly
30310 ## by making an edit and ensuring that the serialization is correct (which it would be
30311 ## only if firstWikitextNode is properly set).
30312 !! test
30313 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30314 !! options
30315 parsoid= {
30316 "modes": ["wt2wt"],
30317 "changes": [
30318 [ "div#x", "remove" ],
30319 [ "div", "before", "<div>new</div>" ]
30320 ]
30321 }
30322 !! wikitext
30323 <div id="x">foo</div>
30324 {|
30325 {{echo|<div>boo</div>
30326 {{!}}b}}
30327 |c
30328 |}
30329 !! wikitext/edited
30330
30331 <div>new</div>
30332 {|
30333 {{echo|<div>boo</div>
30334 {{!}}b}}
30335 |c
30336 |}
30337 !! end
30338
30339 # --------------------------------------------
30340 # Tests spec'ing wikitext serialization norms |
30341 # --------------------------------------------
30342
30343 !! test
30344 Serialize multi-line indent-pre starting with wikitext syntax
30345 !! options
30346 parsoid=html2wt
30347 !! html/parsoid
30348 <pre>* 1
30349 ** 2
30350 * 3</pre>
30351 !! wikitext
30352 * 1
30353 ** 2
30354 * 3
30355 !! end
30356
30357 !! test
30358 1. Categories should always be serialized on their own line
30359 !! options
30360 parsoid=html2wt
30361 !! html/parsoid
30362 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30363 !! wikitext
30364 foo
30365 [[Category:Foo]]
30366 bar
30367 !! end
30368
30369 !! test
30370 2. Categories that are part of templates should not introduce a line break
30371 !! wikitext
30372 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30373 !! html/parsoid
30374 <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>
30375 !! end
30376
30377 # Careful while editing these next 2 tests. There are \u200f characters
30378 # before and after the <link> tags in the HTML and following some
30379 # of the categories in wikitext
30380 # Do not remove these characters in edits.
30381 #
30382 # As part of the serialization, these bidi characters will get stripped.
30383 !! test
30384 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30385 !! options
30386 parsoid={
30387 "modes": ["html2wt"],
30388 "scrubWikitext": true
30389 }
30390 !! html/parsoid
30391 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30392 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30393 !! wikitext
30394 [[קטגוריה:טקסים]]
30395 [[קטגוריה: שיטות משפט]]
30396 !! end
30397
30398 !! test
30399 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30400 !! options
30401 parsoid={
30402 "modes": ["html2wt"],
30403 "scrubWikitext": true
30404 }
30405 !! html/parsoid
30406 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30407 !! wikitext
30408 [[קטגוריה:טקסים]]
30409 ‏y
30410 !! end
30411
30412 !! test
30413 Lists: Add space after bullets
30414 !! options
30415 parsoid=html2wt
30416 !! html/parsoid
30417 <ul>
30418 <li>foo</li>
30419 <li> bar</li>
30420 <li><span> baz</span></li>
30421 </ul>
30422 !! wikitext
30423 * foo
30424 * bar
30425 * <span> baz</span>
30426 !! end
30427
30428 !! test
30429 1. Headings: Add space before/after == (T53744)
30430 !! options
30431 parsoid=html2wt
30432 !! html/parsoid
30433 <h2>foo</h2>
30434 <h2> bar</h2>
30435 <h2>baz </h2>
30436 <h2><span> baz</span></h2>
30437 !! wikitext
30438 == foo ==
30439
30440 == bar ==
30441
30442 == baz ==
30443
30444 == <span> baz</span> ==
30445 !! end
30446
30447 !! test
30448 2. Headings: Add space before/after == even after hoisted content
30449 !! options
30450 parsoid={
30451 "modes": ["html2wt"],
30452 "scrubWikitext": true
30453 }
30454 !! html/parsoid
30455 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30456 !! wikitext
30457 [[Category:A2]]
30458
30459 == ok ==
30460 !! end
30461
30462 !! test
30463 1. Headings: suppress newly created empty headings
30464 !! options
30465 parsoid={
30466 "modes": ["html2wt"],
30467 "scrubWikitext": true
30468 }
30469 !! html/parsoid
30470 <h2></h2>
30471 !! wikitext
30472 !! end
30473
30474 !! test
30475 2. Headings: don't suppress empty headings if scrubWikitext is false
30476 !! options
30477 parsoid=html2wt
30478 !! html/parsoid
30479 <h2></h2>
30480 !! wikitext
30481 ==<nowiki/>==
30482 !! end
30483
30484 !! test
30485 3. Headings: suppress empty headings on edits
30486 !! options
30487 parsoid={
30488 "modes": ["selser"],
30489 "scrubWikitext": true,
30490 "changes": [
30491 [ "#x", "remove"]
30492 ]
30493 }
30494 !! wikitext
30495 ==<span id="x">foo</span>==
30496 !! wikitext/edited
30497 !! end
30498
30499 !! test
30500 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30501 !! options
30502 parsoid={
30503 "modes": ["html2wt"],
30504 "scrubWikitext": true
30505 }
30506 !! html/parsoid
30507 <h2>foo<br/>bar</h2>
30508 <h2>foo <span><br/>bar</span> baz</h2>
30509 !! wikitext
30510 == foo bar ==
30511
30512 == foo <span> bar</span> baz ==
30513 !! end
30514
30515 !! test
30516 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30517 !! options
30518 parsoid={
30519 "modes": ["html2wt"],
30520 "scrubWikitext": false
30521 }
30522 !! html/parsoid
30523 <h2>foo<br/>bar</h2>
30524 !! wikitext
30525 == foo<br />bar ==
30526 !! end
30527
30528 !! test
30529 1. WT Quote Tags: suppress newly created empty style tags
30530 !! options
30531 parsoid={
30532 "modes": ["html2wt"],
30533 "scrubWikitext": true
30534 }
30535 !! html/parsoid
30536 <i></i><b></b>
30537 !! wikitext
30538 !! end
30539
30540 !! test
30541 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30542 !! options
30543 parsoid=html2wt
30544 !! html/parsoid
30545 <i></i><b></b>
30546 !! wikitext
30547 ''<nowiki/>'''''<nowiki/>'''
30548 !! end
30549
30550 !! test
30551 3. WT Quote Tags: suppress empty style tags on edits
30552 !! options
30553 parsoid={
30554 "modes": ["selser"],
30555 "scrubWikitext": true,
30556 "changes": [
30557 [ "#x", "remove"]
30558 ]
30559 }
30560 !! wikitext
30561 '''<span id="x">foo</span>'''
30562 !! wikitext/edited
30563 !! end
30564
30565 !! test
30566 1. Anchors: suppress newly created empty anchors
30567 !! options
30568 parsoid={
30569 "modes": ["html2wt"],
30570 "scrubWikitext": true
30571 }
30572 !! html/parsoid
30573 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30574 !! wikitext
30575 !! end
30576
30577 !! test
30578 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30579 !! options
30580 parsoid={
30581 "modes": ["html2wt"],
30582 "scrubWikitext": false
30583 }
30584 !! html/parsoid
30585 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30586 !! wikitext
30587 [[Test|<nowiki/>]]
30588 !! end
30589
30590 !! test
30591 3. Anchors: suppress empty anchors on edits
30592 !! options
30593 parsoid={
30594 "modes": ["selser"],
30595 "scrubWikitext": true,
30596 "changes": [
30597 [ "#x", "remove"]
30598 ]
30599 }
30600 !! wikitext
30601 [[Test|<span id="x">foo</span>]]
30602 !! wikitext/edited
30603 !! end
30604
30605 !! test
30606 3a. Anchors: do not suppress numbered extlinks
30607 !! options
30608 parsoid={
30609 "modes": ["wt2wt"],
30610 "scrubWikitext": true
30611 }
30612 !! wikitext
30613 [http://foo.com]
30614 !! html/parsoid
30615 <a rel="mw:ExtLink" href="http://foo.com"></a>
30616 !! end
30617
30618 !! test
30619 3b. Anchors: do not suppress numbered extlinks
30620 !! options
30621 parsoid={
30622 "modes": ["wt2wt"],
30623 "scrubWikitext": true,
30624 "changes": [
30625 [ "#x", "remove"]
30626 ]
30627 }
30628 !! wikitext
30629 [http://foo.com <span id="x">foo</span>]
30630 !! wikitext/edited
30631 [http://foo.com]
30632 !! end
30633
30634 !!test
30635 Normalizations should be restricted to edited content
30636 !!options
30637 parsoid={
30638 "modes": ["selser"],
30639 "scrubWikitext": true,
30640 "changes": [
30641 [ "h1", "before", "<i></i>"]
30642 ]
30643 }
30644 !!wikitext
30645 a
30646 = =
30647 b
30648 !!wikitext/edited
30649 a
30650 = =
30651 b
30652 !!end
30653
30654 !! test
30655 1. Multiple normalizations (html2wt)
30656 !! options
30657 parsoid={
30658 "modes": ["html2wt"],
30659 "scrubWikitext": true
30660 }
30661 !! html/parsoid
30662 <h2><i></i></h2>
30663 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30664 </a><b><i></i></b>x</p>
30665 !! wikitext
30666
30667 [[foo]]
30668 x
30669
30670 !! end
30671
30672 !! test
30673 2. Multiple normalizations (selser)
30674 !! options
30675 parsoid={
30676 "modes": ["selser"],
30677 "scrubWikitext": true,
30678 "changes": [
30679 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30680 ]
30681 }
30682 !! wikitext
30683 <div id="x">foo</div>
30684 !! wikitext/edited
30685 <div id="x">foo</div>
30686 bar
30687 !! end
30688
30689 !! test
30690 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30691 !! options
30692 parsoid={
30693 "modes": ["html2wt"],
30694 "scrubWikitext": true
30695 }
30696 !! html/parsoid
30697 <p> hi</p>
30698 <p> hello</p>
30699 !! wikitext
30700 hi
30701
30702 hello
30703 !! end
30704
30705 !! test
30706 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30707 !! options
30708 parsoid=html2wt
30709 !! html/parsoid
30710 <p> hi</p>
30711 <p> hello</p>
30712 !! wikitext
30713 <nowiki> </nowiki>hi
30714
30715 <nowiki> </nowiki> hello
30716 !! end
30717
30718 !! test
30719 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30720 !! options
30721 parsoid={
30722 "modes": ["html2wt"],
30723 "scrubWikitext": true
30724 }
30725 !! html/parsoid
30726 <p>Foo
30727 bar
30728 baz</p>
30729
30730 <table><tr><td>Foo
30731 bar
30732 baz bang</td></tr></table>
30733
30734 <p><!--boo--> foo
30735 bar</p>
30736
30737 <p> foo
30738 bar<span>boo</span></p>
30739 !! wikitext
30740 Foo
30741 bar
30742 baz
30743
30744 {|
30745 |Foo
30746 bar
30747 baz bang
30748 |}
30749
30750 <!--boo-->foo
30751 bar
30752
30753 foo
30754 bar<span>boo</span>
30755 !! end
30756
30757 !! test
30758 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30759 !! options
30760 parsoid={
30761 "modes": ["selser"],
30762 "scrubWikitext": true,
30763 "changes": [
30764 [ "p", "html", " a\n b" ]
30765 ]
30766 }
30767 !! wikitext
30768 xyz
30769 !! wikitext/edited
30770 a
30771 b
30772 !! end
30773
30774 !! test
30775 1. New links that end in spaces
30776 !! options
30777 parsoid={
30778 "modes": ["html2wt"],
30779 "scrubWikitext": false
30780 }
30781 !! html/parsoid
30782 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30783 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30784 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30785 !! wikitext
30786 [[Berlin ]]<nowiki/>is the capital of Germany.
30787
30788 [[Foo ]]'''bar'''
30789
30790 [[Boston ]] is a city.
30791 !! end
30792
30793 !! test
30794 2. New links that end in spaces
30795 !! options
30796 parsoid={
30797 "modes": ["html2wt"],
30798 "scrubWikitext": true
30799 }
30800 !! html/parsoid
30801 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30802 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30803 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30804 !! wikitext
30805 [[Berlin]] is the capital of Germany.
30806
30807 [[Foo]] '''bar'''
30808
30809 [[Boston]] is a city.
30810 !! end
30811
30812 !! test
30813 1. Table cells with escapable prefixes
30814 !! options
30815 parsoid={
30816 "modes": ["html2wt"],
30817 "scrubWikitext": false
30818 }
30819 !! html/parsoid
30820 <table>
30821 <tr><td>a</td></tr>
30822 <tr><td>-</td></tr>
30823 <tr><td>+</td></tr>
30824 <tr><td>}</td></tr>
30825 </table>
30826 !! wikitext
30827 {|
30828 |a
30829 |-
30830 |<nowiki>-</nowiki>
30831 |-
30832 |<nowiki>+</nowiki>
30833 |-
30834 |<nowiki>}</nowiki>
30835 |}
30836 !! end
30837
30838 !! test
30839 2. Table cells with escapable prefixes
30840 !! options
30841 parsoid={
30842 "modes": ["html2wt"],
30843 "scrubWikitext": true
30844 }
30845 !! html/parsoid
30846 <table>
30847 <tr><td>a</td></tr>
30848 <tr><td>-</td></tr>
30849 <tr><td>+</td></tr>
30850 <tr><td>}</td></tr>
30851 </table>
30852 !! wikitext
30853 {|
30854 |a
30855 |-
30856 | -
30857 |-
30858 | +
30859 |-
30860 | }
30861 |}
30862 !! end
30863
30864 !! test
30865 3a. Table cells with escapable prefixes after edits
30866 !! options
30867 parsoid={
30868 "modes": ["selser"],
30869 "scrubWikitext": true,
30870 "changes": [
30871 [ "table tbody tr:first-child td:first-child", "remove"]
30872 ]
30873 }
30874 !! wikitext
30875 {|
30876 |a||-
30877 |}
30878 !! wikitext/edited
30879 {|
30880 | -
30881 |}
30882 !! end
30883
30884 !! test
30885 3b. Table cells with escapable prefixes after edits
30886 !! options
30887 parsoid={
30888 "modes": ["selser"],
30889 "scrubWikitext": true,
30890 "changes": [
30891 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30892 [ "#x", "remove" ]
30893 ]
30894 }
30895 !! wikitext
30896 {|
30897 |pqr
30898 |<span id="x">foo</span>+
30899 |}
30900 !! wikitext/edited
30901 {|
30902 | -
30903 | +
30904 |}
30905 !! end
30906
30907 # FIXME: This test will fail because
30908 # normalization doesn't realize that the id attribute
30909 # will eliminate the escapable scenario
30910 !! test
30911 4a. Table cells without escapable prefixes after edits
30912 !! options
30913 parsoid={
30914 "modes": ["selser"],
30915 "scrubWikitext": true,
30916 "changes": [
30917 [ "#x", "html", "-" ]
30918 ]
30919 }
30920 !! wikitext
30921 {|
30922 | id="x" |abcd
30923 |}
30924 !! wikitext/edited
30925 {|
30926 | id="x" |-
30927 |}
30928 !! end
30929
30930 ## This tests normalizer's ability to discriminate between
30931 ## cells having identical content.
30932 !! test
30933 4b. Table cells without escapable prefixes after edits
30934 !! options
30935 parsoid={
30936 "modes": ["selser"],
30937 "scrubWikitext": true,
30938 "changes": [
30939 [ "td", "html", "-" ]
30940 ]
30941 }
30942 !! wikitext
30943 {|
30944 |a||b
30945 |}
30946 !! wikitext/edited
30947 {|
30948 | -||-
30949 |}
30950 !! end
30951
30952 ## This tests normalizer's ability to not be tripped by
30953 ## comments (and whitespace)
30954 !! test
30955 4c. Table cells without escapable prefixes after edits
30956 !! options
30957 parsoid={
30958 "modes": ["selser"],
30959 "scrubWikitext": true,
30960 "changes": [
30961 [ "table tbody tr td:first-child", "remove" ]
30962 ]
30963 }
30964 !! wikitext
30965 {|
30966 |-
30967 <!--foo--> |a||-
30968 |}
30969 !! wikitext/edited
30970 {|
30971 |-
30972 <!--foo--> | -
30973 |}
30974 !! end
30975
30976 ## This tests normalizer's ability to handle HTML cells
30977 !! test
30978 4d. Table cells without escapable prefixes after edits
30979 !! options
30980 parsoid={
30981 "modes": ["selser"],
30982 "scrubWikitext": true,
30983 "changes": [
30984 [ "td", "html", "-" ]
30985 ]
30986 }
30987 !! wikitext
30988 <table>
30989 <tr><td>a</td></tr>
30990 </table>
30991 !! wikitext/edited
30992 <table>
30993 <tr><td>-</td></tr>
30994 </table>
30995 !! end
30996
30997 ## T111151 Remove font elements without attributes
30998 !! test
30999 5a. font tags without attributes should be dropped in scrubWikitext mode
31000 !! options
31001 parsoid={
31002 "modes": ["html2wt"],
31003 "scrubWikitext": true
31004 }
31005 !! html/parsoid
31006 <font>foo</font>
31007 <font><font>bar</font></font>
31008 <font class="x">boo</font>
31009 !! wikitext
31010 foo
31011 bar
31012 <font class="x">boo</font>
31013 !! end
31014
31015 !! test
31016 5b. font tags should not be dropped without scrubWikitext being enabled
31017 !! options
31018 parsoid={
31019 "modes": ["html2wt"],
31020 "scrubWikitext": false
31021 }
31022 !! html/parsoid
31023 <font>foo</font>
31024 !! wikitext
31025 <font>foo</font>
31026 !! end
31027
31028 !! test
31029 Ignore empty <p></p> when scrubWikitext is false
31030 !! options
31031 parsoid={
31032 "modes": ["html2wt"],
31033 "scrubWikitext": false
31034 }
31035 !! html/parsoid
31036 <div>1</div>
31037 <p>a</p><p></p><p>b</p>
31038 <div>2</div>
31039 <p>a</p>
31040 <p></p>
31041 <p>b</p>
31042 <div>3</div>
31043 <p>a</p>
31044 <p></p>
31045 <p></p>
31046 <p></p>
31047 <p></p>
31048 <p>b</p>
31049 !! wikitext
31050 <div>1</div>
31051 a
31052
31053 b
31054 <div>2</div>
31055 a
31056
31057 b
31058 <div>3</div>
31059 a
31060
31061 b
31062 !! html/php+tidy
31063 <div>1</div>
31064 <p>a
31065 </p><p>b
31066 </p>
31067 <div>2</div>
31068 <p>a
31069 </p><p>b
31070 </p>
31071 <div>3</div>
31072 <p>a
31073 </p><p>b
31074 </p>
31075 !! end
31076
31077 !! test
31078 Normalize empty paragraphs to HTML form that html2wt expects
31079 !! options
31080 parsoid={
31081 "modes": ["html2wt"],
31082 "scrubWikitext": true
31083 }
31084 !! html/parsoid
31085 <div>1</div>
31086 <p>a</p><p></p><p>b</p>
31087 <div>2</div>
31088 <p>a</p>
31089 <p></p>
31090 <p>b</p>
31091 <div>3</div>
31092 <p>a</p>
31093 <p></p>
31094 <p></p>
31095 <p></p>
31096 <p></p>
31097 <p>b</p>
31098 <div>4</div>
31099 <p>a</p>
31100 <p></p>
31101 <div>foo</div>
31102 !! wikitext
31103 <div>1</div>
31104 a
31105
31106
31107 b
31108 <div>2</div>
31109 a
31110
31111
31112 b
31113 <div>3</div>
31114 a
31115
31116
31117
31118
31119
31120 b
31121 <div>4</div>
31122 a
31123
31124 <br />
31125 <div>foo</div>
31126 !! html/php+tidy
31127 <div>1</div>
31128 <p>a
31129 </p><p><br />
31130 b
31131 </p>
31132 <div>2</div>
31133 <p>a
31134 </p><p><br />
31135 b
31136 </p>
31137 <div>3</div>
31138 <p>a
31139 </p><p><br />
31140 </p><p><br />
31141 </p><p>b
31142 </p>
31143 <div>4</div>
31144 <p>a
31145 </p><p><br />
31146 </p>
31147 <div>foo</div>
31148 !! end
31149
31150 !! test
31151 Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away
31152 !! options
31153 parsoid={
31154 "modes": ["html2wt"],
31155 "scrubWikitext": true
31156 }
31157 !! html/parsoid
31158 <table>
31159 <tbody>
31160 <tr>
31161 <td><div>foo
31162 </div>
31163 <p class="mw-empty-elt"></p>
31164 </td>
31165 </tr>
31166 </tbody>
31167 <caption></caption>
31168 </table>
31169 !! wikitext
31170 {|
31171 |<div>foo
31172 </div>
31173 |+
31174 |}
31175 !! end
31176
31177 !! test
31178 Templated content should be skipped over by normalization
31179 !! options
31180 parsoid={
31181 "modes": ["html2wt"],
31182 "scrubWikitext": true
31183 }
31184 !! html/parsoid
31185 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SomeTemplate1","href":"./Template:SomeTemplate1"},"params":{"1":{"wt":"boo"}},"i":0}}]}'>foobar</p><p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SomeTemplate2","href":"./Template:SomeTemplate2"},"params":{"1":{"wt":"booboo"}},"i":0}}]}'>foobar</p><span about="#mwt2">
31186 </span><p about="#mwt2"></p><span about="#mwt2">
31187 </span>
31188 !! wikitext
31189 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
31190 !! end
31191
31192 !! test
31193 Escape nowiki DOM elements
31194 !! options
31195 parsoid=html2wt
31196 !! html/parsoid
31197 <nowiki><i>foo</i></nowiki>
31198 !! wikitext
31199 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
31200 !! end
31201
31202 # This is meant to be an interim fix while we go about figuring out
31203 # how to not introduce these trailing <nowiki/>s in the first place.
31204 !! test
31205 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
31206 !! options
31207 parsoid=html2wt
31208 !! html/parsoid
31209 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
31210 y</p>
31211 <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>
31212 <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>
31213 !! wikitext
31214 x
31215 y
31216
31217 {{echo|
31218 1 = <nowiki/>}}
31219
31220 {{echo|
31221 1 = <nowiki/>
31222 }}
31223 !! end
31224
31225 !! test
31226 New list is serialized on newlines
31227 !! options
31228 parsoid=html2wt
31229 !! html/parsoid
31230 <p>The quick brown fox jumps over the lazy dog.</p><ul>
31231 <li>Yesterday</li>
31232 <li>Today</li>
31233 <li>Tomorrow</li>
31234 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
31235 !! wikitext
31236 The quick brown fox jumps over the lazy dog.
31237
31238 * Yesterday
31239 * Today
31240 * Tomorrow
31241
31242 The quick onyx goblin jumps over the lazy dwarf.
31243 !! end
31244
31245 !! test
31246 New lists in formatting elements serialized w/o newlines
31247 !! options
31248 parsoid=html2wt
31249 !! html/parsoid
31250 <small>
31251
31252 <ul>
31253 <li>123</li>
31254 </ul>
31255
31256 </small>
31257
31258 <small><ul><li>hi</li></ul></small>
31259 !! wikitext
31260 <small>
31261 * 123
31262 </small>
31263
31264 <small>
31265 * hi
31266 </small>
31267 !! end
31268
31269 !! test
31270 New list in table doesn't need newlines
31271 !! options
31272 parsoid=html2wt
31273 !! html/parsoid
31274 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
31275 !! wikitext
31276 {|
31277 |
31278 * test
31279 * 123
31280 |}
31281 !! end
31282
31283 # ---------------------------------------------------
31284 # End of tests spec'ing wikitext serialization norms |
31285 # ---------------------------------------------------
31286
31287 # T104032
31288 !! test
31289 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
31290 !! options
31291 parsoid=html2wt
31292 !! html/parsoid
31293 a<p>b</p>
31294 <b>c</b><p>d</p>
31295 <table><tr>
31296 <td>a<p>b</p></td>
31297 <td><b>c</b><p>d</p></td>
31298 </tr></table>
31299 !! wikitext
31300 a
31301
31302 b
31303
31304 '''c'''
31305
31306 d
31307 {|
31308 |a
31309 b
31310 |'''c'''
31311 d
31312 |}
31313 !! end
31314
31315 !! test
31316 Anchor without href scenarios
31317 !! options
31318 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
31319 !! html/parsoid
31320 <a class="bc"></a>
31321 <a class="no">dice</a>
31322 <a name="foo"></a>
31323 !! wikitext
31324
31325 dice
31326 <span name="foo"></span>
31327 !! end
31328
31329 !! test
31330 New transclusion added after a list should be serialized after the list
31331 !! options
31332 parsoid=html2wt
31333 !! html/parsoid
31334 <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>
31335 !! wikitext
31336 * a
31337 {{echo|foo}}
31338 !! end
31339
31340 # -----------------------------------------------------------------
31341 # End of section for Parsoid-only html2wt tests for serialization
31342 # of new content
31343 # -----------------------------------------------------------------
31344
31345 # -----------------------------------------------------------------
31346 # The following section of tests are primarily to spec behavior of
31347 # the selective serializer. All these tests have manual selser
31348 # changes. The automated selser changes for all tests handle the
31349 # wide variation of changes, but these tests here capture specs
31350 # deterministically.
31351 # ----------------------------------------------------------------
31352
31353 ## T90517
31354 !! test
31355 Selser: New comments should not be lost
31356 !! options
31357 parsoid={
31358 "modes": ["selser"],
31359 "changes": [
31360 [ "#a", "after", "<!--c1-->" ],
31361 [ "#b", "before", "<!--c2-->" ]
31362 ]
31363 }
31364 !! wikitext
31365 <span id="a">a</span>
31366
31367 <span id="b">b</span>
31368 !! wikitext/edited
31369 <span id="a">a</span><!--c1-->
31370
31371 <!--c2--><span id="b">b</span>
31372 !! end
31373
31374 ## T89383
31375 !! test
31376 Selser: Check for validity of DSR before using it
31377 !! options
31378 parsoid={
31379 "modes": ["selser"],
31380 "changes": [
31381 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31382 ]
31383 }
31384 !! wikitext
31385 <span id="a">a</span>
31386 !! wikitext/edited
31387 {{DISPLAYTITLE:foo}}
31388 <span id="a">a</span>
31389 !! end
31390
31391 !! test
31392 1. DOMDiff: Changes to <ref> content should be looked up using id
31393 !! options
31394 parsoid={
31395 "modes": ["selser"],
31396 "changes": [
31397 ["#X", "after", "bar"],
31398 ["#Y", "after", "baz"]
31399 ]
31400 }
31401 !! wikitext
31402 X <ref><span id="X">foo</span></ref>
31403 Y <ref name="a" />
31404 <references>
31405 <ref name="a"><span id="Y">foo</span></ref>
31406 </references>
31407 !! wikitext/edited
31408 X <ref><span id="X">foo</span>bar</ref>
31409 Y <ref name="a" />
31410 <references>
31411 <ref name="a"><span id="Y">foo</span>baz</ref>
31412 </references>
31413 !! end
31414
31415 !! test
31416 2. DOMDiff: Changes to <ref> content should be looked up using id
31417 !! options
31418 parsoid={
31419 "modes": ["selser"],
31420 "changes": [
31421 ["#Z", "after", "bar"]
31422 ]
31423 }
31424 !! wikitext
31425 A <ref>foo bar for a</ref>
31426 B <ref group="X" name="b" />
31427
31428 <references />
31429
31430 <references group="X">
31431 <ref name="b"><span id="Z">foo</span></ref>
31432 </references>
31433 !! wikitext/edited
31434 A <ref>foo bar for a</ref>
31435 B <ref group="X" name="b" />
31436
31437 <references />
31438
31439 <references group="X">
31440 <ref name="b"><span id="Z">foo</span>bar</ref>
31441 </references>
31442 !! end
31443
31444 !! test
31445 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31446 !! options
31447 parsoid={
31448 "modes": ["selser"],
31449 "changes": [
31450 [ "div:first-child", "text", "bar" ]
31451 ]
31452 }
31453 !! wikitext
31454 <div style="{{1x|color:red;}}%">foo</div>
31455 !! wikitext/edited
31456 <div style="{{1x|color:red;}}%">bar</div>
31457 !! end
31458
31459 !! test
31460 Empty LI (T49673)
31461 !! wikitext
31462 *a
31463 *
31464 *
31465 *b
31466 !! html+tidy
31467 <ul><li>a</li>
31468 <li class="mw-empty-elt"></li>
31469 <li class="mw-empty-elt"></li>
31470 <li>b</li></ul>
31471 !! end
31472
31473 !! test
31474 Thumbnail output
31475 !! wikitext
31476 [[File:Thumb.png|thumb]]
31477 !! html/php+tidy
31478 <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>
31479 !! html/parsoid
31480 <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>
31481 !! end
31482
31483 !! test
31484 unclosed internal link XSS (T137264)
31485 !! wikitext
31486 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31487 !! html/php
31488 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31489 </p>
31490 !! html/parsoid
31491 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31492 !! end
31493
31494 !! test
31495 Validating that <style> isn't eaten by tidy (T167349)
31496 !! options
31497 styletag=1
31498 !! wikitext
31499 <div class="foo">
31500 <style>.foo::before { content: "<foo>"; }</style>
31501 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31502 </div>
31503 !! html/php+tidy
31504 <div class="foo">
31505 <style>.foo::before { content: "<foo>"; }</style>
31506 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31507 </div>
31508 !! html/parsoid
31509 <div class="foo">
31510 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31511 <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>
31512 </div>
31513 !! end
31514
31515 ## Right now, Parsoid doesn't de-duplicate style tags.
31516 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31517 ## In a followup patch, when we de-duplicate style tags and
31518 ## introduce link tags, we'll add a hook for link tags in
31519 ## the parser test runner script.
31520 !! test
31521 Validating that <style> isn't wrapped in a paragraph (T186965)
31522 !! options
31523 styletag=1
31524 !! wikitext
31525 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31526
31527 <style>.foo::before { content: "<foo>"; }</style>
31528
31529 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31530
31531 But if it's on a line with other content, let it be wrapped.
31532
31533 <style>.foo::before { content: "<foo>"; }</style> bar
31534
31535 foo <style>.foo::before { content: "<foo>"; }</style>
31536
31537 foo <style>.foo::before { content: "<foo>"; }</style> bar
31538
31539 And the same if we have non-paragraph-breaking whitespace
31540
31541 foo
31542 <style>.foo::before { content: "<foo>"; }</style>
31543 bar
31544 !! html/php
31545 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31546 </p>
31547 <style>.foo::before { content: "<foo>"; }</style>
31548 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31549 <p>But if it's on a line with other content, let it be wrapped.
31550 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31551 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31552 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31553 </p><p>And the same if we have non-paragraph-breaking whitespace
31554 </p><p>foo
31555 <style>.foo::before { content: "<foo>"; }</style>
31556 bar
31557 </p>
31558 !! html/parsoid
31559 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31560
31561 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31562
31563 <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>
31564
31565 <p>But if it's on a line with other content, let it be wrapped.</p>
31566
31567 <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>
31568
31569 <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>
31570
31571 <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>
31572
31573 <p>And the same if we have non-paragraph-breaking whitespace</p>
31574
31575 <p>foo
31576 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31577 bar</p>
31578 !! end
31579
31580 !! test
31581 Validating that <link> isn't wrapped in a paragraph (T186965)
31582 !! options
31583 styletag=1
31584 !! wikitext
31585 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31586
31587 <link rel="foo" href="bar"/>
31588
31589 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31590
31591 But if it's on a line with other content, let it be wrapped.
31592
31593 <link rel="foo" href="bar"/> bar
31594
31595 foo <link rel="foo" href="bar"/>
31596
31597 foo <link rel="foo" href="bar"/> bar
31598
31599 And the same if we have non-paragraph-breaking whitespace
31600
31601 foo
31602 <link rel="foo" href="bar"/>
31603 bar
31604 !! html/php
31605 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31606 </p>
31607 <link rel="foo" href="bar"/>
31608 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31609 <p>But if it's on a line with other content, let it be wrapped.
31610 </p><p><link rel="foo" href="bar"/> bar
31611 </p><p>foo <link rel="foo" href="bar"/>
31612 </p><p>foo <link rel="foo" href="bar"/> bar
31613 </p><p>And the same if we have non-paragraph-breaking whitespace
31614 </p><p>foo
31615 <link rel="foo" href="bar"/>
31616 bar
31617 </p>
31618 !! end
31619
31620 !! test
31621 Extension returning multiple nodes starting with a style tag roundtrips
31622 !! options
31623 wgRawHtml=1
31624 !! wikitext
31625 <table>
31626 {{echo|<html><style>.hi { color: red; }</style>
31627 </html>}}
31628 <tr><td class="hi">ho</td></tr>
31629 </table>
31630 !! html/parsoid
31631 <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">
31632 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31633
31634 <tbody><tr><td class="hi">ho</td></tr>
31635 </tbody></table>
31636 !! end
31637
31638 !! test
31639 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31640 !! config
31641 wgFragmentMode=[ 'html5', 'legacy' ]
31642 !! wikitext
31643 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31644 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31645 !! html/php
31646 <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>
31647 <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>
31648 </p>
31649 !! html/parsoid
31650 <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>
31651 <p><a rel="mw:WikiLink" href="./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#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>
31652 !! end
31653
31654 !! test
31655 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31656 !! config
31657 wgFragmentMode=[ 'legacy' ]
31658 !! wikitext
31659 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31660 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31661 !! html/php
31662 <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>
31663 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31664 </p>
31665 !! end
31666
31667 !! test
31668 Decoding of HTML entities in embedded HTML tags
31669 !! wikitext
31670 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31671 !! html/php
31672 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31673
31674 !! html/parsoid
31675 <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>
31676 !! end
31677
31678 !! test
31679 Decoding of HTML entities in indicator names for IDs (T104196)
31680 !! options
31681 parsoid=wt2html,html2html
31682 showindicators
31683 !! wikitext
31684 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31685 !! html/php
31686 1&2&3&amp;4&amp;amp;5=Indicator
31687
31688 !! html/parsoid
31689 <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>
31690 !! end
31691
31692 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31693 !! test
31694 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31695 !! options
31696 showindicators
31697 !! wikitext
31698 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31699 !! html/php
31700 1&2&3&amp;4&amp;amp;5=Indicator
31701
31702 !! html/parsoid
31703 <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>
31704 !! end
31705
31706 # This fragment mode is what Parsoid supports.
31707 !! test
31708 HTML5 ids: fallback to legacy
31709 !! config
31710 wgFragmentMode=[ 'html5', 'legacy' ]
31711 !! wikitext
31712 ==Foo bar==
31713
31714 ==foo Bar==
31715
31716 ==Тест==
31717
31718 ==Тест==
31719
31720 ==тест==
31721
31722 ==Hey < # " > % : '==
31723 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31724
31725 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31726
31727 <!-- These two links should produce identical HTML -->
31728 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31729
31730 !! html/php
31731 <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>
31732 <ul>
31733 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31734 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31735 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31736 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31737 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31738 <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>
31739 </ul>
31740 </div>
31741
31742 <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>
31743 <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>
31744 <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>
31745 <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>
31746 <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>
31747 <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>
31748 <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>
31749 </p><p>💩 <span id="💩"></span>
31750 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31751 </p>
31752 !! html/parsoid
31753 <h2 id="Foo_bar">Foo bar</h2>
31754
31755 <h2 id="foo_Bar_2">foo Bar</h2>
31756
31757 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31758
31759 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31760
31761 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31762
31763 <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>
31764 <p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Parser_test#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Parser_test#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Parser_test#тест">#тест</a> <a rel="mw:WikiLink" href="./Parser_test#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Hey_&lt;_#_\"_>_%_:_&#39;"},"sa":{"href":"#Hey &lt; # \" > % : &#39;"}}'>#Hey &lt; # " > % : '</a></p>
31765
31766 <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>
31767
31768 <!-- These two links should produce identical HTML -->
31769 <p><a rel="mw:WikiLink" href="./Parser_test#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Parser_test#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
31770 !! end
31771
31772 # Parsoid doesn't support this mode
31773 !! test
31774 HTML5 ids: legacy with a fallback to modern
31775 !! config
31776 wgFragmentMode=[ 'legacy', 'html5' ]
31777 !! wikitext
31778 ==Foo bar==
31779
31780 ==foo Bar==
31781
31782 ==Тест==
31783
31784 ==Тест==
31785
31786 ==тест==
31787
31788 ==Hey < # " > % : '==
31789 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31790
31791 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31792
31793 <!-- These two links should produce identical HTML -->
31794 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31795
31796 !! html/php
31797 <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>
31798 <ul>
31799 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31800 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31801 <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>
31802 <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>
31803 <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>
31804 <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>
31805 </ul>
31806 </div>
31807
31808 <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>
31809 <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>
31810 <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>
31811 <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>
31812 <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>
31813 <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>
31814 <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>
31815 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31816 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31817 </p>
31818 !! end
31819
31820 # Parsoid doesn't support this mode.
31821 !! test
31822 HTML5 ids: no legacy
31823 !! config
31824 wgFragmentMode=[ 'html5' ]
31825 !! wikitext
31826 ==Foo bar==
31827
31828 ==foo Bar==
31829
31830 ==Тест==
31831
31832 ==Тест==
31833
31834 ==тест==
31835
31836 ==Hey < # " > % : '==
31837 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31838
31839 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31840
31841 <!-- These two links should produce identical HTML -->
31842 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31843
31844 !! html/php
31845 <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>
31846 <ul>
31847 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31848 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31849 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31850 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31851 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31852 <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>
31853 </ul>
31854 </div>
31855
31856 <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>
31857 <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>
31858 <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>
31859 <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>
31860 <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>
31861 <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>
31862 <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>
31863 </p><p>💩 <span id="💩"></span>
31864 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31865 </p>
31866 !! end
31867
31868 !! test
31869 T90902: Normalize weird characters in section IDs
31870 !! config
31871 wgFragmentMode=[ 'html5', 'legacy' ]
31872 !! wikitext
31873 ==Foo&nbsp;bar==
31874 [[#Foo&nbsp;bar]]
31875
31876 !! html/php
31877 <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>
31878 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31879 </p>
31880 !! html/parsoid
31881 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31882 <p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
31883 !! end
31884
31885 !! test
31886 T51672: Test for brackets in attributes of elements in external link texts
31887 !! wikitext
31888 [http://example.com/ link <span title="title with [brackets]">span</span>]
31889 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31890
31891 !! html/php
31892 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31893 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31894 </p>
31895 !! html/parsoid
31896 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31897 <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>
31898 !! end
31899
31900 !! test
31901 T72875: Test for brackets in attributes of elements in internal link texts
31902 !! wikitext
31903 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31904 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31905
31906 !! html/php
31907 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31908 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31909 </p>
31910 !! html/parsoid
31911 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31912 <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>
31913 !! end
31914
31915 !! test
31916 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31917 !! options
31918 parsoid={
31919 "modes": ["html2wt"]
31920 }
31921 !! html/parsoid
31922 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31923 <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>
31924 !! wikitext
31925 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31926 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31927 !! end
31928
31929 !! test
31930 T179544: {{anchorencode:}} output should be always usable in links
31931 !! config
31932 wgFragmentMode=[ 'html5' ]
31933 !! wikitext
31934 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31935 !! html/php
31936 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31937 </p>
31938 !! html/parsoid
31939 <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="./Parser_test#[foo]" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#[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>
31940 !! end
31941
31942 ## ------------------------------
31943 ## Parsoid section-wrapping tests
31944 ## ------------------------------
31945 !! test
31946 Section wrapping for well-nested sections (no leading content)
31947 !! options
31948 parsoid={
31949 "wrapSections": true
31950 }
31951 !! wikitext
31952 =1=
31953 a
31954
31955 =2=
31956 b
31957
31958 ==2.1==
31959 c
31960
31961 ==2.2==
31962 d
31963
31964 ===2.2.1===
31965 e
31966
31967 =3=
31968 f
31969 !! html/parsoid
31970 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31971 <p>a</p>
31972
31973 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31974 <p>b</p>
31975
31976 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31977 <p>c</p>
31978
31979 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31980 <p>d</p>
31981
31982 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31983 <p>e</p>
31984
31985 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31986 <p>f</p>
31987
31988 </section>
31989 !! end
31990
31991 !! test
31992 Section wrapping for well-nested sections (with leading content)
31993 !! options
31994 parsoid={
31995 "wrapSections": true
31996 }
31997 !! wikitext
31998 Para 1.
31999
32000 Para 2 with a <div>nested in it</div>
32001
32002 Para 3.
32003
32004 =1=
32005 a
32006
32007 =2=
32008 b
32009
32010 ==2.1==
32011 c
32012 !! html/parsoid
32013 <section data-mw-section-id="0"><p>Para 1.</p>
32014
32015 <p>Para 2 with a </p><div>nested in it</div>
32016
32017 <p>Para 3.</p>
32018
32019 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
32020 <p>a</p>
32021
32022 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
32023 <p>b</p>
32024
32025 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
32026 <p>c</p>
32027
32028 </section></section>
32029 !! end
32030
32031 !! test
32032 Section wrapping with template-generated sections (good nesting 1)
32033 !! options
32034 parsoid={
32035 "wrapSections": true
32036 }
32037 !! wikitext
32038 =1=
32039 a
32040
32041 {{echo|1=
32042 ==1.1==
32043 b
32044 }}
32045
32046 ==1.2==
32047 c
32048
32049 =2=
32050 d
32051 !! html/parsoid
32052 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
32053 <p>a</p>
32054
32055 <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">
32056 </span><p about="#mwt1">b</p>
32057 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
32058 <p>c</p>
32059
32060 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
32061 <p>d</p></section>
32062 !! end
32063
32064 # In this example, the template scope is mildly expanded to incorporate the
32065 # trailing newline after the transclusion since that is part of section 1.1.1
32066 !! test
32067 Section wrapping with template-generated sections (good nesting 2)
32068 !! options
32069 parsoid={
32070 "wrapSections": true,
32071 "modes": ["wt2html", "wt2wt"]
32072 }
32073 !! wikitext
32074 =1=
32075 a
32076
32077 {{echo|1=
32078 ==1.1==
32079 b
32080 ===1.1.1===
32081 d
32082 }}
32083 =2=
32084 e
32085 !! html/parsoid
32086 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
32087 <p>a</p>
32088
32089 <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">
32090 </span><p about="#mwt1">b</p><span about="#mwt1">
32091 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
32092 </span><p about="#mwt1">d</p><span about="#mwt1">
32093 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
32094 <p>e</p></section>
32095 !! end
32096
32097 # In this example, the template scope is mildly expanded to incorporate the
32098 # trailing newline after the transclusion since that is part of section 1.2.1
32099 !! test
32100 Section wrapping with template-generated sections (good nesting 3)
32101 !! options
32102 parsoid={
32103 "wrapSections": true,
32104 "modes": ["wt2html", "wt2wt"]
32105 }
32106 !! wikitext
32107 =1=
32108 a
32109
32110 {{echo|1=
32111 x
32112 ==1.1==
32113 b
32114 ==1.2==
32115 c
32116 ===1.2.1===
32117 d
32118 }}
32119 =2=
32120 e
32121 !! html/parsoid
32122 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
32123 <p>a</p>
32124
32125 <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">
32126 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
32127 </span><p about="#mwt1">b</p><span about="#mwt1">
32128 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
32129 </span><p about="#mwt1">c</p><span about="#mwt1">
32130 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
32131 </span><p about="#mwt1">d</p><span about="#mwt1">
32132 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
32133 <p>e</p></section>
32134 !! end
32135
32136 # Because of section-wrapping and template-wrapping interactions,
32137 # the scope of the template is expanded so that the template markup
32138 # is valid in the presence of <section> tags.
32139 # This exercises the s1 is null scenario in the wrapSections code
32140 !! test
32141 Section wrapping with template-generated sections (bad nesting 1)
32142 !! options
32143 parsoid={
32144 "wrapSections": true
32145 }
32146 !! wikitext
32147 <div>
32148 a
32149
32150 {{echo|
32151 =1=
32152 b
32153 }}
32154
32155 c
32156 </div>
32157 !! html/parsoid
32158 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
32159 <p>a</p>
32160
32161 <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"]}'>
32162 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
32163 </span><p about="#mwt1">b
32164 </p><span about="#mwt1">
32165
32166 </span><p about="#mwt1">c</p><span about="#mwt1">
32167 </span></section></div></section>
32168 !! end
32169
32170 # Because of section-wrapping and template-wrapping interactions,
32171 # the scope of the template is expanded so that the template markup
32172 # is valid in the presence of <section> tags.
32173 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
32174 !! test
32175 Section wrapping with template-generated sections (bad nesting 2)
32176 !! options
32177 parsoid={
32178 "wrapSections": true
32179 }
32180 !! wikitext
32181 =1=
32182 a
32183
32184 {{echo|1=
32185 =2=
32186 b
32187 ==2.1==
32188 c
32189 }}
32190
32191 d
32192
32193 =3=
32194 e
32195 !! html/parsoid
32196 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
32197 <p>a</p>
32198
32199 </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">
32200 </span><p about="#mwt1">b</p><span about="#mwt1">
32201 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
32202 </span><p about="#mwt1">c</p><span about="#mwt1">
32203
32204 </span><p about="#mwt1">d</p><span about="#mwt1">
32205
32206 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
32207 <p>e</p></section>
32208 !! end
32209
32210 # Because of section-wrapping and template-wrapping interactions,
32211 # additional template wrappers are added to <section> tags
32212 # so that template wrapping semantics are valid whether section
32213 # tags are retained or stripped. But, the template scope can expand
32214 # greatly when accounting for section tags.
32215 # This exercises the s1 and s2 are in different subtrees scenario
32216 !! test
32217 Section wrapping with template-generated sections (bad nesting 3)
32218 !! options
32219 parsoid={
32220 "wrapSections": true,
32221 "modes": ["wt2html", "wt2wt"]
32222 }
32223 !! wikitext
32224 =1=
32225 a
32226
32227 {{echo|1=
32228 ==1.2==
32229 b
32230 =2=
32231 c
32232 }}
32233
32234 d
32235
32236 =3=
32237 e
32238 !! html/parsoid
32239 <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>
32240 <p>a</p>
32241
32242 <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">
32243 </span><p about="#mwt1">b</p><span about="#mwt1">
32244 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
32245 </span><p about="#mwt1">c</p>
32246
32247 <p>d</p>
32248 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
32249 <p>e</p></section>
32250 !! end
32251
32252 !! test
32253 Section wrapping with uneditable lead section + div wrapping multiple sections
32254 !! options
32255 parsoid={
32256 "wrapSections": true
32257 }
32258 !! wikitext
32259 foo
32260
32261 <div style="border:1px solid red;">
32262 =1=
32263 a
32264
32265 ==1.1==
32266 b
32267
32268 =2=
32269 c
32270 </div>
32271
32272 =3=
32273 d
32274
32275 ==3.1==
32276 e
32277 !! html/parsoid
32278 <section data-mw-section-id="-1"><p>foo</p>
32279
32280 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32281 <section data-mw-section-id="1"><h1 id="1">1</h1>
32282 <p>a</p>
32283
32284 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
32285 <p>b</p>
32286
32287 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
32288 <p>c</p>
32289 </section></div>
32290
32291 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
32292 <p>d</p>
32293
32294 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
32295 <p>e</p>
32296 </section></section>
32297 !! end
32298
32299 !! test
32300 Section wrapping with editable lead section + div overlapping multiple sections
32301 !! options
32302 parsoid={
32303 "wrapSections": true
32304 }
32305 !! wikitext
32306 foo
32307
32308 =1=
32309 a
32310 <div style="border:1px solid red;">
32311 b
32312
32313 ==1.1==
32314 c
32315
32316 =2=
32317 d
32318 </div>
32319 e
32320
32321 =3=
32322 f
32323
32324 ==3.1==
32325 g
32326 !! html/parsoid
32327 <section data-mw-section-id="0"><p>foo</p>
32328
32329 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
32330 <p>a</p>
32331 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32332 <p>b</p>
32333
32334 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
32335 <p>c</p>
32336
32337 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
32338 <p>d</p>
32339 </section></div>
32340 <p>e</p>
32341
32342 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
32343 <p>f</p>
32344
32345 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
32346 <p>g</p>
32347 </section></section>
32348 !! end
32349
32350 !! test
32351 HTML header tags should not be wrapped in section tags
32352 !! options
32353 parsoid={
32354 "wrapSections": true
32355 }
32356 !! wikitext
32357 foo
32358
32359 <h1>a</h1>
32360
32361 =b=
32362
32363 <h1>c</h1>
32364
32365 =d=
32366 !! html/parsoid
32367 <section data-mw-section-id="0"><p>foo</p>
32368
32369 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32370
32371 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
32372
32373 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32374
32375 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
32376 !! end
32377
32378 !! test
32379 Lead section containing only whitespace and comments.
32380 !! options
32381 parsoid={
32382 "wrapSections": true
32383 }
32384 !! wikitext
32385
32386 <!-- this is a comment, presumably significant to editors -->
32387 =1=
32388 a
32389
32390 =2=
32391 b
32392 !! html/parsoid
32393 <section data-mw-section-id="0" data-parsoid="{}">
32394 <!-- this is a comment, presumably significant to editors -->
32395 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
32396 <p>a</p>
32397
32398 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
32399 <p>b</p></section>
32400 !! end
32401
32402 !! test
32403 Pseudo-sections emitted by templates should have id -2
32404 !! options
32405 parsoid={
32406 "wrapSections": true
32407 }
32408 !! wikitext
32409 foo
32410 {{echo|<div>
32411 ==a==
32412 ==b==
32413 </div>
32414 }}
32415 !! html/parsoid
32416 <section data-mw-section-id="-1"><p>foo</p>
32417 </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}}]}'>
32418 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32419 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32420 </section></div><span about="#mwt1">
32421 </span></section>
32422 !! end
32423
32424 ##########################################################################
32425 Tests demonstrating white-space insensitivity in input wikitext
32426 for wikitext headings, wikitext list items, and wikitext table captions,
32427 headings, and cells. HTML versions of the same should preserve whitespace.
32428 ##########################################################################
32429 !! test
32430 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32431 !! options
32432 parsoid={
32433 "modes": ["wt2html"],
32434 "preserveIEW": true
32435 }
32436 !! wikitext
32437 __NOTOC__
32438 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32439 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32440 == <!--Headings with fallback ids--> Личная жизнь ==
32441 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32442 ; <!--term to define--> term : <!--term's definition--> definition
32443 {|
32444 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32445 |-
32446 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32447 |-
32448 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32449 |-
32450 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32451 |-
32452 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32453 |}
32454 : {|
32455 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32456 |} foo <!--c1-->
32457 !! html/php+tidy
32458 <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>
32459 <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>
32460 <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>
32461 <ul><li>List item</li></ul>
32462 <dl><dt>term&#160;</dt>
32463 <dd>definition</dd></dl>
32464 <table>
32465 <caption>Table Caption
32466 </caption>
32467 <tbody><tr>
32468 <th>Table Heading 1</th>
32469 <th>Table Heading 2
32470 </th></tr>
32471 <tr>
32472 <td>Table Cell 1</td>
32473 <td>Table Cell 2
32474 </td></tr>
32475 <tr>
32476 <td>class="foo"</td>
32477 <td>Table Cell 3
32478 </td></tr>
32479 <tr>
32480 <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
32481 </td></tr></tbody></table>
32482 <dl><dd><table>
32483 <tbody><tr>
32484 <td>Table Cell 1</td>
32485 <td>Table Cell 2
32486 </td></tr></tbody></table> foo</dd></dl>
32487 !! html/parsoid
32488 <meta property="mw:PageProp/notoc">
32489 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32490 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32491 <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>
32492 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32493 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32494 <table>
32495 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32496 <tbody><tr>
32497 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32498 <tr>
32499 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32500 <tr>
32501 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32502 <tr>
32503 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32504 </tbody></table>
32505 <dl><dd><table>
32506 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32507 </tbody></table> foo<!--c1--></dd></dl>
32508 !! end
32509
32510 # Looks like <caption> is not accepted in HTML
32511 !! test
32512 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32513 !! options
32514 parsoid={
32515 "modes": ["wt2html"],
32516 "preserveIEW": true
32517 }
32518 !! wikitext
32519 __NOTOC__
32520 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32521 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32522 <table>
32523 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32524 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32525 </table>
32526 !! html/php+tidy
32527 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32528 <ul><li> List item </li></ul>
32529 <table>
32530 <tbody><tr><th> Table Heading </th><th></th></tr>
32531 <tr><td> Table Cell </td><th></th></tr>
32532 </tbody></table>
32533 !! html/parsoid
32534 <meta property="mw:PageProp/notoc"/>
32535 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32536 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32537 <table>
32538 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32539 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32540 </tbody></table>
32541 !! end
32542
32543 !! test
32544 Do not trim whitespace in links and quotes
32545 !! options
32546 parsoid={
32547 "modes": ["wt2html"],
32548 "preserveIEW": true
32549 }
32550 !! wikitext
32551 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32552 [[Foo| some text ]]
32553 !! html/php+tidy
32554 <p>foo <i> italic </i> and <b> bold </b>
32555 <a href="/wiki/Foo" title="Foo"> some text </a>
32556 </p>
32557 !! html/parsoid
32558 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32559 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32560 !! end
32561
32562 !! test
32563 Remove p tags surrounding a single element in a figcaption
32564 !! options
32565 parsoid=html2wt
32566 !! wikitext
32567 [[File:Foobar.jpg|right|200x200px|Caption]]
32568 !! html/parsoid
32569 <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>
32570 !! end
32571
32572 !! test
32573 Selser preserves lack of newline before list and allows newline after the list
32574 !! options
32575 parsoid={
32576 "modes": ["selser"],
32577 "scrubWikitext": true,
32578 "changes": [
32579 [ "ul", "after", "<p>footer</p>" ]
32580 ]
32581 }
32582 !! wikitext
32583 header
32584 *foo
32585 *bar
32586 !! wikitext/edited
32587 header
32588 *foo
32589 *bar
32590
32591 footer
32592 !! end
32593
32594
32595 !! test
32596 Selser does not introduce newlines between unedited paragraph preceding the list
32597 !! options
32598 parsoid={
32599 "modes": ["selser"],
32600 "changes": [
32601 [ "table tbody tr td p:last-child", "empty" ]
32602 ]
32603 }
32604 !! wikitext
32605 {|
32606 |
32607 header
32608 *foo
32609 *bar
32610 footer
32611 |}
32612 !! wikitext/edited
32613 {|
32614 |
32615 header
32616 *foo
32617 *bar
32618
32619 |}
32620 !! end
32621
32622 !! test
32623 Selser does not introduce newlines between unedited paragraph following the list
32624 !! options
32625 parsoid={
32626 "modes": ["selser"],
32627 "changes": [
32628 [ "table tbody tr td p:first-child", "empty" ]
32629 ]
32630 }
32631 !! wikitext
32632 {|
32633 |
32634 header
32635 *foo
32636 *bar
32637 footer
32638 |}
32639 !! wikitext/edited
32640 {|
32641 |
32642
32643 *foo
32644 *bar
32645 footer
32646 |}
32647 !! end
32648
32649 !! test
32650 Remove a list item but do not insert newline above list
32651 !! options
32652 parsoid={
32653 "modes": ["selser"],
32654 "changes": [
32655 [ "ul li:last-child", "remove" ]
32656 ]
32657 }
32658 !! wikitext
32659 header
32660 *foo
32661 *bar
32662 footer
32663 !! wikitext/edited
32664 header
32665 *foo
32666 footer
32667 !! end