Merge "CommentStore: Hard-deprecate newKey()"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:redirect to foo
67 !! text
68 #REDIRECT [[Template:Foo]]
69 !! endarticle
70
71 !! article
72 Template:Blank
73 !! text
74 !! endarticle
75
76 !! article
77 Template:pipe
78 !! text
79 |
80 !! endarticle
81
82 !! article
83 Template:=
84 !! text
85 <nowiki>=</nowiki>
86 !! endarticle
87
88 !!article
89 MediaWiki:bad image list
90 !!text
91 * [[File:Bad.jpg]] except [[Nasty page]]
92 !!endarticle
93
94 !! article
95 Template:inner list
96 !! text
97 * item 1
98 !! endarticle
99
100 !! article
101 Template:tbl-start
102 !! text
103 {|
104 !! endarticle
105
106 !! article
107 Template:tbl-end
108 !! text
109 |}
110 !! endarticle
111
112 !! article
113 Template:echo
114 !! text
115 {{{1}}}
116 !! endarticle
117
118 !! article
119 Template:echo3
120 !! text
121 {{{1}}}
122 {{{1}}}
123 {{{1}}}
124 !! endarticle
125
126 // For Serbian; localize Template namespace
127 !! article
128 Шаблон:Echo
129 !! text
130 {{{1}}}
131 !! endarticle
132
133 !! article
134 Template:echo_with_span
135 !! text
136 <span>{{{1}}}</span>
137 !! endarticle
138
139 !! article
140 Template:echo_with_div
141 !! text
142 <div>{{{1}}}</div>
143 !! endarticle
144
145 !! article
146 Template:echo with depth
147 !! text
148 {{echo|{{{1}}}}}
149 !! endarticle
150
151 !! article
152 Template:blank_param
153 !! text
154 {{{1}}}
155 {{{}}}
156 !! endarticle
157
158 !! article
159 Template:table_attribs
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"|Foo
163 !! endarticle
164
165 !! article
166 Template:table_attribs_2
167 !! text
168 <noinclude>
169 |</noinclude>style="color:red;"|Foo
170 |Bar||Baz
171 !! endarticle
172
173 !! article
174 Template:table_attribs_3
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
178 !! endarticle
179
180 !! article
181 Template:table_attribs_4
182 !! text
183 | style="background-color:#DC241f;" width="10px" |
184 !! endarticle
185
186 !! article
187 Template:table_attribs_5
188 !! text
189 <noinclude>
190 |</noinclude>style="color:red;"||Bar
191 !! endarticle
192
193 !! article
194 Template:table_attribs_6
195 !! text
196 style="background: <nowiki>
197
198
199 red;</nowiki>" |
200 !! endarticle
201
202 !! article
203 Template:table_attribs_7
204 !! text
205 <noinclude>
206 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
207 !! endarticle
208
209 !! article
210 Template:table_header_cells
211 !! text
212 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
213 !! endarticle
214
215 !! article
216 Template:table_cells
217 !! text
218 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:PartialTable
223 !! text
224 {|
225 |-
226 !! endarticle
227
228 !! article
229 Template:image_attribs
230 !! text
231 <noinclude>
232 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
233 !! endarticle
234
235 ## See T48811 for details
236 !! article
237 Template:mixed_attr_content_template
238 !! text
239 style="color:red;" title="T48811"
240 |-
241 |foo
242 !! endarticle
243
244 !! article
245 Template:definition_list
246 !! text
247 one
248 ::two
249 !! endarticle
250
251 !! article
252 A?b
253 !! text
254 Weirdo titles!
255 !! endarticle
256
257 !!article
258 Template:Bullet
259 !!text
260 *Bar
261 !!endarticle
262
263 !!article
264 Template:OpenTable
265 !!text
266 {|
267 !!endarticle
268
269 !!article
270 Template:EmptyLITest
271 !!text
272 *a
273 *
274 *
275 *b
276 !!endarticle
277
278 !!article
279 Template:EmptyTRTest
280 !!text
281 {|
282 |-
283 |-
284 |foo
285 |-
286 |-
287 |bar
288 |}
289 !!endarticle
290
291 !!article
292 Template:EmptyTRWithHTMLAttrTest
293 !!text
294 <table>
295 <tr align="center"></tr>
296 <tr><td>foo</td></tr>
297 <tr align="center"></tr>
298 <tr><td>bar</td></tr>
299 </table>
300 !!endarticle
301
302 !! article
303 Template:With: Colon
304 !! text
305 Template with colon
306 !! endarticle
307
308 ###
309 ### Basic tests
310 ###
311
312 !! test
313 Blank input
314 !! wikitext
315 !! html
316 !! end
317
318 !! test
319 Simple paragraph
320 !! wikitext
321 This is a simple paragraph.
322 !! html
323 <p>This is a simple paragraph.
324 </p>
325 !! end
326
327 !! test
328 Paragraphs with extra newline spacing
329 !! wikitext
330 a
331
332 b (+2 nls)
333
334
335 c (+3 nls)
336
337
338
339 d (+4 nls)
340
341
342
343
344 e (+5 nls)
345 !! html
346 <p>a
347 </p><p>b (+2 nls)
348 </p><p><br />
349 c (+3 nls)
350 </p><p><br />
351 </p><p>d (+4 nls)
352 </p><p><br />
353 </p><p><br />
354 e (+5 nls)
355 </p>
356 !! end
357
358 !! test
359 Paragraphs with newline spacing with comment lines in between
360 !! wikitext
361 ----
362 a
363 <!--foo-->
364 b
365 ----
366 a
367 <!--foo--><!--More than 1 comment, still stripped-->
368 b
369 ----
370 a
371 <!--foo--> <!----> <!-- bar -->
372 b
373 ----
374 a
375 <!--foo-->
376
377 b
378 ----
379 a
380
381 <!--foo-->
382 b
383 ----
384 a
385 <!--foo-->
386
387
388 b
389 ----
390 a
391
392
393 <!--foo-->
394 b
395 ----
396 !! html
397 <hr />
398 <p>a
399 b
400 </p>
401 <hr />
402 <p>a
403 b
404 </p>
405 <hr />
406 <p>a
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p>b
412 </p>
413 <hr />
414 <p>a
415 </p><p>b
416 </p>
417 <hr />
418 <p>a
419 </p><p><br />
420 b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty white-space lines in between
433 !! wikitext
434 ----
435 a
436
437 b
438 ----
439 a
440
441
442 b
443 ----
444 !! html
445 <hr />
446 <p>a
447 </p><p>b
448 </p>
449 <hr />
450 <p>a
451 </p><p><br />
452 b
453 </p>
454 <hr />
455
456 !! end
457
458 !! test
459 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
460 !! wikitext
461 ----
462 a
463 <!--foo-->
464 b
465 ----
466 a
467 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
468 b
469 ----
470 a
471
472 <!--foo-->
473 <!--bar-->
474 b
475 ----
476 a
477
478 <!--foo-->
479 <!--bar-->
480
481 b
482 ----
483 !! html
484 <hr />
485 <p>a
486 b
487 </p>
488 <hr />
489 <p>a
490 b
491 </p>
492 <hr />
493 <p>a
494 </p><p>b
495 </p>
496 <hr />
497 <p>a
498 </p><p><br />
499 b
500 </p>
501 <hr />
502
503 !! end
504
505 !! test
506 Extra newlines: More paragraphs with indented comment
507 !! wikitext
508 a
509
510 <!--boo-->
511
512 b
513 !! html
514 <p>a
515 </p><p><br />
516 b
517 </p>
518 !!end
519
520 !! test
521 Extra newlines followed by heading
522 !! wikitext
523 a
524
525
526 =b=
527 [[a]]
528
529
530 =b=
531 !! html
532 <p>a
533 </p><p><br />
534 </p>
535 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
536 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
537 </p><p><br />
538 </p>
539 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
540
541 !! end
542
543 !! test
544 Extra newlines between heading and content are swallowed (Parsoid does not)
545 !! wikitext
546 =b=
547
548
549
550 [[a]]
551 !! html/php+tidy
552 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
553 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
554 </p>
555 !! html/parsoid
556 <h1 id="b">b</h1>
557 <p>
558 <br></p>
559
560 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
561 !! end
562
563 !! test
564 Extra new lines before and after lists are preserved
565 !! wikitext
566 a
567
568
569 *b
570
571
572 c
573 !! html/php+tidy
574 <p>a
575 </p><p><br />
576 </p>
577 <ul><li>b</li></ul>
578 <p><br />
579 c
580 </p>
581 !! html/parsoid
582 <p>a</p>
583 <p>
584 <br></p>
585 <ul><li>b</li></ul>
586 <p>
587 <br>
588 c</p>
589 !! end
590
591 # Parsoid regression test
592 !!test
593 Multiple newlines after tables are converted to p-br-p tags
594 !!options
595 parsoid=wt2html,wt2wt
596 !!wikitext
597 {|
598 |x
599 |}
600
601
602
603
604 =b=
605 !!html/php+tidy
606 <table>
607 <tbody><tr>
608 <td>x
609 </td></tr></tbody></table>
610 <p><br />
611 </p><p><br />
612 </p>
613 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
614 !!html/parsoid
615 <table>
616 <tbody>
617 <tr>
618 <td>x</td>
619 </tr>
620 </tbody>
621 </table>
622 <p><br/></p>
623 <p><br/></p>
624 <h1 id="b">b</h1>
625 !!end
626
627 !! test
628 Heading with line break in nowiki
629 !! options
630 parsoid=wt2html
631 !! config
632 wgFragmentMode=[ 'html5', 'legacy' ]
633 !! wikitext
634 ==A <nowiki>B
635 C</nowiki>==
636 !! html/php
637 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
638 C">A B
639 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
640
641 !! html/parsoid
642 <h2 id="A_B
643 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
644 C</span></h2>
645 !! end
646
647 !! test
648 Parsing an URL
649 !! wikitext
650 http://fr.wikipedia.org/wiki/🍺
651 <!-- EasterEgg we love beer, better be able be able to link to it -->
652 !! html
653 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
654 </p>
655 !! end
656
657 !! test
658 Simple list
659 !! wikitext
660 *Item 1
661 *Item 2
662 !! html
663 <ul><li>Item 1</li>
664 <li>Item 2</li></ul>
665
666 !! end
667
668 !! test
669 Italics and bold
670 !! wikitext
671 *plain
672 *plain''italic''plain
673 *plain''italic''plain''italic''plain
674 *plain'''bold'''plain
675 *plain'''bold'''plain'''bold'''plain
676 *plain''italic''plain'''bold'''plain
677 *plain'''bold'''plain''italic''plain
678 *plain''italic'''bold-italic'''italic''plain
679 *plain'''bold''bold-italic''bold'''plain
680 *plain'''''bold-italic'''italic''plain
681 *plain'''''bold-italic''bold'''plain
682 *plain''italic'''bold-italic'''''plain
683 *plain'''bold''bold-italic'''''plain
684 *plain l'''italic''plain
685 *plain l''''bold''' plain
686 !! html
687 <ul><li>plain</li>
688 <li>plain<i>italic</i>plain</li>
689 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
690 <li>plain<b>bold</b>plain</li>
691 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
692 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
693 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
694 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
695 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
696 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
697 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
698 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
699 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
700 <li>plain l'<i>italic</i>plain</li>
701 <li>plain l'<b>bold</b> plain</li></ul>
702
703 !! end
704
705 # this example taken from the [[simple:Moon]] article (T49326)
706 !! test
707 Italics and possessives (1)
708 !! wikitext
709 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
710 !! html
711 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
712 </p>
713 !! end
714
715 # this example taken from [[en:Flaming Pie]] (T51926)
716 !! test
717 Italics and possessives (2)
718 !! wikitext
719 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
720 !! html
721 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
722 </p>
723 !! end
724
725 # this example taken from [[en:Dictionary]] (T51926)
726 !! test
727 Italics and possessives (3)
728 !! wikitext
729 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
730 !! html
731 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
732 </p>
733 !! end
734
735
736 ###
737 ### 2-quote opening sequence tests
738 ###
739 !! test
740 Italics and bold: 2-quote opening sequence: (2,2)
741 !! wikitext
742 ''foo''
743 !! html
744 <p><i>foo</i>
745 </p>
746 !!end
747
748 !! test
749 Italics and bold: 2-quote opening sequence: (2,3)
750 !! wikitext
751 ''foo'''
752 !! html/*
753 <p><i>foo'</i>
754 </p>
755 !!end
756
757 !! test
758 Italics and bold: 2-quote opening sequence: (2,4)
759 !! options
760 parsoid=wt2html
761 !! wikitext
762 ''foo''''
763 !! html/*
764 <p><i>foo''</i>
765 </p>
766 !!end
767
768 # same html as previous, but wikitext adjusted to match parsoid html2wt
769 !! test
770 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
771 !! wikitext
772 ''foo<nowiki>''</nowiki>''
773 !! html
774 <p><i>foo''</i>
775 </p>
776 !! end
777
778 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
779 !! test
780 Italics and bold: 2-quote opening sequence: (2,5)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''foo'''''
785 !! html/php
786 <p><i>foo</i>
787 </p>
788 !! html/parsoid
789 <p><i>foo</i><b></b>
790 </p>
791 !!end
792
793 # same html as previous, but wikitext adjusted to match parsoid html2wt
794 !! test
795 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
796 !! wikitext
797 ''foo'''''<nowiki/>'''
798 !! html/php
799 <p><i>foo</i>
800 </p>
801 !! html/parsoid
802 <p><i>foo</i><b></b>
803 </p>
804 !! end
805
806
807 ###
808 ### 3-quote opening sequence tests
809 ###
810
811 !! test
812 Italics and bold: 3-quote opening sequence: (3,2)
813 !! wikitext
814 '''foo''
815 !! html/*
816 <p>'<i>foo</i>
817 </p>
818 !!end
819
820 !! test
821 Italics and bold: 3-quote opening sequence: (3,3)
822 !! wikitext
823 '''foo'''
824 !! html
825 <p><b>foo</b>
826 </p>
827 !!end
828
829 !! test
830 Italics and bold: 3-quote opening sequence: (3,4)
831 !! wikitext
832 '''foo''''
833 !! html/*
834 <p><b>foo'</b>
835 </p>
836 !!end
837
838 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
839 !! test
840 Italics and bold: 3-quote opening sequence: (3,5)
841 !! options
842 parsoid=wt2html
843 !! wikitext
844 '''foo'''''
845 !! html/php
846 <p><b>foo</b>
847 </p>
848 !! html/parsoid
849 <p><b>foo</b><i></i>
850 </p>
851 !!end
852
853 # same html as previous, but wikitext adjusted to match parsoid html2wt
854 !! test
855 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
856 !! wikitext
857 '''foo'''''<nowiki/>''
858 !! html/php
859 <p><b>foo</b>
860 </p>
861 !! html/parsoid
862 <p><b>foo</b><i></i>
863 </p>
864 !! end
865
866
867 ###
868 ### 4-quote opening sequence tests
869 ###
870
871 !! test
872 Italics and bold: 4-quote opening sequence: (4,2)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 ''''foo''
877 !! html/*
878 <p>''<i>foo</i>
879 </p>
880 !!end
881
882 # same html as previous, but wikitext adjusted to match parsoid html2wt
883 !! test
884 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
885 !! wikitext
886 <nowiki>''</nowiki>''foo''
887 !! html
888 <p>''<i>foo</i>
889 </p>
890 !! end
891
892 !! test
893 Italics and bold: 4-quote opening sequence: (4,3)
894 !! wikitext
895 ''''foo'''
896 !! html/*
897 <p>'<b>foo</b>
898 </p>
899 !!end
900
901 !! test
902 Italics and bold: 4-quote opening sequence: (4,4)
903 !! options
904 parsoid=wt2html
905 !! wikitext
906 ''''foo''''
907 !! html/*
908 <p>'<b>foo'</b>
909 </p>
910 !!end
911
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
915 !! wikitext
916 '<nowiki/>'''foo''''
917 !! html
918 <p>'<b>foo'</b>
919 </p>
920 !! end
921
922 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
923 !! test
924 Italics and bold: 4-quote opening sequence: (4,5)
925 !! options
926 parsoid=wt2html
927 !! wikitext
928 ''''foo'''''
929 !! html/php
930 <p>'<b>foo</b>
931 </p>
932 !! html/parsoid
933 <p>'<b>foo</b><i></i>
934 </p>
935 !!end
936
937 # same html as previous, but wikitext adjusted to match parsoid html2wt
938 !! test
939 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
940 !! wikitext
941 '<nowiki/>'''foo'''''<nowiki/>''
942 !! html/php
943 <p>'<b>foo</b>
944 </p>
945 !! html/parsoid
946 <p>'<b>foo</b><i></i>
947 </p>
948 !! end
949
950
951 ###
952 ### 5-quote opening sequence tests
953 ###
954
955 !! test
956 Italics and bold: 5-quote opening sequence: (5,2)
957 !! options
958 parsoid=wt2html
959 !! wikitext
960 '''''foo''
961 !! html/*
962 <p><b><i>foo</i></b>
963 </p>
964 !!end
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: 5-quote opening sequence: (5,2+3)
969 !! wikitext
970 '''''foo'''''
971 !! html/*
972 <p><i><b>foo</b></i>
973 </p>
974 !! end
975
976 !! test
977 Italics and bold: 5-quote opening sequence: (5,3)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''''foo'''
982 !! html/*
983 <p><i><b>foo</b></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: 5-quote opening sequence: (5,3+2)
990 !! wikitext
991 '''''foo'''''
992 !! html
993 <p><i><b>foo</b></i>
994 </p>
995 !! end
996
997 !! test
998 Italics and bold: 5-quote opening sequence: (5,4)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''''foo''''
1003 !! html/*
1004 <p><i><b>foo'</b></i>
1005 </p>
1006 !!end
1007
1008 !! test
1009 Italics and bold: 5-quote opening sequence: (5,5)
1010 !! wikitext
1011 '''''foo'''''
1012 !! html
1013 <p><i><b>foo</b></i>
1014 </p>
1015 !!end
1016
1017 !! test
1018 Italics and bold: 5-quote opening sequence: (5,6)
1019 !! wikitext
1020 '''''foo''''''
1021 !! html/*
1022 <p><i><b>foo'</b></i>
1023 </p>
1024 !! end
1025
1026 ###
1027 ### multiple quote sequences in a line
1028 ###
1029
1030 !! test
1031 Italics and bold: multiple quote sequences: (2,4,2)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 ''foo''''bar''
1036 !! html/*
1037 <p><i>foo'<b>bar</b></i>
1038 </p>
1039 !! end
1040
1041 # same html as previous, but wikitext adjusted to match parsoid html2wt
1042 !! test
1043 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1044 !! wikitext
1045 ''foo'<nowiki/>'''bar'''''
1046 !! html
1047 <p><i>foo'<b>bar</b></i>
1048 </p>
1049 !! end
1050
1051 !! test
1052 Italics and bold: multiple quote sequences: (2,4,3)
1053 !! options
1054 parsoid=wt2html
1055 !! wikitext
1056 ''foo''''bar'''
1057 !! html/*
1058 <p><i>foo'<b>bar</b></i>
1059 </p>
1060 !! end
1061
1062 # same html as previous, but wikitext adjusted to match parsoid html2wt
1063 !! test
1064 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1065 !! wikitext
1066 ''foo'<nowiki/>'''bar'''''
1067 !! html
1068 <p><i>foo'<b>bar</b></i>
1069 </p>
1070 !! end
1071
1072 !! test
1073 Italics and bold: multiple quote sequences: (2,4,4)
1074 !! options
1075 parsoid=wt2html
1076 !! wikitext
1077 ''foo''''bar''''
1078 !! html/*
1079 <p><i>foo'<b>bar'</b></i>
1080 </p>
1081 !! end
1082
1083 # same html as previous, but wikitext adjusted to match parsoid html2wt
1084 !! test
1085 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1086 !! wikitext
1087 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1088 !! html
1089 <p><i>foo'<b>bar'</b></i>
1090 </p>
1091 !! end
1092
1093 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1094 !! test
1095 Italics and bold: multiple quote sequences: (3,4,2)
1096 !! options
1097 parsoid=wt2html
1098 !! wikitext
1099 '''foo''''bar''
1100 !! html/php
1101 <p><b>foo'</b>bar
1102 </p>
1103 !! html/parsoid
1104 <p><b>foo'</b>bar<i></i>
1105 </p>
1106 !! end
1107
1108 # same html as previous, but wikitext adjusted to match parsoid html2wt
1109 !! test
1110 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1111 !! wikitext
1112 '''foo''''bar''<nowiki/>''
1113 !! html/php
1114 <p><b>foo'</b>bar
1115 </p>
1116 !! html/parsoid
1117 <p><b>foo'</b>bar<i></i>
1118 </p>
1119 !! end
1120
1121 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1122 !! test
1123 Italics and bold: multiple quote sequences: (3,4,3)
1124 !! options
1125 parsoid=wt2html
1126 !! wikitext
1127 '''foo''''bar'''
1128 !! html/php
1129 <p><b>foo'</b>bar
1130 </p>
1131 !! html/parsoid
1132 <p><b>foo'</b>bar<b></b>
1133 </p>
1134 !! end
1135
1136 # same html as previous, but wikitext adjusted to match parsoid html2wt
1137 !! test
1138 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1139 !! wikitext
1140 '''foo''''bar'''<nowiki/>'''
1141 !! html/php
1142 <p><b>foo'</b>bar
1143 </p>
1144 !! html/parsoid
1145 <p><b>foo'</b>bar<b></b>
1146 </p>
1147 !! end
1148
1149 ###
1150 ### other quote tests
1151 ###
1152 !! test
1153 Italics and bold: other quote tests: (2,3,5)
1154 !! wikitext
1155 ''this is about '''foo's family'''''
1156 !! html
1157 <p><i>this is about <b>foo's family</b></i>
1158 </p>
1159 !!end
1160
1161
1162 !! test
1163 Italics and bold: other quote tests: (2,(3,3),2)
1164 !! wikitext
1165 ''this is about '''foo's''' family''
1166 !! html
1167 <p><i>this is about <b>foo's</b> family</i>
1168 </p>
1169 !!end
1170
1171
1172 !! test
1173 Italics and bold: other quote tests: (3,2,3,2)
1174 !! options
1175 parsoid=wt2html
1176 !! wikitext
1177 '''this is about ''foo'''s family''
1178 !! html/*
1179 <p><b>this is about <i>foo</i></b><i>s family</i>
1180 </p>
1181 !!end
1182
1183
1184 # same html as previous, but wikitext adjusted to match parsoid html2wt
1185 !! test
1186 Italics and bold: other quote tests: (3,2,3+2+2,2)
1187 !! wikitext
1188 '''this is about ''foo'''''<nowiki/>''s family''
1189 !! html
1190 <p><b>this is about <i>foo</i></b><i>s family</i>
1191 </p>
1192 !! end
1193
1194
1195 !! test
1196 Italics and bold: other quote tests: (3,2,3,3)
1197 !! wikitext
1198 '''this is about ''foo'''s family'''
1199 !! html/*
1200 <p>'<i>this is about </i>foo<b>s family</b>
1201 </p>
1202 !!end
1203
1204
1205 !! test
1206 Italics and bold: other quote tests: (3,(2,2),3)
1207 !! wikitext
1208 '''this is about ''foo's'' family'''
1209 !! html
1210 <p><b>this is about <i>foo's</i> family</b>
1211 </p>
1212 !!end
1213
1214
1215 !! test
1216 Italicized possessive
1217 !! wikitext
1218 The ''[[Main Page]]'''s talk page.
1219 !! html/php
1220 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1221 </p>
1222 !! html/parsoid
1223 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1224 !! end
1225
1226 !! test
1227 Quote balancing context should be restricted to td/th cells on the same wikitext line
1228 !! options
1229 parsoid=wt2html,wt2wt
1230 !! wikitext
1231 {|
1232 !''a!!''b
1233 |''a||''b
1234 |}
1235 !! html+tidy
1236 <table>
1237 <tbody><tr>
1238 <th><i>a</i></th>
1239 <th><i>b</i>
1240 </th>
1241 <td><i>a</i></td>
1242 <td><i>b</i>
1243 </td></tr></tbody></table>
1244 !! end
1245
1246 ###
1247 ### Non-html5 tags
1248 ###
1249
1250 !! test
1251 Non-html5 tags should be accepted
1252 !! wikitext
1253 <center>''foo''</center>
1254 <big>''foo''</big>
1255 <font>''foo''</font>
1256 <strike>''foo''</strike>
1257 <tt>''foo''</tt>
1258 !! html
1259 <center><i>foo</i></center>
1260 <p><big><i>foo</i></big>
1261 <font><i>foo</i></font>
1262 <strike><i>foo</i></strike>
1263 <tt><i>foo</i></tt>
1264 </p>
1265 !! end
1266
1267 !! test
1268 <wbr> is valid wikitext (T54468)
1269 !! wikitext
1270 <wbr>
1271 !! html
1272 <p><wbr />
1273 </p>
1274 !! end
1275
1276 # <strike> is HTML4, <s> is HTML4/5.
1277 !! test
1278 <s> or <strike> for strikethrough
1279 !! wikitext
1280 <strike>strike</strike>
1281
1282 <s>s</s>
1283 !! html
1284 <p><strike>strike</strike>
1285 </p><p><s>s</s>
1286 </p>
1287 !! end
1288
1289 ## a not permitted
1290 ## i,b,br omitted
1291 !! test
1292 Text-level semantic html elements in wikitext
1293 !! wikitext
1294 <em>text</em>
1295 <strong>text</strong>
1296 <small>text</small>
1297 <s>text</s>
1298 <cite>text</cite>
1299 <q>text</q>
1300 <dfn>text</dfn>
1301 <abbr>text</abbr>
1302 <data>text</data>
1303 <time>text</time>
1304 <code>text</code>
1305 <var>text</var>
1306 <samp>text</samp>
1307 <kbd>text</kbd>
1308 <sub>text</sub>
1309 <u>text</u>
1310 <mark>text</mark>
1311 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1312 <bdi>text</bdi>
1313 <bdo>text</bdo>
1314 <span>text</span>
1315 <wbr />
1316 !! html
1317 <p><em>text</em>
1318 <strong>text</strong>
1319 <small>text</small>
1320 <s>text</s>
1321 <cite>text</cite>
1322 <q>text</q>
1323 <dfn>text</dfn>
1324 <abbr>text</abbr>
1325 <data>text</data>
1326 <time>text</time>
1327 <code>text</code>
1328 <var>text</var>
1329 <samp>text</samp>
1330 <kbd>text</kbd>
1331 <sub>text</sub>
1332 <u>text</u>
1333 <mark>text</mark>
1334 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1335 <bdi>text</bdi>
1336 <bdo>text</bdo>
1337 <span>text</span>
1338 <wbr />
1339 </p>
1340 !! end
1341
1342 # test cases taken from
1343 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1344 !! test
1345 Ruby markup (W3C-style)
1346 !! wikitext
1347 ;Mono-ruby for individual base characters
1348 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1349 ;Group ruby
1350 :<ruby>今日<rt>きょう</rt></ruby>
1351 ;Jukugo ruby
1352 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1353 ;Inline ruby
1354 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1355 ;Double-sided ruby
1356 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1357
1358 <ruby>
1359 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1360 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1361 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1362 </ruby>
1363 !! html
1364 <dl><dt>Mono-ruby for individual base characters</dt>
1365 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1366 <dt>Group ruby</dt>
1367 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1368 <dt>Jukugo ruby</dt>
1369 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1370 <dt>Inline ruby</dt>
1371 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1372 <dt>Double-sided ruby</dt>
1373 <dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1374 <p><ruby>
1375 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1376 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1377 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1378 </ruby>
1379 </p>
1380 !! end
1381
1382 # The next two test different paths in the sanitizer.
1383 !! test
1384 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1385 !! wikitext
1386 <blockquote|>a</blockquote>
1387
1388 <b→> doesn't terminate </b→>
1389
1390 <bä> doesn't terminate </bä>
1391
1392 <boo> doesn't terminate </boo>
1393
1394 <s.foo> doesn't terminate </s.foo>
1395
1396 <sub-ID#1>
1397 !! html/php
1398 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1399 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1400 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1401 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1402 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1403 </p><p>&lt;sub-ID#1&gt;
1404 </p>
1405 !! end
1406
1407 !! test
1408 Non-word characters don't terminate tag names
1409 !! wikitext
1410 <blockquote|>a</blockquote>
1411
1412 <b→> doesn't terminate </b→>
1413
1414 <bä> doesn't terminate </bä>
1415
1416 <boo> doesn't terminate </boo>
1417
1418 <s.foo> doesn't terminate </s.foo>
1419
1420 <sub-ID#1>
1421 !! html+tidy
1422 <p>&lt;blockquote|&gt;a
1423 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1424 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1425 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1426 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1427 </p><p>&lt;sub-ID#1&gt;
1428 </p>
1429 !! end
1430
1431 ###
1432 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1433 ### This checks that HTML5 tags (with non-word characters in the tag
1434 ### name) make it safely through the parser -- the Sanitizer will
1435 ### munge them later, as it should.
1436 ###
1437 !! test
1438 Non-word characters are valid in extension tags (T19663)
1439 !! wikitext
1440 <tåg>tåg</tåg>
1441 !! html/php
1442 <pre>
1443 'tåg'
1444 array (
1445 )
1446 </pre>
1447
1448 !! html/parsoid
1449 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1450 !! end
1451
1452 !! test
1453 Isolated close tags should be treated as literal text (T54760)
1454 !! options
1455 parsoid=wt2html
1456 !! wikitext
1457 </b>
1458
1459 <s.foo>s</s>
1460 !! html+tidy
1461 <p class="mw-empty-elt">
1462 </p><p>&lt;s.foo&gt;s
1463 </p>
1464 !! end
1465
1466 ###
1467 ### Special characters
1468 ###
1469
1470 !! test
1471 Bare pipe character (T54363)
1472 !! wikitext
1473 |
1474 !! html
1475 <p>|
1476 </p>
1477 !! end
1478
1479 !! test
1480 Bare pipe character from a template (T54363)
1481 !! wikitext
1482 {{pipe}}
1483 !! html
1484 <p>|
1485 </p>
1486 !! end
1487
1488 ###
1489 ### <nowiki> test cases
1490 ###
1491
1492 !! test
1493 <nowiki> unordered list
1494 !! wikitext
1495 <nowiki>* This is not an unordered list item.</nowiki>
1496 !! html/php
1497 <p>* This is not an unordered list item.
1498 </p>
1499 !! html/parsoid
1500 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1501 !! end
1502
1503 !! test
1504 <nowiki> spacing
1505 !! wikitext
1506 <nowiki>Lorem ipsum dolor
1507
1508 sed abit.
1509 sed nullum.
1510
1511 :and a colon
1512 </nowiki>
1513 !! html/php
1514 <p>Lorem ipsum dolor
1515
1516 sed abit.
1517 sed nullum.
1518
1519 :and a colon
1520
1521 </p>
1522 !! html/parsoid
1523 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1524
1525 sed abit.
1526 sed nullum.
1527
1528 :and a colon
1529 </span></p>
1530 !! end
1531
1532 !! test
1533 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1534 !! wikitext
1535 <nowiki><span class="error"></nowiki>
1536 !! html/php
1537 <p>&lt;span class="error"&gt;
1538 </p>
1539 !! html/parsoid
1540 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1541 !! end
1542
1543 !! test
1544 nowiki 3
1545 !! wikitext
1546 :There is not nowiki.
1547 :There is <nowiki>nowiki</nowiki>.
1548
1549 #There is not nowiki.
1550 #There is <nowiki>nowiki</nowiki>.
1551
1552 *There is not nowiki.
1553 *There is <nowiki>nowiki</nowiki>.
1554 !! html/php
1555 <dl><dd>There is not nowiki.</dd>
1556 <dd>There is nowiki.</dd></dl>
1557 <ol><li>There is not nowiki.</li>
1558 <li>There is nowiki.</li></ol>
1559 <ul><li>There is not nowiki.</li>
1560 <li>There is nowiki.</li></ul>
1561
1562 !! html/parsoid
1563 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1564 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1565
1566 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1567 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1568
1569 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1570 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1571 !! end
1572
1573 !! test
1574 Entities inside <nowiki>
1575 !! wikitext
1576 <nowiki>&lt;</nowiki>
1577 !! html/php
1578 <p>&lt;
1579 </p>
1580 !! html/parsoid
1581 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1582 !! end
1583
1584 !! test
1585 Entities inside template parameters
1586 !! wikitext
1587 {{echo|&ndash;}}
1588 !! html/php+tidy
1589 <p>&#8211;
1590 </p>
1591 !! html/parsoid
1592 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1593 !! end
1594
1595 !! test
1596 Properly escape nowiki when combined with other wiki markup
1597 !! options
1598 parsoid=html2wt
1599 !! html/parsoid
1600 <p>* &lt;/nowiki&gt; tag</p>
1601 !! wikitext
1602 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1603 !! end
1604
1605 !! test
1606 T93824: Put escaped HTML tags inside nowiki
1607 !! options
1608 parsoid=html2wt
1609 !! html/parsoid
1610 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1611 !! wikitext
1612 <nowiki><h2>foo</h2></nowiki>
1613 !! end
1614
1615 !! test
1616 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1617 !! options
1618 parsoid=html2wt
1619 !! html/parsoid
1620 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1621 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1622 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1623 !! wikitext
1624 This text: L'[[Foo]]
1625 This text: L<nowiki>''</nowiki>[[Foo]]
1626 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1627 !! end
1628
1629 # This test fails because wikitext whitespace is not normalized before comparing.
1630 !! test
1631 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1632 !! options
1633 parsoid=html2wt
1634 !! html/parsoid
1635 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1636 </p>
1637 !! wikitext
1638 This text : L<nowiki>''</nowiki>[[Foo]]
1639 !! end
1640
1641 # This test and the next one are html2wt only as they test that incorrect wikitext
1642 # passed in template arguments gets escaped or wrapped in nowikis where required.
1643 !! test
1644 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1645 !! options
1646 parsoid=html2wt
1647 !! html/parsoid
1648 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1649 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1650 !! wikitext
1651 {{echo|foo{{!}}bar}}
1652 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1653 !! end
1654
1655 !! test
1656 T53961: Output correct nowikis in template arguments
1657 !! options
1658 parsoid=html2wt
1659 !! html/parsoid
1660 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1661 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1662 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1663 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1664 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1665 !! wikitext
1666 {{echo|a [ b}}
1667 {{echo|<nowiki>a }} b</nowiki>}}
1668 {{echo|<nowiki>a [[ b</nowiki>}}
1669 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1670 {{echo|a <nowiki>}</nowiki>}}
1671 !! end
1672
1673 !! test
1674 Cases where "!!" needs nowiki protection
1675 !! options
1676 parsoid=html2wt
1677 !! html/parsoid
1678 <table>
1679 <tr><th>this needs protection !! here</th></tr>
1680 </table>
1681
1682 <table>
1683 <tr><th>this does not need
1684 protection !! here</th></tr>
1685 </table>
1686 !! wikitext
1687 {|
1688 !<nowiki>this needs protection !! here</nowiki>
1689 |}
1690
1691 {|
1692 !this does not need
1693 protection !! here
1694 |}
1695 !! end
1696
1697 ###
1698 ### Comments
1699 ###
1700 !! test
1701 Comments and Indent-Pre
1702 !! wikitext
1703 <!-- comment 1 --> asdf
1704
1705 <!-- comment 1 --> asdf
1706 <!-- comment 2 -->
1707
1708 <!-- comment 1 --> asdf
1709 <!-- comment 2 -->xyz
1710
1711 <!-- comment 1 --> asdf
1712 <!-- comment 2 --> xyz
1713 !! html
1714 <pre>asdf
1715 </pre>
1716 <pre>asdf
1717 </pre>
1718 <pre>asdf
1719 </pre>
1720 <p>xyz
1721 </p>
1722 <pre>asdf
1723 xyz
1724 </pre>
1725 !! end
1726
1727 !! test
1728 Comment test 2a
1729 !! wikitext
1730 asdf
1731 <!-- comment 1 -->
1732 jkl
1733 !! html
1734 <p>asdf
1735 jkl
1736 </p>
1737 !! end
1738
1739 !! test
1740 Comment test 2b
1741 !! wikitext
1742 asdf
1743 <!-- comment 1 -->
1744
1745 jkl
1746 !! html
1747 <p>asdf
1748 </p><p>jkl
1749 </p>
1750 !! end
1751
1752 !! test
1753 Comment test 3
1754 !! wikitext
1755 asdf
1756 <!-- comment 1 -->
1757 <!-- comment 2 -->
1758 jkl
1759 !! html
1760 <p>asdf
1761 jkl
1762 </p>
1763 !! end
1764
1765 !! test
1766 Comment test 4
1767 !! wikitext
1768 asdf<!-- comment 1 -->jkl
1769 !! html
1770 <p>asdfjkl
1771 </p>
1772 !! end
1773
1774 !! test
1775 Comment spacing
1776 !! wikitext
1777 a
1778 <!-- foo --> b <!-- bar -->
1779 c
1780 !! html
1781 <p>a
1782 </p>
1783 <pre> b
1784 </pre>
1785 <p>c
1786 </p>
1787 !! end
1788
1789 !! test
1790 Comment whitespace
1791 !! wikitext
1792 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1793 !! html
1794
1795 !! end
1796
1797 !! test
1798 Comment semantics and delimiters
1799 !! wikitext
1800 <!-- --><!----><!-----><!------>
1801 !! html/php
1802
1803 !! html/parsoid
1804 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1805 !! end
1806
1807 !! test
1808 Comment semantics and delimiters, redux
1809 !! wikitext
1810 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1811 -- foo -- funky huh? ... -->
1812 !! html/php
1813
1814 !! html/parsoid
1815 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1816 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1817 !! end
1818
1819 !! test
1820 Comment semantics and delimiters: directors cut
1821 !! wikitext
1822 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1823 everything starting with < followed by !-- until the first -- and > we see,
1824 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1825 -->-->
1826 !! html/php
1827 <p>--&gt;
1828 </p>
1829 !! html/parsoid
1830 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1831 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1832 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1833 --><p>--></p>
1834 !! end
1835
1836 !! test
1837 Comment semantics: nesting
1838 !! wikitext
1839 <!--<!-- no, we're not going to do anything fancy here -->-->
1840 !! html/php
1841 <p>--&gt;
1842 </p>
1843 !! html/parsoid
1844 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1845 !! end
1846
1847 # Parsoid closes the unclosed comment, even if it means a slight
1848 # round-trip diff.
1849 !! test
1850 Comment semantics: unclosed comment at end
1851 !! options
1852 parsoid=wt2html,html2html
1853 !! wikitext
1854 <!--This comment will run out to the end of the document
1855 !! html/php
1856
1857 !! html/parsoid
1858 <!--This comment will run out to the end of the document-->
1859 !! end
1860
1861 !! test
1862 Comment semantics: normalize comments to play nice with XML and browsers
1863 !! wikitext
1864 <!-- Browsers --!> think this is closed -->
1865 <!--> This would normally be text -->
1866 <!---> As would this -->
1867 <!-- XML doesn't like trailing dashes -------->
1868 <!-- Nor doubled hyphens -- anywhere in the data -->
1869 But this is not a comment.
1870 !! html/php
1871 <p>But this is not a comment.
1872 </p>
1873 !! html/parsoid
1874 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1875 <!--&#x3E; This would normally be text -->
1876 <!--&#x2D;&#x3E; As would this -->
1877 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1878 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1879 <p>But this is not a comment.</p>
1880 !! end
1881
1882 !! test
1883 Comment semantics: round-trip even text which contains encoded -->
1884 !! wikitext
1885 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1886 !! html/parsoid
1887 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1888 !! end
1889
1890 !! test
1891 Comment in template title
1892 !! wikitext
1893 {{f<!---->oo}}
1894 !! html
1895 <p>FOO
1896 </p>
1897 !! end
1898
1899 !! test
1900 Comment on its own line post-expand
1901 !! wikitext
1902 a
1903 {{blank}}<!---->
1904 b
1905 !! html
1906 <p>a
1907 </p><p>b
1908 </p>
1909 !! end
1910
1911 !! test
1912 Comment on its own line post-expand with non-significant whitespace
1913 !! wikitext
1914 a
1915 {{blank}} <!---->
1916 b
1917 !! html
1918 <p>a
1919 </p><p>b
1920 </p>
1921 !! end
1922
1923 !! test
1924 post-expand include size being exceeded
1925 !! options
1926 maxincludesize=20
1927 !! wikitext
1928 {{echo3|1234567890}}
1929 !! html
1930 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1931 </p>
1932 !! end
1933
1934 !! test
1935 max template depth being reached
1936 !! options
1937 maxtemplatedepth=1
1938 !! wikitext
1939 {{echo with depth|too deep!}}
1940 !! html
1941 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1942 </p>
1943 !! end
1944
1945 !! test
1946 multiple templates that are redirects
1947 !! wikitext
1948 {{redirect to foo}}
1949 {{redirect to foo}}
1950 !! html
1951 <p>FOO
1952 FOO
1953 </p>
1954 !! end
1955
1956 !! test
1957 Multiple comments should still parse as SOL-transparent
1958 !! options
1959 parsoid=wt2html,wt2wt
1960 !! wikitext
1961 <!--c1-->*a
1962 <!--c2--><!--c3--><!--c4-->*b
1963 !! html/php
1964 <ul><li>a</li>
1965 <li>b</li></ul>
1966
1967 !! html/parsoid
1968 <!--c1--><ul>
1969 <li>a
1970 </li>
1971 <!--c2--><!--c3--><!--c4-->
1972 <li>b
1973 </li>
1974 </ul>
1975 !! end
1976
1977 ## Make sure ">" gets escaped in comments to avoid XSS
1978 !! test
1979 IE conditional comments
1980 !! wikitext
1981 <!--[if lt IE 9]>
1982 <script>alert('hi');</script>
1983 <![endif]-->
1984 !! html/parsoid
1985 <!--[if lt IE 9]&#x3E;
1986 <script&#x3E;alert('hi');</script&#x3E;
1987 <![endif]-->
1988 !! end
1989
1990 ###
1991 ### paragraph wrapping tests
1992 ###
1993
1994 !! test
1995 No block tags
1996 !! wikitext
1997 a
1998
1999 b
2000 !! html
2001 <p>a
2002 </p><p>b
2003 </p>
2004 !! end
2005
2006 !! test
2007 Block tag on one line (<div>)
2008 !! wikitext
2009 a <div>foo</div>
2010
2011 b
2012 !! html
2013 a <div>foo</div>
2014 <p>b
2015 </p>
2016 !! html+tidy
2017 <p>a </p><div>foo</div>
2018 <p>b
2019 </p>
2020 !! end
2021
2022 !! test
2023 No p-wrappable content
2024 !! options
2025 parsoid=wt2html,html2html
2026 !! wikitext
2027 <span><div>x</div></span>
2028 <span><s><div>x</div></s></span>
2029 <small><em></em></small><span><s><div>x</div></s></span>
2030 !! html+tidy
2031 <span><div>x</div></span>
2032 <span><s><div>x</div></s></span>
2033 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2034 !! end
2035
2036 # T177612: Parsoid-only test
2037 !! test
2038 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2039 !! wikitext
2040 {{echo|<span><div>x</div></span>}}
2041 x
2042 !! html/parsoid
2043 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
2044 <p>x</p>
2045 !! end
2046
2047 !! test
2048 Block tag on one line (<blockquote>)
2049 !! options
2050 parsoid=wt2html,html2html
2051 !! wikitext
2052 a <blockquote>foo</blockquote>
2053
2054 b
2055 !! html
2056 a <blockquote>foo</blockquote>
2057 <p>b
2058 </p>
2059 !! html+tidy
2060 <p>a </p><blockquote><p>foo</p></blockquote>
2061 <p>b
2062 </p>
2063 !! end
2064
2065 !! test
2066 Block tag on both lines (<div>)
2067 !! wikitext
2068 a <div>foo</div>
2069
2070 b <div>foo</div>
2071 !! html
2072 a <div>foo</div>
2073 b <div>foo</div>
2074
2075 !! html+tidy
2076 <p>a </p><div>foo</div><p>
2077 b </p><div>foo</div>
2078 !! end
2079
2080 !! test
2081 Block tag on both lines (<blockquote>)
2082 !! options
2083 parsoid=wt2html,html2html
2084 !! wikitext
2085 a <blockquote>foo</blockquote>
2086
2087 b <blockquote>foo</blockquote>
2088 !! html
2089 a <blockquote>foo</blockquote>
2090 b <blockquote>foo</blockquote>
2091
2092 !! html+tidy
2093 <p>a </p><blockquote><p>foo</p></blockquote><p>
2094 b </p><blockquote><p>foo</p></blockquote>
2095 !! end
2096
2097 !! test
2098 Multiple lines without block tags
2099 !! wikitext
2100 <div>foo</div> a
2101 b
2102 c
2103 d<!--foo--> e
2104 x <div>foo</div> z
2105 !! html
2106 <div>foo</div> a
2107 <p>b
2108 c
2109 d e
2110 </p>
2111 x <div>foo</div> z
2112
2113 !! html+tidy
2114 <div>foo</div><p> a
2115 </p><p>b
2116 c
2117 d e
2118 </p><p>
2119 x </p><div>foo</div><p> z
2120 </p>
2121 !! end
2122
2123 !! test
2124 Empty lines between lines with block tags
2125 !! wikitext
2126 <div></div>
2127
2128
2129 <div></div>a
2130
2131 b
2132 <div>a</div>b
2133
2134 <div>b</div>d
2135
2136
2137 <div>e</div>
2138 !! html
2139 <div></div>
2140 <p><br />
2141 </p>
2142 <div></div>a
2143 <p>b
2144 </p>
2145 <div>a</div>b
2146 <div>b</div>d
2147 <p><br />
2148 </p>
2149 <div>e</div>
2150
2151 !! html+tidy
2152 <div></div>
2153 <p><br />
2154 </p>
2155 <div></div><p>a
2156 </p><p>b
2157 </p>
2158 <div>a</div><p>b
2159 </p><div>b</div><p>d
2160 </p><p><br />
2161 </p>
2162 <div>e</div>
2163 !! html/parsoid
2164 <div data-parsoid='{"stx":"html"}'></div>
2165
2166 <p><br /></p>
2167 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2168
2169 <p>b</p>
2170 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2171
2172 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2173
2174 <p><br /></p>
2175 <div data-parsoid='{"stx":"html"}'>e</div>
2176 !! end
2177
2178 !! test
2179 Unclosed HTML p-tags should be handled properly
2180 !! wikitext
2181 <div><p>foo</div>
2182 a
2183
2184 b
2185 !! html/php+tidy
2186 <div><p>foo</p></div>
2187 <p>a
2188 </p><p>b
2189 </p>
2190 !! html/parsoid
2191 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2192 <p>a</p>
2193 <p>b</p>
2194 !! end
2195
2196 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2197 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2198 ## them for now.
2199 !! test
2200 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2201 !! options
2202 parsoid=wt2html
2203 !! wikitext
2204 a [[Category:A1]] [[Category:A2]]
2205 [[Category:A3]]
2206 [[Category:A4]]
2207 !! html/parsoid
2208 <p>a</p>
2209 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2210 !! end
2211
2212 !! test
2213 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2214 !! options
2215 parsoid=wt2html
2216 !! wikitext
2217 [[Category:A1]]a
2218 !! html/parsoid
2219 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2220 !! end
2221
2222 !! test
2223 No paragraph necessary for SOL transparent template
2224 !! wikitext
2225 <span><div>foo</div></span>
2226 [[Category:Foo]]
2227
2228 <span><div>foo</div></span>
2229 {{echo|[[Category:Foo]]}}
2230 !! html/php
2231 <span><div>foo</div></span>
2232 <span><div>foo</div></span>
2233
2234 !! html/parsoid
2235 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2236 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2237
2238 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2239 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
2240 !! end
2241
2242 !! test
2243 Avoid expanding multiline sol transparent template ranges unnecessarily
2244 !! wikitext
2245 hi
2246
2247
2248 {{echo|<br/>
2249 }}
2250
2251 [[Category:Ho]]
2252 !! html/php
2253 <p>hi
2254 </p><p><br />
2255 <br />
2256 </p>
2257 !! html/parsoid
2258 <p>hi</p>
2259
2260 <p><br />
2261 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2262 </span></p>
2263
2264 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2265 !! end
2266
2267 !! test
2268 Paragraph wrapping following unclosed table
2269 !! options
2270 parsoid=wt2html,html2html
2271 !! wikitext
2272 {|
2273 |-
2274
2275 {|
2276 | x
2277 |}
2278
2279 a
2280
2281 b
2282
2283 c
2284 !! html/php+tidy
2285 <table>
2286
2287
2288 </table><table>
2289 <tbody><tr>
2290 <td>x
2291 </td></tr></tbody></table>
2292 <p>a
2293 </p><p>b
2294 </p><p>c
2295 </p>
2296 !! html/parsoid
2297 <table data-parsoid='{"autoInsertedEnd":true}'>
2298 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2299
2300 </tbody></table><table>
2301 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2302 </tbody></table>
2303
2304 <p>a</p>
2305
2306 <p>b</p>
2307
2308 <p>c</p>
2309 !! end
2310
2311 !! test
2312 Paragraph wrapping suppressed in html p
2313 !! options
2314 parsoid=wt2html,html2html
2315 !! wikitext
2316 <p>
2317
2318
2319 hi
2320
2321
2322
2323 </p>
2324 !! html/php+tidy
2325 <p>
2326
2327
2328 hi
2329
2330
2331
2332 </p>
2333 !! html/parsoid
2334 <p data-parsoid='{"stx":"html"}'>
2335
2336
2337 hi
2338
2339
2340
2341 </p>
2342 !! end
2343
2344 !! test
2345 Dangling table row doesn't prevent p-wrapping
2346 !! options
2347 parsoid=wt2html,html2html
2348 !! wikitext
2349 {|
2350 | hi
2351 |-
2352 |} ho
2353 !! html/parsoid
2354 <table>
2355 <tbody><tr><td>hi</td></tr>
2356 <tr class="mw-empty-elt"></tr>
2357 </tbody></table><p> ho</p>
2358 !! end
2359
2360 ###
2361 ### Preformatted text
2362 ###
2363
2364 !! test
2365 Preformatted text
2366 !! wikitext
2367 This is some
2368 Preformatted text
2369 With ''italic''
2370 And '''bold'''
2371 And a [[Main Page|link]]
2372 !! html
2373 <pre>This is some
2374 Preformatted text
2375 With <i>italic</i>
2376 And <b>bold</b>
2377 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2378 </pre>
2379 !! end
2380
2381 !! test
2382 Tabs don't trigger preformatted text
2383 !! wikitext
2384 This is not
2385 preformatted text.
2386 This is preformatted text.
2387 So is this.
2388 !! html/php
2389 <p> This is not
2390 preformatted text.
2391 </p>
2392 <pre>This is preformatted text.
2393 So is this.
2394 </pre>
2395 !! html/parsoid
2396 <p> This is not
2397 preformatted text.</p>
2398 <pre>This is preformatted text.
2399 So is this.</pre>
2400 !! end
2401
2402 !! test
2403 Space before tab needs nowiki pre protection
2404 !! options
2405 parsoid=html2wt
2406 !! html/parsoid
2407 <p> a</p>
2408 !! wikitext
2409 <nowiki> </nowiki> a
2410 !! end
2411
2412 !! test
2413 Ident preformatting with inline content
2414 !! wikitext
2415 a
2416 ''b''
2417 !! html
2418 <pre>a
2419 <i>b</i>
2420 </pre>
2421 !! end
2422
2423 !! test
2424 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2425 !! wikitext
2426 <pre><nowiki>
2427 <b>
2428 <cite>
2429 <em>
2430 </nowiki></pre>
2431 !! html
2432 <pre>
2433 &lt;b&gt;
2434 &lt;cite&gt;
2435 &lt;em&gt;
2436 </pre>
2437
2438 !! end
2439
2440 !! test
2441 Regression with preformatted in <center>
2442 !! wikitext
2443 <center>
2444 Blah
2445 </center>
2446 !! html
2447 <center>
2448 <pre>Blah
2449 </pre>
2450 </center>
2451
2452 !! end
2453
2454 !! test
2455 T54763: Preformatted in <blockquote>
2456 !! wikitext
2457 <blockquote>
2458 Blah
2459 {|
2460 |
2461 indented cell (no pre-wrapping!)
2462 |}
2463 </blockquote>
2464 !! html
2465 <blockquote>
2466 <p> Blah
2467 </p>
2468 <table>
2469 <tr>
2470 <td>
2471 <p> indented cell (no pre-wrapping!)
2472 </p>
2473 </td></tr></table>
2474 </blockquote>
2475
2476 !! end
2477
2478 !! test
2479 T53086: Double newlines in blockquotes should be turned into paragraphs
2480 !! wikitext
2481 <blockquote>
2482 Foo
2483
2484 Bar
2485 </blockquote>
2486 !! html
2487 <blockquote>
2488 <p>Foo
2489 </p><p>Bar
2490 </p>
2491 </blockquote>
2492
2493 !! end
2494
2495 !! test
2496 T17491: <ins>/<del> in blockquote
2497 !! options
2498 parsoid=wt2html
2499 !! wikitext
2500 <blockquote>
2501 Foo <del>bar</del> <ins>baz</ins> quux
2502 </blockquote>
2503 !! html
2504 <blockquote>
2505 <p>Foo <del>bar</del> <ins>baz</ins> quux
2506 </p>
2507 </blockquote>
2508
2509 !! html+tidy
2510 <blockquote>
2511 <p>Foo <del>bar</del> <ins>baz</ins> quux
2512 </p>
2513 </blockquote>
2514 !! end
2515
2516 !! test
2517 T17491: <ins>/<del> in blockquote (2)
2518 !! options
2519 parsoid=wt2html
2520 !! wikitext
2521 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2522 </blockquote>
2523 !! html
2524 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2525 </blockquote>
2526
2527 !! html+tidy
2528 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2529 </p></blockquote>
2530 !! end
2531
2532 !! test
2533 <pre> with attributes (T5202)
2534 !! wikitext
2535 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2536 !! html
2537 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2538
2539 !! end
2540
2541 !! test
2542 <pre> with width attribute (T5202)
2543 !! wikitext
2544 <pre width="8">Narrow screen goodies</pre>
2545 !! html
2546 <pre width="8">Narrow screen goodies</pre>
2547
2548 !! end
2549
2550 !! test
2551 <pre> with forbidden attribute (T5202)
2552 !! wikitext
2553 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2554 !! html
2555 <pre width="8">Narrow screen goodies</pre>
2556
2557 !! end
2558
2559 !! test
2560 Entities inside <pre>
2561 !! wikitext
2562 <pre>&lt;</pre>
2563 !! html
2564 <pre>&lt;</pre>
2565
2566 !! end
2567
2568 !! test
2569 <pre> with forbidden attribute values (T5202)
2570 !! wikitext
2571 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2572 !! html
2573 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2574
2575 !! end
2576
2577 !! test
2578 <nowiki> inside <pre> (T15238)
2579 !! wikitext
2580 <pre>
2581 <nowiki>
2582 </pre>
2583 <pre>
2584 <nowiki></nowiki>
2585 </pre>
2586 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2587 !! html
2588 <pre>
2589 &lt;nowiki&gt;
2590 </pre>
2591 <pre>
2592
2593 </pre>
2594 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2595
2596 !! end
2597
2598 !! test
2599 <nowiki> inside of #tag:pre
2600 !! wikitext
2601 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2602 !! html/php
2603 <pre>Foo &#8594;bar</pre>
2604
2605 !! html/parsoid
2606 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2607 !! end
2608
2609 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2610 ## aren't enclosed in nowikis.
2611 !! test
2612 <nowiki> and <pre> preference (first one wins)
2613 !! options
2614 parsoid=wt2html
2615 !! wikitext
2616 <pre>
2617 <nowiki>
2618 </pre>
2619 </nowiki>
2620 </pre>
2621
2622 <nowiki>
2623 <pre>
2624 <nowiki>
2625 </pre>
2626 </nowiki>
2627 </pre>
2628
2629 !! html/php
2630 <pre>
2631 &lt;nowiki&gt;
2632 </pre>
2633 <p>&lt;/nowiki&gt;
2634 &lt;/pre&gt;
2635 </p><p>
2636 &lt;pre&gt;
2637 &lt;nowiki&gt;
2638 &lt;/pre&gt;
2639
2640 &lt;/pre&gt;
2641 </p>
2642 !! html/parsoid
2643 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2644 </pre>
2645 <p>&lt;/nowiki></p>
2646
2647
2648 <p><span typeof="mw:Nowiki">
2649 &lt;pre>
2650 &lt;nowiki>
2651 &lt;/pre>
2652 </span></p>
2653 !! end
2654
2655 !! test
2656 </pre> inside nowiki
2657 !! wikitext
2658 <nowiki></pre></nowiki>
2659 !! html
2660 <p>&lt;/pre&gt;
2661 </p>
2662 !! end
2663
2664 !! test
2665 Empty pre; pre inside other HTML tags (T56946)
2666 !! wikitext
2667 a
2668
2669 <div><pre>
2670 foo
2671 </pre></div>
2672 <pre></pre>
2673 !! html/php+tidy
2674 <p>a
2675 </p>
2676 <div><pre>foo
2677 </pre></div>
2678 <pre></pre>
2679 !! html/parsoid
2680 <p>a</p>
2681
2682 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2683 </pre></div>
2684 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2685 !! end
2686
2687 !! test
2688 HTML pre followed by indent-pre
2689 !! wikitext
2690 <pre>foo</pre>
2691 bar
2692 !! html
2693 <pre>foo</pre>
2694 <pre>bar
2695 </pre>
2696 !! end
2697
2698 !! test
2699 Block tag pre
2700 !! wikitext
2701 <p><pre>foo</pre></p>
2702 !! html/php+tidy
2703 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2704 !! html/parsoid
2705 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2706 !! end
2707
2708 !!test
2709 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2710 !! wikitext
2711 {{echo|}}
2712 !! html
2713
2714 !!end
2715
2716 !!test
2717 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2718 !! wikitext
2719 {{echo|
2720 foo}}
2721 !! html
2722 <p>foo
2723 </p>
2724 !!end
2725
2726 !! test
2727 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2728 !! wikitext
2729 {{echo|a
2730 b}}
2731 !! html
2732 <pre>a
2733 </pre>
2734 <p>b
2735 </p>
2736 !!end
2737
2738 !! test
2739 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2740 !! wikitext
2741 {{echo|a
2742 b
2743 c
2744 d
2745 e
2746 }}
2747 !! html
2748 <pre>a
2749 </pre>
2750 <p>b
2751 c
2752 </p>
2753 <pre>d
2754 </pre>
2755 <p>e
2756 </p>
2757 !!end
2758
2759 !!test
2760 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2761 !! wikitext
2762 {{echo| foo}}
2763
2764 {{echo| foo}}{{echo| bar}}
2765
2766 {{echo| foo}}
2767 {{echo| bar}}
2768
2769 {{echo|<!--cmt--> foo}}
2770
2771 <!--cmt-->{{echo| foo}}
2772
2773 {{echo|{{echo| }}bar}}
2774 !! html
2775 <pre>foo
2776 </pre>
2777 <pre>foo bar
2778 </pre>
2779 <pre>foo
2780 bar
2781 </pre>
2782 <pre>foo
2783 </pre>
2784 <pre>foo
2785 </pre>
2786 <pre>bar
2787 </pre>
2788 !!end
2789
2790 !! test
2791 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2792 !! wikitext
2793 {{echo| }}a
2794
2795 {{echo|
2796 }}a
2797
2798 {{echo|
2799 b}}
2800
2801 {{echo|a
2802 }}b
2803
2804 {{echo|a
2805 }} b
2806 !! html
2807 <pre>a
2808 </pre>
2809 <p><br />
2810 </p>
2811 <pre>a
2812 </pre>
2813 <p><br />
2814 </p>
2815 <pre>b
2816 </pre>
2817 <p>a
2818 </p>
2819 <pre>b
2820 </pre>
2821 <p>a
2822 </p>
2823 <pre>b
2824 </pre>
2825 !!end
2826
2827 ## Hmm, should Parsoid rt this?
2828 !! test
2829 Pres with newline attributes
2830 !! options
2831 parsoid=wt2html,html2html
2832 !! wikitext
2833 <pre class="one
2834 two">hi</pre>
2835 !! html/php
2836 <pre class="one two">hi</pre>
2837
2838 !! html/parsoid
2839 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2840 !! end
2841
2842 !! test
2843 Things that look like <pre> tags aren't treated as such
2844 !! wikitext
2845 Barack Obama <President> of the United States
2846 <President></President>
2847 !! html
2848 <p>Barack Obama &lt;President&gt; of the United States
2849 &lt;President&gt;&lt;/President&gt;
2850 </p>
2851 !! end
2852
2853 ## Remex doesn't account for fostered content.
2854 !! test
2855 Handle broken pre-like tags (T66025)
2856 !! options
2857 parsoid=wt2html
2858 !! wikitext
2859 {{echo|<pre <pre>x</pre>}}
2860
2861 <table><pre </table>
2862 !! html/php
2863 <pre>x</pre>
2864 <table>&lt;pre </table>
2865
2866 !! html/php+tidy
2867 <pre>x</pre>
2868 &lt;pre <table></table>
2869 !! html/parsoid
2870 <pre typeof="mw:Transclusion mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html","a":{"&lt;pre":null},"sa":{"&lt;pre":""},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2871
2872 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>&lt;pre </p><table data-parsoid='{"stx":"html"}'></table>
2873 !! end
2874
2875 !! test
2876 Parsoid: handle pre with space after attribute
2877 !! options
2878 parsoid=wt2html
2879 !! wikitext
2880 <pre style="width:50%;" >{{echo|foo}}</pre>
2881 !! html/php
2882 <pre style="width:50%;">{{echo|foo}}</pre>
2883
2884 !! html/parsoid
2885 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2886 !! end
2887
2888 # TODO / maybe: fix wt2wt for this
2889 !! test
2890 Parsoid: Don't paragraph-wrap fosterable content
2891 !! options
2892 parsoid=wt2html
2893 !! wikitext
2894 {|
2895 <td></td>
2896 <td></td>
2897
2898
2899
2900 |}
2901 !! html
2902 <table>
2903
2904 <tbody>
2905 <tr>
2906 <td></td>
2907
2908 <td></td></tr>
2909
2910
2911
2912 </tbody></table>
2913 !! end
2914
2915 !! test
2916 Self-closed pre
2917 !! wikitext
2918 <pre />
2919 !! html/php
2920 <pre></pre>
2921
2922 !! html/parsoid
2923 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2924 !! end
2925
2926 !! test
2927 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2928 !! options
2929 parsoid=wt2html
2930 !! wikitext
2931 {|
2932 <td>
2933 <td>
2934 </td>
2935
2936
2937
2938 |}
2939 !! html
2940 <table>
2941
2942 <tbody>
2943 <tr>
2944 <td></td>
2945
2946 <td>
2947 </td></tr>
2948
2949
2950
2951 </tbody></table>
2952 !! end
2953
2954
2955 #--------------------------------------------------------------------
2956 # Transclusion parameter whitespace stripping tests
2957 # Behavior is different for positional and named parameters
2958 #--------------------------------------------------------------------
2959 !! test
2960 Templates: Strip leading and trailing whitespace from named-param values
2961 !! wikitext
2962 {{echo|1= a }}
2963
2964 {{echo|1= {{echo|b}} }}
2965
2966 {{echo| 1 =
2967 c }}
2968
2969 {{echo| 1 =
2970 * d
2971 }}
2972 !! html
2973 <p>a
2974 </p><p>b
2975 </p><p>c
2976 </p>
2977 <ul><li>d</li></ul>
2978
2979 !! end
2980
2981 !! test
2982 Templates: Don't strip whitespace from positional-param values
2983 !! wikitext
2984 {{echo|a }}
2985
2986 {{echo|{{echo|b}} }}
2987
2988 {{echo| c
2989 }}
2990
2991 {{echo| {{echo|d}}
2992 }}
2993
2994 {{echo|
2995 e}}
2996
2997 {{echo|
2998 *f}}
2999
3000 {{echo|
3001 }}g
3002 !! html
3003 <p>a
3004 </p><p>b
3005 </p>
3006 <pre>c
3007 </pre>
3008 <p><br />
3009 </p>
3010 <pre>d
3011 </pre>
3012 <p><br />
3013 </p>
3014 <pre>e
3015 </pre>
3016 <p><br />
3017 </p>
3018 <ul><li>f</li></ul>
3019 <p><br />
3020 </p>
3021 <pre>g
3022 </pre>
3023 !! end
3024
3025 !! test
3026 Templates: Don't recognize targets split by newlines
3027 !! options
3028 parsoid=wt2html
3029 !! wikitext
3030 {{ech
3031 o|foo}}
3032 !! html/php
3033 <p>{{ech
3034 o|foo}}
3035 </p>
3036 !! html/parsoid
3037 <p>{{ech
3038 o|foo}}</p>
3039 !! end
3040
3041 !! test
3042 Templates: Recognize targets when newlines and comments don't split the target
3043 !! options
3044 parsoid=wt2html
3045 !! wikitext
3046 {{
3047 <!--X--> ech<!--X-->o<!--X-->
3048 <!--X--> <!--X-->
3049
3050 |foo}}
3051 !! html/php
3052 <p>foo
3053 </p>
3054 !! html/parsoid
3055 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3056 !! end
3057
3058 !! test
3059 Templates: Handle empty comment-and-ws-only lines correctly
3060 !! wikitext
3061 {{echo|foo
3062 <!--should be ignored-->
3063 <!--should be ignored as well-->
3064 bar}}
3065 !! html/php
3066 <p>foo
3067 bar
3068 </p>
3069 !! html/parsoid
3070 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
3071 !! end
3072
3073 !! test
3074 Templates: Handle comments in the target
3075 !! wikitext
3076 {{echo
3077 <!-- should be ignored -->
3078 |foo}}
3079
3080 {{echo
3081 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3082 |foo}}
3083
3084 {{echo<!-- should be ignored -->
3085 |foo}}
3086
3087 {{echo<!-- should be ignored -->|foo}}
3088
3089 {{<!-- should be ignored -->echo|foo}}
3090 !! html/php
3091 <p>foo
3092 </p><p>foo
3093 </p><p>foo
3094 </p><p>foo
3095 </p><p>foo
3096 </p>
3097 !! html/parsoid
3098 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3099
3100 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3101
3102 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3103
3104 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3105
3106 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3107 !! end
3108
3109 !! test
3110 Templates: Handle comments in parameter names (T69657)
3111 !! wikitext
3112 {{echo|1
3113 <!-- should be ignored -->
3114 =foo}}
3115
3116 {{echo|
3117 <!-- should be ignored -->
3118 1 = foo}}
3119
3120 {{echo|1<!-- should be ignored -->=foo}}
3121
3122 {{echo|<!-- should be ignored -->1=foo}}
3123 !! html/php
3124 <p>foo
3125 </p><p>foo
3126 </p><p>foo
3127 </p><p>foo
3128 </p>
3129 !! html/parsoid
3130 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3131
3132 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
3133
3134 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3135
3136 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
3137 !! end
3138
3139 !! test
3140 Templates: Other wikitext in parameter names (T69657)
3141 !! wikitext
3142 {{echo|''1''=foo}}
3143 !! html/php
3144 <p>{{{1}}}
3145 </p>
3146 !! html/parsoid
3147 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3148 !! end
3149
3150 !! test
3151 Templates: With colons
3152 !! wikitext
3153 {{With: Colon}}
3154 !! html/php
3155 <p>Template with colon
3156 </p>
3157 !! html/parsoid
3158 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
3159 !! end
3160
3161 #--------------------------------------------------------------------
3162 # Transclusion parameter escaping tests
3163 #--------------------------------------------------------------------
3164
3165 !! test
3166 Templates: Parsoid parameter escaping test 1
3167 !! wikitext
3168 {{echo|[foo]|{{echo|[bar]}}}}
3169 !! html/php+tidy
3170 <p>[foo]
3171 </p>
3172 !! html/parsoid
3173 <p about="#mwt1" typeof="mw:Transclusion"
3174 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3175 !! end
3176
3177 !! test
3178 Parsoid: Pipes in external links in template parameter
3179 !! wikitext
3180 {{echo|[{{echo|http://example.com}} link]}}
3181 !! html/php+tidy
3182 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3183 </p>
3184 !! html/parsoid
3185 <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
3186 !! end
3187
3188 !! test
3189 Parsoid: pipe in transclusion parameter
3190 !! wikitext
3191 {{echo|http://foo.com/a&#124;b}}
3192 !! html/php+tidy
3193 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3194 </p>
3195 !! html/parsoid
3196 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
3197 !! end
3198
3199 !! test
3200 Parsoid: Pipe in external link target and content in template parameter
3201 !! options
3202 parsoid=html2wt,wt2wt
3203 !! wikitext
3204 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3205 !! html/php+tidy
3206 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3207 </p>
3208 !! html/parsoid
3209 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3210 typeof="mw:Transclusion"
3211 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3212 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3213 !! end
3214
3215 !! test
3216 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3217 !! options
3218 parsoid
3219 !! wikitext
3220 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3221 !! html
3222 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3223 !! end
3224
3225 !! test
3226 Templates: Don't escape already nowiki-escaped text in template parameters
3227 !! options
3228 parsoid=html2wt,wt2wt
3229 !! wikitext
3230 {{echo|foo<nowiki>|</nowiki>bar}}
3231 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3232 {{echo|<nowiki></nowiki>}}
3233 !! html/php+tidy
3234 <p>foo|bar
3235 &lt;div&gt;
3236
3237 </p>
3238 !! html/parsoid
3239 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
3240 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
3241 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
3242 </p>
3243 !! end
3244
3245 ## T54824
3246 !! test
3247 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3248 !! options
3249 parsoid=html2wt,wt2wt
3250 !! wikitext
3251 {{echo|{{echo|1=bar}}}}
3252 !! html/php+tidy
3253 <p>bar
3254 </p>
3255 !! html/parsoid
3256 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
3257 !! end
3258
3259 ## T58733
3260 !! test
3261 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3262 !! wikitext
3263 {{echo|a : b}}
3264 !! html/php+tidy
3265 <p>a&#160;: b
3266 </p>
3267 !! html/parsoid
3268 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3269 !! end
3270
3271 ## T73412
3272 !! test
3273 Templates: Preserve blank parameter names
3274 !! wikitext
3275 {{echo|=foo}}
3276 !! html/php+tidy
3277 <p>{{{1}}}
3278 </p>
3279 !! html/parsoid
3280 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3281 !! end
3282
3283 !! test
3284 Templates: Preserve blank parameter names in other positions
3285 !! wikitext
3286 {{blank_param|bar|=foo}}
3287 !! html/php+tidy
3288 <p>bar
3289 foo
3290 </p>
3291 !! html/parsoid
3292 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3293 foo</p>
3294 !! end
3295
3296 ###
3297 ### Parsoid-centric tests for testing RT edge cases for pre
3298 ###
3299
3300 !!test
3301 1a. Indent-Pre and Comments
3302 !! wikitext
3303 a
3304 <!--a-->
3305 c
3306 !! html
3307 <pre>a
3308 </pre>
3309 <p>c
3310 </p>
3311 !!end
3312
3313 !!test
3314 1b. Indent-Pre and Comments
3315 !! wikitext
3316 a
3317 <!--a-->
3318 c
3319 !! html
3320 <pre>a
3321 </pre>
3322 <p>c
3323 </p>
3324 !!end
3325
3326 !!test
3327 1c. Indent-Pre and Comments
3328 !! wikitext
3329 <!--a--> a
3330
3331 <!--a--> a
3332 !! html
3333 <pre> a
3334 </pre>
3335 <pre> a
3336 </pre>
3337 !!end
3338
3339 !!test
3340 1d. Indent-Pre and Comments
3341 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3342 !! wikitext
3343 <!--a--> a
3344
3345 <!--b-->b
3346 !! html
3347 <pre>a
3348 </pre>
3349 <pre>b
3350 </pre>
3351 !!end
3352
3353 !!test
3354 2a. Indent-Pre and tables
3355 !! wikitext
3356 {|
3357 |-
3358 !h1!!h2
3359 |foo||bar
3360 |}
3361 !! html
3362 <table>
3363
3364 <tr>
3365 <th>h1</th>
3366 <th>h2
3367 </th>
3368 <td>foo</td>
3369 <td>bar
3370 </td></tr></table>
3371
3372 !!end
3373
3374 !!test
3375 2b. Indent-Pre and tables
3376 !! wikitext
3377 {|
3378 |-
3379 |foo
3380 |}
3381 !! html
3382 <table>
3383
3384 <tr>
3385 <td>foo
3386 </td></tr></table>
3387
3388 !!end
3389
3390 !!test
3391 2c. Indent-Pre and tables (T44252)
3392 !! wikitext
3393 {|
3394 |+foo
3395 ! |bar
3396 |}
3397 !! html
3398 <table>
3399 <caption>foo
3400 </caption>
3401 <tr>
3402 <th>bar
3403 </th></tr></table>
3404
3405 !!end
3406
3407 !!test
3408 2d. Indent-Pre and tables
3409 !! wikitext
3410 a
3411 {|
3412 |b
3413 |}
3414 !! html/php
3415 <pre>a
3416 </pre>
3417 <table>
3418 <tr>
3419 <td>b
3420 </td></tr></table>
3421
3422 !! html/parsoid
3423 <pre>a</pre>
3424 <table>
3425 <tbody><tr><td> b</td></tr>
3426 </tbody></table>
3427 !!end
3428
3429 !!test
3430 2e. Indent-Pre and table-line syntax
3431 !! wikitext
3432 a
3433 | b
3434 | c
3435 !! html/php
3436 <pre>a
3437 | b
3438 | c
3439 </pre>
3440 !!end
3441
3442 !!test
3443 2f. Indent-pre started by table-line syntax
3444 !! wikitext
3445 a
3446 | b
3447 | c
3448 !! html/php
3449 <p>a
3450 </p>
3451 <pre>| b
3452 | c
3453 </pre>
3454 !! html/parsoid
3455 <p>a</p>
3456 <pre>
3457 | b
3458 | c</pre>
3459 !!end
3460
3461 !! test
3462 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3463 !! wikitext
3464 <table>
3465 <tr>
3466 <td>
3467 Text that should be rendered preformatted
3468 </td>
3469 </tr>
3470 </table>
3471 !! html
3472 <table>
3473 <tr>
3474 <td>
3475 <pre>Text that should be rendered preformatted
3476 </pre>
3477 </td>
3478 </tr>
3479 </table>
3480
3481 !! end
3482
3483 !! test
3484 2h. Indent pre in tables
3485 !! options
3486 parsoid=wt2html,html2html
3487 !! wikitext
3488 {|
3489 !
3490 foo
3491 !
3492 bar
3493 |-
3494 |
3495 baz
3496 {{!}}
3497 bam
3498 |}
3499 !! html/php
3500 <table>
3501 <tr>
3502 <th>
3503 <pre>foo
3504 </pre>
3505 </th>
3506 <th>
3507 <pre>bar
3508 </pre>
3509 </th></tr>
3510 <tr>
3511 <td>
3512 <pre>baz
3513 </pre>
3514 </td>
3515 <td>
3516 <pre>bam
3517 </pre>
3518 </td></tr></table>
3519
3520 !! html/parsoid
3521 <table>
3522 <tbody><tr><th>
3523 <pre>foo</pre>
3524 </th><th>
3525 <pre>bar</pre>
3526 </th></tr><tr>
3527 <td>
3528 <pre>baz</pre>
3529 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3530 <pre>bam</pre>
3531 </td></tr></tbody></table>
3532 !! end
3533
3534 !! test
3535 3a. Indent-Pre and block tags (single-line html)
3536 !! options
3537 parsoid=wt2html,html2html
3538 !! wikitext
3539 a <p> foo </p>
3540 b <div> foo </div>
3541 c <blockquote> foo </blockquote>
3542 <span> foo </span>
3543 !! html
3544 a <p> foo </p>
3545 b <div> foo </div>
3546 c <blockquote> foo </blockquote>
3547 <pre><span> foo </span>
3548 </pre>
3549 !! html/php+tidy
3550 <p> a </p><p> foo </p><p>
3551 b </p><div> foo </div><p>
3552 c </p><blockquote><p> foo </p></blockquote>
3553 <pre><span> foo </span>
3554 </pre>
3555 !! html/parsoid
3556 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3557 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3558 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3559 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3560 !! end
3561
3562 !! test
3563 3b. Indent-Pre and block tags (multi-line html)
3564 !! wikitext
3565 a <span>foo</span>
3566 <!-- comment --> b <div> foo </div>
3567 !! html/php
3568 <pre>a <span>foo</span>
3569 </pre>
3570 b <div> foo </div>
3571
3572 !! html/parsoid
3573 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3574 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3575 !! html/php+tidy
3576 <pre>a <span>foo</span>
3577 </pre><p>
3578 b </p><div> foo </div>
3579 !! end
3580
3581 !!test
3582 3c. Indent-Pre and block tags (pre-content on separate line)
3583 !! wikitext
3584 <p>
3585 foo
3586 </p>
3587
3588 <div>
3589 foo
3590 </div>
3591
3592 <center>
3593 foo
3594 </center>
3595
3596 <blockquote>
3597 foo
3598 </blockquote>
3599
3600 <blockquote>
3601 <pre>
3602 foo
3603 </pre>
3604 </blockquote>
3605
3606 <table><tr><td>
3607 foo
3608 </td></tr></table>
3609
3610 <ul><li>
3611 foo
3612 </li></ul>
3613
3614 !! html
3615 <p>
3616 foo
3617 </p>
3618 <div>
3619 <pre>foo
3620 </pre>
3621 </div>
3622 <center>
3623 <pre>foo
3624 </pre>
3625 </center>
3626 <blockquote>
3627 <p> foo
3628 </p>
3629 </blockquote>
3630 <blockquote>
3631 <pre>
3632 foo
3633 </pre>
3634 </blockquote>
3635 <table><tr><td>
3636 <pre>foo
3637 </pre>
3638 </td></tr></table>
3639 <ul><li>
3640 foo
3641 </li></ul>
3642
3643 !!end
3644
3645 !! test
3646 4. Indent-Pre and extension tags
3647 !! options
3648 parsoid=wt2html,html2html
3649 !! wikitext
3650 a <tag />
3651 !! html/php+tidy
3652 <p> a </p><pre>NULL
3653 array (
3654 )
3655 </pre>
3656 !! html/parsoid
3657 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3658 !! end
3659
3660 !! test
3661 5. Indent-Pre and html pre
3662 !! wikitext
3663 <pre class="123">hi</pre>
3664 !! html/php
3665 <pre class="123">hi</pre>
3666
3667 !! html/parsoid
3668 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3669 !! end
3670
3671 !!test
3672 Render paragraphs when indent-pre is suppressed in blocklevels
3673 !! wikitext
3674 <blockquote>
3675 foo
3676
3677 bar
3678 </blockquote>
3679 !! html
3680 <blockquote>
3681 <p> foo
3682 </p><p> bar
3683 </p>
3684 </blockquote>
3685
3686 !!end
3687
3688 !!test
3689 4. Multiple spaces at start-of-line
3690 !! wikitext
3691 <p> foo </p>
3692 foo
3693 {|
3694 |foo
3695 |}
3696 !! html
3697 <p> foo </p>
3698 <pre> foo
3699 </pre>
3700 <table>
3701 <tr>
3702 <td>foo
3703 </td></tr></table>
3704
3705 !!end
3706
3707 ## NOTE: the leading white-space chars on empty line are significant
3708 !! test
3709 5a. White-space in indent-pre
3710 !! wikitext
3711 a<br />
3712
3713 b
3714 !! html
3715 <pre>a<br />
3716
3717 b
3718 </pre>
3719 !! end
3720
3721 ## NOTE: the leading white-space chars on empty line are significant
3722 !! test
3723 5b. White-space in indent-pre
3724 !! wikitext
3725 a
3726
3727 b
3728
3729
3730 c
3731 !! html
3732 <pre>a
3733
3734 b
3735
3736
3737 c
3738 </pre>
3739 !! end
3740
3741 !! test
3742 5c. White-space in indent-pre
3743 !! wikitext
3744 ''a''
3745 ''b''
3746 ''c''
3747 !! html
3748 <pre><i>a</i>
3749 <i>b</i>
3750 <i>c</i>
3751 </pre>
3752 !! end
3753
3754 !! test
3755 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3756 !! wikitext
3757 a
3758
3759 <!-- continue -->
3760 b
3761
3762 c
3763
3764 d
3765 !! html
3766 <pre>a
3767
3768 b
3769 </pre>
3770 <pre>c
3771
3772 </pre>
3773 <p>d
3774 </p>
3775 !! end
3776
3777 !! test
3778 7a. Indent-pre and category links
3779 !! options
3780 parsoid=wt2html,wt2wt
3781 !! wikitext
3782 [[Category:foo]] <!-- No pre-wrapping -->
3783 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3784 !! html/php+tidy
3785 !! html/parsoid
3786 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3787 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3788 !! end
3789
3790 ## We used to, but no longer wt2wt this test since the default serializer
3791 ## will normalize all categories to serialize on their own line.
3792 ## This wikitext usage is going to be fairly uncommon in production and
3793 ## selser will take care of preserving formatting in those scenarios.
3794 !! test
3795 7b. Indent-pre and category links
3796 !! options
3797 parsoid=wt2html
3798 !! wikitext
3799 [[Category:foo]] a
3800 [[Category:foo]] {{echo|b}}
3801 !! html/parsoid
3802 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3803 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3804 !! end
3805
3806 !! test
3807 Indent-Pre: Newlines in comments shouldn't affect sol state
3808 !! wikitext
3809 a <!--
3810 foo
3811 --> b
3812 !! html/php+tidy
3813 <p>a b
3814 </p>
3815 !! html/parsoid
3816 <p>a <!--
3817 foo
3818 --> b</p>
3819 !! end
3820
3821 ###
3822 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3823 ###
3824
3825 !!test
3826 HTML-pre: 1. embedded newlines
3827 !! wikitext
3828 <pre>foo</pre>
3829
3830 <pre>
3831 foo
3832 </pre>
3833
3834 <pre>
3835
3836 foo
3837 </pre>
3838
3839 <pre>
3840
3841
3842 foo
3843 </pre>
3844 !! html/php+tidy
3845 <pre>foo</pre>
3846 <pre>foo
3847 </pre>
3848 <pre>
3849
3850 foo
3851 </pre>
3852 <pre>
3853
3854
3855 foo
3856 </pre>
3857 !! html/parsoid
3858 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3859
3860 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3861 </pre>
3862
3863 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3864
3865 foo
3866 </pre>
3867
3868 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3869
3870
3871 foo
3872 </pre>
3873 !!end
3874
3875 !! test
3876 HTML-pre: big spaces
3877 !! wikitext
3878 <pre>
3879
3880
3881
3882
3883 haha
3884
3885
3886
3887
3888 haha
3889
3890
3891
3892
3893 </pre>
3894 !! html/php+tidy
3895 <pre>
3896
3897
3898
3899
3900 haha
3901
3902
3903
3904
3905 haha
3906
3907
3908
3909
3910 </pre>
3911 !! html/parsoid
3912 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3913
3914
3915
3916
3917 haha
3918
3919
3920
3921
3922 haha
3923
3924
3925
3926
3927 </pre>
3928 !! end
3929
3930 !!test
3931 HTML-pre: 2: indented text
3932 !! wikitext
3933 <pre>
3934 foo
3935 </pre>
3936 !! html
3937 <pre>
3938 foo
3939 </pre>
3940
3941 !!end
3942
3943 !!test
3944 HTML-pre: 3: other wikitext
3945 !! wikitext
3946 <pre>
3947 * foo
3948 # bar
3949 = no-h =
3950 '' no-italic ''
3951 [[ NoLink ]]
3952 </pre>
3953 !! html/php
3954 <pre>
3955 * foo
3956 # bar
3957 = no-h =
3958 '' no-italic ''
3959 [[ NoLink ]]
3960 </pre>
3961
3962 !! html/parsoid
3963 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3964 # bar
3965 = no-h =
3966 '' no-italic ''
3967 [[ NoLink ]]
3968 </pre>
3969 !!end
3970
3971 ###
3972 ### Definition lists
3973 ###
3974 !! test
3975 Simple definition
3976 !! wikitext
3977 ;name :Definition
3978 !! html
3979 <dl><dt>name</dt>
3980 <dd>Definition</dd></dl>
3981
3982 !! end
3983
3984 !! test
3985 Definition list for indentation only
3986 !! wikitext
3987 :Indented text
3988 !! html
3989 <dl><dd>Indented text</dd></dl>
3990
3991 !! end
3992
3993 !! test
3994 Definition list with no space
3995 !! wikitext
3996 ;name:Definition
3997 !! html
3998 <dl><dt>name</dt>
3999 <dd>Definition</dd></dl>
4000
4001 !!end
4002
4003 !! test
4004 Definition list with URL link
4005 !! wikitext
4006 ;http://example.com/ :definition
4007 !! html
4008 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
4009 <dd>definition</dd></dl>
4010
4011 !! end
4012
4013 !! test
4014 Definition list with bracketed URL link
4015 !! wikitext
4016 ;[http://www.example.com/ Example]:Something about it
4017 !! html
4018 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4019 <dd>Something about it</dd></dl>
4020
4021 !! end
4022
4023 !! test
4024 Definition list with wikilink containing colon
4025 !! wikitext
4026 ;[[Help:FAQ]]:The least-read page on Wikipedia
4027 !! html
4028 <dl><dt><a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
4029 <dd>The least-read page on Wikipedia</dd></dl>
4030
4031 !! end
4032
4033 # At Brion's and JeLuF's insistence... :)
4034 !! test
4035 Definition list with news link containing colon
4036 !! wikitext
4037 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4038 !! html/php
4039 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4040 <dd>This isn't even a real newsgroup!</dd></dl>
4041
4042 !! html/parsoid
4043 <dl><dt><a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
4044 !! end
4045
4046 !! test
4047 Malformed definition list with colon
4048 !! wikitext
4049 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4050 !! html
4051 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
4052
4053 !! end
4054
4055 !! test
4056 Definition lists: colon in external link text
4057 !! wikitext
4058 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4059 !! html
4060 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4061 <dd>OK, I made that up</dd></dl>
4062
4063 !! end
4064
4065 !! test
4066 Definition lists: colon in HTML attribute
4067 !! wikitext
4068 ;<b style="display: inline">bold</b>
4069 !! html
4070 <dl><dt><b style="display: inline">bold</b></dt></dl>
4071
4072 !! end
4073
4074 !! test
4075 Definition lists: self-closed tag
4076 !! wikitext
4077 ;one<br/>two :two-line fun
4078 !! html
4079 <dl><dt>one<br />two</dt>
4080 <dd>two-line fun</dd></dl>
4081
4082 !! end
4083
4084 !! test
4085 Definition lists: ignore colons inside tags
4086 !! wikitext
4087 ;one <b>two : tag <i>fun:</i>:</b>:def
4088 !! html
4089 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4090 <dd>def</dd></dl>
4091
4092 !! end
4093
4094 !! test
4095 Definition lists: excess closed tags
4096 !! wikitext
4097 ;one</b>two :bad tag fun
4098 !! html/php+tidy
4099 <dl><dt>onetwo</dt>
4100 <dd>bad tag fun</dd></dl>
4101 !! html/parsoid
4102 <dl>
4103 <dt>onetwo</dt>
4104 <dd>bad tag fun</dd>
4105 </dl>
4106 !! end
4107
4108 !! test
4109 T13748: Literal closing tags
4110 !! wikitext
4111 <dl>
4112 <dt>test 1</dt>
4113 <dd>test test test test test</dd>
4114 <dt>test 2</dt>
4115 <dd>test test test test test</dd>
4116 </dl>
4117 !! html
4118 <dl>
4119 <dt>test 1</dt>
4120 <dd>test test test test test</dd>
4121 <dt>test 2</dt>
4122 <dd>test test test test test</dd>
4123 </dl>
4124
4125 !! end
4126
4127 !! test
4128 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4129 !! wikitext
4130 <ul><li>
4131 ;term :description
4132 *unordered
4133 </li></ul>
4134 !! html
4135 <ul><li>
4136 <dl><dt>term</dt>
4137 <dd>description</dd></dl>
4138 <ul><li>unordered</li></ul>
4139 </li></ul>
4140
4141 !! end
4142
4143 !! test
4144 Definition list with empty definition and following paragraph
4145 !! wikitext
4146 ;term:
4147
4148 Paragraph text
4149 !! html
4150 <dl><dt>term</dt>
4151 <dd></dd></dl>
4152 <p>Paragraph text
4153 </p>
4154 !! end
4155
4156 !! test
4157 Nested definition lists using html syntax
4158 !! wikitext
4159 <dl><dt>x</dt>
4160 <dd>a</dd>
4161 <dd>b</dd></dl>
4162 !! html
4163 <dl><dt>x</dt>
4164 <dd>a</dd>
4165 <dd>b</dd></dl>
4166
4167 !! end
4168
4169 !! test
4170 Definition Lists: No nesting: Multiple dd's
4171 !! wikitext
4172 ;x
4173 :a
4174 :b
4175 !! html
4176 <dl><dt>x</dt>
4177 <dd>a</dd>
4178 <dd>b</dd></dl>
4179
4180 !! end
4181
4182 !! test
4183 Definition Lists: Indentation: Regular
4184 !! wikitext
4185 :i1
4186 ::i2
4187 :::i3
4188 !! html
4189 <dl><dd>i1
4190 <dl><dd>i2
4191 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4192
4193 !! end
4194
4195 !! test
4196 Definition Lists: Indentation: Missing 1st level
4197 !! wikitext
4198 ::i2
4199 :::i3
4200 !! html
4201 <dl><dd><dl><dd>i2
4202 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4203
4204 !! end
4205
4206 !! test
4207 Definition Lists: Indentation: Multi-level indent
4208 !! wikitext
4209 :::i3
4210 !! html
4211 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4212
4213 !! end
4214
4215 !! test
4216 Definition Lists: Hacky use to indent tables
4217 !! wikitext
4218 ::{|
4219 |foo
4220 |bar
4221 |}
4222 this text
4223 should be left alone
4224 !! html
4225 <dl><dd><dl><dd><table>
4226 <tr>
4227 <td>foo
4228 </td>
4229 <td>bar
4230 </td></tr></table></dd></dl></dd></dl>
4231 <p>this text
4232 should be left alone
4233 </p>
4234 !! end
4235
4236 !! test
4237 Definition Lists: Hacky use to indent tables (with content following table)
4238 !! wikitext
4239 :{|
4240 |foo
4241 |bar
4242 |} <!--c1--> this text should be part of the dl
4243 !! html/php+tidy
4244 <dl><dd><table>
4245 <tbody><tr>
4246 <td>foo
4247 </td>
4248 <td>bar
4249 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4250 !! html/parsoid
4251 <dl><dd><table>
4252 <tbody><tr>
4253 <td>foo
4254 </td>
4255 <td>bar
4256 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4257 !! end
4258
4259 !! test
4260 Definition Lists: Hacky use to indent tables, with comments (T65979)
4261 !! wikitext
4262 <!-- foo -->
4263 ::{|
4264 |foo
4265 |bar
4266 |}<!-- bar -->
4267 this text
4268 should be left alone
4269 !! html/parsoid
4270 <!-- foo -->
4271 <dl><dd><dl><dd><table><tr>
4272 <td>foo</td>
4273 <td>bar</td>
4274 </tr></table><!-- bar --></dd></dl></dd></dl>
4275 <p>this text
4276 should be left alone</p>
4277 !! end
4278
4279 !! test
4280 Definition Lists: Hacky use to indent tables, with comment before table
4281 !!options
4282 parsoid=wt2html
4283 !! wikitext
4284 ::<!-- foo -->{|
4285 |foo
4286 |}
4287 !! html/parsoid
4288 <dl><dd><dl><dd><!-- foo --><table><tr>
4289 <td>foo</td>
4290 </tr></table></dd></dl></dd></dl>
4291 !! end
4292
4293 # The trailing whitespace in this test is to catch a regression in
4294 # Parsoid after T54473.
4295 !! test
4296 Definition Lists: Hacky use to indent tables (WS-insensitive)
4297 !! wikitext
4298 :{|
4299 |a
4300 |}
4301 !! html/php
4302 <dl><dd><table>
4303 <tr>
4304 <td>a
4305 </td></tr></table></dd></dl>
4306
4307 !! html/parsoid
4308 <dl><dd><table>
4309 <tbody><tr><td>a</td></tr>
4310 </tbody></table></dd></dl>
4311 !! end
4312
4313 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4314 ## as an empty dt item. It also ignores all but the last ";" when followed
4315 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4316 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4317 ## ";"s.
4318 ##
4319 ## Ex: ";;t2 ::d2" is transformed into:
4320 ##
4321 ## <dl>
4322 ## <dt>t2 </dt>
4323 ## <dd>
4324 ## <dl>
4325 ## <dt></dt>
4326 ## <dd>d2</dd>
4327 ## </dl>
4328 ## </dd>
4329 ## </dl>
4330 ##
4331 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4332 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4333 ##
4334 ## <dl>
4335 ## <dt>
4336 ## <dl>
4337 ## <dt>t2 </dt>
4338 ## <dd>:d2</dd>
4339 ## </dl>
4340 ## </dt>
4341 ## </dl>
4342 ##
4343 ## All Parsoid only definition list tests have this difference.
4344 ##
4345 ## See also: https://phabricator.wikimedia.org/T8569
4346 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4347
4348 !! test
4349 Table / list interaction: indented table with lists in table contents
4350 !! wikitext
4351 :{|
4352 |-
4353 |a
4354
4355 *b
4356 |-
4357 |c
4358
4359 *d
4360 |}
4361 !! html
4362 <dl><dd><table>
4363
4364 <tr>
4365 <td>a
4366 <ul><li>b</li></ul>
4367 </td></tr>
4368 <tr>
4369 <td>c
4370 <ul><li>d</li></ul>
4371 </td></tr></table></dd></dl>
4372
4373 !! end
4374
4375 !!test
4376 Table / list interaction: lists nested in tables nested in indented lists
4377 !! wikitext
4378 :{|
4379 |
4380 :a
4381 :b
4382 |
4383 *c
4384 *d
4385 |}
4386
4387 *e
4388 *f
4389 !! html
4390 <dl><dd><table>
4391 <tr>
4392 <td>
4393 <dl><dd>a</dd>
4394 <dd>b</dd></dl>
4395 </td>
4396 <td>
4397 <ul><li>c</li>
4398 <li>d</li></ul>
4399 </td></tr></table></dd></dl>
4400 <ul><li>e</li>
4401 <li>f</li></ul>
4402
4403 !!end
4404
4405 !! test
4406 Definition Lists: Nesting: Multi-level (Parsoid only)
4407 !! wikitext
4408 ;t1 :d1
4409 ;;t2 ::d2
4410 ;;;t3 :::d3
4411 !! html/parsoid
4412 <dl>
4413 <dt>t1 </dt>
4414 <dd>d1</dd>
4415 <dt>
4416 <dl>
4417 <dt>t2 </dt>
4418 <dd>:d2</dd>
4419 <dt>
4420 <dl>
4421 <dt>t3 </dt>
4422 <dd>::d3</dd>
4423 </dl>
4424 </dt>
4425 </dl>
4426 </dt>
4427 </dl>
4428
4429
4430 !! end
4431
4432
4433 !! test
4434 Definition Lists: Nesting: Test 2
4435 !! wikitext
4436 ;t1
4437 ::d2
4438 !! html+tidy
4439 <dl><dt>t1</dt>
4440 <dd>
4441 <dl><dd>d2</dd></dl></dd></dl>
4442 !! end
4443
4444
4445 !! test
4446 Definition Lists: Nesting: Test 3
4447 !! wikitext
4448 :;t1
4449 ::::d2
4450 !! html+tidy
4451 <dl><dd><dl><dt>t1</dt>
4452 <dd>
4453 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4454 !! end
4455
4456
4457 !! test
4458 Definition Lists: Nesting: Test 4
4459 !! wikitext
4460 ::;t3
4461 :::d3
4462 !! html
4463 <dl><dd><dl><dd><dl><dt>t3</dt>
4464 <dd>d3</dd></dl></dd></dl></dd></dl>
4465
4466 !! end
4467
4468
4469 ## The Parsoid team believes the following three test exposes a
4470 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4471 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4472 ## It also exposes a "misfeature" in tidy, which doesn't like
4473 ## <dl> tags with a single <dt> child; it converts the <dt> into
4474 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4475 !! test
4476 Definition Lists: Mixed Lists: Test 1
4477 !! wikitext
4478 :;*foo
4479 ::*bar
4480 :;baz
4481 !! html/php
4482 <dl><dd><dl><dt><ul><li>foo</li>
4483 <li>bar</li></ul></dt></dl>
4484 <dl><dt>baz</dt></dl></dd></dl>
4485
4486 !! html/php+tidy
4487 <dl><dd><dl><dt><ul><li>foo</li>
4488 <li>bar</li></ul></dt></dl>
4489 <dl><dt>baz</dt></dl></dd></dl>
4490 !! html/parsoid
4491 <dl>
4492 <dd><dl>
4493 <dt><ul>
4494 <li>foo
4495 </li>
4496 </ul></dt>
4497 <dd><ul>
4498 <li>bar
4499 </li>
4500 </ul></dd>
4501 <dt>baz</dt>
4502 </dl></dd>
4503 </dl>
4504 !! end
4505
4506 !! test
4507 Definition Lists: Mixed Lists: Test 2
4508 !! wikitext
4509 *:d1
4510 *:d2
4511 !! html
4512 <ul><li><dl><dd>d1</dd>
4513 <dd>d2</dd></dl></li></ul>
4514
4515 !! end
4516
4517
4518 !! test
4519 Definition Lists: Mixed Lists: Test 3
4520 !! wikitext
4521 *:::d1
4522 *:::d2
4523 !! html
4524 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4525 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4526
4527 !! end
4528
4529
4530 !! test
4531 Definition Lists: Mixed Lists: Test 4
4532 !! wikitext
4533 *;d1 :d2
4534 *;d3 :d4
4535 !! html
4536 <ul><li><dl><dt>d1</dt>
4537 <dd>d2</dd>
4538 <dt>d3</dt>
4539 <dd>d4</dd></dl></li></ul>
4540
4541 !! end
4542
4543
4544 !! test
4545 Definition Lists: Mixed Lists: Test 5
4546 !! wikitext
4547 *:d1
4548 *::d2
4549 !! html
4550 <ul><li><dl><dd>d1
4551 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4552
4553 !! end
4554
4555
4556 !! test
4557 Definition Lists: Mixed Lists: Test 6
4558 !! wikitext
4559 #*:d1
4560 #*:::d3
4561 !! html
4562 <ol><li><ul><li><dl><dd>d1
4563 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4564
4565 !! end
4566
4567
4568 !! test
4569 Definition Lists: Mixed Lists: Test 7
4570 !! wikitext
4571 :*d1
4572 :*d2
4573 !! html
4574 <dl><dd><ul><li>d1</li>
4575 <li>d2</li></ul></dd></dl>
4576
4577 !! end
4578
4579
4580 !! test
4581 Definition Lists: Mixed Lists: Test 8
4582 !! wikitext
4583 :*d1
4584 ::*d2
4585 !! html
4586 <dl><dd><ul><li>d1</li></ul>
4587 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4588
4589 !! end
4590
4591
4592 !! test
4593 Definition Lists: Mixed Lists: Test 9
4594 !! wikitext
4595 *;foo :bar
4596 !! html
4597 <ul><li><dl><dt>foo</dt>
4598 <dd>bar</dd></dl></li></ul>
4599
4600 !! end
4601
4602
4603 !! test
4604 Definition Lists: Mixed Lists: Test 10
4605 !! wikitext
4606 *#;foo :bar
4607 !! html
4608 <ul><li><ol><li><dl><dt>foo</dt>
4609 <dd>bar</dd></dl></li></ol></li></ul>
4610
4611 !! end
4612
4613 # The Parsoid team disagrees with the PHP parser's seemingly-random
4614 # rules regarding dd/dt on the next few tests. Parsoid is more
4615 # consistent, and recognizes the shared nesting and keeps the
4616 # still-open tags around until the nesting is complete.
4617
4618 # This is a regression test for T175099
4619 !! test
4620 Definition Lists: Mixed Lists: Test 11
4621 !! wikitext
4622 ;a
4623 :*b
4624 !! html/php
4625 <dl><dt>a</dt>
4626 <dd>
4627 <ul><li>b</li></ul></dd></dl>
4628
4629 !! html/parsoid
4630 <dl><dt>a
4631 <dd><ul><li>b</li></ul></dd></dl>
4632 !! end
4633
4634 # FIXME: Maybe get rid of this test?
4635 !! test
4636 Definition Lists: Mixed Lists: Test 12
4637 !! wikitext
4638 *#*#;*;;foo :bar
4639 *#*#;boo :baz
4640 !! html/php
4641 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4642 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4643 <dl><dt>boo</dt>
4644 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4645
4646 !! html/php+tidy
4647 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4648 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4649 <dl><dt>boo</dt>
4650 <dd>baz</dd></dl></li></ol></li></ul>
4651 !! html/parsoid
4652 <ul>
4653 <li>
4654 <ol>
4655 <li>
4656 <ul>
4657 <li>
4658 <ol>
4659 <li>
4660 <dl>
4661 <dt>
4662 <ul>
4663 <li>
4664 <dl>
4665 <dt>
4666 <dl>
4667 <dt>foo</dt>
4668 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4669 </dl></dt>
4670 </dl></li>
4671 </ul></dt>
4672 <dt>boo</dt>
4673 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4674 </dl></li>
4675 </ol></li>
4676 </ul></li>
4677 </ol></li>
4678 </ul>
4679 !! end
4680
4681 !! test
4682 Definition Lists: Mixed Lists: Test 13
4683 !! wikitext
4684 *#*#;*;;foo : bar
4685 *#*#;boo : baz
4686 !! html+tidy
4687 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4688 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4689 <dl><dt>boo&#160;</dt>
4690 <dd>baz</dd></dl></li></ol></li></ul>
4691 !! end
4692
4693 # FIXME: Maybe get rid of this test?
4694 # From whitelist:
4695 # * The test is wrong, there are two colons where there should be :;
4696 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4697 !! test
4698 Definition Lists: Weird Ones: Test 1
4699 !! wikitext
4700 *#;*::;;foo :bar (who uses this?)
4701 !! html/php+tidy
4702 <ul><li><ol><li><dl><dt>foo</dt>
4703 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4704 !! html/parsoid
4705 <ul>
4706 <li>
4707 <ol>
4708 <li>
4709 <dl>
4710 <dt>
4711 <ul>
4712 <li>
4713 <dl>
4714 <dd>
4715 <dl>
4716 <dd>
4717 <dl>
4718 <dt>
4719 <dl>
4720 <dt>foo</dt>
4721 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4722 </dl></dt>
4723 </dl></dd>
4724 </dl></dd>
4725 </dl></li>
4726 </ul></dt>
4727 </dl></li>
4728 </ol></li>
4729 </ul>
4730 !! end
4731
4732 !! test
4733 Definition Lists: colons occurring in tags
4734 !! wikitext
4735 ;a:b
4736 ;'''a:b'''
4737 ;<i>a:b</i>
4738 ;<span>a:b</span>
4739 ;<div>a:b</div>
4740 ;<div>a
4741 :b</div>
4742 ;{{echo|a:b}}
4743 ;{{echo|''a:b''}}
4744 ;;;''a:b''
4745 !! html+tidy
4746 <dl><dt>a</dt>
4747 <dd>b</dd>
4748 <dt><b>a:b</b></dt>
4749 <dt><i>a:b</i></dt>
4750 <dt><span>a:b</span></dt>
4751 <dt><div>a:b</div></dt>
4752 <dt><div>a</div></dt>
4753 <dd>b</dd>
4754 <dt>a</dt>
4755 <dd>b</dd>
4756 <dt><i>a:b</i></dt></dl>
4757 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4758 !! html/parsoid
4759 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4760 <dt><b>a:b</b></dt>
4761 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4762 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4763 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4764 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4765 <dd>b</dd>
4766 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4767 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4768 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4769 !! end
4770
4771 # Parsoid's output differs here again because it shares
4772 # nesting between the two lists unlike the PHP parser.
4773 # Unsure which is more desirable.
4774 !! test
4775 Definition Lists: colons and tables 1
4776 !! wikitext
4777 :{|
4778 |x
4779 |}
4780 :{|
4781 |y
4782 |}
4783 !! html/php
4784 <dl><dd><table>
4785 <tr>
4786 <td>x
4787 </td></tr></table></dd></dl>
4788 <dl><dd><table>
4789 <tr>
4790 <td>y
4791 </td></tr></table></dd></dl>
4792
4793 !! html/parsoid
4794 <dl><dd><table>
4795 <tr>
4796 <td>x
4797 </td></tr></table></dd>
4798 <dd><table>
4799 <tr>
4800 <td>y
4801 </td></tr></table></dd></dl>
4802 !! end
4803
4804 # FIXME: Does this need a html/php section?
4805 !! test
4806 Definition Lists: template interaction
4807 !! wikitext
4808 ::{{definition_list}}
4809
4810 :one
4811 ::{{definition_list}}
4812 :::two
4813 :::three
4814 ::four
4815 !! html/parsoid
4816 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4817 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4818
4819 <dl><dd data-parsoid='{}'>one
4820 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4821 </span><dd about="#mwt2">two
4822 <dl><dd>two</dd>
4823 <dd>three</dd></dl></dd>
4824 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4825 !! end
4826
4827
4828 ###
4829 ### External links
4830 ###
4831 !! test
4832 External links: non-bracketed
4833 !! wikitext
4834 Non-bracketed: http://example.com
4835 !! html
4836 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4837 </p>
4838 !! end
4839
4840 # parsoid doesn't explicitly mark autonumbered links, see T55505
4841 !! test
4842 External links: numbered
4843 !! wikitext
4844 Numbered: [http://example.com]
4845 Numbered: [http://example.net]
4846 Numbered: [http://example.com]
4847 !! html/php
4848 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4849 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4850 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4851 </p>
4852 !! html/parsoid
4853 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4854 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4855 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4856 !!end
4857
4858 !! test
4859 External links: specified text
4860 !! wikitext
4861 Specified text: [http://example.com link]
4862 !! html
4863 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4864 </p>
4865 !!end
4866
4867 !! test
4868 External links: trail
4869 !! wikitext
4870 Linktrails should not work for external links: [http://example.com link]s
4871 !! html
4872 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4873 </p>
4874 !! end
4875
4876 !! test
4877 External links: dollar sign in URL
4878 !! wikitext
4879 http://example.com/1$2345
4880 !! html
4881 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4882 </p>
4883 !! end
4884
4885 # parsoid doesn't explicitly mark autonumbered links, see T55505
4886 !! test
4887 External links: dollar sign in URL (autonumber)
4888 !! wikitext
4889 [http://example.com/1$2345]
4890 !! html/php
4891 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4892 </p>
4893 !! html/parsoid
4894 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4895 !!end
4896
4897 !! test
4898 External links: open square bracket forbidden in URL (T6377)
4899 !! options
4900 parsoid=wt2html,wt2wt,html2html
4901 !! wikitext
4902 http://example.com/1[2345
4903 !! html/php
4904 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4905 </p>
4906 !! html/parsoid
4907 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4908 !! end
4909
4910 !! test
4911 External links: open square bracket forbidden in URL (named) (T6377)
4912 !! options
4913 parsoid=wt2html,html2html
4914 !! wikitext
4915 [http://example.com/1[2345]
4916 !! html/php
4917 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4918 </p>
4919 !! html/parsoid
4920 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4921 !!end
4922
4923 # parsoid adds a space before the link name
4924 !! test
4925 External links: open square bracket forbidden in URL (named) (T6377)
4926 Parsoid variant.
4927 !! wikitext
4928 [http://example.com/1 [2345]
4929 !! html
4930 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4931 </p>
4932 !!end
4933
4934 !! test
4935 External links: nowiki in URL link text (T8230)
4936 !! wikitext
4937 [http://example.com/ <nowiki>''example site''</nowiki>]
4938 !! html
4939 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4940 </p>
4941 !! end
4942
4943 !! test
4944 External links: newline forbidden in text (T8230 regression check)
4945 !! wikitext
4946 [http://example.com/ first
4947 second]
4948 !! html
4949 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4950 second]
4951 </p>
4952 !!end
4953
4954 !! test
4955 External links: Pipe char between url and text
4956 !! wikitext
4957 [http://example.com | link]
4958 !! html
4959 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4960 </p>
4961 !!end
4962
4963 !! test
4964 External links: protocol-relative URL in brackets
4965 !! wikitext
4966 [//example.com/ Test]
4967 !! html
4968 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4969 </p>
4970 !! end
4971
4972 # parsoid doesn't explicitly mark autonumbered links, see T55505
4973 !! test
4974 External links: protocol-relative URL in brackets without text
4975 !! wikitext
4976 [//example.com]
4977 !! html/php
4978 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4979 </p>
4980 !! html/parsoid
4981 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4982 !! end
4983
4984 !! test
4985 External links: protocol-relative URL in free text is left alone
4986 !! wikitext
4987 //example.com/Foo
4988 !! html
4989 <p>//example.com/Foo
4990 </p>
4991 !!end
4992
4993 !! test
4994 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4995 !! wikitext
4996 foo//example.com/Foo
4997 !! html
4998 <p>foo//example.com/Foo
4999 </p>
5000 !! end
5001
5002 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
5003 !! test
5004 External links: with no contents
5005 !! options
5006 parsoid=wt2html,wt2wt
5007 !! wikitext
5008 [http://en.wikipedia.org/wiki/Foo]
5009
5010 [[wikipedia:Foo|Bar]]
5011
5012 [[wikipedia:Foo|<span>Bar</span>]]
5013 !! html/php
5014 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
5015 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
5016 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5020 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5021 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5022 !! end
5023
5024 !! test
5025 External links: Free with trailing punctuation
5026 !! wikitext
5027 http://example.com,
5028 http://example.com;
5029 http://example.com\
5030 http://example.com.
5031 http://example.com:
5032 http://example.com!
5033 http://example.com?
5034 http://example.com)
5035 http://example.com/url_with_(brackets)
5036 (http://example.com/url_without_brackets)
5037 http://example.com/url_with_entity&amp;
5038 http://example.com/url_with_entity&#x26;
5039 http://example.com/url_with_entity&#038;
5040 http://example.com/url_with_entity&nbsp;
5041 http://example.com/url_with_entity&#xA0;
5042 http://example.com/url_with_entity&#160;
5043 http://example.com/url_with_entity&lt;
5044 http://example.com/url_with_entity&#x3C;
5045 http://example.com/url_with_entity&#60;
5046 !! html/php
5047 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5048 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5049 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5050 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5051 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5052 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5053 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5054 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5055 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5056 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5057 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5058 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5059 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5060 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5061 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5062 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5063 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5064 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5065 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5066 </p>
5067 !! html/parsoid
5068 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5069 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5070 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5071 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5072 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5073 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5074 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5075 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5076 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5077 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5078 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5079 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5080 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5081 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
5082 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
5083 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
5084 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
5085 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5086 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5087 !! end
5088
5089 !! test
5090 External links: tricky Parsoid html2html case
5091 !! options
5092 parsoid=wt2html,wt2wt,html2html
5093 !! wikitext
5094 http://example.com/url_with_entity&amp;amp;
5095 !! html/php
5096 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
5097 </p>
5098 !! html/parsoid
5099 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
5100 !! end
5101
5102 !! test
5103 External links: Free with trailing quotes (T113666)
5104 !! wikitext
5105 '''News:''' Stuff here
5106
5107 news:'a'b''c''d e
5108 !! html/php
5109 <p><b>News:</b> Stuff here
5110 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5111 </p>
5112 !! html/parsoid
5113 <p><b>News:</b> Stuff here</p>
5114 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5115 !! end
5116
5117 !! test
5118 External links: with entity
5119 !! wikitext
5120 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5121 !! html/php
5122 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5123 </p>
5124 !! html/parsoid
5125 <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
5126 !! end
5127
5128 !! test
5129 External links: Lone protocols are never linked (T105697)
5130 !! wikitext
5131 http://
5132 http://;
5133 (http://)
5134 bitcoin:
5135 bitcoin:;
5136 (bitcoin:)
5137 !! html
5138 <p>http://
5139 http://;
5140 (http://)
5141 bitcoin:
5142 bitcoin:;
5143 (bitcoin:)
5144 </p>
5145 !! end
5146
5147 !! test
5148 External links: No preceding word characters allowed (T67278)
5149 !! wikitext
5150 NOPEhttp://example.com
5151 N0http://example.com
5152 ok:http://example.com
5153 ok-http://example.com
5154 !! html
5155 <p>NOPEhttp://example.com
5156 N0http://example.com
5157 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5158 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5159 </p>
5160 !! end
5161
5162 !! test
5163 External links: nofollow domain exception
5164 !! wikitext
5165 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5166 !! html
5167 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
5168 </p>
5169 !!end
5170
5171 !! test
5172 External image
5173 !! wikitext
5174 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5175 !! html
5176 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5177 </p>
5178 !! end
5179
5180 !! test
5181 External image from https
5182 !! wikitext
5183 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5184 !! html
5185 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5186 </p>
5187 !! end
5188
5189 !! test
5190 External image (when not allowed)
5191 !! options
5192 wgAllowExternalImages=0
5193 !! wikitext
5194 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5195 !! html
5196 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
5197 </p>
5198 !! end
5199
5200 !! test
5201 Link to non-http image, no img tag
5202 !! wikitext
5203 Link to non-http image, no img tag: ftp://example.com/test.jpg
5204 !! html
5205 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
5206 </p>
5207 !! end
5208
5209 !! test
5210 External links: terminating separator
5211 !! wikitext
5212 Terminating separator: http://example.com/thing,
5213 !! html
5214 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5215 </p>
5216 !! end
5217
5218 !! test
5219 External links: intervening separator
5220 !! wikitext
5221 Intervening separator: http://example.com/1,2,3
5222 !! html
5223 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5224 </p>
5225 !! end
5226
5227 !! test
5228 External links: old bug with URL in query
5229 !! wikitext
5230 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5231 !! html
5232 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5233 </p>
5234 !! end
5235
5236 !! test
5237 External links: old URL-in-URL bug, mixed protocols
5238 !! wikitext
5239 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5240 !! html
5241 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5242 </p>
5243 !!end
5244
5245 # Since Parsoid is starting to emit canonical wikitext for links,
5246 # [http://example.com http://example.com] will not RT back to that
5247 # form anymore.
5248 !! test
5249 External links: URL in text
5250 !! options
5251 parsoid=wt2html
5252 !! wikitext
5253 URL in text: [http://example.com http://example.com]
5254 !! html/php
5255 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5256 </p>
5257 !! html/parsoid
5258 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5259 !! end
5260
5261 !! test
5262 External links: Clickable images
5263 !! wikitext
5264 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5265 !! html/php
5266 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
5267 </p>
5268 !! html/parsoid
5269 <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5270 !! end
5271
5272 !! test
5273 External links: raw ampersand
5274 !! wikitext
5275 Old &amp; use: http://x&y
5276 !! html
5277 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5278 </p>
5279 !! end
5280
5281 !! test
5282 External links: encoded ampersand
5283 !! wikitext
5284 Old &amp; use: http://x&amp;y
5285 !! html/php
5286 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5287 </p>
5288 !! html/parsoid
5289 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
5290 !! end
5291
5292 !! test
5293 External links: encoded equals (T8102)
5294 !! wikitext
5295 http://example.com/?foo&#61;bar
5296 !! html/php
5297 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5298 </p>
5299 !! html/parsoid
5300 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5301 !! end
5302
5303 ##
5304 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5305 ## does it number them. As discussed in T55505, we can identify
5306 ## autonumbered links via CSS.
5307 ##
5308
5309 !! test
5310 External links: [raw ampersand]
5311 !! wikitext
5312 Old &amp; use: [http://x&y]
5313 !! html/php
5314 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5315 </p>
5316 !! html/parsoid
5317 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5318 !! end
5319
5320 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5321 # mode will return the [raw ampersand] wikitext
5322 !! test
5323 External links: [encoded ampersand]
5324 !! options
5325 parsoid=wt2html,wt2wt,html2html
5326 !! wikitext
5327 Old &amp; use: [http://x&amp;y]
5328 !! html/php
5329 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5330 </p>
5331 !! html/parsoid
5332 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5333 !! end
5334
5335 !! test
5336 External links: [raw equals]
5337 !! wikitext
5338 [http://example.com/?foo=bar]
5339 !! html/php
5340 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5341 </p>
5342 !! html/parsoid
5343 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5344 !! end
5345
5346 # note that parsoid html is identical to [raw equals] case; so html2wt
5347 # mode will return the [raw equals] wikitext
5348 !! test
5349 External links: [encoded equals] (T8102)
5350 !! options
5351 parsoid=wt2html,wt2wt,html2html
5352 !! wikitext
5353 [http://example.com/?foo&#61;bar]
5354 !! html/php
5355 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5356 </p>
5357 !! html/parsoid
5358 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5359 !! end
5360
5361 # xxx parsoid strips the IDN character, so the round-trip tests will
5362 # obviously fail and are disabled. --cscott
5363 !! test
5364 External links: [IDN ignored character reference in hostname; strip it right off]
5365 !! options
5366 parsoid=wt2html,wt2wt,html2html
5367 !! wikitext
5368 [http://e&zwnj;xample.com/]
5369 !! html/php
5370 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5371 </p>
5372 !! html/parsoid
5373 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5374 !! end
5375
5376 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5377 # Where an external link could easily circumvent the sanitization of the text of
5378 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5379 # test demands a higher standard. That's a bit strange.
5380 #
5381 # Example:
5382 #
5383 # http://e‌xample.com -> [http://example.com|http://example.com]
5384 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5385 #
5386 # The first example is sanitized, but the second is not. Any security benefits
5387 # from this production are trivial to circumvent. Either remove this test and
5388 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5389 # the test accordingly.
5390 #
5391 # All our love,
5392 # The Parsoid team.
5393 # xxx parsoid strips the IDN character, so the round-trip tests will
5394 # obviously fail and are disabled. --cscott
5395 !! test
5396 External links: IDN ignored character reference in hostname; strip it right off
5397 !! options
5398 parsoid=wt2html,html2html
5399 !! wikitext
5400 http://e&zwnj;xample.com/
5401 !! html/php
5402 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5406 !! end
5407
5408 !! test
5409 External links: www.jpeg.org (T2554)
5410 !! wikitext
5411 http://www.jpeg.org
5412 !! html
5413 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5414 </p>
5415 !! end
5416
5417 # parsoid doesn't explicitly mark autonumbered links, see T55505
5418 !! test
5419 External links: URL within URL (T2002)
5420 !! wikitext
5421 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5422 !! html/php
5423 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5424 </p>
5425 !! html/parsoid
5426 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5427 !! end
5428
5429 !! test
5430 T2361: URL inside bracketed URL
5431 !! wikitext
5432 [http://www.example.com/foo http://www.example.com/bar]
5433 !! html
5434 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5435 </p>
5436 !! end
5437
5438 !! test
5439 T2361: URL within URL, not bracketed
5440 !! wikitext
5441 http://www.example.com/foo?=http://www.example.com/bar
5442 !! html
5443 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5444 </p>
5445 !! end
5446
5447 !! test
5448 T2289: ">"-token in URL-tail
5449 !! wikitext
5450 http://www.example.com/<hello>
5451 !! html
5452 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5453 </p>
5454 !!end
5455
5456 !! test
5457 T2289: literal ">"-token in URL-tail
5458 !! wikitext
5459 http://www.example.com/<b>html</b>
5460 !! html/php
5461 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5462 </p>
5463 !! html/parsoid
5464 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5465 !! end
5466
5467 !! test
5468 T2289: ">"-token in bracketed URL
5469 !! wikitext
5470 [http://www.example.com/<hello> stuff]
5471 !! html
5472 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5473 </p>
5474 !!end
5475
5476 !! test
5477 T2289: literal ">"-token in bracketed URL
5478 !! wikitext
5479 [http://www.example.com/<b>html</b> stuff]
5480 !! html
5481 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5482 </p>
5483 !!end
5484
5485 !! test
5486 T2289: literal double quote at end of URL
5487 !! wikitext
5488 http://www.example.com/"hello"
5489 !! html
5490 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5491 </p>
5492 !!end
5493
5494 !! test
5495 T2289: literal double quote in bracketed URL
5496 !! wikitext
5497 [http://www.example.com/"hello" stuff]
5498 !! html
5499 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5500 </p>
5501 !!end
5502
5503 !! test
5504 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5505 !! wikitext
5506 [http://www.example.com test]
5507 !! html
5508 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5509 </p>
5510 !! end
5511
5512 !! test
5513 External links: link text with spaces
5514 !! wikitext
5515 [http://www.example.com a b c]
5516 [http://www.example.com ''a'' ''b'']
5517 !! html
5518 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5519 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5520 </p>
5521 !! end
5522
5523 # Note edge case difference between PHP and Parsoid here.
5524 !! test
5525 External links: wiki links within external link (T5695)
5526 !! options
5527 parsoid=wt2html,html2html
5528 !! wikitext
5529 [http://example.com [[wikilink]] embedded in ext link]
5530
5531 [http://example.com test [[wikilink]] embedded in ext link]
5532 !! html/php
5533 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5534 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5535 </p>
5536 !! html/parsoid
5537 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5538 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5539 !! end
5540
5541 !! test
5542 T2787: Links with one slash after the url protocol are invalid
5543 !! wikitext
5544 http:/example.com
5545
5546 [http:/example.com title]
5547 !! html
5548 <p>http:/example.com
5549 </p><p>[http:/example.com title]
5550 </p>
5551 !! end
5552
5553 !! test
5554 Bracketed external links with template-generated invalid target
5555 !! wikitext
5556 [{{echo|http:/example.com}} title]
5557 !! html
5558 <p>[http:/example.com title]
5559 </p>
5560 !! end
5561
5562 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5563 !! test
5564 Broken wikilinks (but not external links) prevent templates from closing
5565 !! options
5566 parsoid=wt2html
5567 !! wikitext
5568 [http://example.com x
5569
5570 {{echo|[http://example.com x}}
5571
5572 [[Foo
5573
5574 {{echo|[[Foo}}
5575 !! html/php
5576 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5577 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5578 </p><p>[[Foo
5579 </p><p>{{echo|[[Foo}}
5580 </p>
5581 !! html/parsoid
5582 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5583 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5584 <p>[[Foo</p>
5585 <p>{{echo|[[Foo}}</p>
5586 !! end
5587
5588 !! test
5589 Wikilinks with embedded newlines are not broken
5590 !! wikitext
5591 {{echo|[[ Foo
5592 B
5593 C]]}}
5594 !! html/php
5595 <p>[[ Foo
5596 B
5597 C]]
5598 </p>
5599 !! html/parsoid
5600 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5601 !! end
5602
5603 !! test
5604 Broken templates
5605 !! options
5606 parsoid=wt2html
5607 !! wikitext
5608 {{echo|[[Foo|}}]]
5609
5610 [[Foo|{{echo|]]}}
5611 !! html/php
5612 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5613 </p><p>[[Foo|]]
5614 </p>
5615 !! html/parsoid
5616 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5617 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5618 !! end
5619
5620 !! test
5621 T4702: Mismatched <i>, <b> and <a> tags are invalid
5622 !! wikitext
5623 ''[http://example.com text'']
5624 [http://example.com '''text]'''
5625 ''Something [http://example.com in italic'']
5626 ''Something [http://example.com mixed''''', even bold]'''
5627 '''''Now [http://example.com both''''']
5628 !! html
5629 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5630 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5631 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5632 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5633 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5634 </p>
5635 !! end
5636
5637
5638 !! test
5639 T6781: %26 in URL
5640 !! wikitext
5641 http://www.example.com/?title=AT%26T
5642 !! html/php
5643 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5644 </p>
5645 !! html/parsoid
5646 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5647 !! end
5648
5649 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5650 # % is actually legal in HTML5. Any change in output would need testing though.
5651 !! test
5652 T6781, T7267: %25 in URL
5653 !! wikitext
5654 http://www.example.com/?title=100%25_Bran
5655 !! html/php
5656 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5657 </p>
5658 !! html/parsoid
5659 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5660 !! end
5661
5662 !! test
5663 T6781, T7267: %28, %29 in URL
5664 !! wikitext
5665 http://www.example.com/?title=Ben-Hur_%281959_film%29
5666 !! html/php
5667 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5668 </p>
5669 !! html/parsoid
5670 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5671 !! end
5672
5673
5674 !! test
5675 T6781: %26 in autonumber URL
5676 !! wikitext
5677 [http://www.example.com/?title=AT%26T]
5678 !! html/php
5679 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5683 !! end
5684
5685 !! test
5686 T6781, T7267: %26 in autonumber URL
5687 !! wikitext
5688 [http://www.example.com/?title=100%25_Bran]
5689 !! html/php
5690 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5691 </p>
5692 !! html/parsoid
5693 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5694 !! end
5695
5696 !! test
5697 T6781, T7267: %28, %29 in autonumber URL
5698 !! wikitext
5699 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5700 !! html/php
5701 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5702 </p>
5703 !! html/parsoid
5704 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5705 !! end
5706
5707
5708 !! test
5709 T6781: %26 in bracketed URL
5710 !! wikitext
5711 [http://www.example.com/?title=AT%26T link]
5712 !! html/php
5713 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5714 </p>
5715 !! html/parsoid
5716 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5717 !! end
5718
5719 !! test
5720 T6781, T7267: %25 in bracketed URL
5721 !! wikitext
5722 [http://www.example.com/?title=100%25_Bran link]
5723 !! html
5724 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5725 </p>
5726 !! end
5727
5728 !! test
5729 T6781, T7267: %28, %29 in bracketed URL
5730 !! wikitext
5731 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5732 !! html/php
5733 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5734 </p>
5735 !! html/parsoid
5736 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5737 !! end
5738
5739 !! test
5740 External link containing a period in the anchor. (T65947)
5741 !! wikitext
5742 [//foo.org/bar#baz. bang]
5743
5744 [//foo.org/bar. bang]
5745 !! html/php
5746 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5747 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5748 </p>
5749 !! html/parsoid
5750 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5751 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5752 !! end
5753
5754 !! test
5755 External link containing a single quote. (T65947)
5756 !! wikitext
5757 [//foo.org/bar'baz]
5758
5759 [//foo.org/bar'baz bang]
5760 !! html/php
5761 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5762 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5763 </p>
5764 !! html/parsoid
5765 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5766 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5767 !! end
5768
5769 !! test
5770 External link containing double-single-quotes in text '' (T6598 sanity check)
5771 !! wikitext
5772 Some [http://example.com/ pretty ''italics'' and stuff]!
5773 !! html
5774 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5775 </p>
5776 !! end
5777
5778 !! test
5779 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5780 !! wikitext
5781 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5782 !! html
5783 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5784 </p>
5785 !! end
5786
5787 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5788 !! test
5789 External link containing double-single-quotes with no space separating the url from text in italics
5790 !! wikitext
5791 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5792 !! html/php+tidy
5793 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
5794 </p>
5795 !! html/parsoid
5796 <p><a rel="mw:ExtLink" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5797 !! end
5798
5799 !! test
5800 External link with comments in link text
5801 !! wikitext
5802 [http://www.google.com Google <!-- comment -->]
5803 !! html/php
5804 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5805 </p>
5806 !! html/parsoid
5807 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5808 !! end
5809
5810 !! test
5811 External link to bare IPv4 address
5812 !! wikitext
5813 [http://192.168.0.1 Link]
5814 !! html/php
5815 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5816 </p>
5817 !! html/parsoid
5818 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5819 !! end
5820
5821 !! test
5822 URL-encoding in URL functions (single parameter)
5823 !! wikitext
5824 {{localurl:Some page|amp=&}}
5825 !! html
5826 <p>/index.php?title=Some_page&amp;amp=&amp;
5827 </p>
5828 !! end
5829
5830 !! test
5831 URL-encoding in URL functions (multiple parameters)
5832 !! wikitext
5833 {{localurl:Some page|q=?&amp=&}}
5834 !! html
5835 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5836 </p>
5837 !! end
5838
5839 !! test
5840 Brackets in urls
5841 !! wikitext
5842 http://example.com/index.php?foozoid%5B%5D=bar
5843
5844 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5845 !! html/php
5846 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5847 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5848 </p>
5849 !! html/parsoid
5850 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5851
5852 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5853 !! end
5854
5855 !! test
5856 IPv6 urls, autolink format (T23261)
5857 !! wikitext
5858 http://[2404:130:0:1000::187:2]/index.php
5859
5860 Examples from RFC 2373, section 2.2:
5861
5862 *http://[1080::8:800:200C:417A]/unicast
5863 *http://[FF01::101]/multicast
5864 *http://[::1]/loopback
5865 *http://[::]/unspecified
5866 *http://[::13.1.68.3]/ipv4compat
5867 *http://[::FFFF:129.144.52.38]/ipv4compat
5868
5869 Examples from RFC 2732, section 2:
5870
5871 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5872 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5873 *http://[3ffe:2a00:100:7031::1]
5874 *http://[1080::8:800:200C:417A]/foo
5875 *http://[::192.9.5.5]/ipng
5876 *http://[::FFFF:129.144.52.38]:80/index.html
5877 *http://[2010:836B:4179::836B:4179]
5878 !! html/php
5879 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5880 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5881 </p>
5882 <ul><li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5883 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5884 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5885 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5886 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5887 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5888 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5889 </p>
5890 <ul><li><a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5891 <li><a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5892 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5893 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5894 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5895 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5896 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5897
5898 !! html/parsoid
5899 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5900
5901 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5902 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5903 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5904 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5905 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5906 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5907 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5908
5909 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5910 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5911 <li><a rel="mw:ExtLink" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5912 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5913 <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5914 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5915 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5916 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5917 !! end
5918
5919 !! test
5920 IPv6 urls, bracketed format (T23261)
5921 !! wikitext
5922 [http://[2404:130:0:1000::187:2]/index.php test]
5923
5924 Examples from RFC 2373, section 2.2:
5925
5926 *[http://[1080::8:800:200C:417A] unicast]
5927 *[http://[FF01::101] multicast]
5928 *[http://[::1]/ loopback]
5929 *[http://[::] unspecified]
5930 *[http://[::13.1.68.3] ipv4compat]
5931 *[http://[::FFFF:129.144.52.38] ipv4compat]
5932
5933 Examples from RFC 2732, section 2:
5934
5935 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5936 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5937 *[http://[3ffe:2a00:100:7031::1] 3]
5938 *[http://[1080::8:800:200C:417A]/foo 4]
5939 *[http://[::192.9.5.5]/ipng 5]
5940 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5941 *[http://[2010:836B:4179::836B:4179] 7]
5942 !! html/php
5943 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5944 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5945 </p>
5946 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5947 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5948 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5949 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5950 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5951 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5952 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5953 </p>
5954 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5955 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5956 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5957 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5958 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5959 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5960 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5961
5962 !! html/parsoid
5963 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5964
5965 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5966 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5967 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5968 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5969 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5970 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5971 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5972
5973 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5974 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5975 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5976 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5977 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5978 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5979 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5980 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5981 !! end
5982
5983 !! test
5984 Non-extlinks in brackets
5985 !! wikitext
5986 [foo]
5987 [foo bar]
5988 [foo ''bar'']
5989 [fool's] errand
5990 [fool's errand]
5991 [{{echo|foo}}]
5992 [{{echo|foo}} bar]
5993 [{{echo|foo}} ''bar'']
5994 [{{echo|foo}}l's] errand
5995 [{{echo|foo}}l's errand]
5996 [url={{echo|foo}}]
5997 [url=http://example.com]
5998 [http:// bare protocols don't count]
5999 !! html/php
6000 <p>[foo]
6001 [foo bar]
6002 [foo <i>bar</i>]
6003 [fool's] errand
6004 [fool's errand]
6005 [foo]
6006 [foo bar]
6007 [foo <i>bar</i>]
6008 [fool's] errand
6009 [fool's errand]
6010 [url=foo]
6011 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
6012 [http:// bare protocols don't count]
6013 </p>
6014 !! html/parsoid
6015 <p>[foo]
6016 [foo bar]
6017 [foo <i>bar</i>]
6018 [fool's] errand
6019 [fool's errand]
6020 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6021 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
6022 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
6023 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
6024 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
6025 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6026 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6027 [http:// bare protocols don't count]</p>
6028 !! end
6029
6030 !! test
6031 Percent encoding in external links
6032 !! wikitext
6033 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6034 !! html/php
6035 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6036 </p>
6037 !! html/parsoid
6038 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6039 !! end
6040
6041 !! test
6042 Use url link syntax for links where the content is equal the link target
6043 !! wikitext
6044 http://example.com
6045 !! html/php
6046 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6047 </p>
6048 !! html/parsoid
6049 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6050 !! end
6051
6052 !! test
6053 Parenthesis in external links, especially URL links
6054 !! wikitext
6055 http://example.com)
6056
6057 http://example.com/test)
6058
6059 http://example.com/(test)
6060
6061 http://example.com/((test)
6062
6063 (http://example.com/(test))
6064
6065 (http://example.com/(test)))))
6066
6067 http://example.com/a)b
6068
6069 [http://example.com) foo]
6070 !! html/php
6071 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6072 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6073 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6074 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6075 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6076 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6077 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6078 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6079 </p>
6080 !! html/parsoid
6081 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6082 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6083 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6084 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6085 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6086 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6087 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6088 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6089 !! end
6090
6091 !! test
6092 Parenthesis in external links, w/ transclusion or comment
6093 !! wikitext
6094 (http://example.com/{{echo|hi}})
6095
6096 (http://example.com<!-- hi -->)
6097 !! html/php
6098 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6099 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6100 </p>
6101 !! html/parsoid
6102 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
6103
6104 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
6105 !! end
6106
6107 !! test
6108 Serialize <a> tags with invalid link targets as plain text
6109 !! options
6110 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6111 !! html/parsoid
6112 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6113 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6114 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6115 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6116 !! wikitext
6117 text
6118 <nowiki>*</nowiki>text
6119 <nowiki>[[foo]]</nowiki>
6120 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6121 !! end
6122
6123 !! test
6124 mw:ExtLink -vs- mw:WikiLink (T94723)
6125 !! options
6126 parsoid=html2wt
6127 !! html/parsoid
6128 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6129 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6130 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6131 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6132 <p>
6133 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6134 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6135 </p>
6136 !! wikitext
6137 [[Foo|Bar]]
6138 [[Foo|Bar]]
6139 [[:en:Foo|Bar]]
6140 [[:en:Foo|Bar]]
6141
6142 [[:en:European_Robin|European Robin]]
6143 [[:en:European_Robin|European Robin]]
6144 !! end
6145
6146 !! test
6147 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6148 !! options
6149 parsoid=wt2wt
6150 !! wikitext
6151 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6152 !! html/parsoid
6153 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6154 !! end
6155
6156
6157 ###
6158 ### Quotes
6159 ###
6160
6161 !! test
6162 Quotes
6163 !! wikitext
6164 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6165
6166 Normal text. '''''Bold italic text.''''' Normal text.
6167 !! html
6168 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6169 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6170 </p>
6171 !! end
6172
6173
6174 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6175 # parser strips. The wikitext contains just the first half of the bold
6176 # quote pair.
6177 !! test
6178 Unclosed and unmatched quotes
6179 !! wikitext
6180 '''''Bold italic text '''with bold deactivated''' in between.'''''
6181
6182 '''''Bold italic text ''with italic deactivated'' in between.'''''
6183
6184 '''Bold text..
6185
6186 ..spanning two paragraphs (should not work).'''
6187
6188 '''Bold tag left open
6189
6190 ''Italic tag left open
6191
6192 Normal text.
6193
6194 <!-- Unmatching number of opening, closing tags: -->
6195 '''This year''''s election ''should'' beat '''last year''''s.
6196
6197 ''Tom'''s car is bigger than ''Susan'''s.
6198
6199 Plain ''italic'''s plain
6200 !! html/php
6201 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6202 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6203 </p><p><b>Bold text..</b>
6204 </p><p>..spanning two paragraphs (should not work).
6205 </p><p><b>Bold tag left open</b>
6206 </p><p><i>Italic tag left open</i>
6207 </p><p>Normal text.
6208 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6209 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6210 </p><p>Plain <i>italic'</i>s plain
6211 </p>
6212 !! html/parsoid
6213 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6214 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6215 </p><p><b>Bold text..</b>
6216 </p><p>..spanning two paragraphs (should not work).<b></b>
6217 </p><p><b>Bold tag left open</b>
6218 </p><p><i>Italic tag left open</i>
6219 </p><p>Normal text.
6220 </p>
6221 <!-- Unmatching number of opening, closing tags: -->
6222 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6223 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6224 </p><p>Plain <i>italic'</i>s plain
6225 </p>
6226 !! end
6227
6228 ###
6229 ### Tables
6230 ###
6231 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6232 ###
6233
6234 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6235 # is the bare minimum required by the spec, see:
6236 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6237 # Parsoid team replies: empty table tags are legal in HTML5
6238 !! test
6239 A table with no data.
6240 !! options
6241 parsoid=wt2html
6242 !! wikitext
6243 {||}
6244 !! html/php
6245
6246 !! html/parsoid
6247 <table></table>
6248
6249 !! end
6250
6251 !! test
6252 A table with stray table end tags on start tag line (wt2html)
6253 !! options
6254 parsoid=wt2html
6255 !! wikitext
6256 {|style="color: red;"|}
6257
6258 {|style="color: red;" |}
6259 |foo
6260 |}
6261
6262 {|style="color: red;"|} id="foo"
6263 |foo
6264 |}
6265
6266 {|style="color: red;" |} id="foo"
6267 |foo
6268 |}
6269 !! html
6270 <table style="color: red;"></table>
6271
6272 <table style="color: red;">
6273 <tbody><tr>
6274 <td>foo</td>
6275 </tr></tbody>
6276 </table>
6277
6278 <table style="color: red;" id="foo">
6279 <tbody><tr>
6280 <td>foo</td>
6281 </tr></tbody>
6282 </table>
6283
6284 <table style="color: red;" id="foo">
6285 <tbody><tr>
6286 <td>foo</td>
6287 </tr></tbody>
6288 </table>
6289
6290 !! end
6291
6292 !! test
6293 A table with no data (take 2)
6294 !! wikitext
6295 {|
6296 |}
6297 !! html/parsoid
6298 <table></table>
6299 !! end
6300
6301 # A table with nothing but a caption is invalid XHTML, we might want to render
6302 # this as <p>caption</p>
6303 # Parsoid team replies: table with only a caption is legal in HTML5
6304 !! test
6305 A table with nothing but a caption
6306 !! wikitext
6307 {|
6308 |+caption
6309 |}
6310 !! html/php
6311 <table>
6312 <caption>caption
6313 </caption><tr><td></td></tr></table>
6314
6315 !! html/parsoid
6316 <table><caption>caption</caption></table>
6317 !! end
6318
6319 !! test
6320 A table with caption with default-spaced attributes and a table row
6321 !! wikitext
6322 {|
6323 |+ style="color: red;" |caption1
6324 |-
6325 |foo
6326 |}
6327 !! html
6328 <table>
6329 <caption style="color: red;">caption1
6330 </caption>
6331 <tr>
6332 <td>foo
6333 </td></tr></table>
6334
6335 !! end
6336
6337 !! test
6338 A table with captions with non-default spaced attributes and a table row
6339 !! wikitext
6340 {|
6341 |+style="color: red;"|caption2
6342 |+ style="color: red;"|caption3
6343 |-
6344 |foo
6345 |}
6346 !! html
6347 <table>
6348 <caption style="color: red;">caption2
6349 </caption>
6350 <caption style="color: red;">caption3
6351 </caption>
6352 <tr>
6353 <td>foo
6354 </td></tr></table>
6355
6356 !! end
6357
6358 !! test
6359 Table td-cell syntax variations
6360 !! wikitext
6361 {|
6362 |foo bar foo|baz
6363 |foo bar foo||baz
6364 |style='color:red;'|baz
6365 |style='color:red;'||baz
6366 |}
6367 !! html
6368 <table>
6369 <tr>
6370 <td>baz
6371 </td>
6372 <td>foo bar foo</td>
6373 <td>baz
6374 </td>
6375 <td style="color:red;">baz
6376 </td>
6377 <td>style='color:red;'</td>
6378 <td>baz
6379 </td></tr></table>
6380
6381 !! end
6382
6383 !! test
6384 Simple table
6385 !! wikitext
6386 {|
6387 |1||2
6388 |-
6389 |3||4
6390 |}
6391 !! html
6392 <table>
6393 <tr>
6394 <td>1</td>
6395 <td>2
6396 </td></tr>
6397 <tr>
6398 <td>3</td>
6399 <td>4
6400 </td></tr></table>
6401
6402 !! end
6403
6404 !! test
6405 Simple table but with multiple dashes for row wikitext
6406 !! wikitext
6407 {|
6408 |foo
6409 |-----
6410 |bar
6411 |}
6412 !! html
6413 <table>
6414 <tr>
6415 <td>foo
6416 </td></tr>
6417 <tr>
6418 <td>bar
6419 </td></tr></table>
6420
6421 !! end
6422
6423 !! test
6424 Multiplication table
6425 !! wikitext
6426 {| border="1" cellpadding="2"
6427 |+Multiplication table
6428 |-
6429 !&times;!!1!!2!!3
6430 |-
6431 !1
6432 |1||2||3
6433 |-
6434 !2
6435 |2||4||6
6436 |-
6437 !3
6438 |3||6||9
6439 |-
6440 !4
6441 |4||8||12
6442 |-
6443 !5
6444 |5||10||15
6445 |}
6446 !! html
6447 <table border="1" cellpadding="2">
6448 <caption>Multiplication table
6449 </caption>
6450 <tr>
6451 <th>&#215;</th>
6452 <th>1</th>
6453 <th>2</th>
6454 <th>3
6455 </th></tr>
6456 <tr>
6457 <th>1
6458 </th>
6459 <td>1</td>
6460 <td>2</td>
6461 <td>3
6462 </td></tr>
6463 <tr>
6464 <th>2
6465 </th>
6466 <td>2</td>
6467 <td>4</td>
6468 <td>6
6469 </td></tr>
6470 <tr>
6471 <th>3
6472 </th>
6473 <td>3</td>
6474 <td>6</td>
6475 <td>9
6476 </td></tr>
6477 <tr>
6478 <th>4
6479 </th>
6480 <td>4</td>
6481 <td>8</td>
6482 <td>12
6483 </td></tr>
6484 <tr>
6485 <th>5
6486 </th>
6487 <td>5</td>
6488 <td>10</td>
6489 <td>15
6490 </td></tr></table>
6491
6492 !! end
6493
6494 !! test
6495 Accept "||" in table headings
6496 !! wikitext
6497 {|
6498 !h1||h2
6499 |}
6500 !! html
6501 <table>
6502 <tr>
6503 <th>h1</th>
6504 <th>h2
6505 </th></tr></table>
6506
6507 !! end
6508
6509 !! test
6510 Accept "!!" in table data
6511 !! wikitext
6512 {|
6513 |Foo!!||
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>Foo!!</td>
6519 <td>
6520 </td></tr></table>
6521
6522 !! html/parsoid
6523 <table>
6524 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6525 </tbody></table>
6526 !! end
6527
6528 !! test
6529 Accept "||" in indented table headings
6530 !! wikitext
6531 :{|
6532 !h1||h2
6533 |}
6534 !! html
6535 <dl><dd><table>
6536 <tr>
6537 <th>h1</th>
6538 <th>h2
6539 </th></tr></table></dd></dl>
6540
6541 !! end
6542
6543 !! test
6544 Accept "!!" in templates
6545 !! wikitext
6546 {|
6547 !a {{echo|b!!c}}
6548 |}
6549 !! html/php
6550 <table>
6551 <tr>
6552 <th>a b</th>
6553 <th>c
6554 </th></tr></table>
6555
6556 !! html/parsoid
6557 <table>
6558 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6559 !! end
6560
6561 !! test
6562 Accept "!!" in table headings after newline
6563 !! wikitext
6564 {|
6565 !a
6566 b!!c
6567 |}
6568 !! html/php
6569 <table>
6570 <tr>
6571 <th>a
6572 <p>b!!c
6573 </p>
6574 </th></tr></table>
6575
6576 !! html/parsoid
6577 <table>
6578 <tbody><tr><th>a
6579 <p>b!!c</p></th></tr>
6580 </tbody></table>
6581 !! end
6582
6583 !! test
6584 Accept "!!" in table data of mixed wikitext / html syntax
6585 !! wikitext
6586 {|
6587 !a
6588 <tr><td>b!!c</td></tr>
6589 |}
6590 !! html/php+tidy
6591 <table>
6592 <tbody><tr>
6593 <th>a
6594 </th></tr><tr><td>b!!c</td></tr>
6595 </tbody></table>
6596 !! html/parsoid
6597 <table>
6598 <tbody><tr><th>a</th></tr>
6599 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6600 </tbody></table>
6601 !! end
6602
6603 !! test
6604 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6605 !! wikitext
6606 {|
6607 !|h1
6608 ||a
6609 |}
6610 !! html
6611 <table>
6612 <tr>
6613 <th>h1
6614 </th>
6615 <td>a
6616 </td></tr></table>
6617
6618 !! end
6619
6620 !!test
6621 Accept "| !" at start of line in tables (ignore !-attribute)
6622 !! wikitext
6623 {|
6624 |-
6625 |!style="color:red"|bar
6626 |}
6627 !! html
6628 <table>
6629
6630 <tr>
6631 <td>bar
6632 </td></tr></table>
6633
6634 !!end
6635
6636 !!test
6637 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6638 !! wikitext
6639 {|
6640 |-
6641 |style='color:red;'|+1
6642 |style='color:blue;'|-1
6643 |-
6644 |1||2||3
6645 |1||+2||-3
6646 |-
6647 | +1
6648 | -1
6649 |}
6650 !! html
6651 <table>
6652
6653 <tr>
6654 <td style="color:red;">+1
6655 </td>
6656 <td style="color:blue;">-1
6657 </td></tr>
6658 <tr>
6659 <td>1</td>
6660 <td>2</td>
6661 <td>3
6662 </td>
6663 <td>1</td>
6664 <td>+2</td>
6665 <td>-3
6666 </td></tr>
6667 <tr>
6668 <td>+1
6669 </td>
6670 <td>-1
6671 </td></tr></table>
6672
6673 !!end
6674
6675 !! test
6676 Table rowspan
6677 !! wikitext
6678 {| border=1
6679 |Cell 1, row 1
6680 |rowspan=2|Cell 2, row 1 (and 2)
6681 |Cell 3, row 1
6682 |-
6683 |Cell 1, row 2
6684 |Cell 3, row 2
6685 |}
6686 !! html
6687 <table border="1">
6688 <tr>
6689 <td>Cell 1, row 1
6690 </td>
6691 <td rowspan="2">Cell 2, row 1 (and 2)
6692 </td>
6693 <td>Cell 3, row 1
6694 </td></tr>
6695 <tr>
6696 <td>Cell 1, row 2
6697 </td>
6698 <td>Cell 3, row 2
6699 </td></tr></table>
6700
6701 !! end
6702
6703 !! test
6704 Nested table
6705 !! wikitext
6706 {| border=1
6707 | &alpha;
6708 |
6709 {| bgcolor=#ABCDEF border=2
6710 |nested
6711 |-
6712 |table
6713 |}
6714 |the original table again
6715 |}
6716 !! html
6717 <table border="1">
6718 <tr>
6719 <td>&#945;
6720 </td>
6721 <td>
6722 <table bgcolor="#ABCDEF" border="2">
6723 <tr>
6724 <td>nested
6725 </td></tr>
6726 <tr>
6727 <td>table
6728 </td></tr></table>
6729 </td>
6730 <td>the original table again
6731 </td></tr></table>
6732
6733 !! end
6734
6735 !! test
6736 Invalid attributes in table cell (T3830)
6737 !! wikitext
6738 {|
6739 |Cell:|broken
6740 |}
6741 !! html
6742 <table>
6743 <tr>
6744 <td>broken
6745 </td></tr></table>
6746
6747 !! end
6748
6749 !! test
6750 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6751 !! wikitext
6752 {|
6753 |title="foo" |bar
6754 |title="foo<nowiki>|</nowiki>" |bar
6755 |title="foo<nowiki>|</nowiki>" bar
6756 |}
6757 !! html/php
6758 <table>
6759 <tr>
6760 <td title="foo">bar
6761 </td>
6762 <td title="foo&#124;">bar
6763 </td>
6764 <td>title="foo|" bar
6765 </td></tr></table>
6766
6767 !! html/parsoid
6768 <table>
6769 <tbody><tr><td title="foo">bar</td>
6770 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6771 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6772 </tbody></table>
6773 !! end
6774
6775 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6776 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6777 # *2wt modes will fail.
6778 !! test
6779 Table security: embedded pipes
6780 !! options
6781 parsoid=wt2html,html2html
6782 !! wikitext
6783 {|
6784 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6785 !! html/php
6786 <table>
6787 <tr>
6788 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6789 <td>]" onmouseover="alert(document.cookie)"&gt;test
6790 </td>
6791 </tr>
6792 </table>
6793
6794 !! html/parsoid
6795 <table><tbody>
6796 <tr>
6797 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6798 !! end
6799
6800 !! test
6801 Element attributes with double ! should not be broken up by <th>
6802 !! wikitext
6803 {|
6804 !hi <div class="!!">ha</div> ho
6805 |}
6806 !! html/php
6807 <table>
6808 <tr>
6809 <th>hi <div class="!!">ha</div> ho
6810 </th></tr></table>
6811
6812 !! html/parsoid
6813 <table>
6814 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6815 </tbody></table>
6816 !! end
6817
6818 !! test
6819 ! and || in element attributes should not be parsed as <th>/<td>
6820 !! wikitext
6821 {|
6822 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6823 |}
6824 !! html/php
6825 <table>
6826 <tr>
6827 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6828 </td></tr></table>
6829
6830 !! html/parsoid
6831 <table>
6832 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6833 </tbody></table>
6834 !! end
6835
6836 # FIXME: The output seems broken. Filed as T110268.
6837 !! test
6838 ! and || in td attributes should not be parsed as <th>/<td>
6839 !! options
6840 parsoid=wt2html
6841 !! wikitext
6842 {|
6843 |style="color: red !important;" data-contrived="put this here ||"|foo
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <td>style="color: red !important;" data-contrived="put this here</td>
6849 <td>foo
6850 </td></tr></table>
6851
6852 !! html/parsoid
6853 <table>
6854 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6855 </tbody></table>
6856 !! end
6857
6858 !! test
6859 Break on | in element attribute in template
6860 !! options
6861 parsoid=wt2html,html2html
6862 !! wikitext
6863 {{echo|1=<div class="hi|ho">ha</div>}}
6864 !! html/php
6865 <p>ho"&gt;ha&lt;/div&gt;
6866 </p>
6867 !! html/parsoid
6868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</p>
6869 !! end
6870
6871 !! test
6872 Break on | in element attribute name in template
6873 !! wikitext
6874 {{echo|<div cla|ss="hiho">ha</div>}}
6875 !! html/parsoid
6876 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6877 !! end
6878
6879 !! test
6880 Don't break on | in extension attribute in template
6881 !! wikitext
6882 {{echo|<ref name="hi|ho">ha</ref>}}
6883
6884 <references />
6885 !! html/parsoid
6886 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6887
6888 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Main_Page#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6889 !! end
6890
6891 ## We don't support roundtripping of these attributes in Parsoid.
6892 ## Selective serialization takes care of preventing dirty diffs.
6893 ## But, on edits, we dirty-diff the invalid attribute text.
6894 !! test
6895 Invalid text in table attributes should be discarded
6896 !! options
6897 parsoid=wt2html
6898 !! wikitext
6899 {| <span>boo</span> style='border:1px solid black'
6900 | <span>boo</span> style='color:blue' |1
6901 |<span>boo</span> style='color:blue'|2
6902 |}
6903 !! html/php
6904 <table style="border:1px solid black">
6905 <tr>
6906 <td style="color:blue">1
6907 </td>
6908 <td style="color:blue">2
6909 </td></tr></table>
6910
6911 !! html/parsoid
6912 <table style="border:1px solid black">
6913 <tr>
6914 <td style="color:blue">1</td>
6915 <td style="color:blue">2</td>
6916 </tr>
6917 </table>
6918 !! end
6919
6920 !! test
6921 Invalid text in table attributes should be preserved by selective serializer
6922 !! options
6923 parsoid={
6924 "modes": ["selser"],
6925 "changes": [
6926 ["td:first-child", "text", "abc"],
6927 ["td + td", "text", "xyz"]
6928 ]
6929 }
6930 !! wikitext
6931 {| <span>boo</span> style='border:1px solid black'
6932 | <span>boo</span> style='color:blue' | 1
6933 |<span>boo</span> style='color:blue'| 2
6934 |}
6935 !! wikitext/edited
6936 {| <span>boo</span> style='border:1px solid black'
6937 | <span>boo</span> style='color:blue' | abc
6938 |<span>boo</span> style='color:blue'| xyz
6939 |}
6940 !! end
6941
6942 !! test
6943 1. Template-generated table cell attributes and cell content
6944 !! wikitext
6945 {|
6946 |{{table_attribs}}
6947 | {{table_attribs}}
6948 || {{table_attribs_5}}
6949 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6950 |align=center {{table_attribs}}
6951 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6952 |}
6953 !! html
6954 <table>
6955 <tr>
6956 <td style="color:red;">Foo
6957 </td>
6958 <td style="color:red;">Foo
6959 </td>
6960 <td>style="color:red;"</td>
6961 <td>Bar
6962 </td>
6963 <td style="color:red;">Foo
6964 </td>
6965 <td align="center" style="color:red;">Foo
6966 </td>
6967 <td align="center" style="color:red;">Foo
6968 </td></tr></table>
6969
6970 !! end
6971
6972 !! test
6973 2. Template-generated table cell attributes and cell content
6974 !! wikitext
6975 {|
6976 |{{table_attribs_2}}
6977 |}
6978 !! html/php
6979 <table>
6980 <tr>
6981 <td style="color:red;">Foo
6982 </td>
6983 <td>Bar</td>
6984 <td>Baz
6985 </td></tr></table>
6986
6987 !! html/parsoid
6988 <table>
6989 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6990 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6991 </tbody></table>
6992 !! end
6993
6994 !! test
6995 3. Template-generated table cell attributes and cell content
6996 !! wikitext
6997 {|
6998 !align=center {{table_header_cells}}
6999 |-
7000 |align=center {{table_cells}}
7001 |}
7002 !! html/php
7003 <table>
7004 <tr>
7005 <th align="center" style="color:red;">Foo</th>
7006 <th style="color:red;"><i>Bar</i></th>
7007 <th style="color:brown;"><i>Foo</i> and Baz
7008 </th></tr>
7009 <tr>
7010 <td align="center" style="color:red;">Foo</td>
7011 <td style="color:red;"><i>Bar</i></td>
7012 <td style="color:brown;"><i>Foo</i> and Baz
7013 </td></tr></table>
7014
7015 !! html/parsoid
7016 <table>
7017 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
7018 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
7019 </tbody></table>
7020 !! end
7021
7022 !! test
7023 4. Template-generated table cell attributes and cell content inside a templated table
7024 !! wikitext
7025 {{tbl-start}}
7026 !align=center {{table_header_cells}}
7027 |-
7028 |align=center {{table_cells}}
7029 {{tbl-end}}
7030 !! html/php
7031 <table>
7032 <tr>
7033 <th align="center" style="color:red;">Foo</th>
7034 <th style="color:red;"><i>Bar</i></th>
7035 <th style="color:brown;"><i>Foo</i> and Baz
7036 </th></tr>
7037 <tr>
7038 <td align="center" style="color:red;">Foo</td>
7039 <td style="color:red;"><i>Bar</i></td>
7040 <td style="color:brown;"><i>Foo</i> and Baz
7041 </td></tr></table>
7042
7043 !! html/parsoid
7044 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
7045 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
7046 <tr>
7047 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
7048 </tbody></table>
7049 !! end
7050
7051 ## Edge case fix to prevent future regressions
7052 !! test
7053 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7054 !! wikitext
7055 {|
7056 |{{table_attribs_7}}
7057 |}
7058 <references />
7059 !! html/parsoid
7060 <table>
7061 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7062 </tbody></table>
7063 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
7064 !! end
7065
7066 !! test
7067 Table with row followed by newlines and table heading
7068 !! options
7069 parsoid=wt2html,html2html
7070 !! wikitext
7071 {|
7072 |-
7073
7074 !foo
7075 |}
7076 !! html/*
7077 <table>
7078
7079
7080 <tr>
7081 <th>foo
7082 </th></tr></table>
7083
7084 !! end
7085
7086 !! test
7087 Table with empty line following the start tag
7088 !! options
7089 parsoid=wt2html,html2html
7090 !! wikitext
7091 {|
7092
7093 |-
7094 |foo
7095 |}
7096 !! html/*
7097 <table>
7098
7099
7100 <tr>
7101 <td>foo
7102 </td></tr></table>
7103
7104 !! end
7105
7106 !! test
7107 Table attributes with empty value
7108 !! options
7109 parsoid=wt2html,html2html
7110 !! wikitext
7111 {|
7112 | style=|hello
7113 |}
7114 !! html/php
7115 <table>
7116 <tr>
7117 <td style="">hello
7118 </td></tr></table>
7119
7120 !! html/parsoid
7121 <table>
7122 <tbody><tr><td style="">hello</td></tr>
7123 </tbody></table>
7124 !! end
7125
7126 !! test
7127 Wikitext table with a lot of comments
7128 !! wikitext
7129 {|
7130 <!-- c0 -->
7131 |foo
7132 <!-- c1 -->
7133 |-<!-- c2 -->
7134 <!-- c3 -->
7135 |<!-- c4 -->
7136 <!-- c5 -->
7137 |}
7138 !! html
7139 <table>
7140 <tr>
7141 <td>foo
7142 </td></tr>
7143 <tr>
7144 <td>
7145 </td></tr></table>
7146
7147 !! end
7148
7149 !! test
7150 Wikitext table comments represented in parsoid dom
7151 !! wikitext
7152 {|<!--c1--><!--c2-->
7153 |-<!--c3-->
7154 |x
7155 |}
7156 !! html/php+tidy
7157 <table>
7158
7159 <tbody><tr>
7160 <td>x
7161 </td></tr></tbody></table>
7162 !! html/parsoid
7163 <table><!--c1--><!--c2-->
7164 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7165 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7166 </tbody></table>
7167 !! end
7168
7169 !! test
7170 Wikitext table with double-line table cell
7171 !! wikitext
7172 {|
7173 |a
7174 b
7175 |}
7176 !! html
7177 <table>
7178 <tr>
7179 <td>a
7180 <p>b
7181 </p>
7182 </td></tr></table>
7183
7184 !! end
7185
7186 !! test
7187 Table cell with a single comment
7188 !! wikitext
7189 {|
7190 |<!-- c1 -->
7191 |a
7192 |}
7193 !! html
7194 <table>
7195 <tr>
7196 <td>
7197 </td>
7198 <td>a
7199 </td></tr></table>
7200
7201 !! end
7202
7203 !! test
7204 Table-cell after a comment-only-empty-line
7205 !! wikitext
7206 {|
7207 |a
7208 <!--c1-->
7209 <!--c2-->|b
7210 |}
7211 !! html
7212 <table>
7213 <tr>
7214 <td>a
7215 </td>
7216 <td>b
7217 </td></tr></table>
7218
7219 !! html/parsoid
7220 <table>
7221 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7222 <!--c1-->
7223 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7224 </tbody></table>
7225
7226 !! end
7227
7228 !! test
7229 Build table with {{!}}
7230 !! wikitext
7231 {{{!}} class="wikitable"
7232 !header
7233 !second header
7234 {{!}}- style="color:red;"
7235 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7236 {{!}}}
7237 !! html
7238 <table class="wikitable">
7239 <tr>
7240 <th>header
7241 </th>
7242 <th>second header
7243 </th></tr>
7244 <tr style="color:red;">
7245 <td>data</td>
7246 <td style="color:red;">second data
7247 </td></tr></table>
7248
7249 !! end
7250
7251 !! test
7252 Build table with pipe as data
7253 !! wikitext
7254 {| class="wikitable"
7255 !header
7256 !second header
7257 |- style="color:red;"
7258 |data|| style="color:red;" |second data
7259 |-
7260 | style="color:red;" |data with | || style="color:red;" | second data with |
7261 |-
7262 ||data with | |||second data with |
7263 |}
7264 !! html
7265 <table class="wikitable">
7266 <tr>
7267 <th>header
7268 </th>
7269 <th>second header
7270 </th></tr>
7271 <tr style="color:red;">
7272 <td>data</td>
7273 <td style="color:red;">second data
7274 </td></tr>
7275 <tr>
7276 <td style="color:red;">data with |</td>
7277 <td style="color:red;">second data with |
7278 </td></tr>
7279 <tr>
7280 <td>data with |</td>
7281 <td>second data with |
7282 </td></tr></table>
7283
7284 !! end
7285
7286 !! test
7287 Build table with wikilink
7288 !! wikitext
7289 {| class="wikitable"
7290 !header||second header
7291 |- style="color:red;"
7292 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7293 |-
7294 |data||second data [[Main Page|link|text with pipe]]
7295 |}
7296 !! html
7297 <table class="wikitable">
7298 <tr>
7299 <th>header</th>
7300 <th>second header
7301 </th></tr>
7302 <tr style="color:red;">
7303 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7304 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7305 </td></tr>
7306 <tr>
7307 <td>data</td>
7308 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7309 </td></tr></table>
7310
7311 !! end
7312
7313 # The expected HTML structure in this test is debatable. The PHP parser does
7314 # not parse this kind of table at all. The main focus for Parsoid is on
7315 # round-tripping, so this output is ok for now. TODO: revisit!
7316 !! test
7317 Wikitext table with html-syntax row
7318 !! wikitext
7319 {|
7320 |-
7321 <td>foo</td>
7322 |}
7323 !! html/parsoid
7324 <table>
7325 <tbody>
7326 <tr>
7327 <td>foo</td></tr></tbody></table>
7328 !! end
7329
7330 ## Remex doesn't account for fostered content.
7331 !! test
7332 Fostered content in tables: Plain text
7333 !! options
7334 parsoid=wt2html
7335 !! wikitext
7336 {|
7337 |-
7338 a
7339 |}
7340 !! html/php
7341 <table>
7342
7343 a
7344 </table>
7345
7346 !! html/php+tidy
7347
7348
7349 a
7350 <table></table>
7351 !! html/parsoid
7352 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7353 a</p>
7354 <table>
7355 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7356 !! end
7357
7358 !! test
7359 Fostered content in tables: Lists
7360 !! options
7361 parsoid=wt2html,html2html
7362 !! wikitext
7363 {|
7364 |-
7365 *a
7366 |}
7367 !! html/php
7368 <table>
7369
7370 <ul><li>a</li></ul>
7371 </table>
7372
7373 !! html/php+tidy
7374 <ul><li>a</li></ul><table>
7375
7376
7377 </table>
7378 !! html/parsoid
7379 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7380 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7381
7382 </tr></tbody></table>
7383 !! end
7384
7385 !! test
7386 Template generated table cell with attributes
7387 !! wikitext
7388 {|
7389 |-
7390 {{table_attribs_4}} ||a||b
7391 |}
7392 !! html/php+tidy
7393 <table>
7394
7395 <tbody><tr>
7396 <td style="background-color:#DC241f;" width="10px"></td>
7397 <td>a</td>
7398 <td>b
7399 </td></tr></tbody></table>
7400 !! html/parsoid
7401 <table>
7402 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7403 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
7404 !! end
7405
7406 !! test
7407 Parsoid: Round-trip tables directly followed by content (T53219)
7408 !! options
7409 parsoid=wt2html,wt2wt
7410 !! wikitext
7411 {|
7412 |foo
7413 |} bar
7414
7415 {|
7416 |baz
7417 |}<b>quux</b>
7418 !! html+tidy
7419 <table>
7420 <tbody><tr>
7421 <td>foo
7422 </td></tr></tbody></table><p> bar
7423 </p><table>
7424 <tbody><tr>
7425 <td>baz
7426 </td></tr></tbody></table><p><b>quux</b>
7427 </p>
7428 !! end
7429
7430 !! test
7431 Parsoid: Default to a newline after tables in new content (T53219)
7432 !! options
7433 parsoid=html2wt
7434 !! html/parsoid
7435 <table><tbody>
7436 <tr><td>foo</td></tr></tbody></table> bar
7437 <table><tbody>
7438 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7439 !! wikitext
7440 {|
7441 |foo
7442 |}
7443 <nowiki> </nowiki>bar
7444 {|
7445 |baz
7446 |}
7447 '''quux'''
7448 !! end
7449
7450 !! test
7451 Parsoid: Row-syntax table headings followed by comment & table cells
7452 !! options
7453 parsoid=wt2html,wt2wt
7454 !! wikitext
7455 {|
7456 !foo||bar
7457 <!-- foo --> ||baz||quux
7458 |}
7459 !! html/php
7460 <table>
7461 <tr>
7462 <th>foo</th>
7463 <th>bar
7464 </th>
7465 <td>baz</td>
7466 <td>quux
7467 </td></tr></table>
7468
7469 !! html/parsoid
7470 <table>
7471 <tbody><tr><th>foo</th><th>bar
7472 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7473 </tbody></table>
7474 !! end
7475
7476 !!test
7477 Parsoid: Recover better from broken table attributes
7478 !!options
7479 parsoid=wt2html
7480 !!wikitext
7481 {| class="foo
7482 | class="bar" |
7483 foo
7484 |}
7485 !!html/php+tidy
7486 <table class="foo">
7487 <tbody><tr>
7488 <td class="bar">
7489 <p>foo
7490 </p>
7491 </td></tr></tbody></table>
7492 !!html/parsoid
7493 <table class="foo">
7494 <tr>
7495 <td class="bar">
7496 <p>foo</p></td></tr>
7497 </tbody></table>
7498 !!end
7499
7500 !! test
7501 Tables: Digest broken attributes on table and tr tag
7502 !! options
7503 parsoid=wt2html
7504 !! wikitext
7505 {| || |} ++
7506 |- || || ++ --
7507 |- > [
7508 |}
7509 !! html
7510 <table>
7511 <tbody>
7512 <tr class='mw-empty-elt'></tr>
7513 <tr class='mw-empty-elt'></tr>
7514 </tbody></table>
7515 !! end
7516
7517 !! test
7518 Table with missing opening <tr> tag
7519 !! options
7520 parsoid=wt2html,wt2wt
7521 !! wikitext
7522 <table>
7523 <td>foo</td>
7524 </tr>
7525 </table>
7526 !! html+tidy
7527 <table>
7528 <tbody><tr><td>foo</td>
7529 </tr>
7530 </tbody></table>
7531 !! end
7532
7533 # T137406: Whitespace in the HTML
7534 !! test
7535 1. Generate correct wikitext for tables with thead/tbody/tfoot
7536 !! options
7537 parsoid=html2wt
7538 !! html/parsoid
7539 <table>
7540 <caption>Test</caption>
7541 <thead>
7542 <tr>
7543 <th>Month</th>
7544 <th>Savings</th>
7545 </tr>
7546 </thead>
7547 <tbody>
7548 <tr>
7549 <td>January</td>
7550 <td>$100</td>
7551 </tr>
7552 <tr>
7553 <td>February</td>
7554 <td>$80</td>
7555 </tr>
7556 </tbody>
7557 <tfoot>
7558 <tr>
7559 <td>Sum</td>
7560 <td>$180</td>
7561 </tr>
7562 </tfoot>
7563 </table>
7564 !! wikitext
7565 {|
7566 |+Test
7567 !Month
7568 !Savings
7569 |-
7570 |January
7571 |$100
7572 |-
7573 |February
7574 |$80
7575 |-
7576 |Sum
7577 |$180
7578 |}
7579 !! html/php+tidy
7580 <table>
7581 <caption>Test
7582 </caption>
7583 <tbody><tr>
7584 <th>Month
7585 </th>
7586 <th>Savings
7587 </th></tr>
7588 <tr>
7589 <td>January
7590 </td>
7591 <td>$100
7592 </td></tr>
7593 <tr>
7594 <td>February
7595 </td>
7596 <td>$80
7597 </td></tr>
7598 <tr>
7599 <td>Sum
7600 </td>
7601 <td>$180
7602 </td></tr></tbody></table>
7603 !! end
7604
7605 # T137406: No whitespace in the HTML
7606 !! test
7607 2. Generate correct wikitext for tables with thead/tbody/tfoot
7608 !! options
7609 parsoid=html2wt
7610 !! html/parsoid
7611 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7612 !! wikitext
7613 {|
7614 !heading
7615 |-
7616 |foo
7617 |}
7618 !! end
7619
7620 !! test
7621 Wikitext tables can be nested inside HTML tables
7622 !! options
7623 parsoid=html2wt
7624 !! html
7625 <table data-parsoid='{"stx":"html"}'>
7626 <tr><td>
7627 <table>
7628 <tr><td>foo</td></tr>
7629 </table>
7630 </td></tr>
7631 </table>
7632 !! wikitext
7633 <table>
7634 <tr><td>
7635 {|
7636 |foo
7637 |}
7638 </td></tr>
7639 </table>
7640 !! end
7641
7642 ###
7643 ### Internal links
7644 ###
7645 !! test
7646 Plain link, capitalized
7647 !! wikitext
7648 [[Main Page]]
7649 !! html
7650 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7651 </p>
7652 !! end
7653
7654 !! test
7655 Plain link, uncapitalized
7656 !! wikitext
7657 [[main Page]]
7658 !! html
7659 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7660 </p>
7661 !! end
7662
7663 !! test
7664 Piped link
7665 !! wikitext
7666 [[Main Page|The Main Page]]
7667 !! html
7668 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7669 </p>
7670 !! end
7671
7672 !! test
7673 Piped link with comment in link text
7674 !! wikitext
7675 [[Main Page|The Main<!--front--> Page]]
7676 !! html
7677 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7678 </p>
7679 !! end
7680
7681 !! test
7682 Piped link with multiple pipe characters in link text
7683 !! wikitext
7684 [[Main Page||The|Main|Page|]]
7685 !! html/php
7686 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7687 </p>
7688 !! html/parsoid
7689 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7690 !! end
7691
7692 !! test
7693 Piped link with no link text
7694 !! wikitext
7695 [[Thomas Bek (bishop of St David's)|]]
7696 !! html/php
7697 <p>[[Thomas Bek (bishop of St David's)|]]
7698 </p>
7699 !! html/parsoid
7700 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7701 !! end
7702
7703 !! test
7704 Piped link with empty link text
7705 !! wikitext
7706 [[Main Page|<nowiki/>]] - empty nowiki
7707 [[Main Page| ]] - empty space
7708 [[Main Page|&nbsp;]] - empty non breaking space
7709 !! html/php
7710 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7711 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7712 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7713 </p>
7714 !! html/parsoid
7715 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7716 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7717 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7718 !! end
7719
7720 !! test
7721 Broken link
7722 !! wikitext
7723 [[Zigzagzogzagzig]]
7724 !! html
7725 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Broken link with fragment
7731 !! wikitext
7732 [[Zigzagzogzagzig#zug]]
7733 !! html
7734 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7735 </p>
7736 !! end
7737
7738 !! test
7739 Special page link with fragment
7740 !! wikitext
7741 [[Special:Version#anchor]]
7742 !! html
7743 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7744 </p>
7745 !! end
7746
7747 !! test
7748 Nonexistent special page link with fragment
7749 !! wikitext
7750 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7751 !! html
7752 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7753 </p>
7754 !! end
7755
7756 !! test
7757 Link with prefix
7758 !! wikitext
7759 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7760 !! html
7761 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7762 </p>
7763 !! end
7764
7765 !! test
7766 Link with suffix
7767 !! wikitext
7768 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7769 !! html
7770 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7771 </p>
7772 !! end
7773
7774 !! article
7775 prefixed article
7776 !! text
7777 Some text
7778 !! endarticle
7779
7780 !! test
7781 T45661: Piped links with identical prefixes
7782 !! wikitext
7783 [[prefixed article|prefixed articles with spaces]]
7784
7785 [[prefixed article|prefixed articlesaoeu]]
7786
7787 [[Main Page|Main Page test]]
7788 !! html
7789 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7790 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7791 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7792 </p>
7793 !! end
7794
7795
7796 !! test
7797 Link with HTML entity in suffix / tail
7798 !! wikitext
7799 [[Main Page]]&quot;, [[Main Page]]&#97;
7800 !! html/php
7801 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7802 </p>
7803 !! html/parsoid
7804 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7805 !! end
7806
7807 !! test
7808 Link with 3 brackets
7809 !! wikitext
7810 [[[Main Page]]]
7811 Foo [[[Main Page]]]
7812 !! html
7813 <p>[[[Main Page]]]
7814 Foo [[[Main Page]]]
7815 </p>
7816 !! end
7817
7818 !! test
7819 Link with 4 brackets
7820 !! wikitext
7821 [[[[Main Page]]]]
7822 !! html
7823 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7824 </p>
7825 !! end
7826
7827 !! test
7828 Piped link with 3 brackets
7829 !! wikitext
7830 [[[main page|the main page]]]
7831 !! html
7832 <p>[[[main page|the main page]]]
7833 </p>
7834 !! end
7835
7836 !! test
7837 Piped link with extlink-like text
7838 !! wikitext
7839 [[Main Page|[bar]]]
7840 [[Main Page|This is a [bar]]]
7841 [[Main Page|[bar]]
7842 !! html/php
7843 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7844 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7845 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7846 </p>
7847 !! html/parsoid
7848 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7849 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7850 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7851 !! end
7852
7853 !! test
7854 Link with multiple pipes
7855 !! wikitext
7856 [[Main Page|The|Main|Page]]
7857 !! html
7858 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7859 </p>
7860 !! end
7861
7862 !! test
7863 Anchor containing a #. (T65430)
7864 !! config
7865 wgFragmentMode=[ 'html5', 'legacy' ]
7866 !! wikitext
7867 [[Main Page#And#Link]]
7868 !! html/php
7869 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7870 </p>
7871 !! html/parsoid
7872 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7873 !! end
7874
7875 !! test
7876 Link to namespaces
7877 !! wikitext
7878 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7879 !! html
7880 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7881 </p>
7882 !! end
7883
7884 !! test
7885 Link with space in namespace
7886 !! wikitext
7887 [[User talk:Foo bar]]
7888 !! html
7889 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7890 </p>
7891 !! end
7892
7893 !! article
7894 MemoryAlpha:AlphaTest
7895 !! text
7896 This is an article in the MemoryAlpha namespace
7897 (which shadows the memoryalpha interwiki link).
7898 !! endarticle
7899
7900 !! test
7901 Namespace takes precedence over interwiki link (T53680)
7902 !! wikitext
7903 [[MemoryAlpha:AlphaTest]]
7904 !! html
7905 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7906 </p>
7907 !! end
7908
7909 # The previous test doesn't work correctly in html2*, due to not recognizing the
7910 # link as an internal one. This one checks for the correct behavior.
7911 !! test
7912 Link to namespace preferred over interwiki with correct rel attribute
7913 !! options
7914 parsoid=html2wt,html2html
7915 !! html/parsoid
7916 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7917 !! wikitext
7918 [[MemoryAlpha:AlphaTest]]
7919 !! end
7920
7921 !! test
7922 Piped link to namespace
7923 !! wikitext
7924 [[Meta:Disclaimers|The disclaimers]]
7925 !! html
7926 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Link containing }
7932 !! wikitext
7933 [[Usually caused by a typo (oops}]]
7934 !! html
7935 <p>[[Usually caused by a typo (oops}]]
7936 </p>
7937 !! end
7938
7939 !! article
7940 7% Solution
7941 !! text
7942 Just a test of an article title containing a percent.
7943 !! endarticle
7944
7945 !! test
7946 Link containing % (not as a hex sequence)
7947 !! wikitext
7948 [[7% Solution]]
7949 [[7% Solution|7%25 Solution]]
7950 !! html/php
7951 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7952 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7953 </p>
7954 !! html/parsoid
7955 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7956 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7957 !! end
7958
7959 # note that the parsoid HTML is identical to the previous test output,
7960 # so the previous test ensures that the html2wt mode will generate the
7961 # "not as a hex sequence" wikitext.
7962 !! test
7963 Link containing % as a single hex sequence interpreted to char
7964 !! options
7965 parsoid=wt2wt,wt2html,html2html
7966 !! wikitext
7967 [[7%25 Solution]]
7968 [[7%25 Solution|7%25 Solution]]
7969 !! html/php
7970 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7971 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7972 </p>
7973 !! html/parsoid
7974 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7975 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7976 !!end
7977
7978 !! test
7979 Link containing % as a double hex sequence interpreted to hex sequence
7980 !! wikitext
7981 [[7%2525 Solution]]
7982 !! html
7983 <p>[[7%2525 Solution]]
7984 </p>
7985 !!end
7986
7987 ## Example for such a section: == < ==
7988 !! test
7989 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7990 !! config
7991 wgFragmentMode=[ 'html5', 'legacy' ]
7992 !! wikitext
7993 [[%23%3c]][[%23%3e]]
7994 !! html/php
7995 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7996 </p>
7997 !! html/parsoid
7998 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
7999 !! end
8000
8001 ## Example for such a section: == < ==
8002 !! test
8003 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
8004 !! config
8005 wgFragmentMode=[ 'legacy' ]
8006 !! wikitext
8007 [[%23%3c]][[%23%3e]]
8008 !! html/php
8009 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8010 </p>
8011 !! end
8012
8013 !! test
8014 Link containing "<#" and ">#" as a hex sequences
8015 !! wikitext
8016 [[%3c%23]][[%3e%23]]
8017 !! html
8018 <p>[[%3c%23]][[%3e%23]]
8019 </p>
8020 !! end
8021
8022 !! test
8023 Link containing an equals sign
8024 !! wikitext
8025 [[Special:BookSources/isbn=4-00-026157-6]]
8026 !! html/php
8027 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
8028 </p>
8029 !! html/parsoid
8030 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
8031 !! end
8032
8033 !! article
8034 Foo~bar
8035 !! text
8036 Just a test of an article title containing a tilde.
8037 !! endarticle
8038
8039 # note that links containing signatures, like [[Foo~~~~]], are
8040 # massaged by the pre-save transform (PST) and so the tildes are never
8041 # seen by the parser.
8042 !! test
8043 Link containing a tilde
8044 !! wikitext
8045 [[Foo~bar]]
8046 !! html/php
8047 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8048 </p>
8049 !! html/parsoid
8050 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8051 !! end
8052
8053 !! test
8054 Link containing double-single-quotes '' (T6598)
8055 !! wikitext
8056 [[Lista d''e paise d''o munno]]
8057 !! html/php
8058 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
8059 </p>
8060 !! html/parsoid
8061 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
8062 !! end
8063
8064 !! test
8065 Link containing double quotes and spaces
8066 !! wikitext
8067 [[Cool "Gator"]]
8068 !! html/php
8069 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
8070 </p>
8071 !! html/parsoid
8072 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8073 !! end
8074
8075 !! test
8076 File containing double quotes and spaces
8077 !! wikitext
8078 [[File:Cool "Gator".png]]
8079 !! html/parsoid
8080 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
8081 !! end
8082
8083 !! test
8084 Redirect containing double quotes and spaces
8085 !! wikitext
8086 #REDIRECT [[Cool "Gator"]]
8087 !! html/parsoid
8088 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8089 !! end
8090
8091 !! test
8092 Link containing double-single-quotes '' in text (T6598 sanity check)
8093 !! wikitext
8094 Some [[Link|pretty ''italics'' and stuff]]!
8095 !! html/php
8096 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
8097 </p>
8098 !! html/parsoid
8099 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8100 !! end
8101
8102 !! test
8103 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8104 !! wikitext
8105 ''Some [[Link|pretty ''italics'' and stuff]]!''
8106 !! html
8107 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
8108 </p>
8109 !! end
8110
8111 !! test
8112 Link with double quotes in title part (literal) and alternate part (interpreted)
8113 !! wikitext
8114 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8115
8116 [[''Pentecoste'']]
8117
8118 [[''Pentecoste''|Pentecoste]]
8119
8120 [[''Pentecoste''|''Pentecoste'']]
8121 !! html/php
8122 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
8123 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
8124 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
8125 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
8126 </p>
8127 !! html/parsoid
8128 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
8129 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8130 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8131 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8132 !! end
8133
8134 !! test
8135 Broken image links with HTML captions (T41700)
8136 !! wikitext
8137 [[File:Nonexistent|<script></script>]]
8138 [[File:Nonexistent|100x100px|<script></script>]]
8139 [[File:Nonexistent|&lt;]]
8140 [[File:Nonexistent|a<i>b</i>c]]
8141 !! html/php
8142 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8143 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8144 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8145 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8146 </p>
8147 !! html/parsoid
8148 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8149 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8150 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8151 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
8152 !! end
8153
8154 !! test
8155 Plain link to URL
8156 !! wikitext
8157 [[http://www.example.com]]
8158 !! html/php
8159 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8160 </p>
8161 !! html/parsoid
8162 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8163 !! end
8164
8165 !! test
8166 Plain link to URL with link text
8167 !! wikitext
8168 [[http://www.example.com Link text]]
8169 !! html
8170 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8171 </p>
8172 !! end
8173
8174 !! test
8175 Plain link to protocol-relative URL
8176 !! wikitext
8177 [[//www.example.com]]
8178 !! html/php
8179 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8180 </p>
8181 !! html/parsoid
8182 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8183 !! end
8184
8185 !! test
8186 Plain link to protocol-relative URL with link text
8187 !! wikitext
8188 [[//www.example.com Link text]]
8189 !! html
8190 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8191 </p>
8192 !! end
8193
8194 !! test
8195 Plain link to page with question mark in title
8196 !! wikitext
8197 [[A?b]]
8198
8199 [[A?b|Baz]]
8200 !! html
8201 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8202 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8203 </p>
8204 !! end
8205
8206 # I'm fairly sure the expected result here is wrong.
8207 # We want these to be URL links, not pseudo-pages with URLs for titles....
8208 # However the current output is also pretty screwy.
8209 #
8210 # ----
8211 # I'm changing it to match the current output--it arguably makes more
8212 # sense in the light of the test above. Old expected result was:
8213 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8214 #</p>
8215 # But I think this test is bordering on "garbage in, garbage out" anyway.
8216 # -- wtm
8217 !! test
8218 Piped link to URL
8219 !! wikitext
8220 Piped link to URL: [[http://www.example.com|an example URL]]
8221 !! html/php
8222 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8223 </p>
8224 !! html/parsoid
8225 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8226 !! end
8227
8228 !! test
8229 Plain link in template argument
8230 !! options
8231 parsoid=wt2html
8232 !! wikitext
8233 {{echo|[http://www.example.com |123]}}
8234
8235 {{echo|[[http://www.example.com |123]]}}
8236
8237 {{echo|[[http://www.example.com |123]}}
8238
8239 {{echo|[http://www.example.com |123]]}}
8240 !! html/php
8241 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8242 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8243 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8244 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8245 </p>
8246 !! html/parsoid
8247 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8248
8249 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
8250
8251 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8252
8253 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8254 !! end
8255
8256 !! test
8257 T2002: [[page|http://url/]] should link to page, not http://url/
8258 !! wikitext
8259 [[Main Page|http://url/]]
8260 !! html/php
8261 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8262 </p>
8263 !! html/parsoid
8264 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8265 !! end
8266
8267 # Parsoid does not mark self-links, by design.
8268 !! test
8269 T2337: Escaped self-links should be bold
8270 !! options
8271 title=[[Bug462]]
8272 !! wikitext
8273 [[Bu&#103;462]] [[Bug462]]
8274 !! html/php+tidy
8275 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8276 </p>
8277 !! html/parsoid
8278 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8279 !! end
8280
8281 !! test
8282 Self-link to section should not be bold
8283 !! options
8284 title=[[Main Page]]
8285 !! wikitext
8286 [[Main Page#section]]
8287 !! html
8288 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8289 </p>
8290 !! end
8291
8292 !! article
8293 00
8294 !! text
8295 This is 00.
8296 !! endarticle
8297
8298 !!test
8299 Self-link to numeric title
8300 !!options
8301 title=[[0]]
8302 !! wikitext
8303 [[0]]
8304 !! html
8305 <p><a class="mw-selflink selflink">0</a>
8306 </p>
8307 !!end
8308
8309 !!test
8310 Link to numeric-equivalent title
8311 !!options
8312 title=[[0]]
8313 !! wikitext
8314 [[00]]
8315 !! html
8316 <p><a href="/wiki/00" title="00">00</a>
8317 </p>
8318 !!end
8319
8320 !! test
8321 <nowiki> inside a link
8322 !! wikitext
8323 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8324 !! html
8325 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8326 </p>
8327 !! end
8328
8329 !! test
8330 Non-breaking spaces in title
8331 !! wikitext
8332 [[&nbsp; Main &nbsp; Page &nbsp;]]
8333 !! html
8334 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8335 </p>
8336 !!end
8337
8338 # Add new article for the test below so that it doesn't red-link
8339 !! article
8340 Foo bar baz
8341 !! text
8342 boo
8343 !! endarticle
8344
8345 !! test
8346 Multiple spaces in titles should normalize to a single underscore
8347 !! options
8348 parsoid=wt2html,wt2wt
8349 !! wikitext
8350 [[Foo bar baz|x]]
8351 [[Foo bar baz|x]]
8352 [[Foo bar baz|x]]
8353 !! html/php
8354 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8355 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8356 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8357 </p>
8358 !! html/parsoid
8359 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8360 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8361 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8362 </p>
8363 !! end
8364
8365 !! test
8366 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8367 !! options
8368 language=ca
8369 !! wikitext
8370 '''[[Main Page]]'''
8371 !! html
8372 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8373 </p>
8374 !! end
8375
8376 !! test
8377 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8378 !! options
8379 language=ca
8380 !! wikitext
8381 ''[[Main Page]]''
8382 !! html
8383 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8384 </p>
8385 !! end
8386
8387 !! test
8388 Internal link with en linktrail: no apostrophes (T29473)
8389 !! options
8390 language=en
8391 !! wikitext
8392 [[Something]]'nice
8393 !! html
8394 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8395 </p>
8396 !! end
8397
8398 !! test
8399 Internal link with ca linktrail with apostrophes (T29473)
8400 !! options
8401 language=ca
8402 !! wikitext
8403 [[Something]]'nice
8404 !! html
8405 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8406 </p>
8407 !! end
8408
8409 !! test
8410 Internal link with kaa linktrail with apostrophes (T29473)
8411 !! options
8412 language=kaa
8413 !! wikitext
8414 [[Something]]'nice
8415 !! html
8416 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8417 </p>
8418 !! end
8419
8420 !! test
8421 Link with multiple ":" in a subpage-supporting namespace (T65636)
8422 !! wikitext
8423 [[User:Foo/Test/63636:Bar|Test]]
8424 !! html/php
8425 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8426 </p>
8427 !! html/parsoid
8428 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8429 !! end
8430
8431 ## Mainly a sanity check for Parsoid
8432 !! test
8433 Handle title parsing for subpages
8434 !! options
8435 title=[[/123123]]
8436 subpage
8437 !! wikitext
8438 123
8439 !! html/php
8440 <p>123
8441 </p>
8442 !! html/parsoid
8443 <p>123</p>
8444 !! end
8445
8446 !! article
8447 User:Test/123
8448 !! text
8449 test 123
8450 !! endarticle
8451
8452 !! test
8453 Link to a subpage from a namespace other than main
8454 !! options
8455 title=[[User:Test]]
8456 subpage
8457 !! wikitext
8458 [[/123]]
8459 !! html/php
8460 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8461 </p>
8462 !! html/parsoid
8463 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8464 !! end
8465
8466 !! test
8467 Ensure that transclusion titles are not url-decoded
8468 !! options
8469 subpage title=[[Test]]
8470 parsoid=wt2html
8471 !! wikitext
8472 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8473 !! html/php
8474 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8475 </p>
8476 !! html/parsoid
8477 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8478 !! end
8479
8480 !! test
8481 Purely hash wikilink
8482 !! options
8483 title=[[User:Test/123]]
8484 subpage
8485 !! wikitext
8486 [[#a|b]]
8487 !! html/php
8488 <p><a href="#a">b</a>
8489 </p>
8490 !! html/parsoid
8491 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8492 !! end
8493
8494 !! test
8495 Serialization of purely hash wikilink
8496 !! options
8497 title=[[User:Test/123]]
8498 subpage
8499 parsoid=html2wt
8500 !! html/parsoid
8501 <p><a href="#a">[[</a></p>
8502 !! wikitext
8503 [[#a|<nowiki>[[</nowiki>]]
8504 !! html/php
8505 <p><a href="#a">[[</a>
8506 </p>
8507 !! end
8508
8509 !! test
8510 1. Interaction of linktrail and template encapsulation
8511 !! wikitext
8512 {{echo|[[Foo]]}}l
8513 !! html/parsoid
8514 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8515 !! end
8516
8517 !! test
8518 2. Interaction of linktrail and template encapsulation
8519 !! options
8520 parsoid
8521 !! wikitext
8522 {{echo|Some [[Fool]]}}s
8523 !! html
8524 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8525 !! end
8526
8527 !! test
8528 3. Interaction of linktrail and template encapsulation
8529 !! options
8530 parsoid
8531 !! wikitext
8532 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8533 !! html
8534 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8535 !! end
8536
8537 !! article
8538 Söfnuður
8539 !! text
8540 Test.
8541 !! endarticle
8542
8543 !! test
8544 Internal link with is link prefix
8545 !! options
8546 language=is
8547 !! wikitext
8548 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8549 !! html
8550 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8551 </p>
8552 !! end
8553
8554 !! article
8555 Mótmælendatrú
8556 !! text
8557 Test.
8558 !! endarticle
8559
8560 !! test
8561 Internal link with is link trail and link prefix
8562 !! options
8563 language=is
8564 !! wikitext
8565 [[mótmælendatrú|xxx]]ar
8566 [[mótmælendatrú]]ar
8567 mótmælenda[[söfnuður]]
8568 mótmælenda[[söfnuður|söfnuðir]]
8569 mótmælenda[[söfnuður|söfnuðir]]xxx
8570 !! html
8571 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8572 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8573 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8574 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8575 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8576 </p>
8577 !! end
8578
8579 !! test
8580 Parsoid link trail escaping
8581 !! options
8582 parsoid=html2wt,html2html
8583 !! html/parsoid
8584 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8585 !! wikitext
8586 [[apple]]<nowiki/>s
8587 !! end
8588
8589 !! test
8590 Parsoid link prefix escaping
8591 !! options
8592 language=is
8593 parsoid=html2wt,html2html
8594 !! html/parsoid
8595 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8596 !! wikitext
8597 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8598 !! end
8599
8600 !! test
8601 Parsoid link bracket escaping
8602 !! options
8603 parsoid=html2wt,html2html
8604 !! html/parsoid
8605 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8606 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8607 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8608 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8609 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8610 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8611 !! wikitext
8612 [[Test]]
8613
8614 [<nowiki/>[[Test]]]
8615
8616 [[[[Test]]]]
8617
8618 [[[<nowiki/>[[Test]]]]]
8619
8620 [[[[[[Test]]]]]]
8621
8622 [[[[[<nowiki/>[[Test]]]]]]]
8623 !! end
8624
8625 !! test
8626 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8627 !! wikitext
8628 [[Foo| bar]]
8629
8630 [[Foo| ''bar'']]
8631
8632 [http://wp.org foo]
8633
8634 [http://wp.org ''foo'']
8635 !! html
8636 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8637 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8638 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8639 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8640 </p>
8641 !! end
8642
8643 !! test
8644 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8645 !! wikitext
8646 [[Foo|{{echo|a}} b {{echo|c}}]]
8647 !! html/parsoid
8648 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8649 !! end
8650
8651 !! test
8652 Link with angle bracket after anchor
8653 !! config
8654 wgFragmentMode=[ 'html5', 'legacy' ]
8655 !! wikitext
8656 [[Foo#<bar>]]
8657 !! html/php
8658 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8659 </p>
8660 !! html/parsoid
8661 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8662 !! end
8663
8664 !! test
8665 Link with angle bracket after anchor (legacy)
8666 !! config
8667 wgFragmentMode=[ 'legacy' ]
8668 !! wikitext
8669 [[Foo#<bar>]]
8670 !! html/php
8671 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8672 </p>
8673 !! end
8674
8675 ###
8676 ### Interwiki links (see maintenance/interwiki.sql)
8677 ###
8678
8679 !! test
8680 Inline interwiki link
8681 !! options
8682 parsoid=wt2html,wt2wt,html2html
8683 !! wikitext
8684 [[MeatBall:SoftSecurity]]
8685 !! html/php
8686 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8687 </p>
8688 !! html/parsoid
8689 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8690 !! end
8691
8692 !! test
8693 Inline interwiki link with empty title (T4372)
8694 !! options
8695 parsoid=wt2html,wt2wt,html2html
8696 !! wikitext
8697 [[MeatBall:]]
8698 !! html/php
8699 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8700 </p>
8701 !! html/parsoid
8702 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8703 !! end
8704
8705 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8706 !! test
8707 Interwiki link encoding conversion (T3636)
8708 !! options
8709 parsoid=wt2html,wt2wt
8710 !! wikitext
8711 *[[Wikipedia:ro:Olteni&#0355;a]]
8712 *[[Wikipedia:ro:Olteni&#355;a]]
8713 !! html
8714 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8715 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8716
8717 !! html/php+tidy
8718 <ul>
8719 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8720 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8721 </ul>
8722 !! html/parsoid
8723 <ul>
8724 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8725 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8726 </ul>
8727 !! end
8728
8729 !! test
8730 Interwiki link with fragment (T4130)
8731 !! wikitext
8732 [[MeatBall:SoftSecurity#foo]]
8733 !! html
8734 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8735 </p>
8736 !! end
8737
8738 !! test
8739 Link scenarios with escaped fragments
8740 !! config
8741 wgFragmentMode=[ 'html5', 'legacy' ]
8742 !! wikitext
8743 [[#Is this great?]]
8744 [[Foo#Is this great?]]
8745 [[meatball:Foo#Is this great?]]
8746 !! html/php
8747 <p><a href="#Is_this_great?">#Is this great?</a>
8748 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8749 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8750 </p>
8751 !! html/parsoid
8752 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8753 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8754 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8755 !! end
8756
8757 !! test
8758 Link scenarios with escaped fragments (legacy)
8759 !! config
8760 wgFragmentMode=[ 'legacy' ]
8761 !! wikitext
8762 [[#Is this great?]]
8763 [[Foo#Is this great?]]
8764 [[meatball:Foo#Is this great?]]
8765 !! html/php
8766 <p><a href="#Is_this_great.3F">#Is this great?</a>
8767 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8768 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8769 </p>
8770 !! end
8771
8772 # Ideally the wikipedia: prefix here should be proto-relative too
8773 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8774 # define the 'en' prefix, and originally the test used 'wikipedia',
8775 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8776 # article.
8777 !! test
8778 Different interwiki prefixes mapping to the same URL
8779 !! wikitext
8780 [[:en:Foo]]
8781
8782 [[:en:Foo|Foo]]
8783
8784 [[wikipedia:Foo]]
8785
8786 [[:wikipedia:Foo|Foo]]
8787
8788 [[wikipedia:en:Foo]]
8789
8790 [[:wikipedia:en:Foo]]
8791
8792 [[ wikiPEdia :Foo]]
8793 !! html/parsoid
8794 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8795
8796 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8797
8798 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8799
8800 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8801
8802 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8803
8804 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8805
8806 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8807 !! end
8808
8809 !! test
8810 Interwiki links that cannot be represented in wiki syntax
8811 !! wikitext
8812 [[meatball:ok]]
8813 [[meatball:ok#foo|ok with fragment]]
8814 [[meatball:ok_as_well?|ok ending with ? mark]]
8815 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8816 [http://de.wikipedia.org/wiki/#foo is just fragment]
8817
8818 !! html/php
8819 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8820 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8821 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8822 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8823 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8824 </p>
8825 !! html/parsoid
8826 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8827 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8828 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8829 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8830 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8831 !! end
8832
8833 !! test
8834 Interwiki links: trail
8835 !! wikitext
8836 [[wikipedia:Foo|Ba]]r
8837 !! html/php
8838 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8839 </p>
8840 !! html/parsoid
8841 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8842 !! end
8843
8844 !! test
8845 Local interwiki link
8846 !! options
8847 parsoid=wt2html,wt2wt,html2html
8848 !! wikitext
8849 [[local:Template:Foo]]
8850 !! html/php
8851 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8852 </p>
8853 !! html/parsoid
8854 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8855 !! end
8856
8857 # Parsoid does not mark self-links, by design.
8858 !! test
8859 Local interwiki link: self-link to current page
8860 !! options
8861 title=[[Main Page]]
8862 parsoid=wt2html,wt2wt,html2html
8863 !! wikitext
8864 [[local:Main Page]]
8865 !! html/php
8866 <p><a class="mw-selflink selflink">local:Main Page</a>
8867 </p>
8868 !! html/parsoid
8869 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8870 !! end
8871
8872 !! test
8873 Local interwiki link: prefix only (T66167)
8874 !! options
8875 parsoid=wt2html,wt2wt,html2html
8876 !! wikitext
8877 [[local:]]
8878 !! html/php
8879 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8880 </p>
8881 !! html/parsoid
8882 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8883 !! end
8884
8885 !! test
8886 Local interwiki link: with additional interwiki prefix (T63357)
8887 !! options
8888 parsoid=wt2html,wt2wt,html2html
8889 !! wikitext
8890 [[local:meatball:Hello]]
8891 !! html/php
8892 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8893 </p>
8894 !! html/parsoid
8895 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8896 !! end
8897
8898 !! test
8899 Multiple local interwiki link prefixes
8900 !! wikitext
8901 [[local:local:local:local:mi:local:Foo]]
8902 !! options
8903 parsoid=wt2html,wt2wt,html2html
8904 !! html/php
8905 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8906 </p>
8907 !! html/parsoid
8908 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8909 !! end
8910
8911 ###
8912 ### Interlanguage links
8913 ### Language links (so that searching for '### language' matches..)
8914 ###
8915
8916 !! test
8917 Interlanguage link
8918 !! wikitext
8919 Blah blah blah
8920 [[zh:Chinese]]
8921 !! html/php
8922 <p>Blah blah blah
8923 </p>
8924 !! html/parsoid
8925 <p>Blah blah blah</p>
8926 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8927 !! end
8928
8929 ## parsoid html2wt will lose the space variations
8930 !! test
8931 Interlanguage link with spacing
8932 !! options
8933 parsoid=wt2html,wt2wt,html2html
8934 !! wikitext
8935 Blah blah blah
8936 [[ zh : Chinese ]]
8937 !! html/php
8938 <p>Blah blah blah
8939 </p>
8940 !! html/parsoid
8941 <p>Blah blah blah</p>
8942 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8943 !! end
8944
8945 !! test
8946 Double interlanguage link
8947 !! wikitext
8948 Blah blah blah
8949 [[es:Spanish]]
8950 [[zh:Chinese]]
8951 !! html/php
8952 <p>Blah blah blah
8953 </p>
8954 !! html/parsoid
8955 <p>Blah blah blah</p>
8956 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8957 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8958 !! end
8959
8960 ## parsoid html2wt will lose the space variations
8961 !! test
8962 Interlanguage link variations
8963 !! options
8964 parsoid=wt2html,wt2wt,html2html
8965 !! wikitext
8966 Blah blah blah
8967 [[ es :Spanish]]
8968 [[ ZH :Chinese]]
8969 [[es:Foo_bar]]
8970 !! html/php
8971 <p>Blah blah blah
8972 </p>
8973 !! html/parsoid
8974 <p>Blah blah blah</p>
8975 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8976 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8977 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8978 !! end
8979
8980 !! test
8981 Escaping of interlanguage links (T129218, T156308)
8982 !! wikitext
8983 Blah blah blah
8984 [[:es:Spanish]]
8985 [[ : zh : Chinese ]]
8986 !! html/php
8987 <p>Blah blah blah
8988 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8989 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8990 </p>
8991 !! html/parsoid
8992 <p>Blah blah blah
8993 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8994 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8995 !! end
8996
8997 !! test
8998 Multiple colons escaping interlanguage links
8999 !! options
9000 parsoid=wt2html
9001 !! wikitext
9002 [[:es:Spanish]]
9003 [[::es:Spanish]]
9004 [[:::es:Spanish]]
9005 !! html/php
9006 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9007 [[::es:Spanish]]
9008 [[:::es:Spanish]]
9009 </p>
9010 !! html/parsoid
9011 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9012 [[::es:Spanish]]
9013 [[:::es:Spanish]]</p>
9014 !! end
9015
9016 ## parsoid html2wt will normalize the space to _
9017 !! test
9018 Space and question mark encoding in interlanguage links (T95473)
9019 !! options
9020 parsoid=wt2html,wt2wt,html2html
9021 !! wikitext
9022 Blah blah blah
9023 [[es:Foo bar?]]
9024 !! html/php
9025 <p>Blah blah blah
9026 </p>
9027 !! html/parsoid
9028 <p>Blah blah blah</p>
9029 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9030 !! end
9031
9032 !! test
9033 Interlanguage link, with prefix links
9034 !! options
9035 language=ln
9036 !! wikitext
9037 Blah blah blah
9038 [[zh:Chinese]]
9039 !! html/php
9040 <p>Blah blah blah
9041 </p>
9042 !! html/parsoid
9043 <p>Blah blah blah</p>
9044 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9045 !! end
9046
9047 !! test
9048 Double interlanguage link, with prefix links (T10897)
9049 !! options
9050 language=ln
9051 !! wikitext
9052 Blah blah blah
9053 [[es:Spanish]]
9054 [[zh:Chinese]]
9055 !! html/php
9056 <p>Blah blah blah
9057 </p>
9058 !! html/parsoid
9059 <p>Blah blah blah</p>
9060 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9061 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9062 !! end
9063
9064 !! test
9065 "Extra" interlanguage links (T34189 / gerrit 111390)
9066 !! wikitext
9067 Blah blah blah
9068 [[mul:Article]]
9069 !! html/php
9070 <p>Blah blah blah
9071 </p>
9072 !! html/parsoid
9073 <p>Blah blah blah</p>
9074 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9075 !! end
9076
9077 ## PHP parser tests script needs an update
9078 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9079 !! test
9080 Language links render as inline links if $wgInterwikiMagic=false
9081 !! options
9082 wgInterwikiMagic=false
9083 parsoid=wt2html,wt2wt,html2html
9084 !! wikitext
9085 Blah blah blah
9086 [[zh:Chinese]]
9087 !! html/parsoid
9088 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9089 !! end
9090
9091 ## PHP parser tests script needs an update
9092 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9093 !! test
9094 Language links render as inline links in the Talk namespace
9095 !! options
9096 title=Talk:Foo
9097 parsoid=wt2html,wt2wt,html2html
9098 !! wikitext
9099 Blah blah blah
9100 [[zh:Chinese]]
9101 !! html/parsoid
9102 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9103 !! end
9104
9105 !! test
9106 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9107 !! options
9108 language=ln
9109 !! wikitext
9110 [[WW&nbsp;II]]
9111 !! html
9112 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
9113 </p>
9114 !! end
9115
9116 !! test
9117 Parsoid T55221: Wikilinks should be properly entity-escaped
9118 !! options
9119 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9120 !! html/parsoid
9121 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9122 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9123 !! wikitext
9124 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9125
9126 He&amp;nbsp;llo He&amp;nbsp;llo
9127 !! html/php
9128 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9129 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9130 </p>
9131 !! end
9132
9133 # html2wt will fail because of title normalization without data-parsoid
9134 !! test
9135 Parsoid: handle constructor well
9136 !! options
9137 parsoid=wt2html,wt2wt
9138 !! wikitext
9139 [[constructor]]
9140
9141 [[constructor:foo]]
9142 !! html/php
9143 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9144 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
9145 </p>
9146 !! html/parsoid
9147 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9148
9149 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
9150 !! end
9151
9152 !! test
9153 Template parameter named "constructor"
9154 !! wikitext
9155 {{echo| constructor = |hi}}
9156 !! html/parsoid
9157 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"constructor","named":true,"spc":[" "," ",""," "]},{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"},"constructor":{"wt":""}},"i":0}}]}'>hi</p>
9158 !! end
9159
9160 !! article
9161 ko:
9162 !! text
9163 Test.
9164 !! endarticle
9165
9166 # Note that `ko` isn't a known interlanguage prefix
9167 !! test
9168 Parsoid: recognize interlanguage links without a target page
9169 !! options
9170 ill
9171 !! wikitext
9172 [[es:]]
9173
9174 [[ko:]]
9175 !! html/php
9176 es:
9177 !! html/parsoid
9178 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9179
9180 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9181 !! end
9182
9183 # Note that `ko` isn't a known interwiki prefix
9184 !! test
9185 Parsoid: recognize interwiki links without a target page
9186 !! options
9187 parsoid=wt2html,wt2wt,html2html
9188 !! wikitext
9189 [[:es:]]
9190
9191 [[:ko:]]
9192 !! html/php
9193 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9194 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9195 </p>
9196 !! html/parsoid
9197 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9198 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9199 !! end
9200
9201 !! test
9202 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9203 !! wikitext
9204 [[mi:Foo]]
9205 !! html/php
9206 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9207 </p>
9208 !! html/parsoid
9209 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9210 !! end
9211
9212 !! test
9213 Interlanguage link with preceding local interwiki link (T70085)
9214 !! options
9215 parsoid=wt2html,wt2wt,html2html
9216 !! wikitext
9217 Blah blah blah
9218 [[local:es:Spanish]]
9219 !! html/php
9220 <p>Blah blah blah
9221 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9222 </p>
9223 !! html/parsoid
9224 <p>Blah blah blah
9225 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9226 !! end
9227
9228 !! test
9229 Looks like an interlanguage link, but is actually a local interwiki
9230 !! options
9231 parsoid=wt2html,wt2wt,html2html
9232 !! wikitext
9233 Blah blah blah
9234 [[mi:Template:Foo]]
9235 !! html/php
9236 <p>Blah blah blah
9237 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9238 </p>
9239 !! html/parsoid
9240 <p>Blah blah blah
9241 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9242 !! end
9243
9244 ###
9245 ### Redirects, Parsoid-only
9246 ###
9247
9248 !! test
9249 1. Simple redirect to page
9250 !! wikitext
9251 #REDIRECT [[Main Page]]
9252 !! html/parsoid
9253 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9254 !! end
9255
9256 !! test
9257 2. Other redirect variants
9258 !! wikitext
9259 #REDIRECT [[Main_Page]]
9260 !! html/parsoid
9261 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9262 !! end
9263
9264 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9265 # This tests the Parsoid bail-out code.
9266 !! test
9267 3. Other redirect variants
9268 !! options
9269 parsoid=wt2html
9270 !! wikitext
9271 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9272 !! html/parsoid
9273 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9274 !! end
9275
9276 !! test
9277 4. Redirect to a templated destination
9278 !! wikitext
9279 #REDIRECT [[{{echo|Foo}}bar]]
9280 !! html/parsoid
9281 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9282 !! end
9283
9284 !! test
9285 Empty redirect
9286 !! options
9287 parsoid=wt2html,wt2wt
9288 !! wikitext
9289 #REDIRECT [[]]
9290 !! html/parsoid
9291 <ol>
9292 <li>REDIRECT [[]]</li></ol>
9293 !! end
9294
9295 !! test
9296 Optional colon in #REDIRECT
9297 !! options
9298 # the colon is archaic syntax. we support it for wt2html, but we
9299 # don't care that it roundtrips back to the modern syntax.
9300 parsoid=wt2html,html2html
9301 !! wikitext
9302 #REDIRECT:[[Main Page]]
9303 !! html/parsoid
9304 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9305 !! end
9306
9307 !! test
9308 Whitespace in #REDIRECT with optional colon
9309 !! options
9310 # the colon and gratuitous whitespace is archaic syntax. we support
9311 # it for wt2html, but we don't care that it roundtrips back to the
9312 # modern syntax (without extra whitespace)
9313 parsoid=wt2html,html2html
9314 !! wikitext
9315
9316 #REDIRECT
9317 :
9318 [[Main Page]]
9319 !! html/parsoid
9320 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9321 !! end
9322
9323 !! test
9324 Piped link in #REDIRECT
9325 !! options
9326 # content after piped link is ignored. we support this syntax,
9327 # but don't care that the piped link is lost when we roundtrip this.
9328 parsoid=wt2html
9329 !! wikitext
9330 #REDIRECT [[Main Page|bar]]
9331 !! html/parsoid
9332 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9333 !! end
9334
9335 !! test
9336 Redirect to category (T104502)
9337 !! options
9338 parsoid=wt2html,wt2wt
9339 !! wikitext
9340 #REDIRECT [[Category:Foo]]
9341 !! html/parsoid
9342 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9343 !! end
9344
9345 !! test
9346 Redirect to category with URL encoding (T104502)
9347 !! options
9348 parsoid=wt2html
9349 !! wikitext
9350 #REDIRECT [[Category%3AFoo]]
9351 !! html/parsoid
9352 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9353 !! end
9354
9355 !! test
9356 Redirect to category page
9357 !! wikitext
9358 #REDIRECT [[:Category:Foo]]
9359 !! html/parsoid
9360 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9361 !! end
9362
9363 !! test
9364 Redirect to image page (1)
9365 !! wikitext
9366 #REDIRECT [[File:Wiki.png]]
9367 !! html/parsoid
9368 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9369 !! end
9370
9371 !! test
9372 Redirect to image page (2)
9373 !! wikitext
9374 #REDIRECT [[Image:Wiki.png]]
9375 !! html/parsoid
9376 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9377 !! end
9378
9379 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9380 # Next test confirms this.
9381 !! test
9382 Redirect to language (1) (T104918)
9383 !! options
9384 parsoid=wt2html,wt2wt,html2html
9385 !! wikitext
9386 #REDIRECT [[en:File:Wiki.png]]
9387 !! html/parsoid
9388 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9389 !! end
9390
9391 !! test
9392 Redirect to language (2) (T104918)
9393 !! wikitext
9394 #REDIRECT [[:en:File:Wiki.png]]
9395 !! html/parsoid
9396 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9397 !! end
9398
9399 !! test
9400 Redirect to interwiki (T104918)
9401 !! wikitext
9402 #REDIRECT [[meatball:File:Wiki.png]]
9403 !! html/parsoid
9404 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9405 !! end
9406
9407 !! test
9408 Non-English #REDIRECT
9409 !! options
9410 language=is
9411 !! wikitext
9412 #TILVÍSUN [[Main Page]]
9413 !! html/parsoid
9414 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9415 !! end
9416
9417 !! test
9418 Redirect syntax under text isn't considered a redirect
9419 !! wikitext
9420 some text
9421
9422 #redirect [[Main Page]]
9423 !! html/parsoid
9424 <p>some text</p>
9425 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9426 !! end
9427
9428 !! test
9429 New redirect
9430 !! options
9431 parsoid=html2wt
9432 !! html/parsoid
9433 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9434 !! wikitext
9435 #REDIRECT [[Foo]]
9436 Foo
9437 !! end
9438
9439 !! test
9440 Redirect followed by block on the same line
9441 !! options
9442 parsoid=wt2html
9443 !! wikitext
9444 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9445 !! html/parsoid
9446 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9447 !! end
9448
9449 !! test
9450 Redirect followed by a newline
9451 !! wikitext
9452 #REDIRECT [[Main Page]]
9453 A newline
9454 !! html/parsoid
9455 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9456 <p>A newline</p>
9457 !! end
9458
9459 !! test
9460 Redirect followed by multiple newlines
9461 !! wikitext
9462 #REDIRECT [[Main Page]]
9463
9464
9465 A newline
9466 !! html/parsoid
9467 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9468
9469 <p><br/>
9470 A newline</p>
9471 !! end
9472
9473 !! test
9474 Drop duplicate redirects
9475 !! options
9476 parsoid=html2wt
9477 !! html/parsoid
9478 <link rel="mw:PageProp/redirect" href="./Foo"/>
9479 <link rel="mw:PageProp/redirect" href="./Bar"/>
9480 <link rel="mw:PageProp/redirect" href="./Baz"/>
9481 !! wikitext
9482 #REDIRECT [[Foo]]
9483 !! end
9484
9485 ##
9486 ## XHTML tidiness
9487 ###
9488
9489 !! test
9490 <br> to <br />
9491 !! wikitext
9492 1<br>2<br />3
9493 !! html
9494 <p>1<br />2<br />3
9495 </p>
9496 !! end
9497
9498 !! test
9499 Broken br tag sanitization
9500 !! wikitext
9501 </br>
9502 !! html/php
9503 <p>&lt;/br&gt;
9504 </p>
9505 !! end
9506
9507 # TODO: Fix html2html mode (T53055)!
9508 !! test
9509 Parsoid: Broken br tag recognition
9510 !! options
9511 parsoid=wt2html
9512 !! wikitext
9513 </br>
9514
9515 <br/ >
9516 !! html+tidy
9517 <p><br />
9518 </p><p><br />
9519 </p>
9520 !! end
9521
9522 !! test
9523 Incorrecly removing closing slashes from correctly formed XHTML
9524 !! wikitext
9525 <br style="clear:both;" />
9526 !! html
9527 <p><br style="clear:both;" />
9528 </p>
9529 !! end
9530
9531 !! test
9532 Failing to transform badly formed HTML into correct XHTML
9533 !! wikitext
9534 <br style="clear: left;">
9535 <br style="clear: right;">
9536 <br style="clear: both;">
9537 !! html
9538 <p><br style="clear: left;" />
9539 <br style="clear: right;" />
9540 <br style="clear: both;" />
9541 </p>
9542 !!end
9543
9544 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9545 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9546 !! test
9547 Handling html with a div self-closing tag
9548 !! wikitext
9549 <div title />
9550 <div title/>
9551 <div title/ >
9552 <div title=bar />
9553 <div title=bar/>
9554 <div title=bar/ >
9555 !! html/php
9556 <p>&lt;div title /&gt;
9557 &lt;div title/&gt;
9558 </p>
9559 <div>
9560 <p>&lt;div title=bar /&gt;
9561 &lt;div title=bar/&gt;
9562 </p>
9563 <div title="bar/"></div>
9564 </div>
9565
9566 !! html/parsoid
9567 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9568 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9569 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9570 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9571 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9572 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9573 !! end
9574
9575 !! test
9576 Handling html with a br self-closing tag
9577 !! wikitext
9578 <br title />
9579 <br title/>
9580 <br title/ >
9581 <br title=bar />
9582 <br title=bar/>
9583 <br title=bar/ >
9584 !! html/php
9585 <p><br title="" />
9586 <br title="" />
9587 <br />
9588 <br title="bar" />
9589 <br title="bar" />
9590 <br title="bar/" />
9591 </p>
9592 !! html/parsoid
9593 <p><br title="" />
9594 <br title="" />
9595 <br title="" />
9596 <br title="bar" />
9597 <br title="bar" />
9598 <br title="bar/" />
9599 </p>
9600 !! end
9601
9602 !! test
9603 Horizontal ruler (should it add that extra space?)
9604 !! wikitext
9605 <hr>
9606 <hr >
9607 foo <hr
9608 > bar
9609 !! html+tidy
9610 <hr />
9611 <hr /><p>
9612 foo </p><hr /><p> bar
9613 </p>
9614 !! end
9615
9616 !! test
9617 Horizontal ruler -- 4+ dashes render hr
9618 !! wikitext
9619 ----
9620 !! html
9621 <hr />
9622
9623 !! end
9624
9625 !! test
9626 Horizontal ruler -- eats additional dashes on the same line
9627 !! wikitext
9628 ---------
9629 !! html
9630 <hr />
9631
9632 !! end
9633
9634 !! test
9635 Horizontal ruler -- does not collapse dashes on consecutive lines
9636 !! wikitext
9637 ----
9638 ----
9639 !! html
9640 <hr />
9641 <hr />
9642
9643 !! end
9644
9645 !! test
9646 Horizontal ruler -- <4 dashes render as plain text
9647 !! wikitext
9648 ---
9649 !! html
9650 <p>---
9651 </p>
9652 !! end
9653
9654 !! test
9655 Horizontal ruler -- Supports content following dashes on same line
9656 !! wikitext
9657 ---- Foo
9658 !! html
9659 <hr /> Foo
9660
9661 !! html+tidy
9662 <hr /><p> Foo
9663 </p>
9664 !! end
9665
9666 ###
9667 ### Block-level elements
9668 ###
9669 !! test
9670 Common list
9671 !! wikitext
9672 *Common list
9673 *item 2
9674 *item 3
9675 !! html
9676 <ul><li>Common list</li>
9677 <li>item 2</li>
9678 <li>item 3</li></ul>
9679
9680 !! end
9681
9682 !! test
9683 Numbered list
9684 !! wikitext
9685 #Numbered list
9686 #item 2
9687 #item 3
9688 !! html
9689 <ol><li>Numbered list</li>
9690 <li>item 2</li>
9691 <li>item 3</li></ol>
9692
9693 !! end
9694
9695 # the switch from level 3 to ordered should not introduce a newline between
9696 !! test
9697 Mixed list
9698 !! wikitext
9699 *Mixed list
9700 *#with numbers
9701 **and bullets
9702 *#and numbers
9703 *bullets again
9704 **bullet level 2
9705 ***bullet level 3
9706 ***#Number on level 4
9707 **bullet level 2
9708 **#Number on level 3
9709 **#Number on level 3
9710 *#number level 2
9711 *Level 1
9712 ***Level 3
9713 #**Level 3, but ordered
9714 !! html
9715 <ul><li>Mixed list
9716 <ol><li>with numbers</li></ol>
9717 <ul><li>and bullets</li></ul>
9718 <ol><li>and numbers</li></ol></li>
9719 <li>bullets again
9720 <ul><li>bullet level 2
9721 <ul><li>bullet level 3
9722 <ol><li>Number on level 4</li></ol></li></ul></li>
9723 <li>bullet level 2
9724 <ol><li>Number on level 3</li>
9725 <li>Number on level 3</li></ol></li></ul>
9726 <ol><li>number level 2</li></ol></li>
9727 <li>Level 1
9728 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9729 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9730
9731 !! end
9732
9733 !! test
9734 1. Nested mixed wikitext and html list
9735 !! wikitext
9736 *hi
9737 *<ul><li>ho</li></ul>
9738 *hi
9739 **ho
9740 !! html/php
9741 <ul><li>hi</li>
9742 <li><ul><li>ho</li></ul></li>
9743 <li>hi
9744 <ul><li>ho</li></ul></li></ul>
9745
9746 !! html/parsoid
9747 <ul><li>hi</li>
9748 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9749 <li>hi
9750 <ul><li>ho</li></ul></li></ul>
9751 !! end
9752
9753 !! test
9754 2. Nested mixed wikitext and html list (incompatible)
9755 !! wikitext
9756 ;hi
9757 :{{echo|<li>ho</li>}}
9758 !! html/php
9759 <dl><dt>hi</dt>
9760 <dd><li>ho</li></dd></dl>
9761
9762 !! html/parsoid
9763 <dl><dt>hi</dt>
9764 <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9765 !! end
9766
9767 !! test
9768 Nested lists 1
9769 !! wikitext
9770 *foo
9771 **bar
9772 !! html
9773 <ul><li>foo
9774 <ul><li>bar</li></ul></li></ul>
9775
9776 !! end
9777
9778 !! test
9779 Nested lists 2
9780 !! wikitext
9781 **foo
9782 *bar
9783 !! html
9784 <ul><li><ul><li>foo</li></ul></li>
9785 <li>bar</li></ul>
9786
9787 !! end
9788
9789 !! test
9790 Nested lists 3 (first element empty)
9791 !! wikitext
9792 *
9793 **bar
9794 !! html
9795 <ul><li>
9796 <ul><li>bar</li></ul></li></ul>
9797
9798 !! end
9799
9800 !! test
9801 Nested lists 4 (first element empty)
9802 !! wikitext
9803 **
9804 *bar
9805 !! html
9806 <ul><li><ul><li></li></ul></li>
9807 <li>bar</li></ul>
9808
9809 !! end
9810
9811 !! test
9812 Nested lists 5 (both elements empty)
9813 !! wikitext
9814 **
9815 *
9816 !! html
9817 <ul><li><ul><li></li></ul></li>
9818 <li></li></ul>
9819
9820 !! end
9821
9822 !! test
9823 Nested lists 6 (both elements empty)
9824 !! wikitext
9825 *
9826 **
9827 !! html
9828 <ul><li>
9829 <ul><li></li></ul></li></ul>
9830
9831 !! end
9832
9833 !! test
9834 Nested lists 7 (skip initial nesting levels)
9835 !! wikitext
9836 ***foo
9837 !! html
9838 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9839
9840 !! end
9841
9842 !! test
9843 Nested lists 8 (multiple nesting transitions)
9844 !! wikitext
9845 *foo
9846 ***bar
9847 **baz
9848 *boo
9849 !! html
9850 <ul><li>foo
9851 <ul><li><ul><li>bar</li></ul></li>
9852 <li>baz</li></ul></li>
9853 <li>boo</li></ul>
9854
9855 !! end
9856
9857 !! test
9858 Nested lists 9 (extension interaction)
9859 !! options
9860 parsoid
9861 !! wikitext
9862 *<references />
9863 !! html/parsoid
9864 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9865 !! end
9866
9867 !! test
9868 1. Lists with start-of-line-transparent tokens before bullets: Comments
9869 !! wikitext
9870 *foo
9871 *<!--cmt-->bar
9872 <!--cmt-->*baz
9873 !! html
9874 <ul><li>foo</li>
9875 <li>bar</li>
9876 <li>baz</li></ul>
9877
9878 !! end
9879
9880 !! test
9881 Nested lists 10 (list and span siblings: wt2wt regression)
9882 !! wikitext
9883 *a <span>x</span>
9884 **b <span>y</span>
9885 !! html/parsoid
9886 <ul><li>a <span>x</span>
9887 <ul><li>b <span>y</span></li></ul></li></ul>
9888 !! end
9889
9890 !! test
9891 2. Lists with start-of-line-transparent tokens before bullets: Template close
9892 !! wikitext
9893 *foo {{echo|bar
9894 }}*baz
9895 !! html
9896 <ul><li>foo bar</li>
9897 <li>baz</li></ul>
9898
9899 !! end
9900
9901 !! test
9902 List items are not parsed correctly following a <pre> block (T2785)
9903 !! wikitext
9904 *<pre>foo</pre>
9905 *<pre>bar</pre>
9906 *zar
9907 !! html/php
9908 <ul><li><pre>foo</pre></li>
9909 <li><pre>bar</pre></li>
9910 <li>zar</li></ul>
9911
9912 !! html/parsoid
9913 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9914 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9915 <li>zar</li></ul>
9916 !! end
9917
9918 # FIXME: Might benefit from a html/parsoid since this has a template
9919 !! test
9920 List items from template
9921 !! wikitext
9922
9923 {{inner list}}
9924 *item 2
9925
9926 *item 0
9927 {{inner list}}
9928 *item 2
9929
9930 *item 0
9931 *notSOL{{inner list}}
9932 *item 2
9933 !! html
9934 <ul><li>item 1</li>
9935 <li>item 2</li></ul>
9936 <ul><li>item 0</li>
9937 <li>item 1</li>
9938 <li>item 2</li></ul>
9939 <ul><li>item 0</li>
9940 <li>notSOL</li>
9941 <li>item 1</li>
9942 <li>item 2</li></ul>
9943
9944 !! end
9945
9946 !! test
9947 List interrupted by empty line or heading
9948 !! wikitext
9949 *foo
9950
9951 **bar
9952 ==A heading==
9953 *Another list item
9954 !! html
9955 <ul><li>foo</li></ul>
9956 <ul><li><ul><li>bar</li></ul></li></ul>
9957 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9958 <ul><li>Another list item</li></ul>
9959
9960 !!end
9961
9962 !! test
9963 Multiple list tags generated by templates
9964 !! wikitext
9965 {{echo|<li>}}a
9966 {{echo|<li>}}b
9967 {{echo|<li>}}c
9968 !! html
9969 <li>a
9970 <li>b
9971 <li>c</li>
9972 </li>
9973 </li>
9974
9975
9976 !! html+tidy
9977 <li>a
9978 </li><li>b
9979 </li><li>c
9980 </li>
9981 !! html/parsoid
9982 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
9983 </li><li about="#mwt1">b
9984 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9985 !! end
9986
9987 !! test
9988 Multiple newlines in between HTML list items don't induce paragraph wrapping
9989 !! wikitext
9990 <ul>
9991 <li>hi</li>
9992
9993
9994
9995
9996 <li>ho</li>
9997 </ul>
9998
9999 <dl>
10000 <dt>hi</dt>
10001 <dd>ho<div>123</div>
10002 </dd>
10003
10004
10005 </dl>
10006 !! html/php+tidy
10007 <ul>
10008 <li>hi</li>
10009
10010
10011
10012
10013 <li>ho</li>
10014 </ul>
10015 <dl>
10016 <dt>hi</dt>
10017 <dd>ho<div>123</div>
10018 </dd>
10019
10020
10021 </dl>
10022 !! end
10023
10024 !!test
10025 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10026 !! wikitext
10027 *a
10028 <!--This line will NOT split the list-->
10029 *b
10030 <!--This line will NOT split the list either-->
10031 *c
10032 <!--foo--> <!----> <!--This line NOT split the list either-->
10033 *d
10034 !! html
10035 <ul><li>a</li>
10036 <li>b</li>
10037 <li>c</li>
10038 <li>d</li></ul>
10039
10040 !!end
10041
10042 !!test
10043 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10044 !! wikitext
10045 *a
10046 <!--This line will NOT split the list-->
10047 *b
10048 <!--This line will NOT split the list either-->
10049 *c
10050 <!--foo--> <!----> <!--This line NOT split the list
10051 either-->
10052 *d
10053 !! html
10054 <ul><li>a</li>
10055 <li>b</li>
10056 <li>c</li>
10057 <li>d</li></ul>
10058
10059 !!end
10060
10061 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10062 # That pass could possibly be removed.
10063 !!test
10064 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10065 !!options
10066 parsoid=wt2html,wt2wt
10067 !! wikitext
10068 *foo
10069 *<li>li-hack
10070 *{{echo|<li>templated li-hack}}
10071 *<!--foo--><li> unsupported li-hack with preceding comments
10072
10073 <ul>
10074 <li><li>not a li-hack
10075 </li>
10076 </ul>
10077 !! html+tidy
10078 <ul><li>foo</li>
10079 <li class="mw-empty-elt"></li><li>li-hack</li>
10080 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10081 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10082 <ul>
10083 <li class="mw-empty-elt"></li><li>not a li-hack
10084 </li>
10085 </ul>
10086 !! html/parsoid
10087 <ul><li> foo</li>
10088 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10089 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
10090 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10091
10092 <ul data-parsoid='{"stx":"html"}'>
10093 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10094 </li>
10095 </ul>
10096
10097 !!end
10098
10099 !! test
10100 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10101 !! options
10102 parsoid
10103 !! wikitext
10104 #foo
10105 ##bar
10106
10107 *foo
10108 **bar
10109
10110 :foo
10111 ::bar
10112 !! html
10113 <ol>
10114 <li>foo<ol>
10115 <li>bar</li>
10116 </ol></li>
10117 </ol><ul>
10118 <li>foo<ul>
10119 <li>bar</li>
10120 </ul></li>
10121 </ul><dl>
10122 <dd>foo<dl>
10123 <dd>bar</dd>
10124 </dl></dd>
10125 </dl>
10126 !! end
10127
10128 !! test
10129 Parsoid: Test of whitespace serialization with Templated bullets
10130 !! options
10131 parsoid=wt2html
10132 !! wikitext
10133 * {{bullet}}
10134 !! html/parsoid
10135 <ul>
10136 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
10137 </ul>
10138 !! end
10139
10140 # ------------------------------------------------------------------------
10141 # The next set of tests are about Parsoid's ability to handle badly nested
10142 # tags (parse, minimize scope of fixup, and roundtrip back)
10143 # ------------------------------------------------------------------------
10144
10145 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10146 # Parsoid's list handling is more aware of block structure.
10147 !! test
10148 Unbalanced closing block tags break a list
10149 !! wikitext
10150 <div>
10151 *a</div><div>
10152 *b</div>
10153 !! html+tidy
10154 <div>
10155 <ul><li>a</li></ul></div><div>
10156 <li>b</li></div>
10157 !! html/parsoid
10158 <div><ul>
10159 <li>a</li>
10160 </ul></div>
10161 <div><ul>
10162 <li>b</li>
10163 </ul></div>
10164 !! end
10165
10166 !! test
10167 Unbalanced closing non-block tags don't break a list
10168 !! options
10169 parsoid=wt2html,html2html
10170 !! wikitext
10171 <span>
10172 *a</span><span>
10173 *b</span>
10174 !! html/php+tidy
10175 <p><span>
10176 </span></p>
10177 <ul><li>a<span></span></li>
10178 <li>b</li></ul>
10179 !! html/parsoid
10180 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10181 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10182 <li>b</li></ul>
10183 !! end
10184
10185 # Parsoid does some post-dom-building cleanup
10186 # which is why its output differs from Remex.
10187 !! test
10188 Unclosed formatting tags that straddle lists are closed and reopened
10189 !! options
10190 parsoid=wt2html,wt2wt,html2html
10191 !! wikitext
10192 #<s> a
10193 #b </s>
10194 !! html/php+tidy
10195 <ol><li><s> a</s></li><s>
10196 </s><li><s>b </s></li></ol>
10197 !! html/parsoid
10198 <ol><li><s> a</s></li>
10199 <li><s>b </s></li></ol>
10200 !! end
10201
10202 # Output is ugly because of all the misnested tag fixups.
10203 !! test
10204 1. List embedded in a formatting tag
10205 !! wikitext
10206 <small>
10207 *foo
10208 </small>
10209 !! html/php+tidy
10210 <p><small>
10211 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10212 </p>
10213 !! html/parsoid
10214 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10215 <ul><li data-parsoid='{}'>foo</li></ul></small>
10216 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10217 !! end
10218
10219 # Output is ugly because of all the misnested tag fixups.
10220 !! test
10221 2. List embedded in a formatting tag in a misnested way
10222 !! wikitext
10223 <small>
10224 *a
10225 *b</small>
10226 !! html/php+tidy
10227 <p><small>
10228 </small></p><small></small><ul><small><li>a</li>
10229 </small><li><small>b</small></li></ul>
10230 !! html/parsoid
10231 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><p></p>
10232 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10233 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10234 !! end
10235
10236 ###
10237 ### Magic Words
10238 ###
10239
10240 # Note that the current date is hard-coded as
10241 # 1970-01-01T00:02:03Z (a Thursday)
10242 # when running parser tests. The timezone is also fixed to GMT, so
10243 # local date will be identical to current date.
10244
10245 !! test
10246 Magic Word: {{CURRENTDAY}}
10247 !! wikitext
10248 {{CURRENTDAY}}
10249 !! html
10250 <p>1
10251 </p>
10252 !! end
10253
10254 !! test
10255 Magic Word: {{CURRENTDAY2}}
10256 !! wikitext
10257 {{CURRENTDAY2}}
10258 !! html
10259 <p>01
10260 </p>
10261 !! end
10262
10263 !! test
10264 Magic Word: {{CURRENTDAYNAME}}
10265 !! wikitext
10266 {{CURRENTDAYNAME}}
10267 !! html
10268 <p>Thursday
10269 </p>
10270 !! end
10271
10272 !! test
10273 Magic Word: {{CURRENTDOW}}
10274 !! wikitext
10275 {{CURRENTDOW}}
10276 !! html
10277 <p>4
10278 </p>
10279 !! end
10280
10281 !! test
10282 Magic Word: {{CURRENTMONTH}}
10283 !! wikitext
10284 {{CURRENTMONTH}}
10285 !! html
10286 <p>01
10287 </p>
10288 !! end
10289
10290 !! test
10291 Magic Word: {{CURRENTMONTH1}}
10292 !! wikitext
10293 {{CURRENTMONTH1}}
10294 !! html
10295 <p>1
10296 </p>
10297 !! end
10298
10299 !! test
10300 Magic Word: {{CURRENTMONTHABBREV}}
10301 !! wikitext
10302 {{CURRENTMONTHABBREV}}
10303 !! html
10304 <p>Jan
10305 </p>
10306 !! end
10307
10308 !! test
10309 Magic Word: {{CURRENTMONTHNAME}}
10310 !! wikitext
10311 {{CURRENTMONTHNAME}}
10312 !! html
10313 <p>January
10314 </p>
10315 !! end
10316
10317 !! test
10318 Magic Word: {{CURRENTMONTHNAMEGEN}}
10319 !! wikitext
10320 {{CURRENTMONTHNAMEGEN}}
10321 !! html
10322 <p>January
10323 </p>
10324 !! end
10325
10326 !! test
10327 Magic Word: {{CURRENTTIME}}
10328 !! wikitext
10329 {{CURRENTTIME}}
10330 !! html
10331 <p>00:02
10332 </p>
10333 !! end
10334
10335 !! test
10336 Magic Word: {{CURRENTHOUR}}
10337 !! wikitext
10338 {{CURRENTHOUR}}
10339 !! html
10340 <p>00
10341 </p>
10342 !! end
10343
10344 !! test
10345 Magic Word: {{CURRENTWEEK}} (T6594)
10346 !! wikitext
10347 {{CURRENTWEEK}}
10348 !! html
10349 <p>1
10350 </p>
10351 !! end
10352
10353 !! test
10354 Magic Word: {{CURRENTYEAR}}
10355 !! wikitext
10356 {{CURRENTYEAR}}
10357 !! html
10358 <p>1970
10359 </p>
10360 !! end
10361
10362 !! test
10363 Magic Word: {{CURRENTTIMESTAMP}}
10364 !! wikitext
10365 {{CURRENTTIMESTAMP}}
10366 !! html
10367 <p>19700101000203
10368 </p>
10369 !! end
10370
10371 !! test
10372 Magic Words LOCAL (UTC)
10373 !! wikitext
10374 *{{LOCALMONTH}}
10375 *{{LOCALMONTH1}}
10376 *{{LOCALMONTHNAME}}
10377 *{{LOCALMONTHNAMEGEN}}
10378 *{{LOCALMONTHABBREV}}
10379 *{{LOCALDAY}}
10380 *{{LOCALDAY2}}
10381 *{{LOCALDAYNAME}}
10382 *{{LOCALYEAR}}
10383 *{{LOCALTIME}}
10384 *{{LOCALHOUR}}
10385 *{{LOCALWEEK}}
10386 *{{LOCALDOW}}
10387 *{{LOCALTIMESTAMP}}
10388 !! html
10389 <ul><li>01</li>
10390 <li>1</li>
10391 <li>January</li>
10392 <li>January</li>
10393 <li>Jan</li>
10394 <li>1</li>
10395 <li>01</li>
10396 <li>Thursday</li>
10397 <li>1970</li>
10398 <li>00:02</li>
10399 <li>00</li>
10400 <li>1</li>
10401 <li>4</li>
10402 <li>19700101000203</li></ul>
10403
10404 !! end
10405
10406 !! test
10407 Magic Word: {{FULLPAGENAME}}
10408 !! options
10409 title=[[User:Ævar Arnfjörð Bjarmason]]
10410 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10411 !! wikitext
10412 {{FULLPAGENAME}}
10413 !! html/*
10414 <p>User:Ævar Arnfjörð Bjarmason
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{FULLPAGENAMEE}}
10420 !! options
10421 title=[[User:Ævar Arnfjörð Bjarmason]]
10422 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10423 !! wikitext
10424 {{FULLPAGENAMEE}}
10425 !! html/*
10426 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10427 </p>
10428 !! end
10429
10430 !! test
10431 Magic Word: {{TALKSPACE}}
10432 !! options
10433 title=[[User:Ævar Arnfjörð Bjarmason]]
10434 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10435 !! wikitext
10436 {{TALKSPACE}}
10437 !! html/*
10438 <p>User talk
10439 </p>
10440 !! end
10441
10442 !! test
10443 Magic Word: {{TALKSPACE}}, same namespace
10444 !! options
10445 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10446 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10447 !! wikitext
10448 {{TALKSPACE}}
10449 !! html/*
10450 <p>User talk
10451 </p>
10452 !! end
10453
10454 !! test
10455 Magic Word: {{TALKSPACE}}, main namespace
10456 !! options
10457 title=[[Parser Test]]
10458 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10459 !! wikitext
10460 {{TALKSPACE}}
10461 !! html/*
10462 <p>Talk
10463 </p>
10464 !! end
10465
10466 !! test
10467 Magic Word: {{TALKSPACEE}}
10468 !! options
10469 title=[[User:Ævar Arnfjörð Bjarmason]]
10470 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10471 !! wikitext
10472 {{TALKSPACEE}}
10473 !! html/*
10474 <p>User_talk
10475 </p>
10476 !! end
10477
10478 !! test
10479 Magic Word: {{SUBJECTSPACE}}
10480 !! options
10481 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10482 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10483 !! wikitext
10484 {{SUBJECTSPACE}}
10485 !! html/*
10486 <p>User
10487 </p>
10488 !! end
10489
10490 !! test
10491 Magic Word: {{SUBJECTSPACE}}, same namespace
10492 !! options
10493 title=[[User:Ævar Arnfjörð Bjarmason]]
10494 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10495 !! wikitext
10496 {{SUBJECTSPACE}}
10497 !! html/*
10498 <p>User
10499 </p>
10500 !! end
10501
10502 !! test
10503 Magic Word: {{SUBJECTSPACE}}, main namespace
10504 !! options
10505 title=[[Parser Test]]
10506 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10507 !! wikitext
10508 {{SUBJECTSPACE}}
10509 !! html/*
10510
10511 !! end
10512
10513 !! test
10514 Magic Word: {{SUBJECTSPACEE}}
10515 !! options
10516 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10517 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10518 !! wikitext
10519 {{SUBJECTSPACEE}}
10520 !! html/*
10521 <p>User
10522 </p>
10523 !! end
10524
10525 !! test
10526 Magic Word: {{NAMESPACE}}
10527 !! options
10528 title=[[User:Ævar Arnfjörð Bjarmason]]
10529 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10530 !! wikitext
10531 {{NAMESPACE}}
10532 !! html/*
10533 <p>User
10534 </p>
10535 !! end
10536
10537 !! test
10538 Magic Word: {{NAMESPACEE}}
10539 !! options
10540 title=[[User:Ævar Arnfjörð Bjarmason]]
10541 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10542 !! wikitext
10543 {{NAMESPACEE}}
10544 !! html/*
10545 <p>User
10546 </p>
10547 !! end
10548
10549 !! test
10550 Magic Word: {{NAMESPACENUMBER}}
10551 !! options
10552 title=[[User:Ævar Arnfjörð Bjarmason]]
10553 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10554 !! wikitext
10555 {{NAMESPACENUMBER}}
10556 !! html/*
10557 <p>2
10558 </p>
10559 !! end
10560
10561 !! test
10562 Magic Word: {{SUBPAGENAME}}
10563 !! options
10564 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10565 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10566 !! wikitext
10567 {{SUBPAGENAME}}
10568 !! html/*
10569 <p>sub ö
10570 </p>
10571 !! end
10572
10573 !! test
10574 Magic Word: {{SUBPAGENAMEE}}
10575 !! options
10576 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10577 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10578 !! wikitext
10579 {{SUBPAGENAMEE}}
10580 !! html/*
10581 <p>sub_%C3%B6
10582 </p>
10583 !! end
10584
10585 !! test
10586 Magic Word: {{ROOTPAGENAME}}
10587 !! options
10588 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10589 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10590 !! wikitext
10591 {{ROOTPAGENAME}}
10592 !! html/*
10593 <p>Ævar Arnfjörð Bjarmason
10594 </p>
10595 !! end
10596
10597 !! test
10598 Magic Word: {{ROOTPAGENAMEE}}
10599 !! options
10600 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{ROOTPAGENAMEE}}
10604 !! html/*
10605 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{BASEPAGENAME}}
10611 !! options
10612 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10613 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10614 !! wikitext
10615 {{BASEPAGENAME}}
10616 !! html/*
10617 <p>Ævar Arnfjörð Bjarmason
10618 </p>
10619 !! end
10620
10621 !! test
10622 Magic Word: {{BASEPAGENAMEE}}
10623 !! options
10624 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10625 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10626 !! wikitext
10627 {{BASEPAGENAMEE}}
10628 !! html/*
10629 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10630 </p>
10631 !! end
10632
10633 !! test
10634 Magic Word: {{TALKPAGENAME}}
10635 !! options
10636 title=[[User:Ævar Arnfjörð Bjarmason]]
10637 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10638 !! wikitext
10639 {{TALKPAGENAME}}
10640 !! html/*
10641 <p>User talk:Ævar Arnfjörð Bjarmason
10642 </p>
10643 !! end
10644
10645 !! test
10646 Magic Word: {{TALKPAGENAMEE}}
10647 !! options
10648 title=[[User:Ævar Arnfjörð Bjarmason]]
10649 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10650 !! wikitext
10651 {{TALKPAGENAMEE}}
10652 !! html/*
10653 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10654 </p>
10655 !! end
10656
10657 !! test
10658 Magic Word: {{SUBJECTPAGENAME}}
10659 !! options
10660 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10661 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10662 !! wikitext
10663 {{SUBJECTPAGENAME}}
10664 !! html/*
10665 <p>User:Ævar Arnfjörð Bjarmason
10666 </p>
10667 !! end
10668
10669 !! test
10670 Magic Word: {{SUBJECTPAGENAMEE}}
10671 !! options
10672 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10673 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10674 !! wikitext
10675 {{SUBJECTPAGENAMEE}}
10676 !! html/*
10677 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10678 </p>
10679 !! end
10680
10681 !! test
10682 Magic Word: {{NUMBEROFFILES}}
10683 !! options
10684 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10685 !! wikitext
10686 {{NUMBEROFFILES}}
10687 !! html/*
10688 <p>7
10689 </p>
10690 !! end
10691
10692 !! test
10693 Magic Word: {{PAGENAME}}
10694 !! options
10695 title=[[User:Ævar Arnfjörð Bjarmason]]
10696 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10697 !! wikitext
10698 {{PAGENAME}}
10699 !! html/*
10700 <p>Ævar Arnfjörð Bjarmason
10701 </p>
10702 !! end
10703
10704 !! test
10705 Magic Word: {{PAGENAME}} with metacharacters
10706 !! options
10707 title=[['foo & bar = baz']]
10708 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10709 !! wikitext
10710 ''{{PAGENAME}}''
10711 !! html+tidy
10712 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10713 </p>
10714 !! end
10715
10716 !! test
10717 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10718 !! options
10719 title=[[*RFC 1234 http://example.com/]]
10720 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10721 !! wikitext
10722 {{PAGENAME}}
10723 !! html+tidy
10724 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10725 </p>
10726 !! end
10727
10728 !! test
10729 Magic Word: {{PAGENAMEE}}
10730 !! options
10731 title=[[User:Ævar Arnfjörð Bjarmason]]
10732 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10733 !! wikitext
10734 {{PAGENAMEE}}
10735 !! html/*
10736 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10737 </p>
10738 !! end
10739
10740 !! test
10741 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10742 !! options
10743 title=[[*RFC 1234 http://example.com/]]
10744 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10745 !! wikitext
10746 {{PAGENAMEE}}
10747 !! html+tidy
10748 <p>&#42;RFC_1234_http&#58;//example.com/
10749 </p>
10750 !! end
10751
10752 !! test
10753 Magic Word: {{REVISIONID}}
10754 !! options
10755 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10756 showflags
10757 !! wikitext
10758 {{REVISIONID}}
10759 !! html/*
10760 <p>1337
10761 </p>
10762 flags=vary-revision-id
10763 !! end
10764
10765 !! test
10766 Magic Word: {{SCRIPTPATH}}
10767 !! options
10768 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10769 !! wikitext
10770 {{SCRIPTPATH}}
10771 !! html/*
10772
10773 !! end
10774
10775 !! test
10776 Magic Word: {{STYLEPATH}}
10777 !! options
10778 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10779 !! wikitext
10780 {{STYLEPATH}}
10781 !! html/*
10782 <p>/skins
10783 </p>
10784 !! end
10785
10786 !! test
10787 Magic Word: {{SERVER}}
10788 !! options
10789 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10790 !! wikitext
10791 {{SERVER}}
10792 !! html/*
10793 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10794 </p>
10795 !! end
10796
10797 !! test
10798 Magic Word: {{SERVERNAME}}
10799 !! options
10800 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10801 !! wikitext
10802 {{SERVERNAME}}
10803 !! html/*
10804 <p>example.org
10805 </p>
10806 !! end
10807
10808 !! test
10809 Magic Word: {{SITENAME}}
10810 !! options
10811 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10812 !! wikitext
10813 {{SITENAME}}
10814 !! html/*
10815 <p>MediaWiki
10816 </p>
10817 !! end
10818
10819 !! test
10820 Magic Word: {{PAGELANGUAGE}}
10821 !! options
10822 language=fr
10823 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10824 !! wikitext
10825 {{PAGELANGUAGE}}
10826 !! html/*
10827 <p>fr
10828 </p>
10829 !! end
10830
10831 !! test
10832 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10833 !! options
10834 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10835 !! wikitext
10836 {{PAGELANGUAGE}}
10837 !! html/*
10838 <p>en
10839 </p>
10840 !! end
10841
10842 !! test
10843 Case-sensitive magic words, when cased differently, should just be template transclusions
10844 !! wikitext
10845 {{CurrentMonth}}
10846 {{currentday}}
10847 {{cURreNTweEK}}
10848 {{currentHour}}
10849 !! html
10850 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10851 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10852 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10853 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10854 </p>
10855 !! end
10856
10857 !! test
10858 Case-insensitive magic words should still work with weird casing.
10859 !! wikitext
10860 {{sErVeRNaMe}}
10861 {{LCFirst:AOEU}}
10862 {{ucFIRST:aoeu}}
10863 {{SERver}}
10864 !! html
10865 <p>example.org
10866 aOEU
10867 Aoeu
10868 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10869 </p>
10870 !! end
10871
10872 # From plwiki:PLOS_ONE
10873 !! test
10874 Parsoid: Page property magic word with magic word contents
10875 !! wikitext
10876 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10877 !! html/parsoid
10878 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10879 !! end
10880
10881 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10882 # But, this is a limitation of our representation and is documented in
10883 # TemplateHandler.js in processSpecialMagicWord
10884 !! test
10885 Parsoid: Template-generated DISPLAYTITLE
10886 !! wikitext
10887 {{{{echo|DISPLAYTITLE}}:Foo}}
10888 !! options
10889 showtitle
10890 !! config
10891 wgAllowDisplayTitle=true
10892 wgRestrictDisplayTitle=false
10893 !! html/php
10894 Foo
10895
10896 !! html/parsoid
10897 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10898 !! end
10899
10900 !! test
10901 Namespace 1 {{ns:1}}
10902 !! wikitext
10903 {{ns:1}}
10904 !! html
10905 <p>Talk
10906 </p>
10907 !! end
10908
10909 !! test
10910 Namespace 1 {{ns:01}}
10911 !! wikitext
10912 {{ns:01}}
10913 !! html
10914 <p>Talk
10915 </p>
10916 !! end
10917
10918 !! test
10919 Namespace 0 {{ns:0}} (T6783)
10920 !! wikitext
10921 {{ns:0}}
10922 !! html
10923
10924 !! end
10925
10926 !! test
10927 Namespace 0 {{ns:00}} (T6783)
10928 !! wikitext
10929 {{ns:00}}
10930 !! html
10931
10932 !! end
10933
10934 !! test
10935 Namespace -1 {{ns:-1}}
10936 !! wikitext
10937 {{ns:-1}}
10938 !! html
10939 <p>Special
10940 </p>
10941 !! end
10942
10943 !! test
10944 Namespace User {{ns:User}}
10945 !! wikitext
10946 {{ns:User}}
10947 !! html
10948 <p>User
10949 </p>
10950 !! end
10951
10952 !! test
10953 Namespace User talk {{ns:User_talk}}
10954 !! wikitext
10955 {{ns:User_talk}}
10956 !! html
10957 <p>User talk
10958 </p>
10959 !! end
10960
10961 !! test
10962 Namespace User talk {{ns:uSeR tAlK}}
10963 !! wikitext
10964 {{ns:uSeR tAlK}}
10965 !! html
10966 <p>User talk
10967 </p>
10968 !! end
10969
10970 !! test
10971 Namespace File {{ns:File}}
10972 !! wikitext
10973 {{ns:File}}
10974 !! html
10975 <p>File
10976 </p>
10977 !! end
10978
10979 !! test
10980 Namespace File {{ns:Image}}
10981 !! wikitext
10982 {{ns:Image}}
10983 !! html
10984 <p>File
10985 </p>
10986 !! end
10987
10988 !! test
10989 Namespace (lang=de) Benutzer {{ns:User}}
10990 !! options
10991 language=de
10992 !! wikitext
10993 {{ns:User}}
10994 !! html
10995 <p>Benutzer
10996 </p>
10997 !! end
10998
10999 !! test
11000 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11001 !! options
11002 language=de
11003 !! wikitext
11004 {{ns:3}}
11005 !! html
11006 <p>Benutzer Diskussion
11007 </p>
11008 !! end
11009
11010 !! test
11011 Urlencode
11012 !! wikitext
11013 {{urlencode:hi world?!}}
11014 {{urlencode:hi world?!|WIKI}}
11015 {{urlencode:hi world?!|PATH}}
11016 {{urlencode:hi world?!|QUERY}}
11017 !! html/php
11018 <p>hi+world%3F%21
11019 hi_world%3F!
11020 hi%20world%3F%21
11021 hi+world%3F%21
11022 </p>
11023 !! end
11024
11025 !! test
11026 Magic Word: prioritize type info over data-parsoid
11027 !! options
11028 parsoid=html2wt
11029 !! html/parsoid
11030 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11031 !! wikitext
11032 __FORCETOC__
11033 !! end
11034
11035 !! test
11036 Magic Word: serialize on separate line (parsoid)
11037 !! options
11038 parsoid=wt2wt,html2wt
11039 !! wikitext
11040 foo
11041 __NOTOC__
11042 bar
11043 !! html/parsoid
11044 foo<meta property="mw:PageProp/notoc"/>bar
11045 !! end
11046
11047 !! test
11048 Magic Word: rt non-english wikis
11049 !! options
11050 parsoid=wt2wt
11051 language=de
11052 !! wikitext
11053 __NOEDITSECTION__
11054 !! html/parsoid
11055 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11056 !! end
11057
11058 !!test
11059 __proto__ is treated as normal wikitext (T105997)
11060 !!wikitext
11061 __proto__
11062 !!html
11063 <p>__proto__
11064 </p>
11065 !!end
11066
11067 ###
11068 ### Magic links
11069 ###
11070 !! test
11071 Magic links: internal link to RFC (T2479)
11072 !! wikitext
11073 [[RFC 123]]
11074 !! html/php
11075 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
11076 </p>
11077 !! html/parsoid
11078 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11079 !! end
11080
11081 !! test
11082 Magic links: RFC (T2479)
11083 !! wikitext
11084 RFC 822
11085 !! html/php
11086 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11087 </p>
11088 !! html/parsoid
11089 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11090 !! end
11091
11092 !! test
11093 Magic links: RFC (T67278)
11094 !! wikitext
11095 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11096 !! html/php
11097 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
11098 </p>
11099 !! html/parsoid
11100 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
11101 !! end
11102
11103 !! test
11104 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11105 !! wikitext
11106 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11107 RFC
11108 822
11109 !! html/php
11110 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11111 RFC
11112 822
11113 </p>
11114 !! html/parsoid
11115 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
11116 RFC
11117 822</p>
11118 !! end
11119
11120 !! test
11121 Magic links: ISBN (T3937)
11122 !! wikitext
11123 ISBN 0-306-40615-2
11124 !! html/php
11125 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11126 </p>
11127 !! html/parsoid
11128 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11129 !! end
11130
11131 !! test
11132 Magic links: ISBN (T67278)
11133 !! wikitext
11134 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11135 !! html/php
11136 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11137 </p>
11138 !! html/parsoid
11139 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
11140 !! end
11141
11142 !! test
11143 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11144 !! wikitext
11145 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11146 ISBN
11147 9780316098113
11148 ISBN 978
11149 0316098113
11150 !! html/php
11151 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11152 ISBN
11153 9780316098113
11154 ISBN 978
11155 0316098113
11156 </p>
11157 !! html/parsoid
11158 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
11159 ISBN
11160 9780316098113
11161 ISBN 978
11162 0316098113</p>
11163 !! end
11164
11165 !! test
11166 Magic links: PMID incorrectly converts space to underscore
11167 !! wikitext
11168 PMID 1234
11169 !! html/php
11170 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11171 </p>
11172 !! html/parsoid
11173 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11174 !! end
11175
11176 !! test
11177 Magic links: PMID (T67278)
11178 !! wikitext
11179 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11180 !! html/php
11181 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
11182 </p>
11183 !! html/parsoid
11184 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11185 !! end
11186
11187 !! test
11188 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11189 !! wikitext
11190 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11191 PMID
11192 1234
11193 !! html/php
11194 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11195 PMID
11196 1234
11197 </p>
11198 !! html/parsoid
11199 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
11200 PMID
11201 1234</p>
11202 !! end
11203
11204 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11205 # since these are ExtLinkText, not MagicLinkText
11206 !! test
11207 Magic links: use appropriate serialization for "almost" magic links.
11208 !! wikitext
11209 X[[Special:BookSources/0978739256|foo]]
11210
11211 X[https://tools.ietf.org/html/rfc1234 foo]
11212 !! html/php
11213 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11214 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11215 </p>
11216 !! html/parsoid
11217 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11218 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11219 !! end
11220
11221 !! test
11222 Magic links: All disabled (T47942)
11223 !! options
11224 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11225 !! wikitext
11226 ISBN 0-306-40615-2
11227 PMID 1234
11228 RFC 4321
11229 !! html/php
11230 <p>ISBN 0-306-40615-2
11231 PMID 1234
11232 RFC 4321
11233 </p>
11234 !! end
11235
11236 ###
11237 ### Templates
11238 ####
11239
11240 !! test
11241 Nonexistent template
11242 !! wikitext
11243 {{thistemplatedoesnotexist}}
11244 !! html
11245 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
11246 </p>
11247 !! end
11248
11249 !! test
11250 Template with invalid target containing tags
11251 !! wikitext
11252 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11253 !! html
11254 <p>{{a<b>b</b>|foo|a=b|a = b}}
11255 </p>
11256 !! end
11257
11258 !! test
11259 Template with invalid target containing unclosed tag
11260 !! wikitext
11261 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11262 !! html
11263 <p>{{a<b>|foo|a=b|a = b}}</b>
11264 </p>
11265 !! end
11266
11267 !! test
11268 Template with invalid target containing wikilink
11269 !! wikitext
11270 {{[[Main Page]]}}
11271 !! html/php
11272 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11273 </p>
11274 !! html/parsoid
11275 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
11276 !! end
11277
11278 !! test
11279 Template with just whitespace in it, T70421
11280 !! wikitext
11281 {{echo|{{ }}}}
11282 !! html/parsoid
11283 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11284 !! end
11285
11286 !! article
11287 Template:test
11288 !! text
11289 This is a test template
11290 !! endarticle
11291
11292 !! test
11293 Simple template
11294 !! wikitext
11295 {{test}}
11296 !! html
11297 <p>This is a test template
11298 </p>
11299 !! end
11300
11301 !! test
11302 Template with explicit namespace
11303 !! wikitext
11304 {{Template:test}}
11305 !! html
11306 <p>This is a test template
11307 </p>
11308 !! end
11309
11310
11311 !! article
11312 Template:paramtest
11313 !! text
11314 This is a test template with parameter {{{param}}}
11315 !! endarticle
11316
11317 !! test
11318 Template parameter
11319 !! wikitext
11320 {{paramtest|param=foo}}
11321 !! html
11322 <p>This is a test template with parameter foo
11323 </p>
11324 !! end
11325
11326 !! article
11327 Template:paramtestnum
11328 !! text
11329 [[{{{1}}}|{{{2}}}]]
11330 !! endarticle
11331
11332 !! test
11333 Template unnamed parameter
11334 !! wikitext
11335 {{paramtestnum|Main Page|the main page}}
11336 !! html
11337 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11338 </p>
11339 !! end
11340
11341 !! article
11342 Template:templatesimple
11343 !! text
11344 (test)
11345 !! endarticle
11346
11347 !! article
11348 Template:templateredirect
11349 !! text
11350 #redirect [[Template:templatesimple]]
11351 !! endarticle
11352
11353 !! article
11354 Template:templateasargtestnum
11355 !! text
11356 {{{{{1}}}}}
11357 !! endarticle
11358
11359 !! article
11360 Template:templateasargtest
11361 !! text
11362 {{template{{{templ}}}}}
11363 !! endarticle
11364
11365 !! article
11366 Template:templateasargtest2
11367 !! text
11368 {{{{{templ}}}}}
11369 !! endarticle
11370
11371 !! test
11372 Template with template name as unnamed argument
11373 !! wikitext
11374 {{templateasargtestnum|templatesimple}}
11375 !! html
11376 <p>(test)
11377 </p>
11378 !! end
11379
11380 !! test
11381 Template with template name as argument
11382 !! wikitext
11383 {{templateasargtest|templ=simple}}
11384 !! html
11385 <p>(test)
11386 </p>
11387 !! end
11388
11389 !! test
11390 Template with template name as argument (2)
11391 !! wikitext
11392 {{templateasargtest2|templ=templatesimple}}
11393 !! html
11394 <p>(test)
11395 </p>
11396 !! end
11397
11398 !! article
11399 Template:templateasargtestdefault
11400 !! text
11401 {{{{{templ|templatesimple}}}}}
11402 !! endarticle
11403
11404 !! article
11405 Template:templa
11406 !! text
11407 '''templ'''
11408 !! endarticle
11409
11410 !! test
11411 Template with default value
11412 !! wikitext
11413 {{templateasargtestdefault}}
11414 !! html
11415 <p>(test)
11416 </p>
11417 !! end
11418
11419 !! test
11420 Template with default value (value set)
11421 !! wikitext
11422 {{templateasargtestdefault|templ=templa}}
11423 !! html
11424 <p><b>templ</b>
11425 </p>
11426 !! end
11427
11428 !! test
11429 Template redirect
11430 !! wikitext
11431 {{templateredirect}}
11432 !! html/php
11433 <p>(test)
11434 </p>
11435 !! html/parsoid
11436 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11437 !! end
11438
11439 !! test
11440 Template with argument in separate line
11441 !! wikitext
11442 {{ templateasargtest |
11443 templ = simple }}
11444 !! html
11445 <p>(test)
11446 </p>
11447 !! end
11448
11449 !! test
11450 Template with complex template as argument
11451 !! wikitext
11452 {{paramtest|
11453 param ={{ templateasargtest |
11454 templ = simple }}}}
11455 !! html
11456 <p>This is a test template with parameter (test)
11457 </p>
11458 !! end
11459
11460 !! test
11461 Templates with templated name
11462 !! wikitext
11463 {{{{echo|echo}}|foo}}
11464 {{{{echo|inner list}} }}
11465 !! html
11466 <p>foo
11467 </p>
11468 <ul><li>item 1</li></ul>
11469
11470 !! html/parsoid
11471 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11472 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
11473 !! end
11474
11475 ## Regression test; the output here isn't really that interesting.
11476 !! test
11477 Templates with templated name and top level template args
11478 !! wikitext
11479 {{1{{2{{{3}}}|4=5}}}}
11480 !! html/parsoid
11481 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11482 !! end
11483
11484 # Parsoid markup is deliberate "broken". This is an edge case.
11485 # See long comment in TemplateHandler.js:convertAttribsToString.
11486 !! test
11487 Templates with invalid templated targets
11488 !! wikitext
11489 {{echo
11490 {{echo|foo}}
11491 }}
11492 !! html/php
11493 <p>{{echo
11494 foo
11495 }}
11496 </p>
11497 !! html/parsoid
11498 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11499 foo }}</p>
11500 !! end
11501
11502 !! test
11503 Template with thumb image (with link in description)
11504 !! wikitext
11505 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11506 !! html/php
11507 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11508
11509 !! html+tidy
11510 <p>This is a test template with parameter </p><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11511 !! html/parsoid
11512 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11513 !! end
11514
11515 !! article
11516 Template:complextemplate
11517 !! text
11518 {{{1}}} {{paramtest|
11519 param ={{{param}}}}}
11520 !! endarticle
11521
11522 !! test
11523 Template with complex arguments
11524 !! wikitext
11525 {{complextemplate|
11526 param ={{ templateasargtest |
11527 templ = simple }}|[[Template:complextemplate|link]]}}
11528 !! html
11529 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11530 </p>
11531 !! end
11532
11533 !! test
11534 T2553: link with two variables in a piped link
11535 !! wikitext
11536 {|
11537 |[[{{{1}}}|{{{2}}}]]
11538 |}
11539 !! html/php
11540 <table>
11541 <tr>
11542 <td>[[{{{1}}}|{{{2}}}]]
11543 </td></tr></table>
11544
11545 !! html/parsoid
11546 <table>
11547 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11548 </tbody></table>
11549 !! end
11550
11551 # See: T2553
11552 !! test
11553 Abort table cell attribute parsing on wikilink
11554 !! wikitext
11555 {|
11556 |testing [[one|two]] |three||four
11557 |testing one two |three||four
11558 |testing="[[one|two]]" |three||four
11559 |}
11560 !! html/php
11561 <table>
11562 <tr>
11563 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
11564 <td>four
11565 </td>
11566 <td>three</td>
11567 <td>four
11568 </td>
11569 <td>testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
11570 <td>four
11571 </td></tr></table>
11572
11573 !! html/parsoid
11574 <table>
11575 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11576 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11577 <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td></tr>
11578 </tbody></table>
11579 !! end
11580
11581 !! test
11582 Don't abort table cell attribute parsing if wikilink is found in template arg
11583 !! wikitext
11584 {|
11585 |Test {{#tag:ref|One two "[[three]]" four}}
11586 |}
11587 !! html/parsoid
11588 <table>
11589 <tbody><tr><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11590 </tbody></table>
11591 !! end
11592
11593 !! test
11594 Magic variable as template parameter
11595 !! wikitext
11596 {{paramtest|param={{SITENAME}}}}
11597 !! html
11598 <p>This is a test template with parameter MediaWiki
11599 </p>
11600 !! end
11601
11602 !! article
11603 Template:linktest
11604 !! text
11605 [[{{{param}}}|link]]
11606 !! endarticle
11607
11608 !! test
11609 Template parameter as link source
11610 !! wikitext
11611 {{linktest|param=Main Page}}
11612 !! html
11613 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11614 </p>
11615 !! end
11616
11617 !!article
11618 Template:paramtest2
11619 !! text
11620 including another template, {{paramtest|param={{{arg}}}}}
11621 !! endarticle
11622
11623 !! test
11624 Template passing argument to another template
11625 !! wikitext
11626 {{paramtest2|arg='hmm'}}
11627 !! html
11628 <p>including another template, This is a test template with parameter 'hmm'
11629 </p>
11630 !! end
11631
11632 !! article
11633 Template:Linktest2
11634 !! text
11635 Main Page
11636 !! endarticle
11637
11638 !! test
11639 Template as link source
11640 !! wikitext
11641 [[{{linktest2}}]]
11642
11643 [[{{linktest2}}|Main Page]]
11644
11645 [[{{linktest2}}]]Page
11646 !! html
11647 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11648 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11649 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11650 </p>
11651 !! end
11652
11653
11654 !! article
11655 Template:loop1
11656 !! text
11657 {{loop2}}
11658 !! endarticle
11659
11660 !! article
11661 Template:loop2
11662 !! text
11663 {{loop1}}
11664 !! endarticle
11665
11666 !! test
11667 Template infinite loop
11668 !! wikitext
11669 {{loop1}}
11670 !! html
11671 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11672 </p>
11673 !! end
11674
11675 !! test
11676 Template from main namespace
11677 !! wikitext
11678 {{:Main Page}}
11679 !! html
11680 <p>blah blah
11681 </p>
11682 !! end
11683
11684 !! test
11685 Template from non-includable namespace
11686 !! options
11687 wgNonincludableNamespaces=10
11688 !! wikitext
11689 {{echo|uh oh!}}
11690 !! html
11691 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11692 </p>
11693 !! end
11694
11695 !! article
11696 Template:table
11697 !! text
11698 {|
11699 | 1 || 2
11700 |-
11701 | 3 || 4
11702 |}
11703 !! endarticle
11704
11705 !! test
11706 T2529: Template with table, not included at beginning of line
11707 !! wikitext
11708 foo {{table}}
11709 !! html
11710 <p>foo
11711 </p>
11712 <table>
11713 <tr>
11714 <td>1</td>
11715 <td>2
11716 </td></tr>
11717 <tr>
11718 <td>3</td>
11719 <td>4
11720 </td></tr></table>
11721
11722 !! end
11723
11724 !! test
11725 T2523: Template shouldn't eat newline (or add an extra one before table)
11726 !! wikitext
11727 foo
11728 {{table}}
11729 !! html
11730 <p>foo
11731 </p>
11732 <table>
11733 <tr>
11734 <td>1</td>
11735 <td>2
11736 </td></tr>
11737 <tr>
11738 <td>3</td>
11739 <td>4
11740 </td></tr></table>
11741
11742 !! end
11743
11744 !! test
11745 T2041: Template parameters shown as broken links
11746 !! wikitext
11747 {{{parameter}}}
11748 !! html
11749 <p>{{{parameter}}}
11750 </p>
11751 !! end
11752
11753 !! test
11754 Template with targets containing wikilinks
11755 !! options
11756 parsoid=wt2html
11757 !! wikitext
11758 {{[[foo]]}}
11759
11760 {{[[{{echo|foo}}]]}}
11761
11762 {{{{echo|[[foo}}]]}}
11763 !! html/php
11764 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11765 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11766 </p><p>{{[[foo}}]]
11767 </p>
11768 !! html/parsoid
11769 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11770 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11771 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11772 !! end
11773
11774 !! article
11775 Template:''
11776 !! text
11777 bar
11778 !! endarticle
11779
11780 !! test
11781 Templates: Double quotes as template target
11782 !! wikitext
11783 foo {{''}} baz
11784 !! html/php
11785 <p>foo bar baz
11786 </p>
11787 !! html/parsoid
11788 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11789 </p>
11790 !! end
11791
11792 ## This test is about making sure Parsoid's data-mw is well formed in the
11793 ## face of multiple templates with intersecting and overlapping ranges. The
11794 ## wikitext itself is wretched.
11795 !! test
11796 Templates with intersecting and overlapping ranges
11797 !! wikitext
11798 {|{{echo|
11799 <p>ha</p>}}
11800 {|{{echo|
11801 <p>ho</p>}}
11802 {{echo|{{!}}hi}}
11803 |}
11804 !! html/php+tidy
11805 <p>ha</p><table>
11806
11807 </table><p>ho</p><table>
11808
11809 <tbody><tr>
11810 <td>hi
11811 </td></tr></tbody></table>
11812 !! html/parsoid
11813 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11814
11815 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11816
11817 <tbody><tr><td>hi</td></tr>
11818 </tbody></table>
11819 !! end
11820
11821 !! article
11822 Template:MSGNW test
11823 !! text
11824 ''None'' of '''this''' should be
11825 * interpreted
11826 but rather passed unmodified
11827 {{test}}
11828 <gallery>
11829 File:Foobar.jpg
11830 </gallery>
11831 <!-- comment -->
11832 !! endarticle
11833
11834 # hmm, fix this or just deprecate msgnw and document its behavior?
11835 !! test
11836 msgnw keyword
11837 !! wikitext
11838 {{msgnw:MSGNW test}}
11839 !! html/php
11840 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11841 &#42; interpreted
11842 &#32;but rather passed unmodified
11843 &#123;&#123;test&#125;&#125;
11844 &#60;gallery&#62;
11845 File:Foobar.jpg
11846 &#60;/gallery&#62;
11847 &#60;!-- comment --&#62;
11848 </p>
11849 !! end
11850
11851 !! test
11852 int keyword
11853 !! wikitext
11854 {{int:youhavenewmessages|lots of money|not!}}
11855 !! html
11856 <p>You have lots of money (not!).
11857 </p>
11858 !! end
11859
11860 !! test
11861 int keyword - non-existing message
11862 !! wikitext
11863 {{int:var}}
11864 !! html
11865 <p>⧼var⧽
11866 </p>
11867 !! end
11868
11869 !! article
11870 Template:Includes
11871 !! text
11872 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11873 !! endarticle
11874
11875 !! test
11876 <includeonly> and <noinclude> being included
11877 !! wikitext
11878 {{Includes}}
11879 !! html
11880 <p>Foobar
11881 </p>
11882 !! end
11883
11884 !! article
11885 Template:Includes2
11886 !! text
11887 <onlyinclude>Foo</onlyinclude>bar
11888 !! endarticle
11889
11890 !! test
11891 <onlyinclude> being included
11892 !! wikitext
11893 {{Includes2}}
11894 !! html
11895 <p>Foo
11896 </p>
11897 !! end
11898
11899
11900 !! article
11901 Template:Includes3
11902 !! text
11903 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11904 !! endarticle
11905
11906 !! test
11907 <onlyinclude> and <includeonly> being included
11908 !! wikitext
11909 {{Includes3}}
11910 !! html
11911 <p>Foo
11912 </p>
11913 !! end
11914
11915 !! test
11916 <includeonly> and <noinclude> on a page
11917 !! wikitext
11918 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11919 !! html
11920 <p>Foozar
11921 </p>
11922 !! end
11923
11924 !! test
11925 Un-closed <noinclude>
11926 !! wikitext
11927 <noinclude>
11928 !! html
11929 !! end
11930
11931 !! test
11932 <onlyinclude> on a page
11933 !! wikitext
11934 <onlyinclude>Foo</onlyinclude>bar
11935 !! html
11936 <p>Foobar
11937 </p>
11938 !! end
11939
11940 !! test
11941 Un-closed <onlyinclude>
11942 !! wikitext
11943 <onlyinclude>
11944 !! html
11945 !! end
11946
11947 !!test
11948 Self-closed noinclude, includeonly, onlyinclude tags
11949 !! wikitext
11950 <noinclude />
11951 <includeonly />
11952 <onlyinclude />
11953 !! html
11954 <p><br />
11955 </p>
11956 !!end
11957
11958 !!test
11959 Unbalanced includeonly and noinclude tags
11960 !! wikitext
11961 {|
11962 |a</noinclude>
11963 |b</noinclude></noinclude>
11964 |c</noinclude></includeonly>
11965 |d</includeonly></includeonly>
11966 |}
11967 !! html
11968 <table>
11969 <tr>
11970 <td>a
11971 </td>
11972 <td>b
11973 </td>
11974 <td>c&lt;/includeonly&gt;
11975 </td>
11976 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11977 </td></tr></table>
11978
11979 !!end
11980
11981 !! article
11982 Template:Includeonly section
11983 !! text
11984 <includeonly>
11985 ==Includeonly section==
11986 </includeonly>
11987 ==Section T-1==
11988 !!endarticle
11989
11990 !! test
11991 T8563: Edit link generation for section shown by <includeonly>
11992 !! wikitext
11993 {{includeonly section}}
11994 !! html
11995 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11996 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
11997
11998 !! end
11999
12000 # Uses same input as the contents of [[Template:Includeonly section]]
12001 !! test
12002 T8563: Section extraction for section shown by <includeonly>
12003 !! options
12004 section=T-2
12005 !! wikitext
12006 <includeonly>
12007 ==Includeonly section==
12008 </includeonly>
12009 ==Section T-2==
12010 !! html
12011 ==Section T-2==
12012 !! end
12013
12014 !! test
12015 T8563: Edit link generation for section suppressed by <includeonly>
12016 !! wikitext
12017 <includeonly>
12018 ==Includeonly section==
12019 </includeonly>
12020 ==Section 1==
12021 !! html
12022 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12023
12024 !! end
12025
12026 !! test
12027 T8563: Section extraction for section suppressed by <includeonly>
12028 !! options
12029 section=1
12030 !! wikitext
12031 <includeonly>
12032 ==Includeonly section==
12033 </includeonly>
12034 ==Section 1==
12035 !! html
12036 ==Section 1==
12037 !! end
12038
12039 !! test
12040 Un-closed <includeonly>
12041 !! wikitext
12042 <includeonly>
12043 !! html/php
12044 !! html/parsoid
12045 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
12046 !! end
12047
12048 ## We used to, but no longer wt2wt this test since the default serializer
12049 ## will normalize the include directives to serialize on their own line.
12050 ## Selser will take care of preserving formatting in scenarios where they
12051 ## intermingled with other wikitext.
12052 !! test
12053 Includes and comments at SOL
12054 !! options
12055 parsoid=wt2html,html2html
12056 !! wikitext
12057 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12058
12059 <noinclude>
12060 some
12061 </noinclude>*stuff
12062 *here
12063
12064 <includeonly>can have stuff</includeonly>===here===
12065
12066 !! html/php
12067 <h2><span class="mw-headline" id="hu">hu</span></h2>
12068 <p>some
12069 </p>
12070 <ul><li>stuff</li>
12071 <li>here</li></ul>
12072 <h3><span class="mw-headline" id="here">here</span></h3>
12073
12074 !! html/parsoid
12075 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2 id="hu">hu</h2>
12076
12077 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12078 <p>some</p>
12079 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12080 <li>here</li></ul>
12081
12082 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
12083
12084 !! end
12085
12086 # TODO: test with DOM fragment reuse!
12087 !! test
12088 Parsoid: DOM fragment reuse
12089 !! options
12090 parsoid=wt2wt,wt2html
12091 !! wikitext
12092 a{{echo|b<table></table>c}}d
12093
12094 a{{echo|b
12095 <table></table>
12096 c}}d
12097
12098 {{echo|a
12099
12100 <table></table>
12101
12102 b}}
12103 !! html
12104 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
12105
12106 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
12107 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12108 </span><p about="#mwt2">cd</p>
12109
12110 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
12111
12112 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12113
12114 </span><p about="#mwt3">b</p>
12115 !! end
12116
12117 !! test
12118 Parsoid: Merge double tds (T52603)
12119 !! options
12120 parsoid
12121 !! wikitext
12122 {|
12123 |{{echo|{{!}} foo}}
12124 |}
12125 !! html
12126 <table><tbody>
12127 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
12128 </tbody></table>
12129 !! end
12130
12131 !! test
12132 Parsoid: Merge double tds in nested transclusion content (T52603)
12133 !! options
12134 parsoid
12135 !! wikitext
12136 {{echo|<div>}}
12137 {|
12138 |{{echo|{{!}} foo}}
12139 |}
12140 {{echo|</div>}}
12141 !! html
12142 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
12143 <table><tbody>
12144 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12145 </tbody></table>
12146 </div>
12147 !! end
12148
12149 ###
12150 ### <includeonly> and <noinclude> in attributes
12151 ###
12152 !!test
12153 0. includeonly around the entire attribute
12154 !! wikitext
12155 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12156 !! html
12157 <p><span id="v2">bar</span>
12158 </p>
12159 !!end
12160
12161 !!test
12162 1. includeonly in html attr key
12163 !! wikitext
12164 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12165 !! html
12166 <p><span id="foo">bar</span>
12167 </p>
12168 !!end
12169
12170 !!test
12171 2. includeonly in html attr value
12172 !! wikitext
12173 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12174 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12175 !! html
12176 <p><span id="v1">bar</span>
12177 <span id="v1">bar</span>
12178 </p>
12179 !!end
12180
12181 !!test
12182 3. includeonly in part of an attr value
12183 !! wikitext
12184 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12185 !! html
12186 <p><span style="color:red;">bar</span>
12187 </p>
12188 !!end
12189
12190 !!test
12191 4. includeonly in table attributes
12192 !! wikitext
12193 {|
12194 |- <noinclude>
12195 |-
12196 |a
12197 </noinclude>
12198 |- <includeonly>
12199 |-
12200 |b
12201 </includeonly>
12202 |}
12203 !! html
12204 <table>
12205
12206
12207 <tr>
12208 <td>a
12209 </td></tr>
12210 </table>
12211
12212 !!end
12213
12214 ###
12215 ### Preprocessor precedence tests
12216 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12217 ###
12218 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12219 !! test
12220 Preprocessor precedence 1: link is rightmost opening
12221 !! options
12222 parsoid=wt2html
12223 !! wikitext
12224 {{[[Foo|bar}}]]
12225
12226 But close-brace is not a valid character in a link title:
12227 {{[[Foo}}|bar]]
12228
12229 However, we can still tell this was handled as a link in the preprocessor:
12230 {{echo|[[Foo}}|bar]]|bat}}
12231 !! html/php
12232 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12233 </p><p>But close-brace is not a valid character in a link title:
12234 {{[[Foo}}|bar]]
12235 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12236 [[Foo}}|bar]]
12237 </p>
12238 !! html/parsoid
12239 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12240 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12241 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12242 !! end
12243
12244 !! test
12245 Preprocessor precedence 2: template is rightmost opening
12246 !! options
12247 language=zh
12248 !! wikitext
12249 -{{echo|foo}-}}-
12250 !! html/php
12251 <p>-foo}--
12252 </p>
12253 !! html/parsoid
12254 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12255 !! end
12256
12257 !! test
12258 Preprocessor precedence 3: language converter is rightmost opening
12259 !! options
12260 language=zh
12261 parsoid=wt2html
12262 !! wikitext
12263 {{echo|hi}}
12264
12265 {{-{R|echo|hi}}}-
12266
12267 [[-{R|raw]]}-
12268 !! html/php
12269 <p>hi
12270 </p><p>{{echo|hi}}
12271 </p><p>[[raw]]
12272 </p>
12273 !! html/parsoid
12274 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12275 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12276 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12277 !! end
12278
12279 !! test
12280 Preprocessor precedence 4: left-most angle bracket
12281 !! options
12282 language=zh
12283 !! wikitext
12284 <!--{raw}-->
12285 !! html/php
12286 !! html/parsoid
12287 <!--{raw}-->
12288 !! end
12289
12290 !! article
12291 Template:Precedence5
12292 !! text
12293 {{{{{1}}}}}
12294 !! endarticle
12295
12296 !! test
12297 Preprocessor precedence 5: tplarg takes precedence over template
12298 !! wikitext
12299 {{Precedence5|Bullet}}
12300 !! html/php
12301 <ul><li>Bar</li></ul>
12302
12303 !! html/parsoid
12304 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12305 !! end
12306
12307 !! test
12308 Preprocessor precedence 6: broken link is rightmost opening
12309 !! options
12310 parsoid=wt2html
12311 !! wikitext
12312 {{echo|[[Foo}}
12313
12314 {{echo|[[Foo|bar|bat=baz}}
12315 !! html/php
12316 <p>{{echo|[[Foo}}
12317 </p><p>{{echo|[[Foo|bar|bat=baz}}
12318 </p>
12319 !! html/parsoid
12320 <p>{{echo|[[Foo}}</p>
12321 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12322 !! end
12323
12324 # This next test exposes a difference between PHP and Parsoid:
12325 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12326 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12327 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12328 # outer `[[Foo` extends until the `y]]`
12329 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12330 # intermediate result (after template expansion), and link processing
12331 # happens on this intermediate result, which moves the wikilink
12332 # boundary leftward to `[[Foo|Bar]]`
12333 # 2b) Parsoid works in a single step, so it's going to keep the
12334 # wikilink as extending to the `y]]`
12335 # 3a) Then PHP does linktrail processing which slurps up the trailing
12336 # `xy` inside the link.
12337 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12338 # `z` inside the link.
12339 # This is "correct" behavior. Parsoid's basic worldview is that the
12340 # `]]` inside the template shouldn't be allowed to leak out to affect
12341 # the surrounding wikilink. PHP may match Parsoid (in the future)
12342 # if you use {{#balance}} (T114445).
12343
12344 !! test
12345 Preprocessor precedence 7: broken template is rightmost opening
12346 !! options
12347 parsoid=wt2html
12348 !! wikitext
12349 [[Foo|{{echo|Bar]]
12350
12351 [[Foo|{{echo|Bar]]-x}}-y]]-z
12352
12353 Careful: linktrails can move the end of the wikilink:
12354 [[Foo|{{echo|y']]a}}l]]l
12355 !! html/php
12356 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12357 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12358 </p><p>Careful: linktrails can move the end of the wikilink:
12359 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12360 </p>
12361 !! html/parsoid
12362 <p>[[Foo|{{echo|Bar]]</p>
12363 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12364 <p>Careful: linktrails can move the end of the wikilink:
12365 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12366 !! end
12367
12368 !! test
12369 Preprocessor precedence 8: broken language converter is rightmost opening
12370 !! options
12371 language=zh
12372 !! wikitext
12373 [[Foo-{R|raw]]
12374 !! html
12375 <p>[[Foo-{R|raw]]
12376 </p>
12377 !! end
12378
12379 !! article
12380 Template:Preprocessor_precedence_9
12381 !! text
12382 ;4: {{{{1}}}}
12383 ;5: {{{{{2}}}}}
12384 ;6: {{{{{{3}}}}}}
12385 ;7: {{{{{{{4}}}}}}}
12386 !! endarticle
12387
12388 !! test
12389 Preprocessor precedence 9: groups of braces
12390 !! wikitext
12391 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12392 !! html/php
12393 <dl><dt>4</dt>
12394 <dd>{Four}</dd>
12395 <dt>5</dt>
12396 <dd></dd></dl>
12397 <ul><li>Bar</li></ul>
12398 <dl><dt>6</dt>
12399 <dd>Four</dd>
12400 <dt>7</dt>
12401 <dd>{Bullet}</dd></dl>
12402
12403 !! html/parsoid
12404 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12405 <dt>4</dt>
12406 <dd>{Four}</dd>
12407 <dt>5</dt>
12408 <dd></dd>
12409 </dl><ul about="#mwt1">
12410 <li>Bar</li>
12411 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12412 <dt>6</dt>
12413 <dd>Four</dd>
12414 <dt>7</dt>
12415 <dd>{Bullet}</dd>
12416 </dl>
12417 !! end
12418
12419 !! article
12420 Template:Preprocessor_precedence_10
12421 !! text
12422 ;1: -{R|raw}-
12423 ;2: -{{Bullet}}-
12424 ;3: -{{{1}}}-
12425 ;4: -{{{{2}}}}-
12426 ;5: -{{{{{3}}}}}-
12427 ;6: -{{{{{{4}}}}}}-
12428 ;7: -{{{{{{{5}}}}}}}-
12429 !! endarticle
12430
12431 !! test
12432 Preprocessor precedence 10: groups of braces with leading dash
12433 !! options
12434 language=zh
12435 !! wikitext
12436 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12437 !! html/php
12438 <dl><dt>1</dt>
12439 <dd>raw</dd>
12440 <dt>2</dt>
12441 <dd>-</dd></dl>
12442 <ul><li>Bar-</li></ul>
12443 <dl><dt>3</dt>
12444 <dd>-Three-</dd>
12445 <dt>4</dt>
12446 <dd>raw2</dd>
12447 <dt>5</dt>
12448 <dd>-</dd></dl>
12449 <ul><li>Bar-</li></ul>
12450 <dl><dt>6</dt>
12451 <dd>-Three-</dd>
12452 <dt>7</dt>
12453 <dd>raw2</dd></dl>
12454
12455 !! html/parsoid
12456 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12457 <dt>1</dt>
12458 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12459 <dt>2</dt>
12460 <dd>-</dd>
12461 </dl><ul about="#mwt1">
12462 <li>Bar-</li>
12463 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12464 <dt>3</dt>
12465 <dd>-Three-</dd>
12466 <dt>4</dt>
12467 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12468 <dt>5</dt>
12469 <dd>-</dd>
12470 </dl><ul about="#mwt1">
12471 <li>Bar-</li>
12472 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12473 <dt>6</dt>
12474 <dd>-Three-</dd>
12475 <dt>7</dt>
12476 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12477 </dl>
12478 !! end
12479
12480 !! test
12481 Preprocessor precedence 11: found during visual diff testing
12482 !! wikitext
12483 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12484
12485 {{echo|-{{echo|-{{echo|x}}}}}}
12486
12487 {{echo|-{{echo|x}}}}
12488 !! html/php
12489 <p><span>-<span>-x</span></span>
12490 </p><p>--x
12491 </p><p>-x
12492 </p>
12493 !! html/parsoid
12494 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12495
12496 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12497
12498 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12499 !! end
12500
12501 !! test
12502 Preprocessor precedence 12: broken language converter closed by brace.
12503 !! options
12504 parsoid=wt2html
12505 !! wikitext
12506 This form breaks the template, which is unfortunate:
12507 *{{echo|foo-{bar}bat}}
12508
12509 But if the broken language converter markup is inside an extension
12510 tag, nothing bad happens:
12511 *<nowiki>foo-{bar}bat</nowiki>
12512 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12513 *<pre>foo-{bar}bat</pre>
12514 *{{echo|<pre>foo-{bar}bat</pre>}}
12515
12516 <tag>foo-{bar}bat</tag>
12517 {{echo|<tag>foo-{bar}bat</tag>}}
12518
12519 !! html/php+tidy
12520 <p>This form breaks the template, which is unfortunate:
12521 </p>
12522 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12523 <p>But if the broken language converter markup is inside an extension
12524 tag, nothing bad happens:
12525 </p>
12526 <ul><li>foo-&#123;bar}bat</li>
12527 <li>foo-&#123;bar}bat</li>
12528 <li><pre>foo-{bar}bat</pre></li>
12529 <li><pre>foo-{bar}bat</pre></li></ul>
12530 <pre>'foo-{bar}bat'
12531 array (
12532 )
12533 </pre>
12534 <pre>'foo-{bar}bat'
12535 array (
12536 )
12537 </pre>
12538 !! html/parsoid
12539 <p>This form breaks the template, which is unfortunate:</p>
12540 <ul>
12541 <li>{{echo|foo-{bar}bat}}</li>
12542 </ul>
12543 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12544 <ul>
12545 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12546 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12547 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12548 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12549 </ul>
12550 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12551 !! end
12552
12553 !! test
12554 Preprocessor precedence 13: broken language converter in external link
12555 !! options
12556 parsoid=wt2html
12557 !! wikitext
12558 *[http://example.com/-{foo Example in URL]
12559 *[http://example.com Example in -{link} description]
12560 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12561 !! html/php+tidy
12562 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12563 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12564 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12565 !! html/parsoid
12566 <ul>
12567 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12568 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12569 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12570 </ul>
12571 !! end
12572
12573 !! test
12574 Preprocessor precedence 14: broken language converter in comment
12575 !! wikitext
12576 *<!--{{foo}}-->...should be ok
12577 *<!---{{foo}}-->...extra dashes
12578 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12579 !! html/php+tidy
12580 <ul><li>...should be ok</li>
12581 <li>...extra dashes</li>
12582 <li>foobat...should be ok</li></ul>
12583 !! html/parsoid
12584 <ul>
12585 <li><!--{{foo}}-->...should be ok</li>
12586 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12587 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
12588 </ul>
12589 !! end
12590
12591 !! test
12592 Preprocessor precedence 15: broken brace markup in headings
12593 !! config
12594 wgFragmentMode=[ 'html5', 'legacy' ]
12595 !! options
12596 parsoid=wt2html
12597 !! wikitext
12598 __NOTOC__ __NOEDITSECTION__
12599 ===1 foo[bar 1===
12600 1
12601 ===2 foo[[bar 2===
12602 2
12603 ===3 foo{bar 3===
12604 3
12605 ===4 foo{{bar 4===
12606 4
12607 ===5 foo{{{bar 5===
12608 5
12609 ===6 foo-{bar 6===
12610 6
12611 !! html/php+tidy
12612 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12613 <p>1
12614 </p>
12615 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12616 <p>2
12617 </p>
12618 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12619 <p>3
12620 </p>
12621 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12622 <p>4
12623 </p>
12624 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12625 <p>5
12626 </p>
12627 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12628 <p>6
12629 </p>
12630 !! html/parsoid
12631 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12632 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12633 <p>1</p>
12634 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12635 <p>2</p>
12636 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12637 <p>3</p>
12638 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12639 <p>4</p>
12640 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12641 <p>5</p>
12642 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12643 <p>6</p>
12644 !! end
12645
12646 !! test
12647 Preprocessor precedence 16: matching closing braces to opening braces
12648 !! options
12649 language=zh
12650 parsoid=wt2html
12651 !! wikitext
12652 -{{{echo|foo}}bar}-
12653 !! html/php
12654 <p>foobar
12655 </p>
12656 !! html/parsoid
12657 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12658 !! end
12659
12660 !! test
12661 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12662 !! options
12663 parsoid=wt2html
12664 !! wikitext
12665 {{echo|hi {{}}}}
12666 !! html/php
12667 <p>hi {{}}
12668 </p>
12669 !! html/parsoid
12670 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12671 !! end
12672
12673 # Ensure we're using a language without variants for this test; even
12674 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12675 !! test
12676 Preprocessor precedence 18: another rightmost wins scenario
12677 !! options
12678 parsoid=wt2html
12679 language=de
12680 !! wikitext
12681 {{ -{{{{1|tplarg}}} }} }-
12682 !! html/php
12683 <p>{{ -{tplarg }} }-
12684 </p>
12685 !! html/parsoid
12686 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12687 !! end
12688
12689 !! test
12690 Preprocessor precedence 19: break syntax
12691 !! options
12692 parsoid=wt2html
12693 !! wikitext
12694 -{{
12695 !! html/php
12696 <p>-{{
12697 </p>
12698 !! html/parsoid
12699 <p>-{{</p>
12700 !! end
12701
12702 ###
12703 ### Token Stream Patcher tests
12704 ###
12705 ### These tests won't always pass wt2wt and other modes because
12706 ### on serialization, the table will be output on a new line.
12707 ### For now, we are blacklisting them, and using this to test selser.
12708 ###
12709
12710 !!test
12711 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12712 !!options
12713 parsoid=wt2html,wt2wt
12714 !!wikitext
12715 {{echo|}}{| width = '100%'
12716 |foo
12717 |}
12718 !!html/parsoid
12719 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12720 <tbody><tr><td>foo</td></tr>
12721 </tbody></table>
12722 !!end
12723
12724 ## We used to, but no longer wt2wt this test since the default serializer
12725 ## will normalize the include directives to serialize on their own line.
12726 ## Selser will take care of preserving formatting in scenarios where they
12727 ## intermingled with other wikitext.
12728 !!test
12729 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12730 !!options
12731 parsoid=wt2html
12732 !!wikitext
12733 <includeonly>a</includeonly>{| {{{b}}}
12734 |c
12735 |}
12736 !!html/parsoid
12737 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12738 <tbody><tr><td>c</td></tr>
12739 </tbody></table>
12740 !!end
12741
12742 !! test
12743 Table wikitext syntax outside wiki-tables
12744 !! wikitext
12745 a
12746 |+ not a caption
12747 ! not a table heading
12748 |- not a table row
12749 | not a table cell
12750 | class="foo bar" | baz
12751 b
12752 |}
12753 |-
12754 c
12755 !! html
12756 <p>a
12757 |+ not a caption
12758 ! not a table heading
12759 |- not a table row
12760 | not a table cell
12761 | class="foo bar" | baz
12762 b
12763 |}
12764 |-
12765 c
12766 </p>
12767 !! end
12768
12769 ###
12770 ### Testing parsing of templates where a template arg
12771 ### has the same name as the template itself.
12772 ###
12773
12774 !! article
12775 Template:quote
12776 !! text
12777 {{{quote|{{{1}}}}}}
12778 !! endarticle
12779
12780 !!test
12781 Templates: Template Name/Arg clash: 1. Use of positional param
12782 !! wikitext
12783 {{quote|foo}}
12784 !! html
12785 <p>foo
12786 </p>
12787 !!end
12788
12789 !!test
12790 Templates: Template Name/Arg clash: 2. Use of named param
12791 !! wikitext
12792 {{quote|quote=foo}}
12793 !! html
12794 <p>foo
12795 </p>
12796 !!end
12797
12798 !!test
12799 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12800 !! wikitext
12801 {{quote|quote}}
12802 !! html
12803 <p>quote
12804 </p>
12805 !!end
12806
12807 ###
12808 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12809 ###
12810
12811 !!test
12812 Templates: 1. Simple use
12813 !! wikitext
12814 {{echo|Foo}}
12815 !! html
12816 <p>Foo
12817 </p>
12818 !!end
12819
12820 !!test
12821 Templates: 2. Inside a block tag
12822 !! wikitext
12823 <div>{{echo|Foo}}</div>
12824 <blockquote>{{echo|Foo}}</blockquote>
12825 !! html
12826 <div>Foo</div>
12827 <blockquote>Foo</blockquote>
12828
12829 !! html+tidy
12830 <div>Foo</div>
12831 <blockquote><p>Foo</p></blockquote>
12832 !!end
12833
12834 !!test
12835 Templates: P-wrapping: 1a. Templates on consecutive lines
12836 !! wikitext
12837 {{echo|Foo}}
12838 {{echo|bar}}
12839 !! html
12840 <p>Foo
12841 bar
12842 </p>
12843 !!end
12844
12845 !!test
12846 Templates: P-wrapping: 1b. Templates on consecutive lines
12847 !! wikitext
12848 Foo
12849
12850 {{echo|bar}}
12851 {{echo|baz}}
12852 !! html
12853 <p>Foo
12854 </p><p>bar
12855 baz
12856 </p>
12857 !!end
12858
12859 !!test
12860 Templates: P-wrapping: 1c. Templates on consecutive lines
12861 !! wikitext
12862 {{echo|Foo}}
12863 {{echo|bar}} <div>baz</div>
12864 !! html
12865 <p>Foo
12866 </p>
12867 bar <div>baz</div>
12868
12869 !! html+tidy
12870 <p>Foo
12871 </p><p>
12872 bar </p><div>baz</div>
12873 !! end
12874
12875 !!test
12876 Templates: P-wrapping: 1d. Template preceded by comment-only line
12877 !!options
12878 parsoid
12879 !! wikitext
12880 <!-- foo -->
12881 {{echo|Bar}}
12882 !! html
12883 <!-- foo -->
12884
12885 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12886 !!end
12887
12888 !!test
12889 Templates: Inline Text: 1. Multiple template uses
12890 !! wikitext
12891 {{echo|Foo}}bar{{echo|baz}}
12892 !! html
12893 <p>Foobarbaz
12894 </p>
12895 !!end
12896
12897 !!test
12898 Templates: Inline Text: 2. Back-to-back template uses
12899 !! wikitext
12900 {{echo|Foo}}{{echo|bar}}
12901 !! html
12902 <p>Foobar
12903 </p>
12904 !!end
12905
12906 !!test
12907 Templates: Block Tags: 1. Multiple template uses
12908 !! wikitext
12909 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12910 !! html
12911 <div>Foo</div><div>bar</div><div>baz</div>
12912
12913 !!end
12914
12915 !!test
12916 Templates: Block Tags: 2. Back-to-back template uses
12917 !! wikitext
12918 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12919 !! html
12920 <div>Foo</div><div>bar</div>
12921
12922 !!end
12923
12924 ## Parsoid drops empty elements in templates.
12925 !! test
12926 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12927 !! wikitext
12928 {{echo|a
12929 b</p>}}
12930 !! html/php+tidy
12931 <p>a
12932 </p><p>
12933 b</p><p class="mw-empty-elt"></p>
12934 !! html/parsoid
12935 <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">
12936 </span><p about="#mwt1">b</p>
12937 !! end
12938
12939 !!test
12940 Templates: Links: 1. Simple example
12941 !! wikitext
12942 {{echo|[[Foo|bar]]}}
12943 !! html
12944 <p><a href="/wiki/Foo" title="Foo">bar</a>
12945 </p>
12946 !!end
12947
12948 !!test
12949 Templates: Links: 2. Generation of link href
12950 !! wikitext
12951 [[{{echo|Foo}}|bar]]
12952 !! html
12953 <p><a href="/wiki/Foo" title="Foo">bar</a>
12954 </p>
12955 !!end
12956
12957 !!test
12958 Templates: Links: 3. Generation of part of a link href
12959 !! wikitext
12960 [[Fo{{echo|o}}|bar]]
12961
12962 [[Foo{{echo|bar}}]]
12963
12964 [[Foo{{echo|bar}}baz]]
12965
12966 [[Foo{{echo|bar}}|bar]]
12967
12968 [[:Foo{{echo|bar}}]]
12969
12970 [[:Foo{{echo|bar}}|bar]]
12971 !! html
12972 <p><a href="/wiki/Foo" title="Foo">bar</a>
12973 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12974 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12975 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12976 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12977 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12978 </p>
12979 !!end
12980
12981 !!test
12982 Templates: Links: 4. Multiple templates generating link href
12983 !! wikitext
12984 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12985 !! html
12986 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12987 </p>
12988 !!end
12989
12990 !!test
12991 Templates: Links: 5. Generation of link text
12992 !! wikitext
12993 [[Foo|{{echo|bar}}]]
12994 !! html
12995 <p><a href="/wiki/Foo" title="Foo">bar</a>
12996 </p>
12997 !!end
12998
12999 !!test
13000 Templates: Links: 5. Nested templates (only outermost template should be marked)
13001 !! wikitext
13002 {{echo|[[{{echo|Foo}}|bar]]}}
13003 !! html
13004 <p><a href="/wiki/Foo" title="Foo">bar</a>
13005 </p>
13006 !!end
13007
13008 !!test
13009 Templates: HTML Tag: 1. Generation of HTML attr. key
13010 !! wikitext
13011 <div {{echo|style}}="color:red;">foo</div>
13012 !! html
13013 <div style="color:red;">foo</div>
13014
13015 !!end
13016
13017 !!test
13018 Templates: HTML Tag: 2. Generation of HTML attr. value
13019 !! wikitext
13020 <div style={{echo|'color:red;'}}>foo</div>
13021 !! html
13022 <div style="color:red;">foo</div>
13023
13024 !!end
13025
13026 !!test
13027 Templates: HTML Tag: 3. Generation of HTML attr key and value
13028 !! wikitext
13029 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13030 !! html
13031 <div style="color:red;">foo</div>
13032
13033 !!end
13034
13035 !!test
13036 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13037 !! wikitext
13038 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13039 !! html
13040 <div title="This is a long title with just one piece templated">foo</div>
13041
13042 !!end
13043
13044 !!test
13045 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13046 !! wikitext
13047 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13048 !! html
13049 <div title="This is a long title with just one piece templated">foo</div>
13050
13051 !!end
13052
13053 !!test
13054 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13055 !! wikitext
13056 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13057 !! html
13058 <div title="This is a long title with just one piece templated">foo</div>
13059
13060 !!end
13061
13062 # SSS FIXME: While it is great we added support for all this,
13063 # do we want to make this part of the spec? Maybe we want to
13064 # deprecate this kind of usage in the future?
13065 !!test
13066 Templates: HTML Tag: 7. Generation of partial attribute key string
13067 !! wikitext
13068 <div st{{echo|yle}}="color:red;">foo</div>
13069 !! html
13070 <div style="color:red;">foo</div>
13071
13072 !!end
13073
13074 !! test
13075 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13076 !! wikitext
13077 <div {{echo|1=id="v1"}}>bar</div>
13078 !! html
13079 <div id="v1">bar</div>
13080
13081 !!end
13082
13083 !! test
13084 Templates: HTML Tag: 9. Multiple template-generated attributes
13085 !! wikitext
13086 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13087 !! html
13088 <div id="v1" title="foo">bar</div>
13089
13090 !!end
13091
13092 !! test
13093 Templates: Support for templates generating attributes and content
13094 !! wikitext
13095 {| {{mixed_attr_content_template}}
13096 |-
13097 |bar
13098 |}
13099 !! html/php
13100 <table style="color:red;" title="T48811">
13101
13102 <tr>
13103 <td>foo
13104 </td></tr>
13105 <tr>
13106 <td>bar
13107 </td></tr></table>
13108
13109 !! html/parsoid
13110 <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|}"]}'>
13111 <tbody><tr>
13112 <td>foo</td></tr>
13113 <tr>
13114 <td>bar</td></tr>
13115 </tbody></table>
13116 !!end
13117
13118 !! article
13119 Template:attribute_from_template
13120 !! text
13121 class="123"
13122 !! endarticle
13123
13124 !! test
13125 Table cell with attribute before expanded attribute
13126 !! wikitext
13127 {|
13128 | align="center" {{attribute_from_template}} |456
13129 |}
13130 !! html/parsoid
13131 <table>
13132 <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>
13133 </tbody></table>
13134 !! end
13135
13136 !! test
13137 1. Entities and nowikis inside templated attributes should be handled correctly
13138 !! wikitext
13139 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13140 !! html/php
13141 <div style="background:#f9f9f9;">foo</div>
13142
13143 !! html/parsoid
13144 <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>
13145 !! end
13146
13147 !! test
13148 2. Entities and nowikis inside templated attributes should be handled correctly
13149 !! wikitext
13150 {|
13151 |{{table_attribs_3}}
13152 |}
13153 !! html/php
13154 <table>
13155 <tr>
13156 <td style="background:#f9f9f9;">Foo
13157 </td></tr></table>
13158
13159 !! html/parsoid
13160 <table>
13161 <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>
13162 </tbody></table>
13163 !! end
13164
13165 !! test
13166 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13167 !! wikitext
13168 {{tbl-start}}
13169 |{{table_attribs_3}}
13170 {{tbl-end}}
13171 !! html/php
13172 <table>
13173 <tr>
13174 <td style="background:#f9f9f9;">Foo
13175 </td></tr></table>
13176
13177 !! html/parsoid
13178 <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}}]}'>
13179 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13180 </tbody></table>
13181 !! end
13182
13183 # T107622
13184 !! test
13185 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13186 !! wikitext
13187 {|
13188 |{{table_attribs_6}} hi
13189 |}
13190 !! html/php
13191 <table>
13192 <tr>
13193 <td style="background: red;">hi
13194 </td></tr></table>
13195
13196 !! html/parsoid
13197 <table>
13198 <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>
13199 </tbody></table>
13200 !! end
13201
13202 !!test
13203 Templates: HTML Tables: 1. Generating start of a HTML table
13204 !! wikitext
13205 {{echo|<table><tr><td>foo</td>}}</tr></table>
13206 !! html
13207 <table><tr><td>foo</td></tr></table>
13208
13209 !!end
13210
13211 !!test
13212 Templates: HTML Tables: 2a. Generating middle of a HTML table
13213 !! wikitext
13214 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13215 !! html
13216 <table><tr><td>foo</td></tr></table>
13217
13218 !!end
13219
13220 !!test
13221 Templates: HTML Tables: 2b. Generating middle of a HTML table
13222 !! wikitext
13223 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13224 !! html
13225 <table><tr><td>foo</td></tr></table>
13226
13227 !!end
13228
13229 !!test
13230 Templates: HTML Tables: 3. Generating end of a HTML table
13231 !! wikitext
13232 <table><tr>{{echo|<td>foo</td></tr></table>}}
13233 !! html
13234 <table><tr><td>foo</td></tr></table>
13235
13236 !!end
13237
13238 !!test
13239 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13240 !! wikitext
13241 {{echo|<table>}}<tr><td>foo</td></tr></table>
13242 !! html
13243 <table><tr><td>foo</td></tr></table>
13244
13245 !!end
13246
13247 !!test
13248 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13249 !! wikitext
13250 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13251 !! html
13252 <table><tr><td>foo</td></tr></table>
13253
13254 !!end
13255
13256 !!test
13257 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13258 !! wikitext
13259 <table><tr>{{echo|<td>}}foo</td></tr></table>
13260 !! html
13261 <table><tr><td>foo</td></tr></table>
13262
13263 !!end
13264
13265 !!test
13266 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13267 !! wikitext
13268 <table><tr><td>foo{{echo|</td>}}</tr></table>
13269 !! html
13270 <table><tr><td>foo</td></tr></table>
13271
13272 !!end
13273
13274 !!test
13275 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13276 !! wikitext
13277 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13278 !! html
13279 <table><tr><td>foo</td></tr></table>
13280
13281 !!end
13282
13283 !!test
13284 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13285 !! wikitext
13286 <table><tr><td>foo</td></tr>{{echo|</table>}}
13287 !! html
13288 <table><tr><td>foo</td></tr></table>
13289
13290 !!end
13291
13292 !!test
13293 Templates: HTML Tables: 5. Proper fostering of categories from inside
13294 !!options
13295 parsoid=wt2html,wt2wt
13296 !! wikitext
13297 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13298 <!--Two categories (T52330)-->
13299 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13300 !! html
13301 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13302 <!--Two categories (T52330)-->
13303 <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>
13304 !!end
13305
13306 ## Remex doesn't account for fostered content.
13307 !! test
13308 Templates: Wiki Tables: 1a. Fostering of entire template content
13309 !! wikitext
13310 {|
13311 {{echo|a}}
13312 |}
13313 !! html/php
13314 <table>
13315 a
13316 <tr><td></td></tr></table>
13317
13318 !! html/php+tidy
13319
13320 a
13321 <table><tbody><tr><td></td></tr></tbody></table>
13322 !! html/parsoid
13323 <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">
13324
13325 </table>
13326 !! end
13327
13328 !!test
13329 Templates: Wiki Tables: 1b. Fostering of entire template content
13330 !! wikitext
13331 {|
13332 {{echo|<div>}}
13333 foo
13334 {{echo|</div>}}
13335 |}
13336 !! html
13337 <table>
13338 <div>
13339 <p>foo
13340 </p>
13341 </div>
13342 <tr><td></td></tr></table>
13343
13344 !! html/php+tidy
13345 <div>
13346 <p>foo
13347 </p>
13348 </div><table>
13349
13350 <tbody><tr><td></td></tr></tbody></table>
13351 !! html/parsoid
13352 <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|}"]}'>
13353 <p>foo</p>
13354 </div><table about="#mwt3">
13355
13356 </table>
13357 !! end
13358
13359 ## Remex doesn't account for fostered content.
13360 !! test
13361 Templates: Wiki Tables: 2. Fostering of partial template content
13362 !! wikitext
13363 {|
13364 {{echo|a
13365 <div>b</div>}}
13366 |}
13367 !! html/php
13368 <table>
13369 a
13370 <div>b</div>
13371 <tr><td></td></tr></table>
13372
13373 !! html/php+tidy
13374
13375 a
13376 <div>b</div><table>
13377 <tbody><tr><td></td></tr></tbody></table>
13378 !! html/parsoid
13379 <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">
13380
13381
13382 </table>
13383 !! end
13384
13385 !!test
13386 Templates: Wiki Tables: 3. td-content via multiple templates
13387 !! wikitext
13388 {|
13389 {{echo|{{pipe}}a}}{{echo|b}}
13390 |}
13391 !! html
13392 <table>
13393 <tr>
13394 <td>ab
13395 </td></tr></table>
13396
13397 !!end
13398
13399 !!test
13400 Templates: Wiki Tables: 4. Templated tags, no content
13401 !! wikitext
13402 {{tbl-start}}
13403 {{tbl-end}}
13404 !! html
13405 <table>
13406 <tr><td></td></tr></table>
13407
13408 !!end
13409
13410 !!test
13411 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13412 !! wikitext
13413 {{tbl-start}}
13414 |foo
13415 {{tbl-end}}
13416 !! html
13417 <table>
13418 <tr>
13419 <td>foo
13420 </td></tr></table>
13421
13422 !!end
13423
13424 !!test
13425 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13426 !! wikitext
13427 {{tbl-start}}
13428 {{!}}foo
13429 {{tbl-end}}
13430 !! html
13431 <table>
13432 <tr>
13433 <td>foo
13434 </td></tr></table>
13435
13436 !!end
13437
13438 ## This test case is very specific to Parsoid's internals
13439 ## and is hence only tested for Parsoid's code. Parsoid uses
13440 ## a <meta> marker tag for <ref> tags and they are expanded
13441 ## much later. We are verifying that this <meta> tag usage
13442 ## doesn't prevent foster parenting.
13443 !! test
13444 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13445 !! wikitext
13446 {{PartialTable}}<ref>foo</ref>
13447 |}
13448
13449 <references />
13450 !! html/parsoid
13451 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
13452 <tbody>
13453 </tbody></table>
13454
13455 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13456 !! end
13457
13458 !! test
13459 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13460 !! wikitext
13461 {{echo|
13462 {{{!}}
13463 {{!}}-}}
13464 <onlyinclude>
13465 |foo
13466 </onlyinclude>
13467 {{!}}}
13468 !! html/parsoid
13469 <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{{!}}}"]}'>
13470 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13471 <tbody><tr>
13472
13473 <td>foo
13474 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13475 </tbody></table>
13476 !! end
13477
13478 !!test
13479 Templates: Lists: Multi-line list-items via templates
13480 !! wikitext
13481 *{{echo|a {{nonexistent|
13482 unused}}}}
13483 *{{echo|b {{nonexistent|
13484 unused}}}}
13485 !! html
13486 <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>
13487 <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>
13488
13489 !!end
13490
13491 !!test
13492 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13493 !! wikitext
13494 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13495 !! html
13496 <p><i>ab</i>c<i>d</i>e
13497 </p>
13498 !!end
13499
13500 !!test
13501 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13502 (PHP parser generates misnested html)
13503 !! wikitext
13504 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13505 !! html/parsoid
13506 <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>
13507 !!end
13508
13509 !!test
13510 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13511 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13512 !! options
13513 parsoid=wt2html,wt2wt
13514 !! wikitext
13515 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13516 !! html
13517 <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>
13518 <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>
13519 <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>
13520 !!end
13521
13522 !!test
13523 Templates: Ugly nesting: 4. Divs opened/closed across templates
13524 !! wikitext
13525 a<div>b{{echo|c</div>d}}e
13526 !! html
13527 a<div>bc</div>de
13528
13529 !! html+tidy
13530 <p>a</p><div>bc</div><p>de
13531 </p>
13532 !! end
13533
13534 !! test
13535 Templates: Ugly templates: 3. newline-only template parameter
13536 !! wikitext
13537 foo {{echo|
13538 }}
13539 !! html
13540 <p>foo
13541 </p>
13542 !! end
13543
13544 # This looks like a bug: a single newline triggers p/br for some reason.
13545 !! test
13546 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13547 !! wikitext
13548 {{echo|
13549 }}
13550 !! html
13551 <p><br />
13552 </p>
13553 !! end
13554
13555 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13556 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13557 !! test
13558 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13559 !! wikitext
13560 {{echo|<table>}}
13561 {{echo|<div>foo}}
13562 {{echo|</table>}}
13563 !! html/parsoid
13564 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
13565 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13566 </table>
13567 !! end
13568
13569 # T66017 -- ugly wikitext with fostered content generates two template ranges
13570 # that are "identical" and generate nesting cycles in the algorithm
13571 !! test
13572 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13573 !! wikitext
13574 {{echo|<table><tr><td><table>}}
13575 {{echo|<div>}}
13576 {{echo|</div>}}
13577 !! html/parsoid
13578 <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"}'>
13579 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13580 </table></td></tr></tbody></table>
13581 !! end
13582
13583 !! test
13584 Templates: Parameters substituted at the top-level
13585 !! wikitext
13586 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13587
13588 {{{foo|bar|baz}}}
13589 !! html/php
13590 <p><i>who</i> me? <b>never!</b>
13591 </p><p>bar
13592 </p>
13593 !! html/parsoid
13594 <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>
13595
13596 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13597 !! end
13598
13599 !! test
13600 Templates: Param with empty arg in the final position
13601 !! wikitext
13602 {{{hi|}}}
13603 !! html/parsoid
13604 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13605 !! end
13606
13607 !!test
13608 Parser Functions: 1. Simple example
13609 !! wikitext
13610 {{uc:foo}}
13611 !! html
13612 <p>FOO
13613 </p>
13614 !!end
13615
13616 !!test
13617 Parser Functions: 2. Nested use (only outermost should be marked up)
13618 !! wikitext
13619 {{uc:{{lc:FOO}}}}
13620 !! html
13621 <p>FOO
13622 </p>
13623 !!end
13624
13625 ## Note that the templates inside the references are not wrapped
13626 !! test
13627 Template nested in extension tag in template
13628 !! wikitext
13629 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13630 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13631 <references />
13632 !! html/parsoid
13633 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>[[ho|{{echo|hi}}]]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13634 <span about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>[http://test.com?q={{echo|ho}}]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt7" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="./Main_Page#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
13635 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"stx":"piped","a":{"href":"./Ho"},"sa":{"href":"ho"}}'>hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><a typeof="mw:ExpandedAttrs" about="#mwt11" rel="mw:ExtLink" class="external autonumber" href="http://test.com?q=ho" data-mw='{"attribs":[[{"txt":"href"},{"html":"http://test.com?q=ho"}]]}'></a></span></li></ol>
13636 !! end
13637
13638 ###
13639 ### Pre-save transform tests
13640 ###
13641 !! test
13642 pre-save transform: subst:
13643 !! options
13644 pst
13645 !! wikitext
13646 {{subst:test}}
13647 !! html/php
13648 This is a test template
13649 !! end
13650
13651 !! test
13652 pre-save transform: normal template
13653 !! options
13654 pst
13655 !! wikitext
13656 {{test}}
13657 !! html/php
13658 {{test}}
13659 !! end
13660
13661 !! test
13662 pre-save transform: nonexistent template
13663 !! options
13664 pst
13665 !! wikitext
13666 {{thistemplatedoesnotexist}}
13667 !! html/php
13668 {{thistemplatedoesnotexist}}
13669 !! end
13670
13671 !! test
13672 pre-save transform: subst magic variables
13673 !! options
13674 pst
13675 !! wikitext
13676 {{subst:SITENAME}}
13677 !! html/php
13678 MediaWiki
13679 !! end
13680
13681 # This is T2089, which I fixed. -- wtm
13682 !! test
13683 pre-save transform: subst: templates with parameters
13684 !! options
13685 pst
13686 !! wikitext
13687 {{subst:paramtest|param="something else"}}
13688 !! html/php
13689 This is a test template with parameter "something else"
13690 !! end
13691
13692 !! article
13693 Template:nowikitest
13694 !! text
13695 <nowiki>'''not wiki'''</nowiki>
13696 !! endarticle
13697
13698 !! test
13699 pre-save transform: nowiki in subst (T3188)
13700 !! options
13701 pst
13702 !! wikitext
13703 {{subst:nowikitest}}
13704 !! html/php
13705 <nowiki>'''not wiki'''</nowiki>
13706 !! end
13707
13708 !! article
13709 Template:commenttest
13710 !! text
13711 This template has <!-- a comment --> in it.
13712 !! endarticle
13713
13714 !! test
13715 pre-save transform: comment in subst (T3936)
13716 !! options
13717 pst
13718 !! wikitext
13719 {{subst:commenttest}}
13720 !! html/php
13721 This template has <!-- a comment --> in it.
13722 !! end
13723
13724 !! test
13725 pre-save transform: unclosed tag
13726 !! options
13727 pst
13728 !! wikitext
13729 <nowiki>'''not wiki'''
13730 !! html/php
13731 <nowiki>'''not wiki'''
13732 !! end
13733
13734 !! test
13735 pre-save transform: mixed tag case
13736 !! options
13737 pst
13738 !! wikitext
13739 <NOwiki>'''not wiki'''</noWIKI>
13740 !! html/php
13741 <NOwiki>'''not wiki'''</noWIKI>
13742 !! end
13743
13744 !! test
13745 pre-save transform: unclosed comment in <nowiki>
13746 !! options
13747 pst
13748 !! wikitext
13749 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13750 !! html/php
13751 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13752 !!end
13753
13754 # Leading @ in this template definition works around a limitation
13755 # in parsoid's parserTests which otherwise strips the <span> from the
13756 # result (confusing it for a template wrapper)
13757 !! article
13758 Template:dangerous
13759 !!text
13760 @<span onmouseover="alert('crap')">Oh no</span>
13761 !!endarticle
13762
13763 !!test
13764 (confirming safety of fix for subst T3936)
13765 !! wikitext
13766 {{Template:dangerous}}
13767 !! html
13768 <p>@<span>Oh no</span>
13769 </p>
13770 !! end
13771
13772 !! test
13773 pre-save transform: comment containing gallery (T7024)
13774 !! options
13775 pst
13776 !! wikitext
13777 <!-- <gallery>data</gallery> -->
13778 !! html/php
13779 <!-- <gallery>data</gallery> -->
13780 !!end
13781
13782 !! test
13783 pre-save transform: comment containing extension
13784 !! options
13785 pst
13786 !! wikitext
13787 <!-- <tag>data</tag> -->
13788 !! html/php
13789 <!-- <tag>data</tag> -->
13790 !!end
13791
13792 !! test
13793 pre-save transform: comment containing nowiki
13794 !! options
13795 pst
13796 !! wikitext
13797 <!-- <nowiki>data</nowiki> -->
13798 !! html/php
13799 <!-- <nowiki>data</nowiki> -->
13800 !!end
13801
13802 !! test
13803 pre-save transform: <noinclude> in subst (T5298)
13804 !! options
13805 pst
13806 !! wikitext
13807 {{subst:Includes}}
13808 !! html/php
13809 Foobar
13810 !! end
13811
13812 !! test
13813 pre-save transform: <onlyinclude> in subst (T5298)
13814 !! options
13815 pst
13816 !! wikitext
13817 {{subst:Includes2}}
13818 !! html/php
13819 Foo
13820 !! end
13821
13822 !! article
13823 Template:SubstTest
13824 !!text
13825 {{<includeonly>subst:</includeonly>Includes}}
13826 !! endarticle
13827
13828 !! article
13829 Template:SafeSubstTest
13830 !! text
13831 {{<includeonly>safesubst:</includeonly>Includes}}
13832 !! endarticle
13833
13834 !! test
13835 T24297: safesubst: works during PST
13836 !! options
13837 pst
13838 !! wikitext
13839 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13840 !! html/php
13841 FoobarFoobar
13842 !! end
13843
13844 !! test
13845 T24297: safesubst: works during normal parse
13846 !! wikitext
13847 {{SafeSubstTest}}
13848 !! html
13849 <p>Foobar
13850 </p>
13851 !! end
13852
13853 !! test
13854 subst: does not work during normal parse
13855 !! wikitext
13856 {{SubstTest}}
13857 !! html
13858 <p>{{subst:Includes}}
13859 </p>
13860 !! end
13861
13862 !! test
13863 pre-save transform: context links ("pipe trick")
13864 !! options
13865 pst
13866 !! wikitext
13867 [[Article (context)|]]
13868 [[Bar:Article|]]
13869 [[:Bar:Article|]]
13870 [[Bar:Article (context)|]]
13871 [[:Bar:Article (context)|]]
13872 [[|Article]]
13873 [[|Article (context)]]
13874 [[Bar:X (Y) Z|]]
13875 [[:Bar:X (Y) Z|]]
13876 !! html/php
13877 [[Article (context)|Article]]
13878 [[Bar:Article|Article]]
13879 [[:Bar:Article|Article]]
13880 [[Bar:Article (context)|Article]]
13881 [[:Bar:Article (context)|Article]]
13882 [[Article]]
13883 [[Article (context)]]
13884 [[Bar:X (Y) Z|X (Y) Z]]
13885 [[:Bar:X (Y) Z|X (Y) Z]]
13886 !! end
13887
13888 !! test
13889 pre-save transform: context links ("pipe trick") with interwiki prefix
13890 !! options
13891 pst
13892 !! wikitext
13893 [[interwiki:Article|]]
13894 [[:interwiki:Article|]]
13895 [[interwiki:Bar:Article|]]
13896 [[:interwiki:Bar:Article|]]
13897 !! html/php
13898 [[interwiki:Article|Article]]
13899 [[:interwiki:Article|Article]]
13900 [[interwiki:Bar:Article|Bar:Article]]
13901 [[:interwiki:Bar:Article|Bar:Article]]
13902 !! end
13903
13904 !! test
13905 pre-save transform: context links ("pipe trick") with parens in title
13906 !! options
13907 pst title=[[Somearticle (context)]]
13908 !! wikitext
13909 [[|Article]]
13910 !! html/php
13911 [[Article (context)|Article]]
13912 !! end
13913
13914 !! test
13915 pre-save transform: context links ("pipe trick") with comma in title
13916 !! options
13917 pst title=[[Someplace, Somewhere]]
13918 !! wikitext
13919 [[|Otherplace]]
13920 [[Otherplace, Elsewhere|]]
13921 [[Otherplace, Elsewhere, Anywhere|]]
13922 !! html/php
13923 [[Otherplace, Somewhere|Otherplace]]
13924 [[Otherplace, Elsewhere|Otherplace]]
13925 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13926 !! end
13927
13928 !! test
13929 pre-save transform: context links ("pipe trick") with parens and comma
13930 !! options
13931 pst title=[[Someplace (IGNORED), Somewhere]]
13932 !! wikitext
13933 [[|Otherplace]]
13934 [[Otherplace (place), Elsewhere|]]
13935 !! html/php
13936 [[Otherplace, Somewhere|Otherplace]]
13937 [[Otherplace (place), Elsewhere|Otherplace]]
13938 !! end
13939
13940 !! test
13941 pre-save transform: context links ("pipe trick") with comma and parens
13942 !! options
13943 pst title=[[Who, me? (context)]]
13944 !! wikitext
13945 [[|Yes, you.]]
13946 [[Me, Myself, and I (1937 song)|]]
13947 !! html/php
13948 [[Yes, you. (context)|Yes, you.]]
13949 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13950 !! end
13951
13952 !! test
13953 pre-save transform: context links ("pipe trick") with namespace
13954 !! options
13955 pst title=[[Ns:Somearticle]]
13956 !! wikitext
13957 [[|Article]]
13958 !! html/php
13959 [[Ns:Article|Article]]
13960 !! end
13961
13962 !! test
13963 pre-save transform: context links ("pipe trick") with namespace and parens
13964 !! options
13965 pst title=[[Ns:Somearticle (context)]]
13966 !! wikitext
13967 [[|Article]]
13968 !! html/php
13969 [[Ns:Article (context)|Article]]
13970 !! end
13971
13972 !! test
13973 pre-save transform: context links ("pipe trick") with namespace and comma
13974 !! options
13975 pst title=[[Ns:Somearticle, Context, Whatever]]
13976 !! wikitext
13977 [[|Article]]
13978 !! html/php
13979 [[Ns:Article, Context, Whatever|Article]]
13980 !! end
13981
13982 !! test
13983 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13984 !! options
13985 pst title=[[Ns:Somearticle, Context (context)]]
13986 !! wikitext
13987 [[|Article]]
13988 !! html/php
13989 [[Ns:Article (context)|Article]]
13990 !! end
13991
13992 !! test
13993 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13994 !! options
13995 pst title=[[Ns:Somearticle (IGNORED), Context]]
13996 !! wikitext
13997 [[|Article]]
13998 !! html/php
13999 [[Ns:Article, Context|Article]]
14000 !! end
14001
14002 !! test
14003 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14004 !! options
14005 pst
14006 !! wikitext
14007 [[Article(context)|]]
14008 [[Bar:Article(context)|]]
14009 [[:Bar:Article(context)|]]
14010 [[|Article(context)]]
14011 [[Bar:X(Y)Z|]]
14012 [[:Bar:X(Y)Z|]]
14013 !! html/php
14014 [[Article(context)|Article]]
14015 [[Bar:Article(context)|Article]]
14016 [[:Bar:Article(context)|Article]]
14017 [[Article(context)]]
14018 [[Bar:X(Y)Z|X(Y)Z]]
14019 [[:Bar:X(Y)Z|X(Y)Z]]
14020 !! end
14021
14022 !! test
14023 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14024 !! options
14025 pst
14026 !! wikitext
14027 [[Article (context)|]]
14028 [[Bar:Article (context)|]]
14029 [[:Bar:Article (context)|]]
14030 [[|Article (context)]]
14031 [[Bar:X (Y) Z|]]
14032 [[:Bar:X (Y) Z|]]
14033 !! html/php
14034 [[Article (context)|Article]]
14035 [[Bar:Article (context)|Article]]
14036 [[:Bar:Article (context)|Article]]
14037 [[Article (context)]]
14038 [[Bar:X (Y) Z|X (Y) Z]]
14039 [[:Bar:X (Y) Z|X (Y) Z]]
14040 !! end
14041
14042 !! test
14043 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14044 !! options
14045 pst
14046 !! wikitext
14047 [[Article(context)|]]
14048 [[Bar:Article(context)|]]
14049 [[:Bar:Article(context)|]]
14050 [[|Article(context)]]
14051 [[Bar:X(Y)Z|]]
14052 [[:Bar:X(Y)Z|]]
14053 !! html/php
14054 [[Article(context)|Article]]
14055 [[Bar:Article(context)|Article]]
14056 [[:Bar:Article(context)|Article]]
14057 [[Article(context)]]
14058 [[Bar:X(Y)Z|X(Y)Z]]
14059 [[:Bar:X(Y)Z|X(Y)Z]]
14060 !! end
14061
14062 !! test
14063 pre-save transform: context links ("pipe trick") with commas (T23660)
14064 !! options
14065 pst
14066 !! wikitext
14067 [[Article (context), context|]]
14068 [[Article (context),context|]]
14069 [[Bar:Article (context), context|]]
14070 [[Bar:Article (context),context|]]
14071 [[:Bar:Article (context), context|]]
14072 [[:Bar:Article (context),context|]]
14073 !! html/php
14074 [[Article (context), context|Article]]
14075 [[Article (context),context|Article]]
14076 [[Bar:Article (context), context|Article]]
14077 [[Bar:Article (context),context|Article]]
14078 [[:Bar:Article (context), context|Article]]
14079 [[:Bar:Article (context),context|Article]]
14080 !! end
14081
14082 !! test
14083 Parsoid: backwards pipe trick
14084 !! wikitext
14085 [[|'''bar''']]
14086 !! html/php
14087 <p>[[|<b>bar</b>]]
14088 </p>
14089 !! html/parsoid
14090 <p>[[|<b>bar</b>]]</p>
14091 !! end
14092
14093 !! test
14094 pre-save transform: trim trailing empty lines
14095 !! options
14096 pst
14097 !! wikitext
14098 Empty lines are trimmed
14099
14100
14101
14102
14103 !! html/php
14104 Empty lines are trimmed
14105 !! end
14106
14107 !! test
14108 pre-save transform: Signature expansion
14109 !! options
14110 pst
14111 !! wikitext
14112 * ~~~
14113 * ~~~~
14114 * ~~~~~
14115 * <noinclude>~~~</noinclude>
14116 * <includeonly>~~~</includeonly>
14117 * <onlyinclude>~~~</onlyinclude>
14118 !! html/php
14119 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14120 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14121 * 00:02, 1 January 1970 (UTC)
14122 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14123 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14124 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14125 !! end
14126
14127
14128 !! test
14129 ParserOutput flags from signature expansion (T84843)
14130 !! options
14131 pst
14132 showflags
14133 !! wikitext
14134 ~~~~
14135 !! html/php
14136 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14137 flags=user-signature
14138 !! end
14139
14140
14141 !! test
14142 pre-save transform: Signature expansion in nowiki tags (T2093)
14143 !! options
14144 pst disabled
14145 !! wikitext
14146 Shall not expand:
14147
14148 <nowiki>~~~~</nowiki>
14149
14150 <includeonly><nowiki>~~~~</nowiki></includeonly>
14151
14152 <noinclude><nowiki>~~~~</nowiki></noinclude>
14153
14154 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14155
14156 {{subst:Foo}} shall be converted to FOO
14157
14158 As well as inside noinclude/onlyinclude
14159 <noinclude>{{subst:Foo}}</noinclude>
14160 <onlyinclude>{{subst:Foo}}</onlyinclude>
14161
14162 But not inside includeonly
14163 <includeonly>{{subst:Foo}}</includeonly>
14164 !! html/php
14165 Shall not expand:
14166
14167 <nowiki>~~~~</nowiki>
14168
14169 <includeonly><nowiki>~~~~</nowiki></includeonly>
14170
14171 <noinclude><nowiki>~~~~</nowiki></noinclude>
14172
14173 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14174
14175 FOO shall be converted to FOO
14176
14177 As well as inside noinclude/onlyinclude
14178 <noinclude>FOO</noinclude>
14179 <onlyinclude>FOO</onlyinclude>
14180
14181 But not inside includeonly
14182 <includeonly>{{subst:Foo}}</includeonly>
14183 !! end
14184
14185 !! test
14186 Parsoid: Recognize nowiki with trailing space in tags
14187 !! options
14188 parsoid=wt2html
14189 !! wikitext
14190 <nowiki ><div>[[foo]]</nowiki >
14191
14192 a<nowiki / >b
14193
14194 c<nowiki />d
14195
14196 e<nowiki/ >f
14197 !! html
14198 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14199 <p>ab</p>
14200 <p>cd</p>
14201 <p>ef</p>
14202 !! end
14203
14204 !! test
14205 Parsoid: Recognize nowiki with odd capitalization
14206 !! options
14207 parsoid=wt2html
14208 !! wikitext
14209 <noWikI ><div>[[foo]]</Nowiki >
14210 !! html
14211 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14212 !! end
14213
14214
14215 !! test
14216 Parsoid: Escape nowiki with trailing space in tags
14217 !! options
14218 parsoid=html2wt
14219 !! html/parsoid
14220 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14221 <p>a&lt;nowiki /&gt;b</p>
14222 <p>c&lt;nowiki/ &gt;d</p>
14223 !! wikitext
14224 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14225
14226 a&lt;nowiki /&gt;b
14227
14228 c&lt;nowiki/ &gt;d
14229 !! end
14230
14231 !! test
14232 Parsoid: Escape weird noWikI capitalizations
14233 !! options
14234 parsoid=html2wt
14235 !! html/parsoid
14236 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14237 !! wikitext
14238 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14239 !! end
14240
14241 ###
14242 ### Message transform tests
14243 ###
14244 !! test
14245 message transform: magic variables
14246 !! options
14247 msg
14248 !! wikitext
14249 {{SITENAME}}
14250 !! html
14251 MediaWiki
14252 !! end
14253
14254 !! test
14255 message transform: should not transform wiki markup
14256 !! options
14257 msg
14258 !! wikitext
14259 ''test''
14260 !! html
14261 ''test''
14262 !! end
14263
14264 !! test
14265 message transform: <noinclude> in transcluded template (T6926)
14266 !! options
14267 msg
14268 !! wikitext
14269 {{Includes}}
14270 !! html
14271 Foobar
14272 !! end
14273
14274 !! test
14275 message transform: <onlyinclude> in transcluded template (T6926)
14276 !! options
14277 msg
14278 !! wikitext
14279 {{Includes2}}
14280 !! html
14281 Foo
14282 !! end
14283
14284 !! test
14285 {{#special:}} page name, known
14286 !! options
14287 msg
14288 !! wikitext
14289 {{#special:Recentchanges}}
14290 !! html
14291 Special:RecentChanges
14292 !! end
14293
14294 !! test
14295 {{#special:}} page name with subpage, known
14296 !! options
14297 msg
14298 !! wikitext
14299 {{#special:Recentchanges/param}}
14300 !! html
14301 Special:RecentChanges/param
14302 !! end
14303
14304 !! test
14305 {{#special:}} page name, unknown
14306 !! options
14307 msg
14308 !! wikitext
14309 {{#special:foobar nonexistent}}
14310 !! html
14311 Special:Foobar nonexistent
14312 !! end
14313
14314 !! test
14315 {{#speciale:}} page name, known
14316 !! options
14317 msg
14318 !! wikitext
14319 {{#speciale:Recentchanges}}
14320 !! html
14321 Special:RecentChanges
14322 !! end
14323
14324 !! test
14325 {{#speciale:}} page name with subpage, known
14326 !! options
14327 msg
14328 !! wikitext
14329 {{#speciale:Recentchanges/param}}
14330 !! html
14331 Special:RecentChanges/param
14332 !! end
14333
14334 !! test
14335 {{#speciale:}} page name, unknown
14336 !! options
14337 msg
14338 !! wikitext
14339 {{#speciale:foobar nonexistent}}
14340 !! html
14341 Special:Foobar_nonexistent
14342 !! end
14343
14344 ###
14345 ### Images
14346 ###
14347 ### For Parsoid-specific tests, see
14348 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14349
14350 !! test
14351 Simple image
14352 !! options
14353 parsoid=wt2html,wt2wt,html2html
14354 !! wikitext
14355 [[Image:foobar.jpg]]
14356 !! html/php
14357 <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>
14358 </p>
14359 !! html/parsoid
14360 <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>
14361 !! end
14362
14363 !! test
14364 Serialize simple image with span wrapper
14365 !! options
14366 parsoid=html2wt
14367 !! html/parsoid
14368 <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>
14369 !! wikitext
14370 [[File:Foobar.jpg]]
14371 !! end
14372
14373 !! test
14374 Simple image (using File: namespace, now canonical)
14375 !! wikitext
14376 [[File:Foobar.jpg]]
14377 !! html/php
14378 <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>
14379 </p>
14380 !! html/parsoid
14381 <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>
14382 !! end
14383
14384 !! test
14385 Right-aligned image
14386 !! wikitext
14387 [[File:Foobar.jpg|right]]
14388 !! html/php
14389 <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>
14390
14391 !! html/parsoid
14392 <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>
14393 !! end
14394
14395 !! test
14396 Image with caption
14397 !! wikitext
14398 [[File:Foobar.jpg|right|Caption text]]
14399 !! html/php
14400 <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>
14401
14402 !! html/parsoid
14403 <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>
14404 !! end
14405
14406 !! test
14407 Image with caption, T55312 #1
14408 !! wikitext
14409 [[File:Foobar.jpg|right|Caption page stuff]]
14410 !! html/php
14411 <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>
14412
14413 !! html/parsoid
14414 <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>
14415 !! end
14416
14417 !! test
14418 Image with caption, T55312 #2
14419 !! wikitext
14420 [[File:Foobar.jpg|right|Caption page=]]
14421 !! html/php
14422 <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>
14423
14424 !! html/parsoid
14425 <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>
14426 !! end
14427
14428 !! test
14429 Image with caption, T55312 #3
14430 !! wikitext
14431 [[File:Foobar.jpg|right|Caption page=stuff]]
14432 !! html/php
14433 <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>
14434
14435 !! html/parsoid
14436 <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>
14437 !! end
14438
14439 !! test
14440 Image caption with pipe entity
14441 !! wikitext
14442 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14443 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14444 !! html/php
14445 <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>
14446 <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>
14447
14448 !! html/parsoid
14449 <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>
14450 <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>
14451 !! end
14452
14453 !! test
14454 Allow empty links in image captions (T62753)
14455 !! options
14456 thumbsize=220
14457 !! wikitext
14458 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14459 [[]]
14460 [[Link2]]
14461 ]]
14462 !! html/php
14463 <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>
14464
14465 !! html/parsoid
14466 <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>
14467 [[]]
14468 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14469 </figcaption></figure>
14470 !! end
14471
14472 !! test
14473 Titles in unlinked images (T23454)
14474 !! wikitext
14475 [[File:Foobar.jpg|link=|stuff]]
14476 !! html/php
14477 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14478 </p>
14479 !! html/parsoid
14480 <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>
14481 !! end
14482
14483 !! test
14484 Link with empty target
14485 !! wikitext
14486 [[]]
14487 !! html
14488 <p>[[]]
14489 </p>
14490 !! end
14491
14492 !! test
14493 Image with link trail
14494 !! wikitext
14495 Linktrails should not work for images: [[File:Foobar.jpg]]s
14496 !! html/php
14497 <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
14498 </p>
14499 !! html/parsoid
14500 <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>
14501 !! end
14502
14503 !! test
14504 Image with empty attribute
14505 !! options
14506 parsoid=wt2html,wt2wt,html2html
14507 !! wikitext
14508 [[File:Foobar.jpg|right||Caption text]]
14509 !! html/php
14510 <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>
14511
14512 !! html/parsoid
14513 <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>
14514 !! end
14515
14516 !! test
14517 1. Block image with individual attributes from templates
14518 !! wikitext
14519 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14520 !! html/php
14521 <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>
14522
14523 !! html/parsoid
14524 <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>
14525 !! end
14526
14527 !! test
14528 2. Block Image with individual attributes from templates
14529 !! wikitext
14530 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14531 !! html/php
14532 <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>
14533
14534 !! html/parsoid
14535 <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>
14536 !! end
14537
14538 !! test
14539 3. Inline image with individual attributes from templates
14540 !! wikitext
14541 [[File:Foobar.jpg|{{echo|50px}}]]
14542 !! html/php
14543 <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>
14544 </p>
14545 !! html/parsoid
14546 <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>
14547 !! end
14548
14549 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14550 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14551 !! test
14552 Image with multiple attributes from the same template
14553 !! wikitext
14554 [[File:Foobar.jpg|{{image_attribs}}]]
14555 !! html/php
14556 <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>
14557
14558 !! html/parsoid
14559 <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>
14560 !! end
14561
14562 !! test
14563 Image with link tails
14564 !! options
14565 thumbsize=220
14566 !! wikitext
14567 123[[File:Foobar.jpg]]456
14568 123[[File:Foobar.jpg|right]]456
14569 123[[File:Foobar.jpg|thumb]]456
14570 !! html/php
14571 <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
14572 </p>
14573 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
14574 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
14575
14576 !! html/php+tidy
14577 <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
14578 </p><p>
14579 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
14580 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
14581 </p>
14582 !! html/parsoid
14583 <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>
14584 <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
14585 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>
14586 !! end
14587
14588 !! test
14589 Image with multiple captions -- only last one is accepted
14590 !! wikitext
14591 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14592 !! html/php
14593 <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>
14594
14595 !! html/parsoid
14596 <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>
14597 !! end
14598
14599 !! test
14600 Image with multiple widths -- use last
14601 !! wikitext
14602 [[File:Foobar.jpg|200px|300px|caption]]
14603 !! html/php
14604 <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>
14605 </p>
14606 !! html/parsoid
14607 <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>
14608 !! end
14609
14610 !! test
14611 Image with multiple alignments -- use first (T50664)
14612 !! options
14613 thumbsize=220
14614 !! wikitext
14615 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14616
14617 [[File:Foobar.jpg|middle|text-top|caption]]
14618 !! html/php
14619 <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>
14620 <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>
14621 </p>
14622 !! html/parsoid
14623 <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>
14624 <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>
14625 !! end
14626
14627 !! test
14628 Image with width attribute at different positions
14629 !! wikitext
14630 [[File:Foobar.jpg|200px|right|Caption]]
14631 [[File:Foobar.jpg|right|200px|Caption]]
14632 [[File:Foobar.jpg|right|Caption|200px]]
14633 !! html/php
14634 <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>
14635 <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>
14636 <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>
14637
14638 !! html/parsoid
14639 <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>
14640 <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>
14641 <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>
14642 !! end
14643
14644 # a sad bit of backward-compatibility
14645 !! test
14646 Image with size specified with pxpx (T15500, T53628)
14647 !! options
14648 parsoid=wt2html,wt2wt,html2html
14649 !! wikitext
14650 [[File:Foobar.jpg|20pxpx]]
14651 [[File:Foobar.jpg|200x20pxpx]]
14652 !! html/php
14653 <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>
14654 <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>
14655 </p>
14656 !! html/parsoid
14657 <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>
14658 !! end
14659
14660 !! test
14661 Image with link parameter, wiki target
14662 !! wikitext
14663 [[File:Foobar.jpg|link=Main Page]]
14664 !! html/php
14665 <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>
14666 </p>
14667 !! html/parsoid
14668 <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>
14669 !! end
14670
14671 # parsoid T51293 (part 1)
14672 !! test
14673 Image with link parameter, URL target
14674 !! wikitext
14675 [[File:Foobar.jpg|link=http://example.com/]]
14676 !! html/php
14677 <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>
14678 </p>
14679 !! html/parsoid
14680 <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>
14681 !! end
14682
14683 # parsoid T51293 (part 2)
14684 !! test
14685 Image with link parameter, protocol-less URL target
14686 !! wikitext
14687 [[File:Foobar.jpg|link=//example.com/]]
14688 !! html/php
14689 <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>
14690 </p>
14691 !! html/parsoid
14692 <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>
14693 !! end
14694
14695 !! test
14696 Escaping non-block captions (T107435)
14697 !! options
14698 parsoid={
14699 "modes": ["wt2wt"],
14700 "changes": [
14701 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14702 ]
14703 }
14704 !! wikitext
14705 [[Image:Foobar.jpg|caption]]
14706 !! wikitext/edited
14707 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14708 !! end
14709
14710 # wgExternalLinkTarget not supported by Parsoid
14711 !! test
14712 Image with link parameter, wgExternalLinkTarget
14713 !! wikitext
14714 [[Image:foobar.jpg|link=http://example.com/]]
14715 !! config
14716 wgExternalLinkTarget='foobar'
14717 !! html/php
14718 <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>
14719 </p>
14720 !! end
14721
14722 !! test
14723 Image with link parameter, wgNoFollowLinks set to false
14724 !! wikitext
14725 [[Image:foobar.jpg|link=http://example.com/]]
14726 !! config
14727 wgNoFollowLinks=false
14728 !! html/php
14729 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14730 </p>
14731 !! end
14732
14733 !! test
14734 Image with link parameter, wgNoFollowDomainExceptions
14735 !! wikitext
14736 [[Image:foobar.jpg|link=http://example.com/]]
14737 !! config
14738 wgNoFollowDomainExceptions='example.com'
14739 !! html/php
14740 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14741 </p>
14742 !! end
14743
14744 # wgExternalLinkTarget not supported by Parsoid
14745 !! test
14746 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14747 !! wikitext
14748 [[Image:foobar.jpg|link=http://example.com/|Title]]
14749 !! config
14750 wgExternalLinkTarget='foobar'
14751 !! html/php
14752 <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>
14753 </p>
14754 !! end
14755
14756 !! test
14757 Image with empty link parameter
14758 !! wikitext
14759 [[File:Foobar.jpg|link=]]
14760 !! html/php
14761 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14762 </p>
14763 !! html/parsoid
14764 <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>
14765 !! end
14766
14767 !! test
14768 Image with link parameter (wiki target) and unnamed parameter
14769 !! wikitext
14770 [[File:Foobar.jpg|link=Main_Page|Title]]
14771 !! html/php
14772 <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>
14773 </p>
14774 !! html/parsoid
14775 <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>
14776 !! end
14777
14778 !! test
14779 Image with link parameter (URL target) and unnamed parameter
14780 !! wikitext
14781 [[File:Foobar.jpg|link=http://example.com/|Title]]
14782 !! html/php
14783 <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>
14784 </p>
14785 !! html/parsoid
14786 <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>
14787 !! end
14788
14789 !! test
14790 Thumbnail image with link parameter
14791 !! options
14792 thumbsize=220
14793 parsoid=wt2html,wt2wt,html2html
14794 !! wikitext
14795 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14796 !! html/php
14797 <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>
14798
14799 !! html/parsoid
14800 <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>
14801 !! end
14802
14803 !! test
14804 Manually-specified thumbnail image
14805 !! options
14806 thumbsize=220
14807 !! wikitext
14808 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14809 !! html/php
14810 <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>
14811
14812 !! html/parsoid
14813 <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>
14814 !! end
14815
14816 !! test
14817 Manually-specified thumbnail image with explicit link to wiki page
14818 !! options
14819 thumbsize=220
14820 parsoid=wt2html,wt2wt,html2html
14821 !! wikitext
14822 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14823 !! html/php
14824 <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>
14825
14826 !! html/parsoid
14827 <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>
14828 !! end
14829
14830 !! test
14831 Manually-specified thumbnail image with explicit link to url
14832 !! options
14833 thumbsize=220
14834 parsoid=wt2html,wt2wt,html2html
14835 !! wikitext
14836 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14837 !! html/php
14838 <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>
14839
14840 !! html/parsoid
14841 <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>
14842 !! end
14843
14844 !! test
14845 Manually-specified thumbnail image with explicit no link
14846 !! options
14847 thumbsize=220
14848 parsoid=wt2html,wt2wt,html2html
14849 !! wikitext
14850 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14851 !! html/php
14852 <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>
14853
14854 !! html/parsoid
14855 <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>
14856 !! end
14857
14858 !! test
14859 Manually-specified thumbnail image with explicit link and alt text
14860 !! options
14861 thumbsize=220
14862 parsoid=wt2html,wt2wt,html2html
14863 !! wikitext
14864 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14865 !! html/php
14866 <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>
14867
14868 !! html/parsoid
14869 <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>
14870 !! end
14871
14872 !! test
14873 Image with frame and link
14874 !! options
14875 parsoid=wt2html,wt2wt,html2html
14876 !! wikitext
14877 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14878 !! html/php
14879 <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>
14880
14881 !! html/parsoid
14882 <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>
14883 !! end
14884
14885 !! test
14886 Image with frame and link and explicit alt
14887 !! options
14888 parsoid=wt2html,wt2wt,html2html
14889 !! wikitext
14890 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14891 !! html/php
14892 <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>
14893
14894 !! html/parsoid
14895 <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>
14896 !! end
14897
14898 !! test
14899 Image with wiki markup in implicit alt
14900 !! wikitext
14901 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14902
14903 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14904 !! html/php
14905 <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>
14906 </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>
14907 </p>
14908 !! html/parsoid
14909 <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>
14910
14911 <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>
14912 !! end
14913
14914 !! test
14915 Alt image option should handle most kinds of wikitext without barfing
14916 !! wikitext
14917 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14918 !! html/php
14919 <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>
14920
14921 !! html/parsoid
14922 <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>
14923 !! end
14924
14925 !! test
14926 Image with table with attributes in caption
14927 !! options
14928 parsoid=wt2html,html2html
14929 !! wikitext
14930 [[File:Foobar.jpg|thumb|
14931 {| class="123" |
14932 |- class="456" |
14933 | ha
14934 |}
14935 ]]
14936 !! html/parsoid
14937 <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>
14938 <table class="123">
14939 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14940 <td> ha</td></tr>
14941 </tbody></table>
14942 </figcaption></figure>
14943 !! end
14944
14945 !! test
14946 Image with table with rows from templates in caption
14947 !! wikitext
14948 [[File:Foobar.jpg|thumb|
14949 {|
14950 {{echo|{{!}} hi}}
14951 |}
14952 ]]
14953 !! html/parsoid
14954 <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>
14955 <table>
14956 <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>
14957 </tbody></table>
14958 </figcaption></figure>
14959 !! end
14960
14961 !! test
14962 Image with nested tables in caption
14963 !! wikitext
14964 [[File:Foobar.jpg|thumb|Foo<br />
14965 {|
14966 |
14967 {|
14968 |z
14969 |}
14970 |}
14971 ]]
14972 !! html/parsoid
14973 <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}'/>
14974 <table>
14975 <tbody><tr><td>
14976 <table>
14977 <tbody><tr><td>z</td></tr>
14978 </tbody></table></td></tr>
14979 </tbody></table>
14980 </figcaption></figure>
14981 !! end
14982
14983 !! test
14984 Image with heading and horizontal rule in caption
14985 !! wikitext
14986 [[File:Foobar.jpg|thumb|
14987 ===Testing===
14988 123
14989 --------------
14990 ]]
14991 !! html/php
14992 <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>
14993
14994 !! html/parsoid
14995 <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>
14996 <h3 id="Testing">Testing</h3>
14997 123
14998 <hr data-parsoid='{"extra_dashes":10}'/>
14999 </figcaption></figure>
15000 !! end
15001
15002 ###################
15003 # Conflicting image format options.
15004 # First option specified should 'win'.
15005 # All three cases in each test should be identical.
15006
15007 !! test
15008 Image with 'frameless' first.
15009 !! options
15010 parsoid=wt2html,wt2wt,html2html
15011 !! wikitext
15012 [[File:Foobar.jpg|frameless|caption]]
15013
15014 [[File:Foobar.jpg|frameless|frame|caption]]
15015
15016 [[File:Foobar.jpg|frameless|thumb|caption]]
15017 !! html/php
15018 <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>
15019 </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>
15020 </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>
15021 </p>
15022 !! html/parsoid
15023 <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>
15024 <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>
15025 <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>
15026 !! end
15027
15028 !! test
15029 Image with 'frame' first.
15030 !! options
15031 parsoid=wt2html,wt2wt,html2html
15032 !! wikitext
15033 [[File:Foobar.jpg|frame|caption]]
15034 [[File:Foobar.jpg|frame|frameless|caption]]
15035 [[File:Foobar.jpg|frame|thumb|caption]]
15036 !! html/php
15037 <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>
15038 <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>
15039 <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>
15040
15041 !! html/parsoid
15042 <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>
15043 <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>
15044 <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>
15045 !! end
15046
15047 !! test
15048 Image with 'thumb' first.
15049 !! options
15050 parsoid=wt2html,wt2wt,html2html
15051 !! wikitext
15052 [[File:Foobar.jpg|thumb|caption]]
15053 [[File:Foobar.jpg|thumb|frameless|caption]]
15054 [[File:Foobar.jpg|thumb|frame|caption]]
15055 !! html/php
15056 <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>
15057 <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>
15058 <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>
15059
15060 !! html/parsoid
15061 <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>
15062 <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>
15063 <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>
15064 !! end
15065
15066 ###################
15067 # Image sizing.
15068 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15069 # and https://phabricator.wikimedia.org/T64258
15070 # Foobar has actual size of 1941x220
15071 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15072 # a scalable format.
15073 # 2. Framed images always ignore size options; always render at default size.
15074 # 3. "Unspecified format" and border are the only types which can be
15075 # enlarged.
15076
15077 !! test
15078 Image: unspecified format and border enlarge
15079 !! options
15080 parsoid=wt2html,wt2wt,html2html
15081 !! wikitext
15082 [[File:Foobar.jpg|2000px]]
15083
15084 [[File:Foobar.jpg|border|2000px]]
15085 !! html/php
15086 <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>
15087 </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>
15088 </p>
15089 !! html/parsoid
15090 <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>
15091 <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>
15092 !! end
15093
15094 !! test
15095 Image: "unspecified format" and border reduce
15096 !! options
15097 parsoid=wt2html,wt2wt,html2html
15098 !! wikitext
15099 [[File:Foobar.jpg|1000px]]
15100
15101 [[File:Foobar.jpg|border|1000px]]
15102 !! html/php
15103 <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>
15104 </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>
15105 </p>
15106 !! html/parsoid
15107 <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>
15108 <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>
15109 !! end
15110
15111 !! test
15112 Image: thumbs reduce
15113 !! options
15114 parsoid=wt2html,wt2wt,html2html
15115 !! wikitext
15116 [[File:Foobar.jpg|thumb|50px]]
15117 !! html/php
15118 <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>
15119
15120 !! html/parsoid
15121 <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>
15122 !! end
15123
15124 !! test
15125 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15126 !! options
15127 parsoid=wt2html,wt2wt,html2html
15128 !! wikitext
15129 [[File:Foobar.jpg|thumb|2000px]]
15130
15131 [[File:Foobar.svg|thumb|2000px]]
15132 !! html/php
15133 <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>
15134 <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>
15135
15136 !! html/parsoid
15137 <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>
15138 <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>
15139 !! end
15140
15141 !! test
15142 Image: frameless can reduce in size
15143 !! options
15144 parsoid=wt2html,wt2wt,html2html
15145 !! wikitext
15146 [[File:Foobar.jpg|frameless|50px]]
15147 !! html/php
15148 <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>
15149 </p>
15150 !! html/parsoid
15151 <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>
15152 !! end
15153
15154 !! test
15155 Image: bitmap frameless can't be enlarged past original size, but vector can
15156 !! options
15157 parsoid=wt2html,wt2wt,html2html
15158 !! wikitext
15159 [[File:Foobar.jpg|frameless|2000px]]
15160
15161 [[File:Foobar.svg|frameless|2000px]]
15162 !! html/php
15163 <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>
15164 </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>
15165 </p>
15166 !! html/parsoid
15167 <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>
15168 <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>
15169 !! end
15170
15171 !! test
15172 Image: framed images are always unscaled.
15173 !! options
15174 parsoid=wt2html,wt2wt,html2html
15175 !! wikitext
15176 [[File:Foobar.jpg|frame]]
15177
15178 [[File:Foobar.jpg|frame|50px]]
15179
15180 [[File:Foobar.jpg|frame|50x50px]]
15181
15182 [[File:Foobar.jpg|frame|2000px]]
15183 !! html/php
15184 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15185 <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>
15186 <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>
15187 <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>
15188
15189 !! html/parsoid
15190 <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>
15191 <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>
15192 <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>
15193 <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>
15194 !! end
15195
15196 ###################
15197
15198 !! test
15199 Link to image page- image page normally doesn't exists, hence edit link
15200 Add test with existing image page
15201 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15202 !! wikitext
15203 [[:Image:test]]
15204 !! html
15205 <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>
15206 </p>
15207 !! end
15208
15209 !! test
15210 T20784 Link to non-existent image page with caption should use caption as link text
15211 !! wikitext
15212 [[:Image:test|caption]]
15213 !! html
15214 <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>
15215 </p>
15216 !! end
15217
15218 !! test
15219 Frameless image caption with a free URL
15220 !! wikitext
15221 [[File:Foobar.jpg|http://example.com]]
15222 !! html/php
15223 <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>
15224 </p>
15225 !! html/parsoid
15226 <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>
15227 !! end
15228
15229 !! test
15230 Thumbnail image caption with a free URL
15231 !! options
15232 thumbsize=220
15233 !! wikitext
15234 [[File:Foobar.jpg|thumb|http://example.com]]
15235 !! html/php
15236 <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>
15237
15238 !! html/parsoid
15239 <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>
15240 !! end
15241
15242 !! test
15243 Thumbnail image caption with a free URL and explicit alt
15244 !! options
15245 thumbsize=220
15246 parsoid=wt2html,wt2wt,html2html
15247 !! wikitext
15248 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15249 !! html/php
15250 <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>
15251
15252 !! html/parsoid
15253 <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>
15254 !! end
15255
15256 !! test
15257 SVG thumbnails with no language set
15258 !! options
15259 !! wikitext
15260 [[File:Foobar.svg|thumb|caption]]
15261 !! html/php
15262 <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>
15263
15264 !! html/parsoid
15265 <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>
15266 !! end
15267
15268 !! test
15269 SVG thumbnails with language de
15270 !! options
15271 parsoid=wt2html,wt2wt,html2html
15272 !! wikitext
15273 [[File:Foobar.svg|thumb|caption|lang=de]]
15274 !! html/php
15275 <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>
15276
15277 !! html/parsoid
15278 <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>
15279 !! end
15280
15281 !! test
15282 SVG thumbnails with invalid language code
15283 !! options
15284 parsoid=wt2html,wt2wt,html2html
15285 !! wikitext
15286 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15287 !! html/php
15288 <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>
15289
15290 !! html/parsoid
15291 <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>
15292 !! end
15293
15294 !! test
15295 T3887: A ISBN with a thumbnail
15296 !! wikitext
15297 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15298 !! html/php
15299 <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>
15300
15301 !! html/parsoid
15302 <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>
15303 !! end
15304
15305 !! test
15306 T3887: A RFC with a thumbnail
15307 !! wikitext
15308 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15309 !! html/php
15310 <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>
15311
15312 !! html/parsoid
15313 <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>
15314 !! end
15315
15316 !! test
15317 T3887: A mailto link with a thumbnail
15318 !! wikitext
15319 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15320 !! html/php
15321 <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>
15322
15323 !! html/parsoid
15324 <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>
15325 !! end
15326
15327 # Pending resolution to T2368
15328 !! test
15329 T2648: Frameless image caption with a link
15330 !! wikitext
15331 [[File:Foobar.jpg|text with a [[link]] in it]]
15332 !! html/php
15333 <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>
15334 </p>
15335 !! html/parsoid
15336 <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>
15337 !! end
15338
15339 !! test
15340 T2648: Frameless image caption with a link (suffix)
15341 !! wikitext
15342 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15343 !! html/php
15344 <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>
15345 </p>
15346 !! html/parsoid
15347 <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>
15348 !! end
15349
15350 !! test
15351 T2648: Frameless image caption with an interwiki link
15352 !! wikitext
15353 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15354 !! html/php
15355 <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>
15356 </p>
15357 !! html/parsoid
15358 <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>
15359 !! end
15360
15361 !! test
15362 T2648: Frameless image caption with a piped interwiki link
15363 !! wikitext
15364 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15365 !! html/php
15366 <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>
15367 </p>
15368 !! html/parsoid
15369 <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>
15370 !! end
15371
15372 !! test
15373 T107474: Frameless image caption with <nowiki>
15374 !! wikitext
15375 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15376 !! html/parsoid
15377 <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>
15378 !! end
15379
15380 !! test
15381 Escape HTML special chars in image alt text
15382 !! wikitext
15383 [[File:Foobar.jpg|& < > "]]
15384 !! html/php
15385 <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>
15386 </p>
15387 !! html/parsoid
15388 <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>
15389 !! end
15390
15391 !! test
15392 Escape HTML special chars in image alt text with LanguageConverter
15393 !! options
15394 language=zh
15395 !! wikitext
15396 [[File:Foobar.jpg|& < > "]]
15397 !! html/php
15398 <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>
15399 </p>
15400 !! html/parsoid
15401 <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>
15402 !! end
15403
15404 !! test
15405 Entities in file name and attributes
15406 !! wikitext
15407 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15408 !! html/php
15409 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15410 </p>
15411 !! html/parsoid
15412 <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>
15413 !! end
15414
15415 !! test
15416 T2499: Alt text should have &#1234;, not &amp;1234;
15417 !! wikitext
15418 [[File:Foobar.jpg|&#9792;]]
15419 !! html/php
15420 <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>
15421 </p>
15422 !! html/parsoid
15423 <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>
15424 !! end
15425
15426 !! test
15427 Broken image caption with link
15428 !! options
15429 parsoid=wt2html,wt2wt,html2html
15430 !! wikitext
15431 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15432 !! html/php
15433 <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.
15434 </p>
15435 !! html/parsoid
15436 <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>
15437 !! end
15438
15439 !! test
15440 Image caption containing another image
15441 !! wikitext
15442 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15443 !! html/php
15444 <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>
15445
15446 !! html/parsoid
15447 <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>
15448 !! end
15449
15450 !! test
15451 Image: caption containing a newline
15452 !! wikitext
15453 [[File:Foobar.jpg|This
15454 *is some text]]
15455 !! html/php
15456 <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>
15457 </p>
15458 !! html/parsoid
15459 <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>
15460 !!end
15461
15462 !!test
15463 Image: caption containing leading space
15464 (The leading space should not trigger nowiki escaping in wt2wt mode)
15465 !! wikitext
15466 [[File:Foobar.jpg|thumb| bar]]
15467 !! html/php
15468 <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>
15469
15470 !! html/parsoid
15471 <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>
15472 !!end
15473
15474 # html/php output not have newlines after table, td, th, etc. because
15475 # Linker::makeThumbLink2() replaces the newlines with spaces since
15476 # the table is inside a caption.
15477 # FIXME: Verify if that circa 2004 fix is still required.
15478 !! test
15479 Image: caption containing a table
15480 !! options
15481 parsoid=wt2html,wt2wt,html2html
15482 !! wikitext
15483 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15484 {|
15485 !Foo!!Bar
15486 |-
15487 |Foo1||Bar1
15488 |}
15489 and some more text.]]
15490 !! html/php
15491 <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>
15492
15493 !! html/parsoid
15494 <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
15495 <table>
15496 <tbody>
15497 <tr><th>Foo</th><th>Bar</th></tr>
15498 <tr>
15499 <td>Foo1</td>
15500 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15501 !! end
15502
15503 !! test
15504 T5090: External links other than http: in image captions
15505 !! wikitext
15506 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15507 !! html/php
15508 <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>
15509
15510 !! html/parsoid
15511 <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>
15512 !! end
15513
15514 !! test
15515 Custom class
15516 !! options
15517 parsoid=wt2html,wt2wt,html2html
15518 !! wikitext
15519 [[Image:foobar.jpg|a|class=b]]
15520 !! html/php
15521 <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>
15522 </p>
15523 !! html/parsoid
15524 <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>
15525 !! end
15526
15527 !! test
15528 Localized image handling (1).
15529 !! options
15530 parsoid=wt2html,wt2wt,html2html
15531 language=es
15532 !! wikitext
15533 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15534 !! html/php
15535 <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>
15536
15537 !! html/parsoid
15538 <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>
15539 !! end
15540
15541 !! test
15542 Localized image handling (2).
15543 !! options
15544 thumbsize=220
15545 parsoid=wt2html,wt2wt,html2html
15546 language=es
15547 !! wikitext
15548 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15549 !! html/php
15550 <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>
15551
15552 !! html/parsoid
15553 <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>
15554 !! end
15555
15556 !! test
15557 Localized image handling (3).
15558 !! options
15559 language=fa
15560 parsoid=html2wt
15561 !! html/parsoid
15562 <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>
15563 !! wikitext
15564 [[File:Foobar.jpg|بندانگشتی]]
15565 !! end
15566
15567 !! test
15568 "border", "frameless" and "class" attributes on an image.
15569 !! options
15570 thumbsize=220
15571 parsoid=wt2html,wt2wt,html2html
15572 !! wikitext
15573 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15574 !! html/php
15575 <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>
15576 </p>
15577 !! html/parsoid
15578 <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>
15579 !! end
15580
15581 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15582 !! test
15583 Invalid image attributes (T64500)
15584 !! options
15585 thumbsize=220
15586 parsoid=wt2html,wt2wt,html2html
15587 !! wikitext
15588 [[File:Foobar.jpg|thumb|float|left|caption]]
15589
15590 [[File:Foobar.jpg|thumb|righ|caption]]
15591
15592 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15593 !! html/php
15594 <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>
15595 <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>
15596 <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>
15597
15598 !! html/parsoid
15599 <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>
15600 <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>
15601 <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>
15602 !! end
15603
15604 !! article
15605 File:Barfoo.jpg
15606 !! text
15607 #REDIRECT [[File:Barfoo.jpg]]
15608 !! endarticle
15609
15610 # FIXME: Parsoid should run this test -- but we'd need to teach the
15611 # mockAPI about the redirected Barfoo.jpg image.
15612 !! test
15613 Redirected image
15614 !! wikitext
15615 [[Image:Barfoo.jpg]]
15616 !! html/php
15617 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15618 </p>
15619 !! end
15620
15621 !! test
15622 Missing image with uploads disabled
15623 !! options
15624 wgEnableUploads=0
15625 !! wikitext
15626 [[File:Foobaz.jpg]]
15627 !! html/php
15628 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15629 </p>
15630 !! html/parsoid
15631 <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>
15632 !! end
15633
15634 # Parsoid-specific testing for images
15635 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15636 # Currently imperfect due to a flaw in the Parsoid testrunner
15637 # Work in progress
15638 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15639 # image tests.
15640
15641 !! test
15642 Parsoid-specific image handling - simple image with size and middle alignment
15643 !! wikitext
15644 [[File:Foobar.jpg|middle|50px]]
15645 !! html/parsoid
15646 <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>
15647 !! end
15648
15649 !! test
15650 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15651 !! options
15652 parsoid=wt2wt,wt2html,html2html
15653 !! wikitext
15654 [[Image:Foobar.jpg|middle|50px]]
15655 !! html/parsoid
15656 <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>
15657 !! end
15658
15659 !! test
15660 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15661 !! wikitext
15662 [[File:Foobar.jpg|50px|middle]]
15663 !! html/parsoid
15664 <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>
15665 !! end
15666
15667 !! test
15668 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15669 !! options
15670 parsoid=wt2html,wt2wt,html2html
15671 !! wikitext
15672 [[Image:Foobar.jpg|50px|middle]]
15673 !! html/parsoid
15674 <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>
15675 !! end
15676
15677 !! test
15678 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15679 !! wikitext
15680 [[File:Foobar.jpg|500x10px|baseline|caption]]
15681 !! html/parsoid
15682 <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>
15683 !! end
15684
15685 !! test
15686 Parsoid-specific image handling - simple image with border and size spec
15687 !! wikitext
15688 [[File:Foobar.jpg|50px|border|caption]]
15689 !! html/parsoid
15690 <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>
15691 !! end
15692
15693 !! test
15694 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15695 !! options
15696 parsoid=wt2html,html2html
15697 !! wikitext
15698 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15699 !! html/parsoid
15700 <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>
15701 !! end
15702
15703 !! test
15704 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15705 !! options
15706 parsoid=wt2html,html2html
15707 !! wikitext
15708 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15709 !! html/parsoid
15710 <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>
15711 !! end
15712
15713 !! test
15714 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15715 !! options
15716 parsoid=wt2html,html2html
15717 !! wikitext
15718 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15719 !! html/parsoid
15720 <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>
15721 !! end
15722
15723 !! test
15724 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15725 !! options
15726 parsoid=wt2html,html2html
15727 !! wikitext
15728 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15729 !! html/parsoid
15730 <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>
15731 !! end
15732
15733 !! test
15734 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15735 !! options
15736 parsoid=wt2html,wt2wt,html2html
15737 !! wikitext
15738 [[File:Foobar.jpg|frame|500x50px|caption]]
15739 !! html/parsoid
15740 <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>
15741 !! end
15742
15743 !! test
15744 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15745 !! options
15746 parsoid=wt2html,html2html
15747 !! wikitext
15748 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15749 !! html/parsoid
15750 <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>
15751 !! end
15752
15753 !! test
15754 Parsoid-specific image handling - frameless image with specific size, border, and caption
15755 !! wikitext
15756 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15757 !! html/parsoid
15758 <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>
15759 !! end
15760
15761 !! test
15762 Parsoid-specific image handling - simple image with a formatted caption
15763 !! wikitext
15764 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15765 !! html/parsoid
15766 <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>
15767 !! end
15768
15769 !! test
15770 Parsoid-specific image handling - caption with a template in it
15771 !! wikitext
15772 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15773 !! html/parsoid
15774 <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>
15775 !! end
15776
15777 !! test
15778 Parsoid-specific image handling - caption with unbalanced tags in it
15779 !! options
15780 parsoid=wt2html,wt2wt,html2html
15781 !! wikitext
15782 foo
15783 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15784 bar
15785 !! html/parsoid
15786 <p>foo</p>
15787 <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>
15788 <p>bar</p>
15789 !! end
15790
15791 !! test
15792 Parsoid-specific image handling - empty caption (1)
15793 !! options
15794 parsoid=wt2html,wt2wt
15795 !! wikitext
15796 [[File:Foobar.jpg|thumb|]]
15797 !! html/parsoid
15798 <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>
15799 !! end
15800
15801 # empty captions don't get serialized unless we're in the "round trip" case
15802 !! test
15803 Parsoid-specific image handling - empty caption (2)
15804 !! options
15805 parsoid=html2wt
15806 !! html/parsoid
15807 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15808 <a href="./File:Foobar.jpg">
15809 <img resource="./File:Foobar.jpg"
15810 src="//example.com/images/3/3a/Foobar.jpg"
15811 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15812 height="25" width="220"/>
15813 </a>
15814 <figcaption></figcaption>
15815 </figure>
15816 !! wikitext
15817 [[File:Foobar.jpg|thumb]]
15818 !! end
15819
15820 !! test
15821 Parsoid-specific image handling - whitespace caption
15822 !! wikitext
15823 [[File:Foobar.jpg|thumb| ]]
15824 !! html/parsoid
15825 <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>
15826 !! end
15827
15828 !! test
15829 Parsoid-specific image handling - lang option
15830 !! wikitext
15831 foo
15832 [[File:Foobar.svg|lang=de|caption]]
15833 bar
15834 !! html/parsoid
15835 <p>foo
15836 <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>
15837 bar</p>
15838 !! end
15839
15840 ## Edge case bugs in Parsoid from T93580
15841 !! test
15842 T93580: 1. Templated <ref> inside block images
15843 !! wikitext
15844 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15845
15846 <references />
15847 !! html/parsoid
15848 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <sup about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
15849
15850 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15851 !! end
15852
15853 !! test
15854 T93580: 2. <ref> inside inline images
15855 !! wikitext
15856 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15857
15858 <references />
15859 !! html/parsoid
15860 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15861
15862 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15863 !! end
15864
15865 !! test
15866 T93580: 3. Templated <ref> inside inline images
15867 !! wikitext
15868 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15869
15870 <references />
15871 !! html/parsoid
15872 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15873
15874 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15875 !! end
15876
15877 ###
15878 ### Subpages
15879 ###
15880 !! article
15881 Subpage test/subpage
15882 !! text
15883 foo
15884 !! endarticle
15885
15886 !! test
15887 Subpage link
15888 !! options
15889 subpage title=[[Subpage test]]
15890 !! wikitext
15891 [[/subpage]]
15892 !! html
15893 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15894 </p>
15895 !! end
15896
15897 !! test
15898 Subpage noslash link
15899 !! options
15900 subpage title=[[Subpage test]]
15901 !! wikitext
15902 [[/subpage/]]
15903 !! html
15904 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15905 </p>
15906 !! end
15907
15908 !! article
15909 Subpage test/1/2/subpage
15910 !! text
15911 blah
15912 !! endarticle
15913
15914 !! test
15915 Relative subpage noslash link
15916 !! options
15917 parsoid=wt2wt,wt2html,html2html
15918 subpage title=[[Subpage test/1/2/3/4]]
15919 !! wikitext
15920 [[../../subpage/]]
15921
15922 [[../../subpage]]
15923 !! html/php
15924 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15925 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15926 </p>
15927 !! html/parsoid
15928 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15929 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15930 !! end
15931
15932 !! test
15933 Parsoid: dot-slash prefixed wikilinks
15934 !! wikitext
15935 [[./foo]]
15936
15937 [[././bar]]
15938
15939 [[././baz/]]
15940 !! html/php
15941 <p>[[./foo]]
15942 </p><p>[[././bar]]
15943 </p><p>[[././baz/]]
15944 </p>
15945 !! html/parsoid
15946 <p>[[./foo]]
15947 </p><p>[[././bar]]
15948 </p><p>[[././baz/]]
15949 </p>
15950 !! end
15951
15952 !! test
15953 Render invalid page names as plain text (T53090)
15954 !! wikitext
15955 [[./../foo|bar]]
15956 [[foo�|bar]]
15957 [[foo/.|bar]]
15958 [[foo/..|bar]]
15959 [[foo~~~bar]]
15960 [[foo>bar]]
15961 [[foo[bar]]
15962 [[.]]
15963 [[..]]
15964 [[foo././bar]]
15965 [[foo[http://example.com]xyz]]
15966
15967 [[{{echo|./../foo}}|bar]]
15968 [[{{echo|foo/.}}|bar]]
15969 [[{{echo|foo/..}}|bar]]
15970 [[{{echo|foo~~~~bar}}]]
15971 [[{{echo|foo>bar}}]]
15972 [[{{echo|foo././bar}}]]
15973 [[{{echo|foo{bar}}]]
15974 [[{{echo|foo}bar}}]]
15975 [[{{echo|foo[bar}}]]
15976 [[{{echo|foo]bar}}]]
15977 [[{{echo|foo<bar}}]]
15978 !!html/php
15979 <p>[[./../foo|bar]]
15980 [[foo�|bar]]
15981 [[foo/.|bar]]
15982 [[foo/..|bar]]
15983 [[foo~~~bar]]
15984 [[foo&gt;bar]]
15985 [[foo[bar]]
15986 [[.]]
15987 [[..]]
15988 [[foo././bar]]
15989 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15990 </p><p>[[./../foo|bar]]
15991 [[foo/.|bar]]
15992 [[foo/..|bar]]
15993 [[foo~~~~bar]]
15994 [[foo&gt;bar]]
15995 [[foo././bar]]
15996 [[foo{bar]]
15997 [[foo}bar]]
15998 [[foo[bar]]
15999 [[foo]bar]]
16000 [[foo&lt;bar]]
16001 </p>
16002 !!html/parsoid
16003 <p>[[./../foo|bar]]
16004 [[foo�|bar]]
16005 [[foo/.|bar]]
16006 [[foo/..|bar]]
16007 [[foo~~~bar]]
16008 [[foo>bar]]
16009 [[foo[bar]]
16010 [[.]]
16011 [[..]]
16012 [[foo././bar]]
16013 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16014
16015 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16016 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16017 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16018 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16019 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16020 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16021 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16022 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16023 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16024 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16025 [[<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>
16026 !!end
16027
16028 !! test
16029 Disabled subpages
16030 !! wikitext
16031 [[/subpage]]
16032 !! html
16033 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16034 </p>
16035 !! end
16036
16037 !! test
16038 T2561: {{/Subpage}}
16039 !! options
16040 subpage title=[[Page]]
16041 !! wikitext
16042 {{/Subpage}}
16043 !! html
16044 <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>
16045 </p>
16046 !! end
16047
16048 ###
16049 ### Categories
16050 ###
16051 !! article
16052 Category:MediaWiki User's Guide
16053 !! text
16054 blah
16055 !! endarticle
16056
16057 !! test
16058 Link to category
16059 !! wikitext
16060 [[:Category:MediaWiki User's Guide]]
16061 !! html
16062 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16063 </p>
16064 !! end
16065
16066 !! test
16067 Simple category
16068 !! options
16069 cat
16070 !! wikitext
16071 [[Category:MediaWiki User's Guide]]
16072 !! html/php
16073 cat=MediaWiki_User's_Guide sort=
16074 !! html/parsoid
16075 <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"}}'/>
16076 !! end
16077
16078 !! test
16079 PAGESINCATEGORY invalid title fatal (r33546 fix)
16080 !! wikitext
16081 {{PAGESINCATEGORY:<bogus>}}
16082 !! html
16083 <p>0
16084 </p>
16085 !! end
16086
16087 !! test
16088 Category with different sort key
16089 !! options
16090 cat
16091 !! wikitext
16092 [[Category:MediaWiki User's Guide|Foo]]
16093 !! html/php
16094 cat=MediaWiki_User's_Guide sort=Foo
16095 !! html/parsoid
16096 <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"}}'/>
16097 !! end
16098
16099 !! test
16100 Category with identical sort key
16101 !! options
16102 cat
16103 !! wikitext
16104 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16105 !! html/php
16106 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16107 !! html/parsoid
16108 <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"}}'/>
16109 !! end
16110
16111 !! test
16112 Category with empty sort key
16113 !! options
16114 cat
16115 pst
16116 !! wikitext
16117 [[Category:MediaWiki User's Guide|]]
16118 !! html/php
16119 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16120 !! end
16121
16122 !! test
16123 Category with empty sort key and parentheses
16124 !! options
16125 cat
16126 pst
16127 !! wikitext
16128 [[Category:Foo (bar)|]]
16129 !! html/php
16130 [[Category:Foo (bar)|Foo]]
16131 !! end
16132
16133 !! test
16134 Category with link tail
16135 !! options
16136 cat
16137 pst
16138 !! wikitext
16139 123[[Category:Foo]]456
16140 !! html/php
16141 123[[Category:Foo]]456
16142 !! end
16143
16144 !! test
16145 Category with template
16146 !! options
16147 cat
16148 pst
16149 !! wikitext
16150 [[Category:{{echo|Foo}}]]
16151 !! html/php
16152 [[Category:{{echo|Foo}}]]
16153 !! end
16154
16155 !! test
16156 Category with template in sort key
16157 !! options
16158 cat
16159 pst
16160 !! wikitext
16161 [[Category:Foo|{{echo|Bar}}]]
16162 !! html/php
16163 [[Category:Foo|{{echo|Bar}}]]
16164 !! end
16165
16166 !! test
16167 Category with template in sort key and title
16168 !! options
16169 cat
16170 pst
16171 !! wikitext
16172 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16173 !! html/php
16174 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16175 !! end
16176
16177 ## We used to, but no longer wt2wt this test since the default serializer
16178 ## will normalize all categories to serialize on their own line.
16179 ## This wikitext usage is going to be fairly uncommon in production and
16180 ## selser will take care of preserving formatting in those scenarios.
16181 !! test
16182 Category / paragraph interactions
16183 !! options
16184 parsoid=wt2html
16185 !! wikitext
16186 Foo [[Category:Baz]] Bar
16187
16188 Foo [[Category:Baz]]
16189 Bar
16190
16191 Foo
16192 [[Category:Baz]]
16193 Bar
16194
16195 Foo
16196 [[Category:Baz]] Bar
16197
16198 Foo
16199 [[Category:Baz]]
16200 [[Category:Baz]]
16201 [[Category:Baz]]
16202 Bar
16203
16204 [[Category:Baz]]
16205 [[Category:Baz]]
16206 [[Category:Baz]]
16207
16208 [[Category:Baz]]
16209 {{echo|[[Category:Baz]]}}
16210 [[Category:Baz]]
16211 !! html/php
16212 <p>Foo Bar
16213 </p><p>Foo
16214 Bar
16215 </p><p>Foo
16216 Bar
16217 </p><p>Foo Bar
16218 </p><p>Foo
16219 Bar
16220 </p>
16221 !! html/parsoid
16222 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16223 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16224 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16225 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16226 <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>
16227 <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}}]}'/>
16228 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16229 !! end
16230
16231 ## We used to, but no longer wt2wt this test since the default serializer
16232 ## will normalize all categories to serialize on their own line.
16233 ## This wikitext usage is going to be fairly uncommon in production and
16234 ## selser will take care of preserving formatting in those scenarios.
16235 ##
16236 ## The whitespace on the empty line is part of the test. Please do not delete
16237 !! test
16238 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16239 !! options
16240 parsoid=wt2html
16241 !! wikitext
16242 This
16243
16244 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16245
16246 {{echo|[[Category:Foo]] and so should this!}}
16247 !! html/php
16248 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16249 </p>
16250 !! html/parsoid
16251 <p>This
16252
16253 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16254
16255 <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>
16256 !! end
16257
16258 ## Parsoid will not try to wt2wt this while preserving newlines because
16259 ## it suppresses excess newlines within list items -- and we don't want to
16260 ## introduce a special case just for categories, which is, in reality somewhat
16261 ## odd behavior -- categories are unlikely to be used in list items like this
16262 ## in top-level pages and are only likely to show up in template-generated
16263 ## list items where this RT-ing is a non-issue.
16264 ##
16265 ## The whitespace on the empty line is part of the test. Please do not delete
16266 !! test
16267 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16268 !! options
16269 parsoid=wt2html
16270 !! wikitext
16271 * This
16272
16273 [[Category:Foo]] and this should be part of the same list item
16274 * So should this
16275
16276 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16277 !! html
16278 <ul><li>This and this should be part of the same list item</li>
16279 <li>So should this and this should be part of the same list item</li></ul>
16280 !! html/parsoid
16281 <ul>
16282 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16283 <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>
16284 </ul>
16285 !! end
16286
16287 ## Newlines and categories that follow the last item of a list
16288 ## are treated differently because this (list followed by categories)
16289 ## is an extremely common pattern on wikis.
16290 !! test
16291 3. Categories and newlines: newline suppression for last list item should RT properly
16292 !! wikitext
16293 *a
16294 *b
16295
16296 [[Category:Foo]]
16297
16298 [[Category:Bar]]
16299 [[Category:Baz]]
16300
16301 :c
16302
16303 [[Category:C]]
16304
16305 ;d
16306
16307 [[Category:D]]
16308 !! html/parsoid
16309 <ul><li>a</li>
16310 <li>b</li></ul>
16311
16312 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16313
16314 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16315 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16316
16317 <dl><dd>c</dd></dl>
16318
16319 <link rel="mw:PageProp/Category" href="./Category:C"/>
16320
16321 <dl><dt>d</dt></dl>
16322
16323 <link rel="mw:PageProp/Category" href="./Category:D"/>
16324 !! end
16325
16326 !! test
16327 4. Categories and newlines: newline suppression for last list item should RT properly
16328 !! wikitext
16329 *a
16330 ****b
16331
16332 [[Category:Foo]]
16333 !! html/parsoid
16334 <ul><li>a
16335 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16336
16337 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16338 !! end
16339
16340 ## only wt2html for this to make sure the algo only applies to the rightmost path
16341 !! test
16342 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16343 !! options
16344 parsoid=wt2html
16345 !! wikitext
16346 *a
16347 **b
16348 [[Category:Foo]]
16349 *c
16350 **d
16351 [[Category:Foo]]
16352 !! html/parsoid
16353 <ul><li>a
16354 <ul><li>b
16355 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16356 <li>c
16357 <ul><li>d</li></ul></li></ul>
16358 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16359 !! end
16360
16361 ## We used to, but no longer wt2wt this test since the default serializer
16362 ## will normalize all categories to serialize on their own line.
16363 ## This wikitext usage is going to be fairly uncommon in production and
16364 ## selser will take care of preserving formatting in those scenarios.
16365 !! test
16366 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16367 !! options
16368 parsoid=wt2html
16369 !! wikitext
16370 *a [[Category:Foo]]
16371 !! html/parsoid
16372 <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>
16373 !! end
16374
16375 # This test also demonstrates because of newline+category tunneling
16376 # through the list hander, template wrapping doesn't expand to the
16377 # containing list when the list item swallows the category.
16378 !! test
16379 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16380 !! wikitext
16381 *{{echo|a
16382 [[Category:Foo]]}}
16383 !! html/parsoid
16384 <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
16385 </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>
16386 !! end
16387
16388 !! test
16389 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16390 !! wikitext
16391 *a
16392
16393 {{echo|[[Category:Foo]]
16394 [[Category:Bar]]}}
16395 [[Category:Baz]]
16396 !! html/parsoid
16397 <ul><li>a</li></ul>
16398
16399 <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">
16400 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16401 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16402 !! end
16403
16404 !! test
16405 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16406 !! wikitext
16407 *a
16408
16409 [[Category:Bar]]<!--boo1--> <!--boo2-->
16410 [[Category:Baz]]<!--boo3--> <!--boo4-->
16411 !! html/parsoid
16412 <ul><li>a</li></ul>
16413
16414 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16415 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16416 !! end
16417
16418 !! test
16419 Categories and newlines: should behave properly with linkprefix (T87753)
16420 !! options
16421 language=ar
16422 !! wikitext
16423 foo bar
16424 foo bar
16425 [[تصنيف:Foo]]
16426 [[تصنيف:Bar]]
16427 !! html/php
16428 <p>foo bar
16429 foo bar
16430 </p>
16431 !! html/parsoid
16432 <p>foo bar
16433 foo bar</p>
16434 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16435 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16436 !! end
16437
16438 !! test
16439 No regressions on internal links following category (T174639)
16440 !! options
16441 parsoid=wt2html,html2html
16442 !! wikitext
16443 [[Category:Foo]]<div>a
16444
16445 [[Foo]]</div>
16446 !! html/php
16447 <div>a
16448 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16449
16450 !! html/parsoid
16451 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16452
16453 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16454 !! end
16455
16456 # Note that Parsoid differs slightly from PHP due to T175421
16457 !! test
16458 11. Special case where only newlines separate links (T175416)
16459 !! options
16460 parsoid=wt2html,html2html
16461 !! wikitext
16462 [[Category:Foo]]
16463
16464 [[Foo]][[es:Alimento]]
16465
16466 [[Foo]]
16467 !! html/php
16468 <p><br />
16469 <a href="/wiki/Foo" title="Foo">Foo</a>
16470 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16471 </p>
16472 !! html/parsoid
16473 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16474
16475 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16476
16477 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16478 !! end
16479
16480 !! test
16481 Category links with multiple namespaces
16482 !! wikitext
16483 [[Category:Project:Foo]]
16484 !! html/parsoid
16485 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16486 !! end
16487
16488 !! test
16489 Parsoid: Serialize link to category page with colon escape
16490 !! options
16491 parsoid
16492 !! wikitext
16493
16494 [[:Category:Foo]]
16495 [[:Category:Foo|Bar]]
16496 !! html
16497 <p>
16498 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16499 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16500 </p>
16501 !! end
16502
16503 # We used to, but no longer wt2wt this test since the default serializer
16504 # will normalize all categories to serialize on their own line.
16505 # This wikitext usage is going to be fairly uncommon in production and
16506 # selser will take care of preventing whitespace insertion if this
16507 # occurs in an article.
16508 #
16509 # html2html disabled for the same reason (whitespace insertion between
16510 # x and y).
16511 #
16512 # html2wt disabled because it localizes the "Category" namespace.
16513 !! test
16514 Link prefix/suffixes aren't applied to category links
16515 !! options
16516 parsoid=wt2html
16517 language=is
16518 !! wikitext
16519 x[[Category:Foo]]y
16520 !! html/php
16521 <p>xy
16522 </p>
16523 !! html/parsoid
16524 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16525 !! end
16526
16527 !! test
16528 Link prefix/suffixes aren't applied to language links
16529 !! options
16530 parsoid=wt2html
16531 language=is
16532 !! wikitext
16533 x[[es:Foo]]y
16534 !! html/php
16535 <p>xy
16536 </p>
16537 !! html/parsoid
16538 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16539 !! end
16540
16541 !! test
16542 Parsoid: Serialize link to file page with colon escape
16543 !! options
16544 parsoid
16545 !! wikitext
16546
16547 [[:File:Foo.png]]
16548 [[:File:Foo.png|Bar]]
16549 !! html
16550 <p>
16551 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16552 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16553 </p>
16554 !! end
16555
16556 !! test
16557 Parsoid: Serialize a genuine category link without colon escape
16558 !! options
16559 parsoid
16560 !! wikitext
16561 [[Category:Foo]]
16562 [[Category:Foo|Bar]]
16563 !! html
16564 <link rel="mw:PageProp/Category" href="./Category:Foo">
16565 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16566 !! end
16567
16568 !! test
16569 Normalize hrefs properly before testing for invalid link targets (T72894)
16570 !! options
16571 parsoid=html2wt
16572 !! html/parsoid
16573 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16574 !! wikitext
16575 [[Category:Toxine bactérienne]]
16576 !! end
16577
16578 !! test
16579 Parsoid: Defaultsort
16580 !! wikitext
16581 {{DEFAULTSORT:Foo}}
16582 !! html/parsoid
16583 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16584 !! end
16585
16586 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16587 # But, this is a limitation of our representation and is documented in
16588 # TemplateHandler.js in processSpecialMagicWord
16589 !! test
16590 Parsoid: Defaultsort (template-generated)
16591 !! wikitext
16592 {{{{echo|DEFAULTSORT}}:Foo}}
16593 !! html/parsoid
16594 <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"}]]}'/>
16595 !! end
16596
16597 ###
16598 ### Inter-language links
16599 ###
16600 !! test
16601 Interlanguage links
16602 !! options
16603 ill
16604 !! wikitext
16605 [[es:Alimento]]
16606 [[fr:Nourriture]]
16607 [[zh:食品]]
16608 !! html/php
16609 es:Alimento fr:Nourriture zh:食品
16610 !! html/parsoid
16611 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16612 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16613 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16614 !! end
16615
16616 !! test
16617 Duplicate interlanguage links (T26502)
16618 !! options
16619 ill
16620 !! wikitext
16621 [[es:1]]
16622 [[es:2]]
16623 [[fr:1]]
16624 [[fr:2]]
16625 !! html/php
16626 es:1 fr:1
16627 !! html/parsoid
16628 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16629 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16630 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16631 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16632 !! end
16633
16634 ###
16635 ### Sections
16636 ###
16637 !! test
16638 Basic section headings
16639 !! wikitext
16640 ==Headline 1==
16641 Some text
16642
16643 ==Headline 2==
16644 More
16645 ===Smaller headline===
16646 Blah blah
16647 !! html
16648 <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>
16649 <p>Some text
16650 </p>
16651 <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>
16652 <p>More
16653 </p>
16654 <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>
16655 <p>Blah blah
16656 </p>
16657 !! end
16658
16659 !! test
16660 Section headings with TOC
16661 !! wikitext
16662 ==Headline 1==
16663 ===Subheadline 1===
16664 =====Skipping a level=====
16665 ======Skipping a level======
16666
16667 ==Headline 2==
16668 Some text
16669 ===Another headline===
16670 !! html
16671 <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>
16672 <ul>
16673 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16674 <ul>
16675 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16676 <ul>
16677 <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>
16678 <ul>
16679 <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>
16680 </ul>
16681 </li>
16682 </ul>
16683 </li>
16684 </ul>
16685 </li>
16686 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16687 <ul>
16688 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16689 </ul>
16690 </li>
16691 </ul>
16692 </div>
16693
16694 <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>
16695 <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>
16696 <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>
16697 <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>
16698 <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>
16699 <p>Some text
16700 </p>
16701 <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>
16702
16703 !! end
16704
16705 !! test
16706 TOC anchors don't collide
16707 !! wikitext
16708 __FORCETOC__
16709 ==Headline 2==
16710 ==Headline==
16711 ==Headline 2==
16712 ==Headline==
16713 !! html/php
16714 <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>
16715 <ul>
16716 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16717 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16718 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16719 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16720 </ul>
16721 </div>
16722
16723 <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>
16724 <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>
16725 <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>
16726 <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>
16727
16728 !! end
16729
16730 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16731 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16732 !! test
16733 Handling of sections up to level 6 and beyond
16734 !! options
16735 parsoid=wt2html
16736 !! wikitext
16737 =Level 1 Heading=
16738 ==Level 2 Heading==
16739 ===Level 3 Heading===
16740 ====Level 4 Heading====
16741 =====Level 5 Heading=====
16742 ======Level 6 Heading======
16743 =======Level 7 Heading=======
16744 ========Level 8 Heading========
16745 =========Level 9 Heading=========
16746 ==========Level 10 Heading==========
16747 !! html/php
16748 <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>
16749 <ul>
16750 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16751 <ul>
16752 <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>
16753 <ul>
16754 <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>
16755 <ul>
16756 <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>
16757 <ul>
16758 <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>
16759 <ul>
16760 <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>
16761 <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>
16762 <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>
16763 <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>
16764 <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>
16765 </ul>
16766 </li>
16767 </ul>
16768 </li>
16769 </ul>
16770 </li>
16771 </ul>
16772 </li>
16773 </ul>
16774 </li>
16775 </ul>
16776 </div>
16777
16778 <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>
16779 <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>
16780 <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>
16781 <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>
16782 <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>
16783 <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>
16784 <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>
16785 <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>
16786 <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>
16787 <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>
16788
16789 !! html/parsoid
16790 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16791 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16792 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16793 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16794 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16795 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16796 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16797 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16798 <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>
16799 <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>
16800 !! end
16801
16802 !! test
16803 TOC regression (T11764)
16804 !! wikitext
16805 ==title 1==
16806 ===title 1.1===
16807 ====title 1.1.1====
16808 ===title 1.2===
16809 ==title 2==
16810 ===title 2.1===
16811 !! html
16812 <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>
16813 <ul>
16814 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16815 <ul>
16816 <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>
16817 <ul>
16818 <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>
16819 </ul>
16820 </li>
16821 <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>
16822 </ul>
16823 </li>
16824 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16825 <ul>
16826 <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>
16827 </ul>
16828 </li>
16829 </ul>
16830 </div>
16831
16832 <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>
16833 <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>
16834 <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>
16835 <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>
16836 <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>
16837 <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>
16838
16839 !! end
16840
16841 !! test
16842 TOC for heading containing <span id="..."></span> (T96153)
16843 !! wikitext
16844 __FORCETOC__
16845 ==<span id="old-anchor"></span>New title==
16846 !! html/php
16847 <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>
16848 <ul>
16849 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16850 </ul>
16851 </div>
16852
16853 <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>
16854
16855 !! end
16856
16857 !! test
16858 TOC with wgMaxTocLevel=3 (T8204)
16859 !! options
16860 wgMaxTocLevel=3
16861 !! wikitext
16862 ==title 1==
16863 ===title 1.1===
16864 ====title 1.1.1====
16865 ===title 1.2===
16866 ==title 2==
16867 ===title 2.1===
16868 !! html
16869 <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>
16870 <ul>
16871 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16872 <ul>
16873 <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>
16874 <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>
16875 </ul>
16876 </li>
16877 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16878 <ul>
16879 <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>
16880 </ul>
16881 </li>
16882 </ul>
16883 </div>
16884
16885 <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>
16886 <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>
16887 <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>
16888 <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>
16889 <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>
16890 <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>
16891
16892 !! end
16893
16894 !! test
16895 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16896 !! options
16897 wgMaxTocLevel=3
16898 !! wikitext
16899 ==Section 1==
16900 ===Section 1.1===
16901 ====Section 1.1.1====
16902 ====Section 1.1.1.1====
16903 ==Section 2==
16904 !! html
16905 <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>
16906 <ul>
16907 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16908 <ul>
16909 <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>
16910 </ul>
16911 </li>
16912 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16913 </ul>
16914 </div>
16915
16916 <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>
16917 <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>
16918 <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>
16919 <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>
16920 <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>
16921
16922 !! end
16923
16924
16925 !! test
16926 Resolving duplicate section names
16927 !! wikitext
16928 ==Foo bar==
16929 ==Foo bar==
16930 !! html
16931 <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>
16932 <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>
16933
16934 !! end
16935
16936 !! test
16937 Resolving duplicate section names with differing case (T12721)
16938 !! wikitext
16939 ==Foo bar==
16940 ==Foo Bar==
16941 !! html
16942 <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>
16943 <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>
16944
16945 !! end
16946
16947 !! article
16948 Template:sections
16949 !! text
16950 ===Section 1===
16951 ==Section 2==
16952 !! endarticle
16953
16954 !! test
16955 Template with sections, __NOTOC__
16956 !! wikitext
16957 __NOTOC__
16958 ==Section 0==
16959 {{sections}}
16960 ==Section 4==
16961 !! html
16962 <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>
16963 <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>
16964 <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>
16965 <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>
16966
16967 !! end
16968
16969 !! test
16970 __NOEDITSECTION__ keyword
16971 !! wikitext
16972 __NOEDITSECTION__
16973 ==Section 1==
16974 ==Section 2==
16975 !! html
16976 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16977 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16978
16979 !! end
16980
16981 !! test
16982 Link inside a section heading
16983 !! wikitext
16984 ==Section with a [[Main Page|link]] in it==
16985 !! html
16986 <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>
16987
16988 !! end
16989
16990 !! test
16991 TOC regression (T14077)
16992 !! wikitext
16993 __TOC__
16994 ==title 1==
16995 ===title 1.1===
16996 ==title 2==
16997 !! html
16998 <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>
16999 <ul>
17000 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17001 <ul>
17002 <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>
17003 </ul>
17004 </li>
17005 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17006 </ul>
17007 </div>
17008
17009 <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>
17010 <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>
17011 <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>
17012
17013 !! end
17014
17015 !! test
17016 T3219 URL next to image (good)
17017 !! wikitext
17018 http://example.com [[File:Foobar.jpg]]
17019 !! html/php
17020 <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>
17021 </p>
17022 !! html/parsoid
17023 <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>
17024 !!end
17025
17026 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17027 !! test
17028 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17029 !! options
17030 parsoid=wt2html,html2html
17031 !! wikitext
17032 ===
17033 The line above must have a trailing space!
17034 === <!--
17035 --> <!-- -->
17036 But just in case it doesn't...
17037 !! html/php
17038 <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>
17039 <p>The line above must have a trailing space!
17040 </p>
17041 <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>
17042 <p>But just in case it doesn't...
17043 </p>
17044 !! html/parsoid
17045 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17046 <p>The line above must have a trailing space!</p>
17047 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17048 --> <!-- -->
17049 <p>But just in case it doesn't...</p>
17050 !! end
17051
17052 !! test
17053 Header with special characters (T27462)
17054 !! wikitext
17055 The tooltips shall not show entities to the user (ie. be double escaped)
17056
17057 ==text > text==
17058 section 1
17059
17060 ==text < text==
17061 section 2
17062
17063 ==text & text==
17064 section 3
17065
17066 ==text ' text==
17067 section 4
17068
17069 ==text " text==
17070 section 5
17071 !! html/php
17072 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17073 </p>
17074 <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>
17075 <ul>
17076 <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>
17077 <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>
17078 <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>
17079 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17080 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17081 </ul>
17082 </div>
17083
17084 <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>
17085 <p>section 1
17086 </p>
17087 <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>
17088 <p>section 2
17089 </p>
17090 <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>
17091 <p>section 3
17092 </p>
17093 <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>
17094 <p>section 4
17095 </p>
17096 <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>
17097 <p>section 5
17098 </p>
17099 !! html/parsoid
17100 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17101
17102 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17103 <p>section 1</p>
17104
17105 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17106 <p>section 2</p>
17107
17108 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17109 <p>section 3</p>
17110
17111 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17112 <p>section 4</p>
17113
17114 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17115 <p>section 5</p>
17116 !! end
17117
17118 !! test
17119 Header with space, plus and underscore as entity
17120 !! wikitext
17121 Id should not contain + for spaces
17122
17123 ==Space between Text==
17124 section 1
17125
17126 ==Space-Entity&#32;between&#32;Text==
17127 section 2
17128
17129 ==Plus+between+Text==
17130 section 3
17131
17132 ==Plus-Entity&#43;between&#43;Text==
17133 section 4
17134
17135 ==Underscore_between_Text==
17136 section 5
17137
17138 ==Underscore-Entity&#95;between&#95;Text==
17139 section 6
17140
17141 [[#Space between Text]]
17142 [[#Space-Entity&#32;between&#32;Text]]
17143 [[#Plus+between+Text]]
17144 [[#Plus-Entity&#43;between&#43;Text]]
17145 [[#Underscore_between_Text]]
17146 [[#Underscore-Entity&#95;between&#95;Text]]
17147 !! html/php
17148 <p>Id should not contain + for spaces
17149 </p>
17150 <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>
17151 <ul>
17152 <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>
17153 <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>
17154 <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>
17155 <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>
17156 <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>
17157 <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>
17158 </ul>
17159 </div>
17160
17161 <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>
17162 <p>section 1
17163 </p>
17164 <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>
17165 <p>section 2
17166 </p>
17167 <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>
17168 <p>section 3
17169 </p>
17170 <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>
17171 <p>section 4
17172 </p>
17173 <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>
17174 <p>section 5
17175 </p>
17176 <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>
17177 <p>section 6
17178 </p><p><a href="#Space_between_Text">#Space between Text</a>
17179 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17180 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17181 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17182 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17183 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17184 </p>
17185 !! html/parsoid
17186 <p>Id should not contain + for spaces</p>
17187
17188 <h2 id="Space_between_Text">Space between Text</h2>
17189 <p>section 1</p>
17190
17191 <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>
17192 <p>section 2</p>
17193
17194 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17195 <p>section 3</p>
17196
17197 <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>
17198 <p>section 4</p>
17199
17200 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17201 <p>section 5</p>
17202
17203 <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>
17204 <p>section 6</p>
17205
17206 <p><a rel="mw:WikiLink" href="./Main_Page#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
17207 <a rel="mw:WikiLink" href="./Main_Page#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
17208 <a rel="mw:WikiLink" href="./Main_Page#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
17209 <a rel="mw:WikiLink" href="./Main_Page#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
17210 <a rel="mw:WikiLink" href="./Main_Page#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
17211 <a rel="mw:WikiLink" href="./Main_Page#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
17212 !! end
17213
17214 # Parsoid html2wt disabled because it adds padding spaces around =
17215 !! test
17216 Headers with excess '=' characters
17217 (Are similar tests necessary beyond the 1st level?)
17218 !! options
17219 parsoid=wt2html,wt2wt,html2html
17220 !! wikitext
17221 =foo==
17222 ==foo=
17223 =''italic'' heading==
17224 ==''italic'' heading=
17225 !! html/php
17226 <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>
17227 <ul>
17228 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17229 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17230 <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>
17231 <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>
17232 </ul>
17233 </div>
17234
17235 <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>
17236 <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>
17237 <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>
17238 <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>
17239
17240 !! html/parsoid
17241 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17242 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17243 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17244 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17245 !! end
17246
17247 !! test
17248 HTML headers vs TOC (T25393)
17249 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17250 !! wikitext
17251 <h1>Header 1</h1>
17252 ==Header 1.1==
17253 ==Header 1.2==
17254
17255 <h1>Header 2
17256 </h1>
17257 ==Header 2.1==
17258 ==Header 2.2==
17259 __NOEDITSECTION__
17260 !! html/php
17261 <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>
17262 <ul>
17263 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17264 <ul>
17265 <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>
17266 <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>
17267 </ul>
17268 </li>
17269 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17270 <ul>
17271 <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>
17272 <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>
17273 </ul>
17274 </li>
17275 </ul>
17276 </div>
17277
17278 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17279 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17280 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17281 <h1><span class="mw-headline" id="Header_2">Header 2
17282 </span></h1>
17283 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17284 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17285
17286 !! html/parsoid
17287 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17288 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17289 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17290
17291 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17292 </h1>
17293 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17294 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17295 <meta property="mw:PageProp/noeditsection"/>
17296 !! end
17297
17298 !! test
17299 Single-line or multiline-comments can follow headings
17300 !! options
17301 parsoid=wt2html,wt2wt
17302 !! wikitext
17303 ==foo==<!---->
17304 ==bar==<!--c1-->
17305 ==baz==<!--
17306 c2
17307 c3-->
17308 !! html/php
17309 <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>
17310 <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>
17311 <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>
17312
17313 !! html/parsoid
17314 <h2 id="foo">foo</h2><!---->
17315 <h2 id="bar">bar</h2><!--c1-->
17316 <h2 id="baz">baz</h2><!--
17317 c2
17318 c3-->
17319 !! end
17320
17321 !! test
17322 T3219 URL next to image (broken)
17323 !! wikitext
17324 http://example.com[[File:Foobar.jpg]]
17325 !! html/php
17326 <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>
17327 </p>
17328 !! html/parsoid
17329 <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>
17330 !!end
17331
17332 !! test
17333 T3186 news: in the middle of text
17334 !! wikitext
17335 http://en.wikinews.org/wiki/Wikinews:Workplace
17336 !! html
17337 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17338 </p>
17339 !!end
17340
17341
17342 !! test
17343 Namespaced link must have a title
17344 !! wikitext
17345 [[Project:]]
17346 !! html
17347 <p>[[Project:]]
17348 </p>
17349 !!end
17350
17351 !! test
17352 Namespaced link must have a title (bad fragment version)
17353 !! wikitext
17354 [[Project:#fragment]]
17355 !! html
17356 <p>[[Project:#fragment]]
17357 </p>
17358 !!end
17359
17360
17361 ###
17362 ### HTML tags and HTML attributes
17363 ###
17364
17365 !! test
17366 div with no attributes
17367 !! wikitext
17368 <div>HTML rocks</div>
17369 !! html
17370 <div>HTML rocks</div>
17371
17372 !! end
17373
17374 !! test
17375 div with double-quoted attribute
17376 !! wikitext
17377 <div id="rock">HTML rocks</div>
17378 !! html
17379 <div id="rock">HTML rocks</div>
17380
17381 !! end
17382
17383 !! test
17384 div with single-quoted attribute
17385 !! wikitext
17386 <div id='rock'>HTML rocks</div>
17387 !! html
17388 <div id="rock">HTML rocks</div>
17389
17390 !! end
17391
17392 !! test
17393 div with unquoted attribute
17394 !! wikitext
17395 <div id=rock>HTML rocks</div>
17396 !! html
17397 <div id="rock">HTML rocks</div>
17398
17399 !! end
17400
17401 !! test
17402 div with illegal double attributes
17403 !! wikitext
17404 <div id="a" id="b">HTML rocks</div>
17405 !! html
17406 <div id="b">HTML rocks</div>
17407
17408 !!end
17409
17410 !! test
17411 div with empty attribute value, space before equals
17412 !! options
17413 parsoid=wt2html,html2html
17414 !! wikitext
17415 <div class =>HTML rocks</div>
17416 !! html/php
17417 <div class="">HTML rocks</div>
17418
17419 !! html/parsoid
17420 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17421 !! end
17422
17423 !! test
17424 div with multiple empty attribute values
17425 !! config
17426 wgFragmentMode=[ 'html5', 'legacy' ]
17427 !! options
17428 parsoid=wt2html,html2html
17429 !! wikitext
17430 <div id= title=>HTML rocks</div>
17431 !! html/php
17432 <div id="title=">HTML rocks</div>
17433
17434 !! html/parsoid
17435 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17436 !! end
17437
17438 # FIXME Parsoid doesn't actually match PHP here.
17439 # Probably we should use the synthetic <foo /> or <indicator>
17440 # extensions for this test, which are enabled when running parser tests.
17441 !! test
17442 Extension tag in attribute value
17443 !! wikitext
17444 <span title="<translate>123</translate>">ok</span>
17445 !! html/php+disabled
17446 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17447 </p>
17448 !! html/parsoid
17449 <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>
17450 !! end
17451
17452 !! test
17453 table with multiple empty attribute values
17454 !! options
17455 parsoid=wt2html,html2html
17456 !! wikitext
17457 {| title= id=
17458 |hi
17459 |}
17460 !! html/php
17461 <table title="id=">
17462 <tr>
17463 <td>hi
17464 </td></tr></table>
17465
17466 !! html/parsoid
17467 <table title="id=">
17468 <tbody><tr><td>hi</td></tr>
17469 </tbody></table>
17470 !! end
17471
17472 !! test
17473 div with braces in attribute value
17474 !! wikitext
17475 <div title="{}">Foo</div>
17476 !! html/php
17477 <div title="&#123;&#125;">Foo</div>
17478
17479 !! html/parsoid
17480 <div title="{}">Foo</div>
17481 !! end
17482
17483 !! test
17484 div with empty attribute value, no space before equals
17485 !! options
17486 parsoid=wt2html,html2html
17487 !! wikitext
17488 <div class=>HTML rocks</div>
17489 !! html/php
17490 <div class="">HTML rocks</div>
17491
17492 !! html/parsoid
17493 <div class="">HTML rocks</div>
17494 !! end
17495
17496 !! test
17497 HTML multiple attributes correction
17498 !! wikitext
17499 <p class="error" class="awesome">Awesome!</p>
17500 !! html
17501 <p class="awesome">Awesome!</p>
17502
17503 !!end
17504
17505 !! test
17506 Table multiple attributes correction
17507 !! wikitext
17508 {|
17509 !+ class="error" class="awesome"|status
17510 |}
17511 !! html
17512 <table>
17513 <tr>
17514 <th class="awesome">status
17515 </th></tr></table>
17516
17517 !!end
17518
17519 !! test
17520 DIV IN UPPERCASE
17521 !! wikitext
17522 <DIV ID="x">HTML ROCKS</DIV>
17523 !! html
17524 <div id="x">HTML ROCKS</div>
17525
17526 !!end
17527
17528 !! test
17529 Non-ASCII pseudo-tags are rendered as text
17530 !! wikitext
17531 <khyô>
17532 !! html
17533 <p>&lt;khyô&gt;
17534 </p>
17535 !! end
17536
17537 !! test
17538 Pseudo-tag with URL 'name' renders as url link
17539 !! wikitext
17540 <http://example.com/>
17541 !! html
17542 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17543 </p>
17544 !! end
17545
17546 !! test
17547 text with amp in the middle of nowhere
17548 !! wikitext
17549 Remember AT&T?
17550 !! html
17551 <p>Remember AT&amp;T?
17552 </p>
17553 !! end
17554
17555 !! test
17556 text with character entity: eacute
17557 !! wikitext
17558 I always thought &eacute; was a cute letter.
17559 !! html+tidy
17560 <p>I always thought &#233; was a cute letter.
17561 </p>
17562 !! end
17563
17564 !! test
17565 text with entity-escaped character entity-like string: eacute
17566 !! wikitext
17567 I always thought &amp;eacute; was a cute letter.
17568 !! html
17569 <p>I always thought &amp;eacute; was a cute letter.
17570 </p>
17571 !! end
17572
17573 !! test
17574 text with undefined character entity: xacute
17575 !! wikitext
17576 I always thought &xacute; was a cute letter.
17577 !! html
17578 <p>I always thought &amp;xacute; was a cute letter.
17579 </p>
17580 !! end
17581
17582 !! test
17583 HTML5 tags
17584 !! wikitext
17585 <data value="5">five</data>
17586 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17587 <mark>This highlighted text</mark>
17588 !! html
17589 <p><data value="5">five</data>
17590 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17591 <mark>This highlighted text</mark>
17592 </p>
17593 !! end
17594
17595 !! test
17596 HTML tag with leading space is parsed as text
17597 !! wikitext
17598 < div>foo< /div>
17599 !! html
17600 <p>&lt; div&gt;foo&lt; /div&gt;
17601 </p>
17602 !! end
17603
17604 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17605 ## the HTML5 parsing spec.
17606 !! test
17607 Element with broken attribute syntax
17608 !! options
17609 parsoid=wt2html
17610 !! wikitext
17611 <div style=" style="123">hi</div>
17612 <div =>ho</div>
17613 !! html/php
17614 <div style="123">hi</div>
17615 <div>ho</div>
17616
17617 !! html/parsoid
17618 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17619 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17620 !! end
17621
17622 ###
17623 ### Nesting tests (see T43545, T52604, T53081)
17624 ###
17625
17626 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17627 # Note that html2wt is considerably more difficult if we use <b> in
17628 # the test case, instead of <small>
17629 !! test
17630 Ensure that HTML adoption agency algorithm is properly implemented.
17631 !! wikitext
17632 <small>X<small>Y</small>Z</small>
17633 !! html
17634 <p><small>X<small>Y</small>Z</small>
17635 </p>
17636 !! end
17637
17638 # This was T43545 in the PHP parser.
17639 !! test
17640 Nesting of <kbd>
17641 !! wikitext
17642 <kbd>X<kbd>Y</kbd>Z</kbd>
17643 !! html+tidy
17644 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17645 </p>
17646 !! end
17647
17648 # The following cases were T53081 in the PHP parser.
17649 # Note that there are some other nestable tags (b, i, etc) which are
17650 # not covered; see T53081 for discussion.
17651
17652 !! test
17653 Nesting of <em>
17654 !! wikitext
17655 <em>X<em>Y</em>Z</em>
17656 !! html+tidy
17657 <p><em>X<em>Y</em>Z</em>
17658 </p>
17659 !! end
17660
17661 !! test
17662 Nesting of <strong>
17663 !! wikitext
17664 <strong>X<strong>Y</strong>Z</strong>
17665 !! html+tidy
17666 <p><strong>X<strong>Y</strong>Z</strong>
17667 </p>
17668 !! end
17669
17670 !! test
17671 Nesting of <q>
17672 !! wikitext
17673 <q>X<q>Y</q>Z</q>
17674 !! html+tidy
17675 <p><q>X<q>Y</q>Z</q>
17676 </p>
17677 !! end
17678
17679 !! test
17680 Nesting of <ruby>
17681 !! wikitext
17682 <ruby>X<ruby>Y</ruby>Z</ruby>
17683 !! html
17684 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17685 </p>
17686 !! end
17687
17688 !! test
17689 Nesting of <bdo>
17690 !! wikitext
17691 <bdo>X<bdo>Y</bdo>Z</bdo>
17692 !! html
17693 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17694 </p>
17695 !! end
17696
17697
17698 ###
17699 ### Media links
17700 ###
17701
17702 !! test
17703 Media link
17704 !! wikitext
17705 [[Media:Foobar.jpg]]
17706 [[Media:Video.ogv]]
17707 [[:Media:Video.ogv]]
17708 !! html/php
17709 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17710 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17711 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17712 </p>
17713 !! html/parsoid
17714 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17715 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17716 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv" data-parsoid='{"a":{"namespace":"Media"},"sa":{"namespace":":Media"}}'>Media:Video.ogv</a></p>
17717 !! end
17718
17719 !! test
17720 Media link with text
17721 !! wikitext
17722 [[Media:Foobar.jpg|A neat file to look at]]
17723 !! html/php
17724 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17725 </p>
17726 !! html/parsoid
17727 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17728 !! end
17729
17730 # FIXME: this is still bad HTML tag nesting
17731 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17732 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17733 !! test
17734 Media link with nasty text
17735 !! options
17736 parsoid=wt2html,html2html
17737 !! wikitext
17738 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17739 !! html/php
17740 <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>
17741
17742 !! html/php+tidy
17743 <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>
17744 !! html/parsoid
17745 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Safe Link</a></p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg"><div style="display:none" data-parsoid='{"stx":"html"}'>" onmouseover="alert(document.cookie)" onfoo="</div></a>
17746 !! end
17747
17748 !! test
17749 Media link to nonexistent file (T3702)
17750 !! wikitext
17751 [[Media:No such.jpg]]
17752 [[Media:No_such file.jpg]]
17753 !! html/php
17754 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17755 <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>
17756 </p>
17757 !! html/parsoid
17758 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
17759 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17760 !! end
17761
17762 !! test
17763 Image link to nonexistent file (T3850 - good)
17764 !! wikitext
17765 [[File:No_such.jpg]]
17766 !! html/php
17767 <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>
17768 </p>
17769 !! html/parsoid
17770 <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>
17771 !! end
17772
17773 !! test
17774 :Image link to nonexistent file (T3850 - bad)
17775 !! wikitext
17776 [[:Image:No such.jpg]]
17777 !! html/php
17778 <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>
17779 </p>
17780 !! html/parsoid
17781 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17782 !! end
17783
17784 !! test
17785 Character reference normalization in link text (T3938)
17786 !! wikitext
17787 [[Main Page|this&that]]
17788 !! html
17789 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17790 </p>
17791 !!end
17792
17793 !! article
17794 אַ
17795 !! text
17796 Test for unicode normalization
17797
17798 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17799 !! endarticle
17800
17801 !! test
17802 (T21451) Links should refer to the normalized form.
17803 !! wikitext
17804 [[&#xFB2E;]]
17805 [[&#x5d0;&#x5b7;]]
17806 [[&#x5d0;ַ]]
17807 [[א&#x5b7;]]
17808 [[אַ]]
17809 !! html
17810 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17811 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17812 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17813 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17814 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17815 </p>
17816 !! end
17817
17818 !! test
17819 Empty attribute crash test (T4067)
17820 !! wikitext
17821 <font color="">foo</font>
17822 !! html
17823 <p><font color="">foo</font>
17824 </p>
17825 !! end
17826
17827 !! test
17828 Empty attribute crash test single-quotes (T4067)
17829 !! wikitext
17830 <font color=''>foo</font>
17831 !! html
17832 <p><font color="">foo</font>
17833 </p>
17834 !! end
17835
17836 !! test
17837 Attribute test: equals, then nothing
17838 !! options
17839 parsoid=wt2html,html2html
17840 !! wikitext
17841 <font color=>foo</font>
17842 !! html/php
17843 <p><font color="">foo</font>
17844 </p>
17845 !! html/parsoid
17846 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17847 !! end
17848
17849 !! test
17850 Attribute test: unquoted value
17851 !! options
17852 parsoid=wt2html,html2html
17853 !! wikitext
17854 <font color=x>foo</font>
17855 !! html/php
17856 <p><font color="x">foo</font>
17857 </p>
17858 !! html/parsoid
17859 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17860 !! end
17861
17862 !! test
17863 Attribute test: unquoted but illegal value (hash)
17864 !! wikitext
17865 <font color=#x>foo</font>
17866 !! html
17867 <p><font color="#x">foo</font>
17868 </p>
17869 !! end
17870
17871 # Parsoid does not serialize to empty attribute syntax,
17872 # so wt2wt and html2wt cases are skipped
17873 !! test
17874 Attribute test: no value (T54330)
17875 !! options
17876 parsoid=wt2html,html2html
17877 !! wikitext
17878 <font color>foo</font>
17879 !! html/php
17880 <p><font color="">foo</font>
17881 </p>
17882 !! html/parsoid
17883 <p><font color="">foo</font></p>
17884 !! end
17885
17886 !! test
17887 T4095: link with three closing brackets
17888 !! wikitext
17889 [[Main Page]]]
17890 !! html/php
17891 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17892 </p>
17893 !! html/parsoid
17894 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17895 !! end
17896
17897 !! test
17898 T4095: link with pipe and three closing brackets
17899 !! wikitext
17900 [[Main Page|link]]]
17901 !! html/php
17902 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17903 </p>
17904 !! html/parsoid
17905 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17906 !! end
17907
17908 !! test
17909 T4095: link with pipe and three closing brackets, version 2
17910 !! wikitext
17911 [[Main Page|[http://example.com/]]]
17912 !! html/php
17913 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17914 </p>
17915 !! html/parsoid
17916 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17917 !! end
17918
17919
17920 ###
17921 ### Safety
17922 ###
17923
17924 !! article
17925 Template:Dangerous attribute
17926 !! text
17927 " onmouseover="alert(document.cookie)
17928 !! endarticle
17929
17930 !! article
17931 Template:Dangerous style attribute
17932 !! text
17933 border-size: expression(alert(document.cookie))
17934 !! endarticle
17935
17936 !! article
17937 Template:Div style
17938 !! text
17939 <div style="float: right; {{{1}}}">Magic div</div>
17940 !! endarticle
17941
17942 !! test
17943 T4304: HTML attribute safety (safe template; regression T4309)
17944 !! wikitext
17945 <div title="{{test}}"></div>
17946 !! html/php
17947 <div title="This is a test template"></div>
17948
17949 !! html/parsoid
17950 <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>
17951 !! end
17952
17953 # Parsoid has enough context to handle this case
17954 !! test
17955 T4304: HTML attribute safety (dangerous template; 2309)
17956 !! wikitext
17957 <div title="{{dangerous attribute}}"></div>
17958 !! html/php
17959 <div title=""></div>
17960
17961 !! html/parsoid
17962 <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>
17963 !! end
17964
17965 !! test
17966 T4304: HTML attribute safety (dangerous style template; 2309)
17967 !! wikitext
17968 <div style="{{dangerous style attribute}}"></div>
17969 !! html/php
17970 <div style="/* insecure input */"></div>
17971
17972 !! html/parsoid
17973 <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>
17974 !! end
17975
17976 !! test
17977 T4304: HTML attribute safety (safe parameter; 2309)
17978 !! wikitext
17979 {{div style|width: 200px}}
17980 !! html/php
17981 <div style="float: right; width: 200px">Magic div</div>
17982
17983 !! html/parsoid
17984 <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>
17985 !! end
17986
17987 !! test
17988 T4304: HTML attribute safety (unsafe parameter; 2309)
17989 !! wikitext
17990 {{div style|width: expression(alert(document.cookie))}}
17991 !! html/php
17992 <div style="/* insecure input */">Magic div</div>
17993
17994 !! html/parsoid
17995 <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>
17996 !! end
17997
17998 ## Parsoid output here differs; needs investigation.
17999 !! test
18000 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18001 !! wikitext
18002 {{div style|"><script>alert(document.cookie)</script>}}
18003 !! html
18004 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18005
18006 !! end
18007
18008 ## Parsoid output here differs; needs investigation.
18009 !! test
18010 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18011 !! wikitext
18012 {{div style|" ><script>alert(document.cookie)</script>}}
18013 !! html
18014 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18015
18016 !! end
18017
18018 !! test
18019 T4304: HTML attribute safety (link)
18020 !! wikitext
18021 <div title="[[Main Page]]"></div>
18022 !! html/php
18023 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18024
18025 !! html/parsoid
18026 <div title="[[Main Page]]"></div>
18027 !! end
18028
18029 !! test
18030 T4304: HTML attribute safety (italics)
18031 !! wikitext
18032 <div title="''foobar''"></div>
18033 !! html
18034 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18035
18036 !! end
18037
18038 !! test
18039 T4304: HTML attribute safety (bold)
18040 !! wikitext
18041 <div title="'''foobar'''"></div>
18042 !! html
18043 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18044
18045 !! end
18046
18047 !! test
18048 T4304: HTML attribute safety (ISBN)
18049 !! wikitext
18050 <div title="ISBN 1234567890"></div>
18051 !! html
18052 <div title="&#73;SBN 1234567890"></div>
18053
18054 !! end
18055
18056 !! test
18057 T4304: HTML attribute safety (RFC)
18058 !! wikitext
18059 <div title="RFC 1234"></div>
18060 !! html
18061 <div title="&#82;FC 1234"></div>
18062
18063 !! end
18064
18065 !! test
18066 T4304: HTML attribute safety (PMID)
18067 !! wikitext
18068 <div title="PMID 1234567890"></div>
18069 !! html
18070 <div title="&#80;MID 1234567890"></div>
18071
18072 !! end
18073
18074 !! test
18075 T4304: HTML attribute safety (web link)
18076 !! wikitext
18077 <div title="http://example.com/"></div>
18078 !! html
18079 <div title="http&#58;//example.com/"></div>
18080
18081 !! end
18082
18083 !! test
18084 T4304: HTML attribute safety (named web link)
18085 !! wikitext
18086 <div title="[http://example.com/ link]"></div>
18087 !! html/php
18088 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18089
18090 !! html/parsoid
18091 <div title="[http://example.com/ link]"></div>
18092 !! end
18093
18094 !! test
18095 T5244: HTML attribute safety (extension; safe)
18096 !! wikitext
18097 <div style="<nowiki>background:blue</nowiki>"></div>
18098 !! html/php
18099 <div style="background:blue"></div>
18100
18101 !! html/parsoid
18102 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18103 !! end
18104
18105 !! test
18106 T5244: HTML attribute safety (extension; unsafe)
18107 !! wikitext
18108 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18109 !! html/php
18110 <div style="/* insecure input */"></div>
18111
18112 !! html/parsoid
18113 <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>
18114 !! end
18115
18116 # More MSIE fun discovered by Tom Gilder
18117
18118 !! test
18119 MSIE CSS safety test: spurious slash
18120 !! wikitext
18121 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18122 !! html/php
18123 <div style="/* insecure input */">evil</div>
18124
18125 !! html/parsoid
18126 <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>
18127 !! end
18128
18129 !! test
18130 MSIE CSS safety test: hex code
18131 !! wikitext
18132 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18133 !! html/php
18134 <div style="/* insecure input */">evil</div>
18135
18136 !! html/parsoid
18137 <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>
18138 !! end
18139
18140 !! test
18141 MSIE CSS safety test: comment in url
18142 !! wikitext
18143 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18144 !! html/php
18145 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18146
18147 !! html/parsoid
18148 <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>
18149 !! end
18150
18151 !! test
18152 MSIE CSS safety test: comment in expression
18153 !! wikitext
18154 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18155 !! html/php
18156 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18157
18158 !! html/parsoid
18159 <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>
18160 !! end
18161
18162 !! test
18163 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18164 !! wikitext
18165 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18166 !! html/php
18167 <p style="/* invalid control char */">A</p>
18168
18169 !! html/parsoid
18170 <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>
18171 !! end
18172
18173 !! test
18174 MSIE 6 CSS safety test: Fullwidth (T57332)
18175 !! wikitext
18176 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18177 <div style="top:EXPRESSION(alert())">B</div>
18178 !! html/php
18179 <p style="/* insecure input */">A</p>
18180 <div style="/* insecure input */">B</div>
18181
18182 !! html/parsoid
18183 <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>
18184 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18185 !! end
18186
18187 !! test
18188 MSIE 6 CSS safety test: IPA extensions (T57332)
18189 !! wikitext
18190 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18191 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18192 !! html/php
18193 <div style="/* insecure input */">A</div>
18194 <p style="/* insecure input */">B</p>
18195
18196 !! html/parsoid
18197 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18198 <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>
18199 !! end
18200
18201 !! test
18202 MSIE 6 CSS safety test: sup/sub script (T57332)
18203 !! wikitext
18204 <div style="background-image:url⁽javascript:alert())">A</div>
18205 <div style="background-image:url₍javascript:alert())">B</div>
18206 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18207 !! html/php
18208 <div style="/* insecure input */">A</div>
18209 <div style="/* insecure input */">B</div>
18210 <p style="/* insecure input */">C</p>
18211
18212 !! html/parsoid
18213 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18214 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18215 <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>
18216 !! end
18217
18218 !! test
18219 Opera -o-link CSS
18220 !! options
18221 parsoid=wt2html,html2html
18222 !! wikitext
18223 <div
18224 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;"
18225 style="-o-link:attr(title);-o-link-source:current">X</div>
18226 !! html/php
18227 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18228
18229 !! html/parsoid
18230 <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>
18231 !! end
18232
18233 !! test
18234 MSIE 6 CSS safety test: Repetition markers (T57332)
18235 !! wikitext
18236 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18237 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18238 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18239 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18240 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18241 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18242 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18243 !! html/php
18244 <p style="/* insecure input */">A</p>
18245 <p style="/* insecure input */">B</p>
18246 <p style="/* insecure input */">C</p>
18247 <p style="/* insecure input */">D</p>
18248 <p style="/* insecure input */">E</p>
18249 <p style="/* insecure input */">F</p>
18250 <p style="/* insecure input */">G</p>
18251
18252 !! html/parsoid
18253 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
18254 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18255 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18256 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
18257 <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>
18258 <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>
18259 <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>
18260 !! end
18261
18262 !! test
18263 Table attribute legitimate extension
18264 !! wikitext
18265 {|
18266 !+ style="<nowiki>color:blue</nowiki>"|status
18267 |}
18268 !! html
18269 <table>
18270 <tr>
18271 <th style="color:blue">status
18272 </th></tr></table>
18273
18274 !!end
18275
18276 !! test
18277 Table attribute safety
18278 !! wikitext
18279 {|
18280 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18281 |}
18282 !! html
18283 <table>
18284 <tr>
18285 <th style="/* insecure input */">status
18286 </th></tr></table>
18287
18288 !! end
18289
18290 !! test
18291 CSS line continuation 1
18292 !! wikitext
18293 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18294 !! html
18295 <div style="/* insecure input */"></div>
18296
18297 !! end
18298
18299 !! test
18300 CSS line continuation 2
18301 !! wikitext
18302 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18303 !! html
18304 <div style="/* invalid control char */"></div>
18305
18306 !! end
18307
18308 !! article
18309 Template:Identity
18310 !! text
18311 {{{1}}}
18312 !! endarticle
18313
18314 !! test
18315 Expansion of multi-line templates in attribute values (T8255)
18316 !! wikitext
18317 <div style="background: {{identity|#00FF00}}">-</div>
18318 !! html
18319 <div style="background: #00FF00">-</div>
18320
18321 !! end
18322
18323 !! test
18324 Expansion of multi-line templates in attribute values (T8255 sanity check)
18325 !! wikitext
18326 <div style="background:
18327 #00FF00">-</div>
18328 !! html/php
18329 <div style="background: #00FF00">-</div>
18330
18331 !! html/parsoid
18332 <div style="background:
18333 #00FF00">-</div>
18334 !! end
18335
18336 !! test
18337 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18338 !! wikitext
18339 <div style="background: &#10;#00FF00">-</div>
18340 !! html
18341 <div style="background: &#10;#00FF00">-</div>
18342
18343 !! end
18344
18345 !! test
18346 Tags which are hidden from tidiers cannot pass through the Sanitizer
18347 !! wikitext
18348 <mw:toc><script>alert();</script></mw:toc>
18349 !! html+tidy
18350 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18351 </p>
18352 !! end
18353
18354 ###
18355 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18356 ###
18357
18358 !! test
18359 Parser hook: empty input
18360 !! wikitext
18361 <tag></tag>
18362 !! html/php
18363 <pre>
18364 ''
18365 array (
18366 )
18367 </pre>
18368
18369 !! html/parsoid
18370 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18371 !! end
18372
18373 ## Don't expect parsoid to rt this form.
18374 !! test
18375 Parser hook: empty input using terminated empty elements
18376 !! options
18377 parsoid=wt2html,html2html
18378 !! wikitext
18379 <tag/>
18380 !! html/php
18381 <pre>
18382 NULL
18383 array (
18384 )
18385 </pre>
18386
18387 !! html/parsoid
18388 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18389 !! end
18390
18391 !! test
18392 Parser hook: empty input using terminated empty elements (space before)
18393 !! wikitext
18394 <tag />
18395 !! html/php
18396 <pre>
18397 NULL
18398 array (
18399 )
18400 </pre>
18401
18402 !! html/parsoid
18403 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18404 !! end
18405
18406 !! test
18407 Parser hook: basic input
18408 !! wikitext
18409 <tag>input</tag>
18410 !! html/php
18411 <pre>
18412 'input'
18413 array (
18414 )
18415 </pre>
18416
18417 !! html/parsoid
18418 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18419 !! end
18420
18421 ## Don't expect parsoid to rt this form.
18422 !! test
18423 Parser hook: case insensitive
18424 !! options
18425 parsoid=wt2html,html2html
18426 !! wikitext
18427 <TAG>input</TAG>
18428 !! html/php
18429 <pre>
18430 'input'
18431 array (
18432 )
18433 </pre>
18434
18435 !! html/parsoid
18436 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18437 !! end
18438
18439 ## Don't expect parsoid to rt this form.
18440 !! test
18441 Parser hook: case insensitive, redux
18442 !! options
18443 parsoid=wt2html,html2html
18444 !! wikitext
18445 <TaG>input</TAg>
18446 !! html/php
18447 <pre>
18448 'input'
18449 array (
18450 )
18451 </pre>
18452
18453 !! html/parsoid
18454 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18455 !! end
18456
18457 !! test
18458 Parser hook: nested tags
18459 !! options
18460 parsoid=wt2html
18461 !! wikitext
18462 <tag><tag></tag></tag>
18463 !! html/php
18464 <pre>
18465 '<tag>'
18466 array (
18467 )
18468 </pre>&lt;/tag&gt;
18469
18470 !! html/php+tidy
18471 <pre>'<tag>'
18472 array (
18473 )
18474 </tag></pre><p>&lt;/tag&gt;
18475 </p>
18476 !! html/parsoid
18477 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18478 !! end
18479
18480 !! test
18481 Parser hook: basic arguments
18482 !! wikitext
18483 <tag width="200" height="100" depth="50" square=""></tag>
18484 !! html/php
18485 <pre>
18486 ''
18487 array (
18488 'width' => '200',
18489 'height' => '100',
18490 'depth' => '50',
18491 'square' => '',
18492 )
18493 </pre>
18494
18495 !! html/parsoid
18496 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18497 !! end
18498
18499 ## Don't expect parsoid to rt this form.
18500 !! test
18501 Parser hook: basic arguments, variations
18502 !! options
18503 parsoid=wt2html,html2html
18504 !! wikitext
18505 <tag width=200 height = "100" depth = '50' square></tag>
18506 !! html/php
18507 <pre>
18508 ''
18509 array (
18510 'width' => '200',
18511 'height' => '100',
18512 'depth' => '50',
18513 'square' => '',
18514 )
18515 </pre>
18516
18517 !! html/parsoid
18518 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18519 !! end
18520
18521 !! test
18522 Parser hook: argument containing a forward slash (T7344)
18523 !! wikitext
18524 <tag filename="/tmp/bla"></tag>
18525 !! html/php
18526 <pre>
18527 ''
18528 array (
18529 'filename' => '/tmp/bla',
18530 )
18531 </pre>
18532
18533 !! html/parsoid
18534 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18535 !! end
18536
18537 ## Don't expect parsoid to rt this form.
18538 !! test
18539 Parser hook: empty input using terminated empty elements (T4374)
18540 !! options
18541 parsoid=wt2html,html2html
18542 !! wikitext
18543 <tag foo=bar/>text
18544 !! html/php
18545 <pre>
18546 NULL
18547 array (
18548 'foo' => 'bar',
18549 )
18550 </pre>text
18551
18552 !! html/parsoid
18553 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}'></pre><p>text</p>
18554 !! end
18555
18556 ## </tag> should be output literally since there is no matching tag that begins it
18557 ## Don't expect parsoid to rt this form.
18558 !! test
18559 Parser hook: basic arguments using terminated empty elements (T4374)
18560 !! options
18561 parsoid=wt2html
18562 !! wikitext
18563 <tag width=200 height = "100" depth = '50' square/>
18564 other stuff
18565 </tag>
18566 !! html/php
18567 <pre>
18568 NULL
18569 array (
18570 'width' => '200',
18571 'height' => '100',
18572 'depth' => '50',
18573 'square' => '',
18574 )
18575 </pre>
18576 <p>other stuff
18577 &lt;/tag&gt;
18578 </p>
18579 !! html/parsoid
18580 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
18581 &lt;/tag></p>
18582 !! end
18583
18584 ## Don't expect parsoid to rt this form.
18585 !! test
18586 Parser hook: Don't allow unclosed extension tags
18587 !! options
18588 parsoid=wt2html
18589 !! wikitext
18590 test <tag>123
18591
18592 this is a '''test'''
18593 !! html/php
18594 <p>test &lt;tag&gt;123
18595 </p><p>this is a <b>test</b>
18596 </p>
18597 !! html/parsoid
18598 <p>test &lt;tag>123</p>
18599
18600 <p>this is a <b>test</b></p>
18601 !! end
18602
18603 !! test
18604 Parser hook: horizontal rule inside extension tag that outputs <pre>
18605 !! wikitext
18606 <tag>
18607 Hello
18608 <hr/>
18609 Goodbye
18610 </tag>
18611 !! html/php
18612 <pre>
18613 '
18614 Hello
18615 <hr/>
18616 Goodbye
18617 '
18618 array (
18619 )
18620 </pre>
18621
18622 !! end
18623
18624 ###
18625 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18626 ###
18627
18628 !! test
18629 Parser hook: static parser hook not inside a comment
18630 !! wikitext
18631 <statictag>hello, world</statictag>
18632
18633 <statictag action="flush" />
18634 !! html/php
18635 <p><br />
18636 hello, world
18637 </p>
18638 !! html/parsoid
18639 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18640 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18641 !! end
18642
18643 !! test
18644 Parser hook: static parser hook inside a comment
18645 !! wikitext
18646 <!-- <statictag>hello, world</statictag> -->
18647 <statictag action="flush" />
18648 !! html/php
18649 <p><br />
18650 </p>
18651 !! html/parsoid
18652 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18653 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18654 !! end
18655
18656 # Nested template calls; this case was broken by Parser.php rev 1.506,
18657 # since reverted.
18658
18659 !! article
18660 Template:One-parameter
18661 !! text
18662 (My parameter is: {{{1}}})
18663 !! endarticle
18664
18665 !! article
18666 Template:Map-one-parameter
18667 !! text
18668 {{{{{1}}}|{{{2}}}}}
18669 !! endarticle
18670
18671 !! test
18672 Nested template calls
18673 !! wikitext
18674 {{Map-one-parameter|One-parameter|param}}
18675 !! html
18676 <p>(My parameter is: param)
18677 </p>
18678 !! end
18679
18680
18681 ###
18682 ### Sanitizer
18683 ###
18684
18685 !! test
18686 Sanitizer: Closing of open tags
18687 !! wikitext
18688 <s></s><table></table>
18689 !! html/php+tidy
18690 <p><s></s></p><table></table>
18691 !! html/parsoid
18692 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
18693 !! end
18694
18695 !! test
18696 Sanitizer: Closing of open but not closed tags
18697 !! wikitext
18698 <s>foo
18699 !! html
18700 <p><s>foo</s>
18701 </p>
18702 !! end
18703
18704 !! test
18705 Sanitizer: Closing of closed but not open tags
18706 !! options
18707 parsoid=wt2html
18708 !! wikitext
18709 </s>
18710 !! html+tidy
18711 <p class="mw-empty-elt">
18712 </p>
18713 !! end
18714
18715 !! test
18716 Sanitizer: Closing of closed but not open table tags
18717 !! options
18718 parsoid=wt2html
18719 !! wikitext
18720 Table not started</td></tr></table>
18721 !! html+tidy
18722 <p>Table not started
18723 </p>
18724 !! end
18725
18726 !! test
18727 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18728 !! config
18729 wgFragmentMode=[ 'html5', 'legacy' ]
18730 !! wikitext
18731 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18732 !! html/php
18733 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18734 </p>
18735 !! html/parsoid
18736 <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>
18737 !! end
18738
18739 !! test
18740 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18741 !! config
18742 wgFragmentMode=[ 'legacy' ]
18743 !! wikitext
18744 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18745 !! html/php
18746 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18747 </p>
18748 !! end
18749
18750 # In HTML5, the restrictions are that id must contain at least one character,
18751 # and must not contain any space characters.
18752 !! test
18753 Sanitizer: Validating the contents of the id attribute (T6515)
18754 !! options
18755 disabled
18756 !! wikitext
18757 <br id="" /><br id="a space" />
18758 !! html
18759 Something ...
18760 !! end
18761
18762 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18763 !! test
18764 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18765 !! options
18766 disabled
18767 !! wikitext
18768 <br id="foo" /><br id="foo" />
18769 !! html
18770 Something need to be done. foo-2 ?
18771 !! end
18772
18773 !! test
18774 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18775 !! wikitext
18776 <div itemscope>
18777 <meta itemprop="hello" content="world">
18778 <meta http-equiv="refresh" content="5">
18779 <meta itemprop="hello" http-equiv="refresh" content="5">
18780 <link itemprop="hello" href="{{SERVER}}">
18781 <link rel="stylesheet" href="{{SERVER}}">
18782 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18783 </div>
18784 !! html
18785 <div itemscope="">
18786 <p> <meta itemprop="hello" content="world" />
18787 &lt;meta http-equiv="refresh" content="5"&gt;
18788 <meta itemprop="hello" content="5" />
18789 <link itemprop="hello" href="http&#58;//example.org" />
18790 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18791 <link itemprop="hello" href="http&#58;//example.org" />
18792 </p>
18793 </div>
18794
18795 !! end
18796
18797 !! test
18798 Sanitizer: Strip comments from CSS attributes
18799 !! options
18800 parsoid=wt2html,wt2wt
18801 !! wikitext
18802 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18803 !! html/php
18804 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18805 </p>
18806 !! html/parsoid
18807 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18808 !! end
18809
18810 !! test
18811 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18812 !! wikitext
18813 [[meatball:Soft"Security]]
18814 !! html/php
18815 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18816 </p>
18817 !! html/parsoid
18818 <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>
18819 !! end
18820
18821 !! test
18822 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18823 !! wikitext
18824 [[meatball:Foo<Bar]]
18825 [[meatball:Foo>Bar]]
18826 [[meatball:Foo&lt;bar]]
18827 [[meatball:Foo&gt;bar]]
18828 !! html/php
18829 <p>[[meatball:Foo&lt;Bar]]
18830 [[meatball:Foo&gt;Bar]]
18831 [[meatball:Foo&lt;bar]]
18832 [[meatball:Foo&gt;bar]]
18833 </p>
18834 !! html/parsoid
18835 <p>[[meatball:Foo&lt;Bar]]
18836 [[meatball:Foo>Bar]]
18837 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18838 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18839 !! end
18840
18841 !! test
18842 Language converter: output gets cut off unexpectedly (T7757)
18843 !! options
18844 language=zh
18845 !! wikitext
18846 this bit is safe: }-
18847
18848 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18849
18850 then we get cut off here: }-
18851
18852 all additional text is vanished
18853 !! html/php
18854 <p>this bit is safe: }-
18855 </p><p>but if we add a conversion instance: xxx
18856 </p><p>then we get cut off here: }-
18857 </p><p>all additional text is vanished
18858 </p>
18859 !! html/parsoid
18860 <p>this bit is safe: }-</p>
18861 <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>
18862 <p>then we get cut off here: }-</p>
18863 <p>all additional text is vanished</p>
18864 !! end
18865
18866 !! test
18867 Language converter glossary rules inside attributes (T119158)
18868 !! options
18869 language=sr variant=sr-el
18870 !! wikitext
18871 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18872
18873 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18874 !! html/php
18875 <p>
18876 </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>
18877 </p>
18878 !! html/parsoid
18879 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18880
18881 <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>
18882 !! end
18883
18884 !! test
18885 Self closed html pairs (T7487)
18886 !! wikitext
18887 <center><font id="bug" />Centered text</center>
18888 <div><font id="bug2" />In div text</div>
18889 !! html+tidy
18890 <center><font id="bug"></font>Centered text</center>
18891 <div><font id="bug2"></font>In div text</div>
18892 !! end
18893
18894 !! test
18895 Punctuation: nbsp before exclamation
18896 !! wikitext
18897 C'est grave !
18898 !! html
18899 <p>C'est grave&#160;!
18900 </p>
18901 !! end
18902
18903 !! test
18904 Punctuation: CSS !important (T13874)
18905 !! wikitext
18906 <div style="width:50% !important">important</div>
18907 !! html
18908 <div style="width:50% !important">important</div>
18909
18910 !!end
18911
18912 !! test
18913 Punctuation: CSS ! important (T13874; with space after)
18914 !! wikitext
18915 <div style="width:50% ! important">important</div>
18916 !! html
18917 <div style="width:50%&#32;! important">important</div>
18918
18919 !!end
18920
18921 !! test
18922 HTML bullet list, closed tags (T7497)
18923 !! wikitext
18924 <ul>
18925 <li>One</li>
18926 <li>Two</li>
18927 </ul>
18928 !! html/php
18929 <ul>
18930 <li>One</li>
18931 <li>Two</li>
18932 </ul>
18933
18934 !! html/parsoid
18935 <ul data-parsoid='{"stx":"html"}'>
18936 <li data-parsoid='{"stx":"html"}'>One</li>
18937 <li data-parsoid='{"stx":"html"}'>Two</li>
18938 </ul>
18939
18940 !! end
18941
18942 !! test
18943 HTML bullet list, unclosed tags (T7497)
18944 !! wikitext
18945 <ul>
18946 <li>One
18947 <li>Two
18948 </ul>
18949 !! html/php+tidy
18950 <ul>
18951 <li>One
18952 </li><li>Two
18953 </li></ul>
18954 !! html/parsoid
18955 <ul data-parsoid='{"stx":"html"}'>
18956 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18957 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18958 </ul>
18959
18960 !! end
18961
18962 !! test
18963 HTML ordered list, closed tags (T7497)
18964 !! wikitext
18965 <ol>
18966 <li>One</li>
18967 <li>Two</li>
18968 </ol>
18969 !! html/php
18970 <ol>
18971 <li>One</li>
18972 <li>Two</li>
18973 </ol>
18974
18975 !! html/parsoid
18976 <ol data-parsoid='{"stx":"html"}'>
18977 <li data-parsoid='{"stx":"html"}'>One</li>
18978 <li data-parsoid='{"stx":"html"}'>Two</li>
18979 </ol>
18980
18981 !! end
18982
18983 !! test
18984 HTML ordered list, unclosed tags (T7497)
18985 !! options
18986 !! wikitext
18987 <ol>
18988 <li>One
18989 <li>Two
18990 </ol>
18991 !! html/php+tidy
18992 <ol>
18993 <li>One
18994 </li><li>Two
18995 </li></ol>
18996 !! html/parsoid
18997 <ol data-parsoid='{"stx":"html"}'>
18998 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18999 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19000 </ol>
19001
19002 !! end
19003
19004 !! test
19005 HTML nested bullet list, closed tags (T7497)
19006 !! wikitext
19007 <ul>
19008 <li>One</li>
19009 <li>Two:
19010 <ul>
19011 <li>Sub-one</li>
19012 <li>Sub-two</li>
19013 </ul>
19014 </li>
19015 </ul>
19016 !! html/php
19017 <ul>
19018 <li>One</li>
19019 <li>Two:
19020 <ul>
19021 <li>Sub-one</li>
19022 <li>Sub-two</li>
19023 </ul>
19024 </li>
19025 </ul>
19026
19027 !! html/parsoid
19028 <ul data-parsoid='{"stx":"html"}'>
19029 <li data-parsoid='{"stx":"html"}'>One</li>
19030 <li data-parsoid='{"stx":"html"}'>Two:
19031 <ul data-parsoid='{"stx":"html"}'>
19032 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19033 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19034 </ul>
19035 </li>
19036 </ul>
19037 !! end
19038
19039 !! test
19040 HTML nested bullet list, open tags (T7497)
19041 !! wikitext
19042 <ul>
19043 <li>One
19044 <li>Two:
19045 <ul>
19046 <li>Sub-one
19047 <li>Sub-two
19048 </ul>
19049 </ul>
19050 !! html+tidy
19051 <ul>
19052 <li>One
19053 </li><li>Two:
19054 <ul>
19055 <li>Sub-one
19056 </li><li>Sub-two
19057 </li></ul>
19058 </li></ul>
19059 !! end
19060
19061 !! test
19062 HTML nested ordered list, closed tags (T7497)
19063 !! wikitext
19064 <ol>
19065 <li>One</li>
19066 <li>Two:
19067 <ol>
19068 <li>Sub-one</li>
19069 <li>Sub-two</li>
19070 </ol>
19071 </li>
19072 </ol>
19073 !! html
19074 <ol>
19075 <li>One</li>
19076 <li>Two:
19077 <ol>
19078 <li>Sub-one</li>
19079 <li>Sub-two</li>
19080 </ol>
19081 </li>
19082 </ol>
19083
19084 !! end
19085
19086 !! test
19087 HTML nested ordered list, open tags (T7497)
19088 !! wikitext
19089 <ol>
19090 <li>One
19091 <li>Two:
19092 <ol>
19093 <li>Sub-one
19094 <li>Sub-two
19095 </ol>
19096 </ol>
19097 !! html/php
19098 <ol>
19099 <li>One
19100 <li>Two:
19101 <ol>
19102 <li>Sub-one
19103 <li>Sub-two
19104 </ol>
19105 </ol>
19106
19107 !! html/parsoid
19108 <ol>
19109 <li>One
19110 </li>
19111 <li>Two:
19112 <ol>
19113 <li>Sub-one
19114 </li>
19115 <li>Sub-two
19116 </li>
19117 </ol>
19118 </li>
19119 </ol>
19120
19121 !! end
19122
19123 !! test
19124 HTML ordered list item with parameters oddity
19125 !! wikitext
19126 <ol><li id="fragment">One</li>
19127 </ol>
19128 !! html
19129 <ol><li id="fragment">One</li>
19130 </ol>
19131
19132 !! end
19133
19134 # parsoid doesn't explicitly mark autonumbered links, see T55505
19135 !!test
19136 T7918: autonumbering
19137 !! wikitext
19138 [http://first/] [http://second] [ftp://ftp]
19139
19140 ftp://inlineftp
19141
19142 [mailto:enclosed@mail.tld With target]
19143
19144 [mailto:enclosed@mail.tld]
19145
19146 mailto:inline@mail.tld
19147 !! html/php
19148 <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>
19149 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19150 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19151 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19152 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19153 </p>
19154 !! html/parsoid
19155 <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>
19156 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19157 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19158 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19159 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19160 !! end
19161
19162
19163 #
19164 # Security and HTML correctness
19165 # From Nick Jenkins' fuzz testing
19166 #
19167
19168 !! test
19169 Fuzz testing: Parser13
19170 !! wikitext
19171 {|
19172 | http://a|
19173 !! html
19174 <table>
19175 <tr>
19176 <td>
19177 </td>
19178 </tr>
19179 </table>
19180
19181 !! end
19182
19183 # Note that Parsoid output differs from the PHP parser here: the PHP
19184 # parser breaks the URL for the magic word, while in Parsoid the URL
19185 # production takes precedence.
19186 !! test
19187 Fuzz testing: Parser14
19188 !! wikitext
19189 ==onmouseover===
19190 http://__TOC__
19191 !! html/php
19192 <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>
19193 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>
19194 <ul>
19195 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19196 </ul>
19197 </div>
19198
19199
19200 !! html/php+tidy
19201 <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>
19202 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>
19203 <ul>
19204 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19205 </ul>
19206 </div>
19207 !! html/parsoid
19208 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19209 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19210 !! end
19211
19212 !! test
19213 Fuzz testing: Parser14-table
19214 !! options
19215 parsoid=wt2html,html2html
19216 !! wikitext
19217 ==a==
19218 {| STYLE=__TOC__
19219 !! html
19220 <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>
19221 <table style="&#95;_TOC&#95;_">
19222 <tr><td></td></tr>
19223 </table>
19224
19225 !! html+tidy
19226 <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>
19227 <table style="__TOC__">
19228 <tr>
19229 <td></td>
19230 </tr>
19231 </table>
19232 !! html/parsoid
19233 <h2 id="a">a</h2>
19234 <table style="__TOC__"></table>
19235 !! end
19236
19237 # Known to produce bogus xml (extra </td>)
19238 # Don't add the html/php section since it generates broken HTML
19239 !! test
19240 Fuzz testing: Parser16
19241 !! wikitext
19242 {|
19243 !https://||||||
19244 !! html+tidy
19245 <table>
19246 <tbody><tr>
19247 <th>https://</th>
19248 <th></th>
19249 <th></th>
19250 <th>
19251
19252 </th></tr>
19253 </tbody></table>
19254 !! end
19255
19256 !! test
19257 Fuzz testing: Parser21
19258 !! wikitext
19259 {|
19260 !irc://{{ftp://a" onmouseover="alert('hello world');"
19261 |
19262 !! html
19263 <table>
19264 <tr>
19265 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19266 </th>
19267 <td>
19268 </td>
19269 </tr>
19270 </table>
19271
19272 !! end
19273
19274 !! test
19275 Fuzz testing: Parser22
19276 !! wikitext
19277 http://===r:::https://b
19278
19279 {|
19280 !! html
19281 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19282 </p>
19283 <table>
19284 <tr><td></td></tr>
19285 </table>
19286
19287 !! end
19288
19289 ## Remex doesn't account for fostered content.
19290 ## Known to produce bad XML for now
19291 !! test
19292 Fuzz testing: Parser24
19293 !! options
19294 parsoid=wt2html
19295 !! wikitext
19296 {|
19297 {{{|
19298 <u CLASS=
19299 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19300 <br style="onmouseover='alert(document.cookie);' " />
19301
19302 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19303 |
19304 !! html/php
19305 <table>
19306 {{{|
19307 <u class="&#124;">}}}} &gt;
19308 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19309
19310 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19311 <tr>
19312 <td></u>
19313 </td>
19314 </tr>
19315 </table>
19316
19317 !! html/php+tidy
19318
19319 {{{|
19320 <u class="&#124;">}}}} &gt;
19321 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19322
19323 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19324 </u><table><tbody><tr>
19325 <td>
19326 </td>
19327 </tr>
19328 </tbody></table><p><u class="&#124;">
19329 </u></p>
19330 !! html/parsoid
19331 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19332 {{{|
19333 <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>"}'/>}}}} >
19334 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19335
19336 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19337 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19338 !! end
19339
19340 # Note: the current result listed for this is not what the original one was,
19341 # but the original bug was JavaScript injection, which is fixed in any case.
19342 # It's not clear that the original result listed was any more correct than the
19343 # current one. Original result:
19344 # <p>{{{|
19345 # </p>
19346 # <li class="&#124;&#124;">
19347 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19348 !!test
19349 Fuzz testing: Parser25 (T8055)
19350 !! wikitext
19351 {{{
19352 |
19353 <LI CLASS=||
19354 >
19355 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19356 !! html/php
19357 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19358 </p>
19359 !! html/parsoid
19360 <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"]}'>
19361 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19362 !! end
19363
19364 !!test
19365 Fuzz testing: URL adjacent extension (with space, clean)
19366 !! wikitext
19367 http://example.com <nowiki>junk</nowiki>
19368 !! html/php
19369 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19370 </p>
19371 !! html/parsoid
19372 <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>
19373 !! end
19374
19375 !!test
19376 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19377 !! wikitext
19378 http://example.com<nowiki>junk</nowiki>
19379 !! html/php
19380 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19381 </p>
19382 !! html/parsoid
19383 <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>
19384 !! end
19385
19386 !! test
19387 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19388 !! wikitext
19389 http://example.com<pre>junk</pre>
19390 !! html/php
19391 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19392
19393 !! html/php+tidy
19394 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19395 !! html/parsoid
19396 <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>
19397 !! end
19398
19399 !! test
19400 Fuzz testing: image with bogus manual thumbnail
19401 !! wikitext
19402 [[Image:foobar.jpg|thumbnail= ]]
19403 !! html/php
19404 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19405
19406 !! html/parsoid
19407 <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>
19408 !! end
19409
19410 # Parsoid will emit the newline literally in wt2wt; see next test case.
19411 !! test
19412 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19413 !! options
19414 parsoid=wt2html
19415 !! wikitext
19416 <pre dir="&#10;"></pre>
19417 !! html/php
19418 <pre dir="&#10;"></pre>
19419
19420 !! html/parsoid
19421 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19422 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19423 !! end
19424
19425 !! test
19426 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19427 !! options
19428 parsoid=html2wt
19429 !! html/parsoid
19430 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19431 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19432 !! wikitext
19433 <pre dir="
19434 "></pre>
19435 !! html/php
19436 <pre dir=""></pre>
19437
19438 !! end
19439
19440 !! test
19441 Templates in extension attributes are not expanded
19442 !! wikitext
19443 <pre dir="{{echo|ltr}}"></pre>
19444 !! html/php
19445 <pre dir="{{echo|ltr}}"></pre>
19446
19447 !! html/parsoid
19448 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19449 !! end
19450
19451 !! test
19452 Parsing optional HTML elements (T8171)
19453 !! options
19454 !! wikitext
19455 <table>
19456 <tr>
19457 <td> Some tabular data</td>
19458 <td> More tabular data ...
19459 <td> And yet som tabular data</td>
19460 </tr>
19461 </table>
19462 !! html
19463 <table>
19464 <tr>
19465 <td> Some tabular data</td>
19466 <td> More tabular data ...
19467 </td><td> And yet som tabular data</td>
19468 </tr>
19469 </table>
19470
19471 !! end
19472
19473 !! test
19474 Correct handling of <td>, <tr> (T8171)
19475 !! options
19476 !! wikitext
19477 <table>
19478 <tr>
19479 <td> Some tabular data</td>
19480 <td> More tabular data ...</td>
19481 <td> And yet som tabular data</td>
19482 </tr>
19483 </table>
19484 !! html
19485 <table>
19486 <tr>
19487 <td> Some tabular data</td>
19488 <td> More tabular data ...</td>
19489 <td> And yet som tabular data</td>
19490 </tr>
19491 </table>
19492
19493 !! end
19494
19495
19496 !! test
19497 Parsing crashing regression (fr:JavaScript)
19498 !! wikitext
19499 </body></x>
19500 !! html
19501 <p>&lt;/body&gt;&lt;/x&gt;
19502 </p>
19503 !! end
19504
19505 !! test
19506 Inline wiki vs wiki block nesting
19507 !! wikitext
19508 '''Bold paragraph
19509
19510 New wiki paragraph
19511 !! html
19512 <p><b>Bold paragraph</b>
19513 </p><p>New wiki paragraph
19514 </p>
19515 !! end
19516
19517 # FIXME: The current php output is documented
19518 # and desired output is the parsoid target.
19519 !! test
19520 Inline HTML vs wiki block nesting
19521 !! wikitext
19522 <b>Bold paragraph
19523
19524 New wiki paragraph
19525 !! html/php
19526 <p><b>Bold paragraph
19527 </p><p>New wiki paragraph</b>
19528 </p>
19529 !! html/php+tidy
19530 <p><b>Bold paragraph
19531 </b></p><p><b>New wiki paragraph
19532 </b></p>
19533 !! html/parsoid
19534 <p><b>Bold paragraph</b>
19535 </p><p>New wiki paragraph
19536 </p>
19537 !! end
19538
19539 # Original result was this:
19540 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19541 # </p>
19542 # While that might be marginally more intuitive, maybe, the six-apostrophe
19543 # construct is clearly pathological and the result stated here (which is what
19544 # the parser actually does) is about as reasonable as anything.
19545 !!test
19546 Mixing markup for italics and bold
19547 !! options
19548 !! wikitext
19549 '''bold''''''bold''bolditalics'''''
19550 !! html
19551 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19552 </p>
19553 !! end
19554
19555
19556 !! article
19557 Xyzzyx
19558 !! text
19559 Article for special page transclusion test
19560 !! endarticle
19561
19562 !! test
19563 Special page transclusion
19564 !! options
19565 !! wikitext
19566 {{Special:Prefixindex/Xyzzyx}}
19567 !! html
19568 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19569 </ul>
19570
19571 !! end
19572
19573 !! test
19574 Special page transclusion twice (T7021)
19575 !! options
19576 !! wikitext
19577 {{Special:Prefixindex/Xyzzyx}}
19578 {{Special:Prefixindex/Xyzzyx}}
19579 !! html
19580 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19581 </ul>
19582 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19583 </ul>
19584
19585 !! end
19586
19587 !! test
19588 Transclusion of default MediaWiki message
19589 !! wikitext
19590 {{MediaWiki:Mainpage}}
19591 !! html
19592 <p>Main Page
19593 </p>
19594 !! end
19595
19596 !! test
19597 Transclusion of nonexistent MediaWiki message
19598 !! wikitext
19599 {{MediaWiki:Mainpagexxx}}
19600 !! html
19601 <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>
19602 </p>
19603 !! end
19604
19605 !! test
19606 Transclusion of MediaWiki message with underscore
19607 !! wikitext
19608 {{MediaWiki:history_short}}
19609 !! html
19610 <p>History
19611 </p>
19612 !! end
19613
19614 !! test
19615 Transclusion of MediaWiki message with space
19616 !! wikitext
19617 {{MediaWiki:history short}}
19618 !! html
19619 <p>History
19620 </p>
19621 !! end
19622
19623 !! test
19624 Invalid header with following text
19625 !! wikitext
19626 = x = y
19627 !! html
19628 <p>= x = y
19629 </p>
19630 !! end
19631
19632
19633 !! test
19634 Section extraction test (section 0)
19635 !! options
19636 section=0
19637 !! wikitext
19638 start
19639 ==a==
19640 ===aa===
19641 ====aaa====
19642 ==b==
19643 ===ba===
19644 ===bb===
19645 ====bba====
19646 ===bc===
19647 ==c==
19648 ===ca===
19649 !! html/php
19650 start
19651 !! end
19652
19653 !! test
19654 Section extraction test (section 1)
19655 !! options
19656 section=1
19657 !! wikitext
19658 start
19659 ==a==
19660 ===aa===
19661 ====aaa====
19662 ==b==
19663 ===ba===
19664 ===bb===
19665 ====bba====
19666 ===bc===
19667 ==c==
19668 ===ca===
19669 !! html/php
19670 ==a==
19671 ===aa===
19672 ====aaa====
19673 !! end
19674
19675 !! test
19676 Section extraction test (section 2)
19677 !! options
19678 section=2
19679 !! wikitext
19680 start
19681 ==a==
19682 ===aa===
19683 ====aaa====
19684 ==b==
19685 ===ba===
19686 ===bb===
19687 ====bba====
19688 ===bc===
19689 ==c==
19690 ===ca===
19691 !! html/php
19692 ===aa===
19693 ====aaa====
19694 !! end
19695
19696 !! test
19697 Section extraction test (section 3)
19698 !! options
19699 section=3
19700 !! wikitext
19701 start
19702 ==a==
19703 ===aa===
19704 ====aaa====
19705 ==b==
19706 ===ba===
19707 ===bb===
19708 ====bba====
19709 ===bc===
19710 ==c==
19711 ===ca===
19712 !! html/php
19713 ====aaa====
19714 !! end
19715
19716 !! test
19717 Section extraction test (section 4)
19718 !! options
19719 section=4
19720 !! wikitext
19721 start
19722 ==a==
19723 ===aa===
19724 ====aaa====
19725 ==b==
19726 ===ba===
19727 ===bb===
19728 ====bba====
19729 ===bc===
19730 ==c==
19731 ===ca===
19732 !! html/php
19733 ==b==
19734 ===ba===
19735 ===bb===
19736 ====bba====
19737 ===bc===
19738 !! end
19739
19740 !! test
19741 Section extraction test (section 5)
19742 !! options
19743 section=5
19744 !! wikitext
19745 start
19746 ==a==
19747 ===aa===
19748 ====aaa====
19749 ==b==
19750 ===ba===
19751 ===bb===
19752 ====bba====
19753 ===bc===
19754 ==c==
19755 ===ca===
19756 !! html/php
19757 ===ba===
19758 !! end
19759
19760 !! test
19761 Section extraction test (section 6)
19762 !! options
19763 section=6
19764 !! wikitext
19765 start
19766 ==a==
19767 ===aa===
19768 ====aaa====
19769 ==b==
19770 ===ba===
19771 ===bb===
19772 ====bba====
19773 ===bc===
19774 ==c==
19775 ===ca===
19776 !! html/php
19777 ===bb===
19778 ====bba====
19779 !! end
19780
19781 !! test
19782 Section extraction test (section 7)
19783 !! options
19784 section=7
19785 !! wikitext
19786 start
19787 ==a==
19788 ===aa===
19789 ====aaa====
19790 ==b==
19791 ===ba===
19792 ===bb===
19793 ====bba====
19794 ===bc===
19795 ==c==
19796 ===ca===
19797 !! html/php
19798 ====bba====
19799 !! end
19800
19801 !! test
19802 Section extraction test (section 8)
19803 !! options
19804 section=8
19805 !! wikitext
19806 start
19807 ==a==
19808 ===aa===
19809 ====aaa====
19810 ==b==
19811 ===ba===
19812 ===bb===
19813 ====bba====
19814 ===bc===
19815 ==c==
19816 ===ca===
19817 !! html/php
19818 ===bc===
19819 !! end
19820
19821 !! test
19822 Section extraction test (section 9)
19823 !! options
19824 section=9
19825 !! wikitext
19826 start
19827 ==a==
19828 ===aa===
19829 ====aaa====
19830 ==b==
19831 ===ba===
19832 ===bb===
19833 ====bba====
19834 ===bc===
19835 ==c==
19836 ===ca===
19837 !! html/php
19838 ==c==
19839 ===ca===
19840 !! end
19841
19842 !! test
19843 Section extraction test (section 10)
19844 !! options
19845 section=10
19846 !! wikitext
19847 start
19848 ==a==
19849 ===aa===
19850 ====aaa====
19851 ==b==
19852 ===ba===
19853 ===bb===
19854 ====bba====
19855 ===bc===
19856 ==c==
19857 ===ca===
19858 !! html/php
19859 ===ca===
19860 !! end
19861
19862 !! test
19863 Section extraction test (nonexistent section 11)
19864 !! options
19865 section=11
19866 !! wikitext
19867 start
19868 ==a==
19869 ===aa===
19870 ====aaa====
19871 ==b==
19872 ===ba===
19873 ===bb===
19874 ====bba====
19875 ===bc===
19876 ==c==
19877 ===ca===
19878 !! html/php
19879 !! end
19880
19881 !! test
19882 Section extraction test with bogus heading (section 1)
19883 !! options
19884 section=1
19885 !! wikitext
19886 ==a==
19887 ==bogus== not a legal section
19888 ==b==
19889 !! html/php
19890 ==a==
19891 ==bogus== not a legal section
19892 !! end
19893
19894 !! test
19895 Section extraction test with bogus heading (section 2)
19896 !! options
19897 section=2
19898 !! wikitext
19899 ==a==
19900 ==bogus== not a legal section
19901 ==b==
19902 !! html/php
19903 ==b==
19904 !! end
19905
19906 !! test
19907 Section extraction test with comment after heading (section 1)
19908 !! options
19909 section=1
19910 !! wikitext
19911 ==a==
19912 ==b== <!-- -->
19913 ==c==
19914 !! html/php
19915 ==a==
19916 !! end
19917
19918 !! test
19919 Section extraction test with comment after heading (section 2)
19920 !! options
19921 section=2
19922 !! wikitext
19923 ==a==
19924 ==b== <!-- -->
19925 ==c==
19926 !! html/php
19927 ==b== <!-- -->
19928 !! end
19929
19930 !! test
19931 Section extraction test with bogus <nowiki> heading (section 1)
19932 !! options
19933 section=1
19934 !! wikitext
19935 ==a==
19936 ==bogus== <nowiki>not a legal section</nowiki>
19937 ==b==
19938 !! html/php
19939 ==a==
19940 ==bogus== <nowiki>not a legal section</nowiki>
19941 !! end
19942
19943 !! test
19944 Section extraction test with bogus <nowiki> heading (section 2)
19945 !! options
19946 section=2
19947 !! wikitext
19948 ==a==
19949 ==bogus== <nowiki>not a legal section</nowiki>
19950 ==b==
19951 !! html/php
19952 ==b==
19953 !! end
19954
19955 # Formerly testing for T4587, now resolved by the use of unmarked sections
19956 # instead of respecting commented sections
19957 !! test
19958 Section extraction prefixed by comment (section 1)
19959 !! options
19960 section=1
19961 !! wikitext
19962 <!-- -->==sec1==
19963 ==sec2==
19964 !! html/php
19965 ==sec2==
19966 !!end
19967
19968 !! test
19969 Section extraction prefixed by comment (section 2)
19970 !! options
19971 section=2
19972 !! wikitext
19973 <!-- -->==sec1==
19974 ==sec2==
19975 !! html/php
19976
19977 !!end
19978
19979 # Formerly testing for T4607, now resolved by the use of unmarked sections
19980 # instead of respecting HTML-style headings
19981 !! test
19982 Section extraction, mixed wiki and html (section 1)
19983 !! options
19984 section=1
19985 !! wikitext
19986 <h2>unmarked</h2>
19987 unmarked
19988 ==1==
19989 one
19990 ==2==
19991 two
19992 !! html/php
19993 ==1==
19994 one
19995 !! end
19996
19997 !! test
19998 Section extraction, mixed wiki and html (section 2)
19999 !! options
20000 section=2
20001 !! wikitext
20002 <h2>unmarked</h2>
20003 unmarked
20004 ==1==
20005 one
20006 ==2==
20007 two
20008 !! html/php
20009 ==2==
20010 two
20011 !! end
20012
20013
20014 # Formerly testing for T5342
20015 !! test
20016 Section extraction, heading surrounded by <noinclude>
20017 !! options
20018 section=1
20019 !! wikitext
20020 <noinclude>==unmarked==</noinclude>
20021 ==marked==
20022 !! html/php
20023 ==marked==
20024 !!end
20025
20026 # Test behavior of T21910
20027 !! test
20028 Sectiion with all-equals
20029 !! options
20030 section=2
20031 !! wikitext
20032 ===
20033 The line above must have a trailing space
20034 === <!--
20035 --> <!-- -->
20036 But just in case it doesn't...
20037 !! html/php
20038 === <!--
20039 --> <!-- -->
20040 But just in case it doesn't...
20041 !! end
20042
20043 !! test
20044 Section replacement test (section 0)
20045 !! options
20046 replace=0,"xxx"
20047 !! wikitext
20048 start
20049 ==a==
20050 ===aa===
20051 ====aaa====
20052 ==b==
20053 ===ba===
20054 ===bb===
20055 ====bba====
20056 ===bc===
20057 ==c==
20058 ===ca===
20059 !! html/php
20060 xxx
20061
20062 ==a==
20063 ===aa===
20064 ====aaa====
20065 ==b==
20066 ===ba===
20067 ===bb===
20068 ====bba====
20069 ===bc===
20070 ==c==
20071 ===ca===
20072 !! end
20073
20074 !! test
20075 Section replacement test (section 1)
20076 !! options
20077 replace=1,"xxx"
20078 !! wikitext
20079 start
20080 ==a==
20081 ===aa===
20082 ====aaa====
20083 ==b==
20084 ===ba===
20085 ===bb===
20086 ====bba====
20087 ===bc===
20088 ==c==
20089 ===ca===
20090 !! html/php
20091 start
20092 xxx
20093
20094 ==b==
20095 ===ba===
20096 ===bb===
20097 ====bba====
20098 ===bc===
20099 ==c==
20100 ===ca===
20101 !! end
20102
20103 !! test
20104 Section replacement test (section 2)
20105 !! options
20106 replace=2,"xxx"
20107 !! wikitext
20108 start
20109 ==a==
20110 ===aa===
20111 ====aaa====
20112 ==b==
20113 ===ba===
20114 ===bb===
20115 ====bba====
20116 ===bc===
20117 ==c==
20118 ===ca===
20119 !! html/php
20120 start
20121 ==a==
20122 xxx
20123
20124 ==b==
20125 ===ba===
20126 ===bb===
20127 ====bba====
20128 ===bc===
20129 ==c==
20130 ===ca===
20131 !! end
20132
20133 !! test
20134 Section replacement test (section 3)
20135 !! options
20136 replace=3,"xxx"
20137 !! wikitext
20138 start
20139 ==a==
20140 ===aa===
20141 ====aaa====
20142 ==b==
20143 ===ba===
20144 ===bb===
20145 ====bba====
20146 ===bc===
20147 ==c==
20148 ===ca===
20149 !! html/php
20150 start
20151 ==a==
20152 ===aa===
20153 xxx
20154
20155 ==b==
20156 ===ba===
20157 ===bb===
20158 ====bba====
20159 ===bc===
20160 ==c==
20161 ===ca===
20162 !! end
20163
20164 !! test
20165 Section replacement test (section 4)
20166 !! options
20167 replace=4,"xxx"
20168 !! wikitext
20169 start
20170 ==a==
20171 ===aa===
20172 ====aaa====
20173 ==b==
20174 ===ba===
20175 ===bb===
20176 ====bba====
20177 ===bc===
20178 ==c==
20179 ===ca===
20180 !! html/php
20181 start
20182 ==a==
20183 ===aa===
20184 ====aaa====
20185 xxx
20186
20187 ==c==
20188 ===ca===
20189 !! end
20190
20191 !! test
20192 Section replacement test (section 5)
20193 !! options
20194 replace=5,"xxx"
20195 !! wikitext
20196 start
20197 ==a==
20198 ===aa===
20199 ====aaa====
20200 ==b==
20201 ===ba===
20202 ===bb===
20203 ====bba====
20204 ===bc===
20205 ==c==
20206 ===ca===
20207 !! html/php
20208 start
20209 ==a==
20210 ===aa===
20211 ====aaa====
20212 ==b==
20213 xxx
20214
20215 ===bb===
20216 ====bba====
20217 ===bc===
20218 ==c==
20219 ===ca===
20220 !! end
20221
20222 !! test
20223 Section replacement test (section 6)
20224 !! options
20225 replace=6,"xxx"
20226 !! wikitext
20227 start
20228 ==a==
20229 ===aa===
20230 ====aaa====
20231 ==b==
20232 ===ba===
20233 ===bb===
20234 ====bba====
20235 ===bc===
20236 ==c==
20237 ===ca===
20238 !! html/php
20239 start
20240 ==a==
20241 ===aa===
20242 ====aaa====
20243 ==b==
20244 ===ba===
20245 xxx
20246
20247 ===bc===
20248 ==c==
20249 ===ca===
20250 !! end
20251
20252 !! test
20253 Section replacement test (section 7)
20254 !! options
20255 replace=7,"xxx"
20256 !! wikitext
20257 start
20258 ==a==
20259 ===aa===
20260 ====aaa====
20261 ==b==
20262 ===ba===
20263 ===bb===
20264 ====bba====
20265 ===bc===
20266 ==c==
20267 ===ca===
20268 !! html/php
20269 start
20270 ==a==
20271 ===aa===
20272 ====aaa====
20273 ==b==
20274 ===ba===
20275 ===bb===
20276 xxx
20277
20278 ===bc===
20279 ==c==
20280 ===ca===
20281 !! end
20282
20283 !! test
20284 Section replacement test (section 8)
20285 !! options
20286 replace=8,"xxx"
20287 !! wikitext
20288 start
20289 ==a==
20290 ===aa===
20291 ====aaa====
20292 ==b==
20293 ===ba===
20294 ===bb===
20295 ====bba====
20296 ===bc===
20297 ==c==
20298 ===ca===
20299 !! html/php
20300 start
20301 ==a==
20302 ===aa===
20303 ====aaa====
20304 ==b==
20305 ===ba===
20306 ===bb===
20307 ====bba====
20308 xxx
20309
20310 ==c==
20311 ===ca===
20312 !!end
20313
20314 !! test
20315 Section replacement test (section 9)
20316 !! options
20317 replace=9,"xxx"
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 ==a==
20333 ===aa===
20334 ====aaa====
20335 ==b==
20336 ===ba===
20337 ===bb===
20338 ====bba====
20339 ===bc===
20340 xxx
20341 !! end
20342
20343 !! test
20344 Section replacement test (section 10)
20345 !! options
20346 replace=10,"xxx"
20347 !! wikitext
20348 start
20349 ==a==
20350 ===aa===
20351 ====aaa====
20352 ==b==
20353 ===ba===
20354 ===bb===
20355 ====bba====
20356 ===bc===
20357 ==c==
20358 ===ca===
20359 !! html/php
20360 start
20361 ==a==
20362 ===aa===
20363 ====aaa====
20364 ==b==
20365 ===ba===
20366 ===bb===
20367 ====bba====
20368 ===bc===
20369 ==c==
20370 xxx
20371 !! end
20372
20373 !! test
20374 Section replacement test with initial whitespace (T15728)
20375 !! options
20376 replace=2,"xxx"
20377 !! wikitext
20378 Preformatted initial line
20379 ==a==
20380 ===a===
20381 !! html/php
20382 Preformatted initial line
20383 ==a==
20384 xxx
20385 !! end
20386
20387
20388 !! test
20389 Section extraction, heading followed by pre with 20 spaces (T8398)
20390 !! options
20391 section=1
20392 !! wikitext
20393 ==a==
20394 a
20395 !! html/php
20396 ==a==
20397 a
20398 !! end
20399
20400 !! test
20401 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20402 !! options
20403 section=1
20404 !! wikitext
20405 ==a==
20406 a
20407 !! html/php
20408 ==a==
20409 a
20410 !! end
20411
20412
20413 !! test
20414 Section extraction, <pre> around bogus header (T12309)
20415 !! options
20416 section=2
20417 !! wikitext
20418 == Section One ==
20419 <pre>
20420 =======
20421 </pre>
20422
20423 == Section Two ==
20424 stuff
20425 !! html/php
20426 == Section Two ==
20427 stuff
20428 !! end
20429
20430 !! test
20431 Section replacement, <pre> around bogus header (T12309)
20432 !! options
20433 replace=2,"xxx"
20434 !! wikitext
20435 == Section One ==
20436 <pre>
20437 =======
20438 </pre>
20439
20440 == Section Two ==
20441 stuff
20442 !! html/php
20443 == Section One ==
20444 <pre>
20445 =======
20446 </pre>
20447
20448 xxx
20449 !! end
20450
20451 !! test
20452 Handling of &#x0A; in URLs
20453 !! wikitext
20454 *irc://&#x0A;a
20455 !! html/php
20456 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20457
20458 !! html/parsoid
20459 <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>
20460 !! end
20461
20462 !! test
20463 Handling of %0A in URLs
20464 !! wikitext
20465 *irc://%0Aa
20466 !! html/php
20467 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20468
20469 !! html/parsoid
20470 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20471 !! end
20472
20473 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20474 !! test
20475 5 quotes, code coverage +1 line
20476 !! options
20477 parsoid=wt2html
20478 !! wikitext
20479 '''''
20480 !! html/php
20481 !! html/parsoid
20482 <p><b><i></i></b></p>
20483 !! end
20484
20485 # same html as previous, but wikitext adjusted to match parsoid html2wt
20486 # note that wt2html and html2html will put the <i> before the <b>
20487 !! test
20488 5 quotes, code coverage +1 line w/ nowiki (1)
20489 !! options
20490 parsoid=wt2wt,html2wt
20491 !! wikitext
20492 '''''<nowiki/>'''''
20493 !! html/php
20494 <p><i></i>
20495 </p>
20496 !! html/parsoid
20497 <p><b><i></i></b></p>
20498 !! end
20499
20500 # same as previous, just swapping the <i> and <b>
20501 !! test
20502 5 quotes, code coverage +1 line w/ nowiki (2)
20503 !! wikitext
20504 '''''<nowiki/>'''''
20505 !! html/php
20506 <p><i></i>
20507 </p>
20508 !! html/parsoid
20509 <p><i><b></b></i></p>
20510 !! end
20511
20512 !! test
20513 Special:Search page linking.
20514 !! wikitext
20515 {{Special:search}}
20516 !! html
20517 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20518 </p>
20519 !! end
20520
20521 !! test
20522 {{!}} is a magic word
20523 !! wikitext
20524 {{!}} is a magic word there and {{!}} is still a magic word here
20525 | is not a magic word here but {{!}} is still a magic word here
20526 !! html/php
20527 <p>| is a magic word there and | is still a magic word here
20528 | is not a magic word here but | is still a magic word here
20529 </p>
20530 !! html/parsoid
20531 <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
20532 | 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>
20533 !! end
20534
20535 !! test
20536 Say the magic word
20537 !! options
20538 title=[[Parser test]]
20539 !! wikitext
20540 *{{PAGENAME}}
20541 *{{PAGENAMEE}}
20542 *{{FULLPAGENAME}}
20543 *{{FULLPAGENAMEE}}
20544 *{{BASEPAGENAME}}
20545 *{{BASEPAGENAMEE}}
20546 *{{SUBPAGENAME}}
20547 *{{SUBPAGENAMEE}}
20548 *{{ROOTPAGENAME}}
20549 *{{ROOTPAGENAMEE}}
20550 *{{TALKPAGENAME}}
20551 *{{TALKPAGENAMEE}}
20552 *{{SUBJECTPAGENAME}}
20553 *{{SUBJECTPAGENAMEE}}
20554 *{{NAMESPACEE}}
20555 *{{NAMESPACE}}
20556 *{{NAMESPACENUMBER}}
20557 *{{TALKSPACE}}
20558 *{{TALKSPACEE}}
20559 *{{SUBJECTSPACE}}
20560 *{{SUBJECTSPACEE}}
20561 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20562 !! html
20563 <ul><li>Parser test</li>
20564 <li>Parser_test</li>
20565 <li>Parser test</li>
20566 <li>Parser_test</li>
20567 <li>Parser test</li>
20568 <li>Parser_test</li>
20569 <li>Parser test</li>
20570 <li>Parser_test</li>
20571 <li>Parser test</li>
20572 <li>Parser_test</li>
20573 <li>Talk:Parser test</li>
20574 <li>Talk:Parser_test</li>
20575 <li>Parser test</li>
20576 <li>Parser_test</li>
20577 <li></li>
20578 <li></li>
20579 <li>0</li>
20580 <li>Talk</li>
20581 <li>Talk</li>
20582 <li></li>
20583 <li></li>
20584 <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>
20585
20586 !! end
20587 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20588
20589 !! test
20590 Gallery with valid attributes
20591 !! wikitext
20592 <gallery type="123" summary="345">
20593 File:File:Foobar.jpg
20594 </gallery>
20595 !! html/php
20596 <ul class="gallery mw-gallery-traditional" type="123">
20597 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20598 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20599 <div class="gallerytext">
20600 </div>
20601 </div></li>
20602 </ul>
20603
20604 !! html/parsoid
20605 <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"}}'>
20606 <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>
20607 </ul>
20608 !! end
20609
20610 ## Parsoid thinks the "centre" here is a property, not a caption.
20611 !! test
20612 Gallery
20613 !! options
20614 parsoid={
20615 "modes": ["wt2html"],
20616 "nativeGallery": true
20617 }
20618 !! wikitext
20619 <gallery>
20620 image1.png |
20621 image2.gif|||||
20622
20623 image3|
20624 image4 |300px| centre
20625 image5.svg| http://///////
20626 [[x|xx]]]]
20627 * image6
20628 </gallery>
20629 !! html/php
20630 <ul class="gallery mw-gallery-traditional">
20631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20632 <div class="thumb" style="height: 150px;">Image1.png</div>
20633 <div class="gallerytext">
20634 </div>
20635 </div></li>
20636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20637 <div class="thumb" style="height: 150px;">Image2.gif</div>
20638 <div class="gallerytext">
20639 </div>
20640 </div></li>
20641 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20642 <div class="thumb" style="height: 150px;">Image3</div>
20643 <div class="gallerytext">
20644 </div>
20645 </div></li>
20646 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20647 <div class="thumb" style="height: 150px;">Image4</div>
20648 <div class="gallerytext">
20649 <pre>centre
20650 </pre>
20651 </div>
20652 </div></li>
20653 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20654 <div class="thumb" style="height: 150px;">Image5.svg</div>
20655 <div class="gallerytext">
20656 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20657 </p>
20658 </div>
20659 </div></li>
20660 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20661 <div class="thumb" style="height: 150px;">* image6</div>
20662 <div class="gallerytext">
20663 </div>
20664 </div></li>
20665 </ul>
20666
20667 !! html/parsoid
20668 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20669 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20670 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File: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>
20671 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20672 <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>
20673 <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>
20674 <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>
20675 </ul>
20676 !! end
20677
20678 !! test
20679 Gallery (with options, html)
20680 !! options
20681 parsoid={
20682 "modes": ["wt2html", "html2html"],
20683 "nativeGallery": true
20684 }
20685 !! wikitext
20686 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20687 File:Nonexistent.jpg|caption
20688 File:Nonexistent.jpg
20689 image:foobar.jpg|some '''caption''' [[Main Page]]
20690 image:foobar.jpg
20691 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20692 </gallery>
20693 !! html/php
20694 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20695 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20696 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20697 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20698 <div class="gallerytext">
20699 <p>caption
20700 </p>
20701 </div>
20702 </div></li>
20703 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20704 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20705 <div class="gallerytext">
20706 </div>
20707 </div></li>
20708 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20709 <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>
20710 <div class="gallerytext">
20711 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20712 </p>
20713 </div>
20714 </div></li>
20715 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20716 <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>
20717 <div class="gallerytext">
20718 </div>
20719 </div></li>
20720 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20721 <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>
20722 <div class="gallerytext">
20723 <p>blabla.
20724 </p>
20725 </div>
20726 </div></li>
20727 </ul>
20728
20729 !! html/parsoid
20730 <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":{}}'>
20731 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20732 <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>
20733 <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>
20734 <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>
20735 <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>
20736 <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>
20737 </ul>
20738 !! end
20739
20740 !! test
20741 Gallery (with options, extsrc)
20742 !! options
20743 parsoid={
20744 "nativeGallery": false
20745 }
20746 !! wikitext
20747 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20748 File:Nonexistent.jpg|caption
20749 File:Nonexistent.jpg
20750 image:foobar.jpg|some '''caption''' [[Main Page]]
20751 image:foobar.jpg
20752 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20753 </gallery>
20754 !! html/php
20755 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20756 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20757 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20758 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20759 <div class="gallerytext">
20760 <p>caption
20761 </p>
20762 </div>
20763 </div></li>
20764 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20765 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20766 <div class="gallerytext">
20767 </div>
20768 </div></li>
20769 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20770 <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>
20771 <div class="gallerytext">
20772 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20773 </p>
20774 </div>
20775 </div></li>
20776 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20777 <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>
20778 <div class="gallerytext">
20779 </div>
20780 </div></li>
20781 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20782 <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>
20783 <div class="gallerytext">
20784 <p>blabla.
20785 </p>
20786 </div>
20787 </div></li>
20788 </ul>
20789
20790 !! html/parsoid
20791 <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"}}'>
20792 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20793 <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>
20794 <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>
20795 <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>
20796 <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>
20797 <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>
20798 </ul>
20799 !! end
20800
20801 !! test
20802 Gallery (without px units)
20803 !! wikitext
20804 <gallery widths="70" heights="40">
20805 File:Foobar.jpg
20806 </gallery>
20807 !! html/php
20808 <ul class="gallery mw-gallery-traditional">
20809 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20810 <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>
20811 <div class="gallerytext">
20812 </div>
20813 </div></li>
20814 </ul>
20815
20816 !! html/parsoid
20817 <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"}}'>
20818 <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>
20819 </ul>
20820 !! end
20821
20822 !! test
20823 Gallery (with invalid units)
20824 !! wikitext
20825 <gallery widths="70em" heights="40em">
20826 File:Foobar.jpg
20827 </gallery>
20828 !! html/php
20829 <ul class="gallery mw-gallery-traditional">
20830 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20831 <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>
20832 <div class="gallerytext">
20833 </div>
20834 </div></li>
20835 </ul>
20836
20837 !! html/parsoid
20838 <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"}}'>
20839 <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>
20840 </ul>
20841 !! end
20842
20843 !! test
20844 Gallery with link that has fragment
20845 !! options
20846 parsoid={
20847 "modes": ["wt2html", "html2html"],
20848 "nativeGallery": true
20849 }
20850 !! wikitext
20851 <gallery>
20852 image:foobar.jpg|link=Main_Page
20853 image:foobar.jpg|link=Main_Page#section
20854 image:foobar.jpg|link=Main Page#section|caption
20855 </gallery>
20856 !! html/php
20857 <ul class="gallery mw-gallery-traditional">
20858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20859 <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>
20860 <div class="gallerytext">
20861 </div>
20862 </div></li>
20863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20864 <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>
20865 <div class="gallerytext">
20866 </div>
20867 </div></li>
20868 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20869 <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>
20870 <div class="gallerytext">
20871 <p>caption
20872 </p>
20873 </div>
20874 </div></li>
20875 </ul>
20876
20877 !! html/parsoid
20878 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20879 <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>
20880 <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>
20881 <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>
20882 </ul>
20883 !! end
20884
20885 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20886 !! test
20887 Gallery with template inside caption
20888 !! options
20889 parsoid={
20890 "nativeGallery": true
20891 }
20892 !! wikitext
20893 <gallery caption="{{echo|hi}}">
20894 File:Foobar.jpg|{{echo|ho}}
20895 </gallery>
20896 !! html/php
20897 <ul class="gallery mw-gallery-traditional">
20898 <li class='gallerycaption'>{{echo|hi}}</li>
20899 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20900 <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>
20901 <div class="gallerytext">
20902 <p>ho
20903 </p>
20904 </div>
20905 </div></li>
20906 </ul>
20907
20908 !! html/parsoid
20909 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20910 <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>
20911 <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>
20912 </ul>
20913 !! end
20914
20915 !! test
20916 Gallery with wikitext inside caption
20917 !! options
20918 parsoid={
20919 "nativeGallery": true
20920 }
20921 !! wikitext
20922 <gallery>
20923 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20924 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20925 </gallery>
20926 !! html/php
20927 <ul class="gallery mw-gallery-traditional">
20928 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20929 <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>
20930 <div class="gallerytext">
20931 <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>
20932 </p>
20933 </div>
20934 </div></li>
20935 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20936 <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>
20937 <div class="gallerytext">
20938 <p>This is a test template
20939 </p>
20940 </div>
20941 </div></li>
20942 </ul>
20943
20944 !! html/parsoid
20945 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20946 <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>
20947 <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>
20948 </ul>
20949 !! end
20950
20951 !! test
20952 Gallery (with showfilename option)
20953 !! options
20954 parsoid={
20955 "nativeGallery": true
20956 }
20957 !! wikitext
20958 <gallery showfilename="">
20959 File:Nonexistent.jpg|caption
20960 File:Nonexistent.jpg
20961 File:Foobar.jpg|some '''caption''' [[Main Page]]
20962 File:Foobar.jpg
20963 </gallery>
20964 !! html/php
20965 <ul class="gallery mw-gallery-traditional">
20966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20967 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20968 <div class="gallerytext">
20969 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20970 caption
20971 </p>
20972 </div>
20973 </div></li>
20974 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20975 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20976 <div class="gallerytext">
20977 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20978 </p>
20979 </div>
20980 </div></li>
20981 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20982 <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>
20983 <div class="gallerytext">
20984 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20985 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20986 </p>
20987 </div>
20988 </div></li>
20989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20990 <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>
20991 <div class="gallerytext">
20992 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20993 </p>
20994 </div>
20995 </div></li>
20996 </ul>
20997
20998 !! html/parsoid
20999 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21000 <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>
21001 <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>
21002 <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>
21003 <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>
21004 </ul>
21005 !! end
21006
21007 ## Should Parsoid be preserving these variations? See T151367
21008 !! test
21009 Gallery (with namespace-less filenames)
21010 !! options
21011 parsoid={
21012 "modes": ["wt2html", "html2html"],
21013 "nativeGallery": true
21014 }
21015 !! wikitext
21016 <gallery>
21017 File:Nonexistent.jpg
21018 Nonexistent.jpg
21019 image:foobar.jpg
21020 foobar.jpg
21021 </gallery>
21022 !! html/php
21023 <ul class="gallery mw-gallery-traditional">
21024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21025 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21026 <div class="gallerytext">
21027 </div>
21028 </div></li>
21029 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21030 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21031 <div class="gallerytext">
21032 </div>
21033 </div></li>
21034 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21035 <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>
21036 <div class="gallerytext">
21037 </div>
21038 </div></li>
21039 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21040 <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>
21041 <div class="gallerytext">
21042 </div>
21043 </div></li>
21044 </ul>
21045
21046 !! html/parsoid
21047 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21048 <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>
21049 <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>
21050 <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>
21051 <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>
21052 </ul>
21053 !! end
21054
21055 !! test
21056 Gallery override link with wikilink (T36852)
21057 !! options
21058 parsoid={
21059 "nativeGallery": true
21060 }
21061 !! wikitext
21062 <gallery>
21063 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21064 </gallery>
21065 !! html/php
21066 <ul class="gallery mw-gallery-traditional">
21067 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21068 <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>
21069 <div class="gallerytext">
21070 </div>
21071 </div></li>
21072 </ul>
21073
21074 !! html/parsoid
21075 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21076 <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>
21077 </ul>
21078 !! end
21079
21080 !! test
21081 Gallery override link with absolute external link (T36852)
21082 !! options
21083 parsoid={
21084 "nativeGallery": true
21085 }
21086 !! wikitext
21087 <gallery>
21088 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21089 </gallery>
21090 !! html/php
21091 <ul class="gallery mw-gallery-traditional">
21092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21093 <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>
21094 <div class="gallerytext">
21095 </div>
21096 </div></li>
21097 </ul>
21098
21099 !! html/parsoid
21100 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21101 <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>
21102 </ul>
21103 !! end
21104
21105 !! test
21106 Gallery override link with absolute external link with LanguageConverter
21107 !! options
21108 language=zh
21109 !! wikitext
21110 <gallery>
21111 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21112 </gallery>
21113 !! html/php
21114 <ul class="gallery mw-gallery-traditional">
21115 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21116 <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>
21117 <div class="gallerytext">
21118 <p>caption
21119 </p>
21120 </div>
21121 </div></li>
21122 </ul>
21123
21124 !! html/parsoid
21125 <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"}}'>
21126 <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>
21127 </ul>
21128 !! end
21129
21130 !! test
21131 Gallery override link with malicious javascript (T36852)
21132 !! options
21133 parsoid={
21134 "modes": ["wt2html", "html2html"],
21135 "nativeGallery": true
21136 }
21137 !! wikitext
21138 <gallery>
21139 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21140 </gallery>
21141 !! html/php
21142 <ul class="gallery mw-gallery-traditional">
21143 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21144 <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>
21145 <div class="gallerytext">
21146 </div>
21147 </div></li>
21148 </ul>
21149
21150 !! html/parsoid
21151 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21152 <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>
21153 </ul>
21154 !! end
21155
21156 # Note that parsoid uses the invalid link as a caption, PHP does not.
21157 !! test
21158 Gallery with invalid title as link (T45964)
21159 !! options
21160 parsoid={
21161 "modes": ["wt2html", "html2html"],
21162 "nativeGallery": true
21163 }
21164 !! wikitext
21165 <gallery>
21166 File:Foobar.jpg|link=<
21167 </gallery>
21168 !! html/php
21169 <ul class="gallery mw-gallery-traditional">
21170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21171 <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>
21172 <div class="gallerytext">
21173 </div>
21174 </div></li>
21175 </ul>
21176
21177 !! html/parsoid
21178 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21179 <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>
21180 </ul>
21181 !! end
21182
21183 !! test
21184 Serialize gallery without attrs in data-mw
21185 !! options
21186 parsoid={
21187 "modes": ["html2wt"],
21188 "nativeGallery": true
21189 }
21190 !! html/parsoid
21191 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21192 <li class="gallerycaption">123</li>
21193 <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>
21194 </ul>
21195 !! wikitext
21196 <gallery caption="123">
21197 File:Test.png
21198 </gallery>
21199 !! end
21200
21201 !! test
21202 Gallery with class and style attributes
21203 !! options
21204 parsoid={
21205 "nativeGallery": true
21206 }
21207 !! wikitext
21208 <gallery class="center" style="text-align: center;">
21209 File:Foobar.jpg
21210 </gallery>
21211 !! html/php
21212 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21213 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21214 <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>
21215 <div class="gallerytext">
21216 </div>
21217 </div></li>
21218 </ul>
21219
21220 !! html/parsoid
21221 <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":{}}'>
21222 <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>
21223 </ul>
21224 !! end
21225
21226 !! test
21227 Gallery in slideshow mode
21228 !! options
21229 parsoid={
21230 "nativeGallery": true
21231 }
21232 !! wikitext
21233 <gallery mode="slideshow" showthumbnails="">
21234 File:Foobar.jpg
21235 </gallery>
21236 !! html/php
21237 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21238 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21239 <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>
21240 <div class="gallerytext">
21241 </div>
21242 </div></li>
21243 </ul>
21244
21245 !! html/parsoid
21246 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21247 <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>
21248 </ul>
21249 !! end
21250
21251 !! test
21252 Serialize gallery image captions on a line
21253 !! options
21254 parsoid={
21255 "modes": ["html2wt"],
21256 "nativeGallery": true
21257 }
21258 !! html/parsoid
21259 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21260 <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>
21261 <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>
21262 </ul>
21263 !! wikitext
21264 <gallery>
21265 File:Foobar.jpg| hi ho
21266 File:Foobar.jpg|hi<br />ho
21267 </gallery>
21268 !! end
21269
21270 !! test
21271 HTML Hex character encoding (spells the word "JavaScript")
21272 !! options
21273 parsoid=wt2html,wt2wt,html2html
21274 !! wikitext
21275 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21276 !! html/php
21277 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21278 </p>
21279 !! html/parsoid
21280 <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>
21281 !! end
21282
21283 !! test
21284 HTML Hex character encoding bogus encoding (T28437 regression check)
21285 !! wikitext
21286 &#xsee;&#XSEE;
21287 !! html
21288 <p>&amp;#xsee;&amp;#XSEE;
21289 </p>
21290 !! end
21291
21292 !! test
21293 HTML Hex character encoding mixed case
21294 !! options
21295 parsoid=wt2html,wt2wt,html2html
21296 !! wikitext
21297 &#xEE;&#Xee;
21298 !! html/php
21299 <p>&#xee;&#xee;
21300 </p>
21301 !! html/parsoid
21302 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21303 !! end
21304
21305 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21306 # Note that U+000C (form feed) is not a valid XML character, so
21307 # it is banned even though allowed in HTML5.
21308 !! test
21309 Illegal character references (T106578)
21310 !! wikitext
21311 ; Null: &#00;
21312 ; FF: &#xC;
21313 ; CR: &#xD;
21314 ; Control (low): &#8;
21315 ; Control (high): &#x7F; &#x9F;
21316 ; Surrogate: &#xD83D;&#xDCA9;
21317 ; This is an okay astral character: &#x1F4A9;
21318 !! html+tidy
21319 <dl><dt>Null</dt>
21320 <dd>&amp;#00;</dd>
21321 <dt>FF</dt>
21322 <dd>&amp;#xC;</dd>
21323 <dt>CR</dt>
21324 <dd>&amp;#xD;</dd>
21325 <dt>Control (low)</dt>
21326 <dd>&amp;#8;</dd>
21327 <dt>Control (high)</dt>
21328 <dd>&amp;#x7F; &amp;#x9F;</dd>
21329 <dt>Surrogate</dt>
21330 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21331 <dt>This is an okay astral character</dt>
21332 <dd>&#x1f4a9;</dd></dl>
21333 !! end
21334
21335 !! test
21336 __FORCETOC__ override
21337 !! wikitext
21338 __NEWSECTIONLINK__
21339 __FORCETOC__
21340 !! html/php
21341 <p><br />
21342 </p>
21343 !! end
21344
21345 !! test
21346 ISBN code coverage
21347 !! wikitext
21348 ISBN 978-0-1234-56&#x20;789
21349 !! html/php
21350 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21351 </p>
21352 !! html/parsoid
21353 <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>
21354 !! end
21355
21356 !! test
21357 ISBN followed by 5 spaces
21358 !! wikitext
21359 ISBN
21360 !! html
21361 <p>ISBN
21362 </p>
21363 !! end
21364
21365 !! test
21366 Double ISBN
21367 !! wikitext
21368 ISBN ISBN 1234567890
21369 !! html/php
21370 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21371 </p>
21372 !! html/parsoid
21373 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21374 !! end
21375
21376 # Uppercase X and lowercase x as well
21377 !! test
21378 ISBN with an X
21379 !! wikitext
21380 ISBN 3-462-04561-X
21381 ISBN 3-462-04561-x
21382 ISBN 080442957X
21383 ISBN 080442957x
21384 ISBN 978080442957X
21385 ISBN 978080442957x
21386 !! html/php
21387 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21388 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21389 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21390 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21391 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21392 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21393 </p>
21394 !! html/parsoid
21395 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21396 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21397 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21398 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21399 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21400 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21401 !! end
21402
21403 !! test
21404 ISBN with empty prefix (parsoid test)
21405 !! wikitext
21406 ISBN 1234567890
21407 !! html/php
21408 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21409 </p>
21410 !! html/parsoid
21411 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21412 !! end
21413
21414 !! test
21415 T24905: <abbr> followed by ISBN followed by </a>
21416 !! wikitext
21417 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21418 !! html/php
21419 <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>
21420 </p>
21421 !! html/parsoid
21422 <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>
21423 !! end
21424
21425 !! test
21426 Double RFC
21427 !! wikitext
21428 RFC RFC 1234
21429 !! html/php
21430 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21431 </p>
21432 !! html/parsoid
21433 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21434 !! end
21435
21436 !! test
21437 Double RFC with a wiki link
21438 !! wikitext
21439 RFC [[RFC 1234]]
21440 !! html/php
21441 <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>
21442 </p>
21443 !! html/parsoid
21444 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21445 !! end
21446
21447 !! test
21448 RFC code coverage
21449 !! wikitext
21450 RFC 983&#x20;987
21451 !! html/php
21452 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21453 </p>
21454 !! html/parsoid
21455 <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>
21456 !! end
21457
21458 !! test
21459 Centre-aligned image
21460 !! wikitext
21461 [[Image:foobar.jpg|centre]]
21462 !! html/php
21463 <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>
21464
21465 !! html/parsoid
21466 <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>
21467 !! end
21468
21469 !! test
21470 None-aligned image
21471 !! wikitext
21472 [[Image:foobar.jpg|none]]
21473 !! html/php
21474 <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>
21475
21476 !! html/parsoid
21477 <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>
21478 !! end
21479
21480 !! test
21481 Width + Height sized image (using px) (height is ignored)
21482 !! wikitext
21483 [[Image:foobar.jpg|640x480px]]
21484 !! html/php
21485 <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>
21486 </p>
21487 !! html/parsoid
21488 <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>
21489 !! end
21490
21491 !! test
21492 Width-sized image (using px, no following whitespace)
21493 !! wikitext
21494 [[Image:foobar.jpg|640px]]
21495 !! html/php
21496 <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>
21497 </p>
21498 !! html/parsoid
21499 <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>
21500 !! end
21501
21502 !! test
21503 Width-sized image (using px, with following whitespace - test regression from r39467)
21504 !! wikitext
21505 [[Image:foobar.jpg|640px ]]
21506 !! html/php
21507 <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>
21508 </p>
21509 !! html/parsoid
21510 <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>
21511 !!end
21512
21513 !! test
21514 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21515 !! wikitext
21516 [[Image:foobar.jpg| 640px]]
21517 !! html/php
21518 <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>
21519 </p>
21520 !! html/parsoid
21521 <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>
21522 !! end
21523
21524 !! test
21525 Image with page parameter
21526 !! options
21527 djvu
21528 !! wikitext
21529 [[File:LoremIpsum.djvu|page=2]]
21530 !! html/php
21531 <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>
21532 </p>
21533 !! html/parsoid
21534 <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>
21535 !! end
21536
21537 !! test
21538 Another italics / bold test
21539 !! wikitext
21540 ''' ''x'
21541 !! html
21542 <pre>'<i> </i>x'
21543 </pre>
21544 !!end
21545
21546 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21547 !! test
21548 dt/dd/dl test
21549 !! wikitext
21550 :;;;::
21551 !! html/php
21552 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21553
21554 !! html/parsoid
21555 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21556
21557 !!end
21558
21559 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21560 !! test
21561 Images with the "|" character in the comment
21562 !! wikitext
21563 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21564 !! html/php
21565 <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>
21566
21567 !! html/parsoid
21568 <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>
21569 !! end
21570
21571 !! test
21572 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21573 !! wikitext
21574 <html><script>alert(1);</script></html>
21575 !! html
21576 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21577 </p>
21578 !! end
21579
21580 !! test
21581 HTML with raw HTML ($wgRawHtml==true)
21582 !! options
21583 wgRawHtml=1
21584 !! wikitext
21585 <html><script>alert(1);</script></html>
21586 !! html/php
21587 <p><script>alert(1);</script>
21588 </p>
21589 !! end
21590
21591 !! test
21592 Parents of subpages, one level up
21593 !! options
21594 subpage title=[[Subpage test/L1/L2/L3]]
21595 !! wikitext
21596 [[../|L2]]
21597 !! html
21598 <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>
21599 </p>
21600 !! end
21601
21602
21603 !! test
21604 Parents of subpages, one level up, not named
21605 !! options
21606 subpage title=[[Subpage test/L1/L2/L3]]
21607 !! wikitext
21608 [[../]]
21609 !! html
21610 <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>
21611 </p>
21612 !! end
21613
21614
21615
21616 !! test
21617 Parents of subpages, two levels up
21618 !! options
21619 subpage title=[[Subpage test/L1/L2/L3]]
21620 !! wikitext
21621 [[../../|L1]]2
21622
21623 [[../../|L1]]l
21624 !! html
21625 <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
21626 </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>
21627 </p>
21628 !! end
21629
21630 !! test
21631 Parents of subpages, two levels up, without trailing slash or name.
21632 !! options
21633 subpage title=[[Subpage test/L1/L2/L3]]
21634 !! wikitext
21635 [[../..]]
21636 !! html
21637 <p>[[../..]]
21638 </p>
21639 !! end
21640
21641 !! test
21642 Parents of subpages, two levels up, with lots of extra trailing slashes.
21643 !! options
21644 subpage title=[[Subpage test/L1/L2/L3]]
21645 !! wikitext
21646 [[../../////]]
21647 !! html
21648 <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>
21649 </p>
21650 !! end
21651
21652 !! article
21653 Subpage test/L1/L2/L3Sibling
21654 !! text
21655 Sibling article
21656 !! endarticle
21657
21658 !! test
21659 Transclusion of a sibling page (one level up)
21660 !! options
21661 subpage title=[[Subpage test/L1/L2/L3]]
21662 !! wikitext
21663 {{../L3Sibling}}
21664 !! html
21665 <p>Sibling article
21666 </p>
21667 !! end
21668
21669 !! test
21670 Transclusion of a child page
21671 !! options
21672 subpage title=[[Subpage test/L1/L2]]
21673 !! wikitext
21674 {{/L3Sibling}}
21675 !! html
21676 <p>Sibling article
21677 </p>
21678 !! end
21679
21680 # This is wt2html only in Parsoid because we add <nowiki>
21681 # because of {{..}} and we don't expect to fix that to
21682 # eliminate the nowikis selective for {{..}} markup.
21683 !! test
21684 Non-transclusion because of too many up levels
21685 !! options
21686 subpage title=[[Subpage test/L1/L2/L3]]
21687 parsoid=wt2html
21688 !! wikitext
21689 {{../../../../More than parent}}
21690 !! html/php
21691 <p>{{../../../../More than parent}}
21692 </p>
21693 !! html/parsoid
21694 <p>{{../../../../More than parent}}</p>
21695 !! end
21696
21697 !! test
21698 Definition list code coverage
21699 !! wikitext
21700 ;title :def
21701 ;title :def
21702 ;title:def
21703 !! html/php
21704 <dl><dt>title</dt>
21705 <dd>def</dd>
21706 <dt>title</dt>
21707 <dd>def</dd>
21708 <dt>title</dt>
21709 <dd>def</dd></dl>
21710
21711 !! html/parsoid
21712 <dl><dt>title </dt><dd>def</dd>
21713 <dt>title </dt><dd>def</dd>
21714 <dt>title</dt><dd>def</dd></dl>
21715 !! end
21716
21717 !! test
21718 Don't fall for the self-closing div
21719 !! wikitext
21720 <div>hello world</div/>
21721 !! html
21722 <div>hello world</div>
21723
21724 !! end
21725
21726 !! test
21727 MSGNW magic word
21728 !! wikitext
21729 {{MSGNW:msg}}
21730 !! html/php
21731 <p>&#91;&#91;:Template:Msg&#93;&#93;
21732 </p>
21733 !! end
21734
21735 !! test
21736 RAW magic word
21737 !! wikitext
21738 {{RAW:QUERTY}}
21739 !! html
21740 <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>
21741 </p>
21742 !! end
21743
21744 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21745 !! test
21746 Always escape literal '>' in output, not just after '<'
21747 !! wikitext
21748 ><>
21749 !! html
21750 <p>&gt;&lt;&gt;
21751 </p>
21752 !! end
21753
21754 !! test
21755 Template caching
21756 !! wikitext
21757 {{Test}}
21758 {{Test}}
21759 !! html
21760 <p>This is a test template
21761 This is a test template
21762 </p>
21763 !! end
21764
21765
21766 !! article
21767 MediaWiki:Fake
21768 !! text
21769 ==header==
21770 !! endarticle
21771
21772 !! test
21773 Inclusion of !userCanEdit() content
21774 !! wikitext
21775 {{MediaWiki:Fake}}
21776 !! html
21777 <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>
21778
21779 !! end
21780
21781
21782 !! test
21783 Out-of-order TOC heading levels
21784 !! wikitext
21785 ==2==
21786 ======6======
21787 ===3===
21788 =1=
21789 =====5=====
21790 ==2==
21791 !! html
21792 <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>
21793 <ul>
21794 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21795 <ul>
21796 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21797 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21798 </ul>
21799 </li>
21800 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21801 <ul>
21802 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21803 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21804 </ul>
21805 </li>
21806 </ul>
21807 </div>
21808
21809 <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>
21810 <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>
21811 <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>
21812 <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>
21813 <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>
21814 <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>
21815
21816 !! end
21817
21818
21819 !! test
21820 ISBN with a dummy number
21821 !! wikitext
21822 ISBN ---
21823 !! html
21824 <p>ISBN ---
21825 </p>
21826 !! end
21827
21828
21829 !! test
21830 ISBN with space-delimited number
21831 !! wikitext
21832 ISBN 92 9017 032 8
21833 !! html/php
21834 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21835 </p>
21836 !! html/parsoid
21837 <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>
21838 !! end
21839
21840
21841 !! test
21842 ISBN with multiple spaces, no number
21843 !! wikitext
21844 ISBN foo
21845 !! html
21846 <p>ISBN foo
21847 </p>
21848 !! end
21849
21850
21851 !! test
21852 ISBN length
21853 !! wikitext
21854 ISBN 123456789
21855
21856 ISBN 1234567890
21857
21858 ISBN 12345678901
21859 !! html/php
21860 <p>ISBN 123456789
21861 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21862 </p><p>ISBN 12345678901
21863 </p>
21864 !! html/parsoid
21865 <p>ISBN 123456789</p>
21866
21867 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21868
21869 <p>ISBN 12345678901</p>
21870 !! end
21871
21872
21873 !! test
21874 ISBN with trailing year (T9110)
21875 !! wikitext
21876 ISBN 1-234-56789-0 - 2006
21877
21878 ISBN 1 234 56789 0 - 2006
21879 !! html/php
21880 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21881 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21882 </p>
21883 !! html/parsoid
21884 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21885
21886 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21887 !! end
21888
21889
21890 !! test
21891 anchorencode
21892 !! config
21893 wgFragmentMode=[ 'html5', 'legacy' ]
21894 !! wikitext
21895 {{anchorencode:foo bar©#%n}}
21896 !! html/php
21897 <p>foo_bar©#%n
21898 </p>
21899 !! html/parsoid
21900 <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>
21901 !! end
21902
21903 !! test
21904 anchorencode (legacy)
21905 !! config
21906 wgFragmentMode=[ 'legacy' ]
21907 !! wikitext
21908 {{anchorencode:foo bar©#%n}}
21909 !! html/php
21910 <p>foo_bar.C2.A9.23.25n
21911 </p>
21912 !! end
21913
21914 !! test
21915 anchorencode trims spaces
21916 !! config
21917 wgFragmentMode=[ 'html5', 'legacy' ]
21918 !! wikitext
21919 {{anchorencode: __pretty__please__}}
21920 !! html/php
21921 <p>pretty_please
21922 </p>
21923 !! html/parsoid
21924 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21925 !! end
21926
21927 !! test
21928 anchorencode deals with links
21929 !! config
21930 wgFragmentMode=[ 'html5', 'legacy' ]
21931 !! wikitext
21932 {{anchorencode: [[hello|world]] [[hi]]}}
21933 !! html/php
21934 <p>world_hi
21935 </p>
21936 !! html/parsoid
21937 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21938 !! end
21939
21940 !! test
21941 anchorencode deals with templates
21942 !! config
21943 wgFragmentMode=[ 'html5', 'legacy' ]
21944 !! wikitext
21945 {{anchorencode: {{Foo}} x}}
21946 !! html/php
21947 <p>FOO_x
21948 </p>
21949 !! html/parsoid
21950 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21951 !! end
21952
21953 !! test
21954 anchorencode encodes like the TOC generator: (T20431)
21955 !! config
21956 wgFragmentMode=[ 'html5', 'legacy' ]
21957 !! wikitext
21958 ===_ +:.3A%3A _ &&amp;]] x===
21959 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21960 __NOEDITSECTION__
21961 !! html/php
21962 <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>
21963 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21964 </p>
21965 !! html/parsoid
21966 <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>
21967 <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>
21968 <meta property="mw:PageProp/noeditsection"/>
21969 !! end
21970
21971 !! test
21972 anchorencode encodes like the TOC generator: (T20431) (legacy)
21973 !! config
21974 wgFragmentMode=[ 'legacy' ]
21975 !! wikitext
21976 ===_ +:.3A%3A&&amp;]]===
21977 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21978 __NOEDITSECTION__
21979 !! html/php
21980 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21981 <p>.2B:.3A.253A.26.26.5D.5D
21982 </p>
21983 !! end
21984
21985 !! test
21986 T8200: blockquotes and paragraph formatting
21987 !! wikitext
21988 <blockquote>
21989 foo
21990 </blockquote>
21991
21992 bar
21993
21994 baz
21995 !! html
21996 <blockquote>
21997 <p>foo
21998 </p>
21999 </blockquote>
22000 <p>bar
22001 </p>
22002 <pre>baz
22003 </pre>
22004 !! end
22005
22006 !! test
22007 T10293: Use of center tag ruins paragraph formatting
22008 !! wikitext
22009 <center>
22010 foo
22011 </center>
22012
22013 bar
22014
22015 baz
22016 !! html
22017 <center>
22018 <p>foo
22019 </p>
22020 </center>
22021 <p>bar
22022 </p>
22023 <pre>baz
22024 </pre>
22025 !! end
22026
22027 !!test
22028 Parsing of overlapping (improperly nested) inline html tags
22029 !! wikitext
22030 <span><s>x</span></s>
22031 !! html/php
22032 <p><span><s>x&lt;/span&gt;</s></span>
22033 </p>
22034 !! html/parsoid
22035 <p><span><s>x</s></span>
22036 </p>
22037 !!end
22038
22039 ###
22040 ### Language variants related tests
22041 ###
22042
22043 # Parsoid does not mark self-links.
22044 # Parsoid does not convert links; PHP will do any necessary redirects.
22045
22046 !! test
22047 Self-link in language variants
22048 !! options
22049 title=[[Dunav]] language=sr
22050 !! wikitext
22051 Both [[Dunav]] and [[Дунав]] are names for this river.
22052 !! html/php
22053 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22054 </p>
22055 !! html/parsoid
22056 <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>
22057 !! end
22058
22059 !! article
22060 Дуна
22061 !! text
22062 content
22063 !! endarticle
22064
22065 !! test
22066 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22067 !! options
22068 title=[[Duna]] language=sr
22069 !! wikitext
22070 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22071 !! html/php
22072 <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.
22073 </p>
22074 !! html/parsoid
22075 <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>
22076 !! end
22077
22078 !! test
22079 Link to a section of a variant of this title shouldn't be parsed as self-link
22080 !! options
22081 title=[[Duna]] language=sr
22082 !! wikitext
22083 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22084 !! html/php
22085 <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.
22086 </p>
22087 !! html/parsoid
22088 <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>
22089 !! end
22090
22091 !! test
22092 Link to pages in language variants
22093 !! options
22094 language=sr
22095 !! wikitext
22096 Main Page can be written as [[Маин Паге]]
22097 !! html/php
22098 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22099 </p>
22100 !! html/parsoid
22101 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22102 !! end
22103
22104
22105 !! test
22106 Multiple links to pages in language variants
22107 !! options
22108 language=sr
22109 !! wikitext
22110 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22111 !! html/php
22112 <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>.
22113 </p>
22114 !! html/parsoid
22115 <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>
22116 !! end
22117
22118
22119 !! test
22120 Simple template in language variants
22121 !! options
22122 language=sr
22123 !! wikitext
22124 {{тест}}
22125 !! html/php
22126 <p>This is a test template
22127 </p>
22128 !! end
22129
22130
22131 !! test
22132 Template with explicit namespace in language variants
22133 !! options
22134 language=sr
22135 !! wikitext
22136 {{Template:тест}}
22137 !! html/php
22138 <p>This is a test template
22139 </p>
22140 !! end
22141
22142
22143 !! test
22144 Basic test for template parameter in language variants
22145 !! options
22146 language=sr
22147 !! wikitext
22148 {{парамтест|param=foo}}
22149 !! html/php
22150 <p>This is a test template with parameter foo
22151 </p>
22152 !! end
22153
22154 !! test
22155 Simple category in language variants
22156 !! options
22157 language=sr cat
22158 !! wikitext
22159 [[Category:МедиаWики Усер'с Гуиде]]
22160 !! html/php
22161 cat=МедиаWики_Усер'с_Гуиде sort=
22162 !! html/parsoid
22163 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22164 !! end
22165
22166 !! article
22167 Category:分类
22168 !! text
22169 blah
22170 !! endarticle
22171
22172 !! article
22173 Category:分類
22174 !! text
22175 blah
22176 !! endarticle
22177
22178 ## We used to, but no longer wt2wt this test since the default serializer
22179 ## will normalize all categories to serialize on their own line.
22180 ## This wikitext usage is going to be fairly uncommon in production and
22181 ## selser will take care of preserving formatting in those scenarios.
22182 !! test
22183 Don't convert blue categorylinks to another variant (T35210)
22184 !! options
22185 cat
22186 language=zh
22187 parsoid=wt2html
22188 !! wikitext
22189 [[A]][[Category:分类]]
22190 !! html/php
22191 cat=分类 sort=
22192 !! html/parsoid
22193 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22194 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22195 !! end
22196
22197 !! test
22198 Stripping -{}- tags (language variants)
22199 !! options
22200 language=sr
22201 !! wikitext
22202 Latin proverb: -{Ne nuntium necare}-
22203 !! html/php
22204 <p>Latin proverb: Ne nuntium necare
22205 </p>
22206 !! html/parsoid
22207 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22208 !! end
22209
22210
22211 !! test
22212 Prevent conversion with -{}- tags (language variants)
22213 !! options
22214 language=sr variant=sr-ec
22215 !! wikitext
22216 Latinski: -{Ne nuntium necare}-
22217 !! html/php
22218 <p>Латински: Ne nuntium necare
22219 </p>
22220 !! html/parsoid
22221 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22222 !! end
22223
22224
22225 !! test
22226 Prevent conversion of text with -{}- tags (language variants)
22227 !! options
22228 language=sr variant=sr-ec
22229 !! wikitext
22230 Latinski: -{Ne nuntium necare}-
22231 !! html/php
22232 <p>Латински: Ne nuntium necare
22233 </p>
22234 !! html/parsoid
22235 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22236 !! end
22237
22238
22239 !! test
22240 Prevent conversion of links with -{}- tags (language variants)
22241 !! options
22242 language=sr variant=sr-ec
22243 !! wikitext
22244 -{[[Main Page]]}-
22245 !! html/php
22246 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22247 </p>
22248 !! html/parsoid
22249 <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>
22250 !! end
22251
22252
22253 !! test
22254 -{}- tags within headlines (within html for parserConvert())
22255 !! config
22256 wgFragmentMode=[ 'html5', 'legacy' ]
22257 !! options
22258 language=sr variant=sr-ec
22259 !! wikitext
22260 ==-{Naslov}-==
22261
22262 Note that even an unprotected headline ID is not affected by language
22263 conversion:
22264
22265 ==Latinski==
22266 !! html/php
22267 <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>
22268 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22269 цонверсион:
22270 </p>
22271 <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>
22272
22273 !! html/parsoid
22274 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22275
22276 <p>Note that even an unprotected headline ID is not affected by language
22277 conversion:</p>
22278
22279 <h2 id="Latinski">Latinski</h2>
22280 !! end
22281
22282 !! test
22283 Explicit definition of language variant alternatives
22284 !! options
22285 language=zh variant=zh-tw
22286 !! wikitext
22287 -{zh:China;zh-tw:Taiwan}-, not China
22288 !! html/php
22289 <p>Taiwan, not China
22290 </p>
22291 !! html/parsoid
22292 <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>
22293 !! end
22294
22295 !! test
22296 Filter syntax for language variants
22297 !! options
22298 language=zh variant=zh-tw
22299 !! wikitext
22300 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22301 !! html/php
22302 <p>fooblog, WEBJOURNAL, WEBLOGquux
22303 </p>
22304 !! html/parsoid
22305 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22306 !! end
22307
22308 # Note that Parsoid post-processing for language variants needs to
22309 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22310 !! test
22311 Conversion around HTML tags
22312 !! options
22313 language=sr variant=sr-ec
22314 !! wikitext
22315 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22316 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22317 !! html/php
22318 <p>
22319 <span title="ЛаCтин">ски</span>
22320 </p>
22321 !! html/parsoid
22322 <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"}]}'/>
22323 <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>
22324 !! end
22325
22326 !! test
22327 Explicit session-wise two-way language variant mapping (A flag and - flag)
22328 !! options
22329 language=zh variant=zh-tw
22330 !! wikitext
22331 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22332
22333 Taiwan is not China.
22334
22335 But -{A|zh:China; zh-tw:Taiwan}- is China,
22336
22337 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22338
22339 and -{China}- is China.
22340 !! html/php
22341 <p>This is Taiwan, but we'll forget that now.
22342 </p><p>Taiwan is not China.
22343 </p><p>But Taiwan is Taiwan,
22344 </p><p>(This should be stripped!)
22345 </p><p>and China is China.
22346 </p>
22347 !! html/parsoid
22348 <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>
22349 <p>Taiwan is not China.</p>
22350 <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>
22351 <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>
22352 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22353 !! end
22354
22355 !! test
22356 Explicit session-wise one-way language variant mapping (A flag and - flag)
22357 !! options
22358 language=zh variant=zh-tw
22359 !! wikitext
22360 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22361
22362 COUNTRY is China or Taiwan.
22363
22364 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22365
22366 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22367
22368 and -{COUNTRY}- is COUNTRY.
22369 !! html/php
22370 <p>This is Taiwan, but we'll forget that now.
22371 </p><p>COUNTRY is China or Taiwan.
22372 </p><p>But Taiwan is Taiwan,
22373 </p><p>(This should be stripped!)
22374 </p><p>and COUNTRY is COUNTRY.
22375 </p>
22376 !! html/parsoid
22377 <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>
22378 <p>COUNTRY is China or Taiwan.</p>
22379 <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>
22380 <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>
22381 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22382 !! end
22383
22384 !! test
22385 Explicit session-wise two-way language variant mapping (H flag for hide)
22386 !! options
22387 language=zh variant=zh-tw
22388 !! wikitext
22389 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22390
22391 Taiwan is China.
22392 !! html/php
22393 <p>(This should be stripped!)
22394 </p><p>Taiwan is Taiwan.
22395 </p>
22396 !! html/parsoid
22397 <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>
22398 <p>Taiwan is China.</p>
22399 !! end
22400
22401 !! test
22402 Explicit session-wise one-way language variant mapping (H flag for hide)
22403 !! options
22404 language=zh variant=zh-tw
22405 !! wikitext
22406 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22407
22408 COUNTRY is Taiwan or China.
22409 !! html/php
22410 <p>(This should be stripped!)
22411 </p><p>Taiwan is Taiwan or China.
22412 </p>
22413 !! html/parsoid
22414 <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>
22415 <p>COUNTRY is Taiwan or China.</p>
22416 !! end
22417
22418 ## Note that parsoid test runner does not support 'showtitle' option.
22419 !! test
22420 Adding explicit conversion rule for title (T flag)
22421 !! options
22422 language=zh variant=zh-tw showtitle
22423 !! wikitext
22424 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22425
22426 Taiwan is China.
22427 !! html/php
22428 Taiwan
22429 <p>Should be stripped!
22430 </p><p>Taiwan is China.
22431 </p>
22432 !! html/parsoid
22433 <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>
22434 <p>Taiwan is China.</p>
22435 !! end
22436
22437 !! test
22438 Code coverage: T combined with H flag
22439 !! options
22440 language=zh variant=zh-tw showtitle
22441 !! wikitext
22442 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22443
22444 Taiwan is China.
22445 !! html/php
22446 Taiwan
22447 <p>Should be stripped!
22448 </p><p>Taiwan is Taiwan.
22449 </p>
22450 !! html/parsoid
22451 <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>
22452 <p>Taiwan is China.</p>
22453 !! end
22454
22455 !! test
22456 Code coverage: T with no variants
22457 !! options
22458 language=zh variant=zh-tw showtitle
22459 !! wikitext
22460 -{H|zh:China; zh-tw:Taiwan}-
22461 Taiwan is China.-{T|Taiwan is China}-
22462 !! html/php
22463 Taiwan is China
22464 <p>
22465 Taiwan is Taiwan.
22466 </p>
22467 !! html/parsoid
22468 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22469 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22470 !! end
22471
22472 !! test
22473 Code coverage: rules with no variants
22474 !! options
22475 language=zh variant=zh-tw
22476 !! wikitext
22477 -{H|zh:China; zh-tw:Taiwan}-
22478 Taiwan is China.
22479 -{H|China}-
22480 Taiwan is China.
22481 !! html/php
22482 <p>
22483 Taiwan is Taiwan.
22484
22485 Taiwan is China.
22486 </p>
22487 !! html/parsoid
22488 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22489 Taiwan is China.
22490 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22491 Taiwan is China.</p>
22492 !! end
22493
22494
22495 !! test
22496 Code coverage: D flag for conversion rule
22497 !! options
22498 language=zh variant=zh-tw
22499 !! wikitext
22500 -{D|zh-cn:XA; zh-tw:YA}-
22501 -{A;D|zh-cn:XB; zh-tw:YB}-
22502 -{D;H|zh-cn:XC; zh-tw:YC}-
22503
22504 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22505
22506 -{D|0=>zh-tw:1}-
22507 -{A;D|2=>zh-tw:3}-
22508 -{D;H|4=>zh-tw:5}-
22509
22510 XA XB XC YA YB YC FOO BAR BAT 012345
22511 !! html/php
22512 <p>大陆:XA;台灣:YA;
22513
22514 大陆:XC;台灣:YC;
22515 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22516 </p><p>0⇒台灣:1;
22517
22518 4⇒台灣:5;
22519 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22520 </p>
22521 !! html/parsoid
22522 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22523 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22524 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22525 <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>
22526 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22527 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22528 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22529 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22530 !! end
22531
22532 !! test
22533 Code coverage: N flag for conversion rule
22534 !! options
22535 language=zh variant=zh-cn
22536 !! wikitext
22537 -{N|zh-cn}-
22538
22539 -{N|zh-tw}-
22540
22541 -{N|sr-ec}-
22542 !! html/php
22543 <p>大陆
22544 </p><p>台灣
22545 </p><p>српски (ћирилица)‎
22546 </p>
22547 !! html/parsoid
22548 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22549 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22550 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22551 !! end
22552
22553 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22554 !! test
22555 Code coverage: N flag for conversion rule (wt2html only)
22556 !! options
22557 language=zh variant=zh-cn
22558 parsoid=wt2html,html2html
22559 !! wikitext
22560 -{D;N|en}-
22561 !! html/php
22562 <p>English
22563 </p>
22564 !! html/parsoid
22565 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22566 !! end
22567
22568 !! test
22569 Testing that changing the language variant here in the tests actually works
22570 !! options
22571 language=zh variant=zh showtitle
22572 !! wikitext
22573 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22574 !! html/php
22575 China
22576 <p>Should be stripped!
22577 </p>
22578 !! html/parsoid
22579 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22580 !! end
22581
22582 !! test
22583 Recursive conversion of alt and title attrs shouldn't clear converter state
22584 !! options
22585 language=zh variant=zh-cn
22586 showtitle
22587 !! wikitext
22588 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22589 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22590 !! html/php
22591 China
22592 <p>
22593 Should be stripped<span title="Exclamation">!</span>
22594 </p>
22595 !! html/parsoid
22596 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22597 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>
22598 !! end
22599
22600 !! test
22601 T26072: more test on conversion rule for title
22602 !! options
22603 language=zh variant=zh-tw showtitle
22604 !! wikitext
22605 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22606
22607 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22608 !! html/php
22609 Taiwan
22610 <p>This should be stripped!
22611 </p><p>This won't take interferes with the title rule.
22612 </p>
22613 !! html/parsoid
22614 <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>
22615 <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>
22616 !! end
22617
22618 !! test
22619 Partly disable title conversion if variant == main language code
22620 !! options
22621 language=zh variant=zh title=[[ZH]] showtitle
22622 !! wikitext
22623 -{T|zh-cn:CN;zh-tw:TW}-
22624 !! html/php
22625 ZH
22626 <p>
22627 </p>
22628 !! html/parsoid
22629 <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>
22630 !! end
22631
22632 !! test
22633 Partly disable title conversion if variant == main language code, more
22634 !! options
22635 language=zh variant=zh title=[[ZH]] showtitle
22636 !! wikitext
22637 -{T|TW}-
22638 !! html/php
22639 ZH
22640 <p>
22641 </p>
22642 !! html/parsoid
22643 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22644 !! end
22645
22646 !! test
22647 Raw output of variant escape tags (R flag)
22648 !! options
22649 language=zh variant=zh-tw
22650 !! wikitext
22651 Raw: -{R|zh:China;zh-tw:Taiwan}-
22652 !! html/php
22653 <p>Raw: zh:China;zh-tw:Taiwan
22654 </p>
22655 !! html/parsoid
22656 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22657 !! end
22658
22659 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22660 !! test
22661 Raw output of variant escape tags (R flag) (wt2html only)
22662 !! options
22663 language=zh variant=zh-tw
22664 parsoid=wt2html,html2html
22665 !! wikitext
22666 -{Variant}- -{D|syntax}- -{D;R|options}-
22667 !! html/php
22668 <p>Variant syntax options
22669 </p>
22670 !! html/parsoid
22671 <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>
22672 !! end
22673
22674 !! test
22675 Nested markup inside raw output of variant escape tags (R flag)
22676 !! options
22677 language=zh variant=zh-tw
22678 !! wikitext
22679 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22680 !! html/php
22681 <p>Nested raw: nested Taiwan nested
22682 </p>
22683 !! html/parsoid
22684 <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>
22685 !! end
22686
22687 !! test
22688 Nested markup and spaces inside raw output of variant escape tags (R flag)
22689 !! options
22690 language=zh variant=zh-tw
22691 !! wikitext
22692 X-{ outer -{ inner }- outer }-X
22693 !! html/php
22694 <p>X outer inner outer X
22695 </p>
22696 !! html/parsoid
22697 <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>
22698 !! end
22699
22700 !! test
22701 Templates inside raw output of variant escape tags (R flag)
22702 !! options
22703 language=zh variant=zh-tw
22704 !! wikitext
22705 Nested raw: -{R|nested {{echo|hi}} templates}-
22706 !! html/php
22707 <p>Nested raw: nested hi templates
22708 </p>
22709 !! html/parsoid
22710 <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>
22711 !! end
22712
22713 !! test
22714 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22715 !! options
22716 language=zh variant=zh-cn
22717 !! wikitext
22718 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22719 !! html/php
22720 <p>0
22721 </p>
22722 !! html/parsoid
22723 <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>
22724 !! end
22725
22726 !! test
22727 Conversion rules from [numeric-only string] to [something else] (T48634)
22728 !! options
22729 language=zh variant=zh-cn
22730 !! wikitext
22731 -{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
22732 !! html/php
22733 <p>D12345EE12345
22734 </p>
22735 !! html/parsoid
22736 <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>
22737 !! end
22738
22739 !! test
22740 Two-way converter rule entries with an empty value should be ignored (T53551)
22741 !! options
22742 language=zh variant=zh-cn
22743 !! wikitext
22744 -{H|zh-cn:foo;zh-tw:;}-foobar
22745 !! html/php
22746 <p>foobar
22747 </p>
22748 !! html/parsoid
22749 <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>
22750 !! end
22751
22752 !! test
22753 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22754 !! options
22755 language=zh variant=zh-cn
22756 !! wikitext
22757 -{H|=>zh-cn:foo;}-foobar
22758 !! html/php
22759 <p>foobar
22760 </p>
22761 !! html/parsoid
22762 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22763 !! end
22764
22765 !! test
22766 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22767 !! options
22768 language=zh variant=zh-cn
22769 !! wikitext
22770 -{H|}-foobar
22771 !! html/php
22772 <p>foobar
22773 </p>
22774 !! html/parsoid
22775 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22776 !! end
22777
22778 !! test
22779 Nested using of manual convert syntax
22780 !! options
22781 language=zh variant=zh-hk
22782 !! wikitext
22783 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22784 !! html/php
22785 <p>Nested: Hello Hong Kong!
22786 </p>
22787 !! html/parsoid
22788 <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>
22789 !! end
22790
22791 !! test
22792 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22793 !! options
22794 language=zh variant=zh-cn
22795 !! wikitext
22796 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22797 !! html/php
22798 <p><span title="X">A</span>
22799 </p>
22800 !! html/parsoid
22801 <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>
22802 !! end
22803
22804 !! test
22805 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22806 !! options
22807 language=zh variant=zh-cn
22808 !! wikitext
22809 -{<span title="-{X}-">A</span>}-
22810 !! html/php+disabled
22811 <p><span title="X">A</span>
22812 </p>
22813 !! html/parsoid
22814 <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>
22815 !! end
22816
22817 # Parsoid and PHP disagree on how to parse this example: Parsoid
22818 # insists that the content of a language converter element be a valid
22819 # DOM fragment or attribute string
22820 !! test
22821 Language converter markup with block content
22822 !! options
22823 language=zh variant=zh-cn
22824 !! wikitext
22825 <span>a-{b<div>c}-d
22826
22827 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22828
22829 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22830 !! html/php+tidy
22831 <span>ab<div>cd
22832 <span>ab<div>cd
22833 <span>ad
22834 </span></div></span></div></span>
22835 !! html/parsoid
22836 <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
22837
22838 <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
22839
22840 <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>
22841 !! end
22842
22843 !! test
22844 LanguageConverter selser (1)
22845 !! options
22846 language=zh variant=zh-cn
22847 parsoid={
22848 "modes": ["wt2wt", "selser"],
22849 "changes": [
22850 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22851 ]
22852 }
22853 !! wikitext
22854 -{raw}-
22855 !! wikitext/edited
22856 -{edited}-
22857 !! end
22858
22859 !! test
22860 LanguageConverter selser (2)
22861 !! options
22862 language=zh variant=zh-cn
22863 parsoid={
22864 "modes": ["wt2wt", "selser"],
22865 "changes": [
22866 ["span[class='x']", "contents", "text", "-{foo}-"],
22867 ["a", "contents", "text", "-{"],
22868 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22869 ]
22870 }
22871 !! wikitext
22872 <span class="x">TEXT1</span>
22873 [http://example.com TEXT2]
22874 [[Foo|TEXT3]]
22875 {{echo|TEXT4}}
22876 !! wikitext/edited
22877 <span class="x"><nowiki>-{foo}-</nowiki></span>
22878 [http://example.com -{]
22879 [[Foo|<nowiki>-{</nowiki>]]
22880 {{1x|<nowiki>-{</nowiki>}}
22881 !! end
22882
22883 # Tests LanguageVariantText in ConstrainedText
22884 !! test
22885 LanguageConverter selser (3)
22886 !! options
22887 language=zh variant=zh-cn
22888 parsoid={
22889 "modes": ["wt2wt", "selser"],
22890 "changes": [
22891 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22892 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22893 ]
22894 }
22895 !! wikitext
22896 {|
22897 |-
22898 |<span>Foo</span>
22899 |}
22900 !! wikitext/edited
22901 {|
22902 |-
22903 |<nowiki/>-{edited}-
22904 |}
22905 !! end
22906
22907 # Tests LanguageVariantText._fromSelSer
22908 !! test
22909 LanguageConverter selser (4)
22910 !! options
22911 language=zh variant=zh-cn
22912 parsoid={
22913 "modes": ["wt2wt", "selser"],
22914 "changes": [
22915 ["td > span.x", "remove"]
22916 ]
22917 }
22918 !! wikitext
22919 {|
22920 |-
22921 |<span class="x">Foo</span>-{Bar}-
22922 ||<span class="x">Foo</span>-{Bar}-
22923 |}
22924 !! wikitext/edited
22925 {|
22926 |-
22927 |<nowiki/>-{Bar}-
22928 ||-{Bar}-
22929 |}
22930 !! end
22931
22932 # Since Parsoid is starting to emit canonical wikitext for links,
22933 # [http://example.com http://example.com] will not RT back to that
22934 # form anymore.
22935 # Parsoid does not language-convert links (it is done in a
22936 # post-processing step)
22937 !! test
22938 Proper conversion of text in external links
22939 !! options
22940 language=sr variant=sr-ec
22941 parsoid=wt2html
22942 !! wikitext
22943 http://www.google.com
22944 gopher://www.google.com
22945 [http://www.google.com http://www.google.com]
22946 [gopher://www.google.com gopher://www.google.com]
22947 [https://www.google.com irc://www.google.com]
22948 [ftp://www.google.com www.google.com/ftp://dir]
22949 [//www.google.com www.google.com]
22950 !! html/php
22951 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22952 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22953 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22954 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22955 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22956 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22957 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22958 </p>
22959 !! html/parsoid
22960 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22961 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22962 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
22963 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22964 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22965 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22966 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22967 !! end
22968
22969 !! test
22970 Do not convert roman numbers to language variants
22971 !! options
22972 language=sr variant=sr-ec
22973 !! wikitext
22974 Fridrih IV je car.
22975 !! html/php
22976 <p>Фридрих IV је цар.
22977 </p>
22978 !! html/parsoid
22979 <p>Fridrih IV je car.</p>
22980 !! end
22981
22982 !! test
22983 Unclosed language converter markup "-{"
22984 !! options
22985 language=sr
22986 !! wikitext
22987 -{T|hello
22988 !! html
22989 <p>-{T|hello
22990 </p>
22991 !! end
22992
22993 !! test
22994 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22995 !! options
22996 language=sr
22997 !! wikitext
22998 -{R|=&gt;}-
22999 !! html/php
23000 <p>=&gt;
23001 </p>
23002 !! html/parsoid
23003 <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>
23004 !!end
23005
23006 !! test
23007 Don't break link parsing if language converter markup is in the caption.
23008 !! options
23009 language=sr variant=sr-ec
23010 !! wikitext
23011 [[Main Page|-{R|main page}-]]
23012 !! html/php
23013 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23014 </p>
23015 !! html/parsoid
23016 <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>
23017 !! end
23018
23019 !! test
23020 T146304: Don't break template parsing if language converter markup is in the parameter.
23021 !! options
23022 language=sr variant=sr-ec
23023 !! wikitext
23024 {{echo|-{R|foo}-}}
23025 !! html/php
23026 <p>foo
23027 </p>
23028 !! html/parsoid
23029 <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>
23030 !! end
23031
23032 !! test
23033 T146305: Don't break image parsing if language converter markup is in the caption.
23034 !! options
23035 language=sr
23036 !! wikitext
23037 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23038 !! html/php
23039 <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>
23040
23041 !! html/parsoid
23042 <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>
23043 !! end
23044
23045 !! test
23046 T146305: Don't break image parsing if nested language converter markup is in the caption.
23047 !! options
23048 language=zh variant=zh-cn
23049 !! wikitext
23050 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23051 !! html/php
23052 <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>
23053
23054 !! html/parsoid
23055 <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>
23056 !! end
23057
23058 # XXX html2wt disabled because rich markup in alt is not preserved.
23059 !! test
23060 Don't break gallery if language converter markup is inside.
23061 !! options
23062 language=zh
23063 !! wikitext
23064 <gallery>
23065 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23066 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23067 </gallery>
23068 !! html/php
23069 <ul class="gallery mw-gallery-traditional">
23070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23071 <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>
23072 <div class="gallerytext">
23073 <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>
23074 </p>
23075 </div>
23076 </div></li>
23077 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23078 <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>
23079 <div class="gallerytext">
23080 <p>This is a test template
23081 </p>
23082 </div>
23083 </div></li>
23084 </ul>
23085
23086 !! html/parsoid
23087 <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"}}'>
23088 <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>
23089 <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>
23090 </ul>
23091 !! end
23092
23093 !! test
23094 T153135: Don't break list handling if language converter markup is in the item.
23095 !! options
23096 language=zh variant=zh-cn
23097 !! wikitext
23098 ;-{zh-cn:AAA;zh-tw:BBB}-
23099 ;-{R|foo:bar}-
23100 !! html/php
23101 <dl><dt>AAA</dt>
23102 <dt>foo:bar</dt></dl>
23103
23104 !! html/parsoid
23105 <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>
23106 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23107 </dl>
23108 !! end
23109
23110 // Note that parsoid does not protect colons unless language converter
23111 // markup is properly nested, because it is a backtracking parser.
23112 !! test
23113 T153135: Unclosed markup in definition list (code coverage)
23114 !! options
23115 language=zh variant=zh-cn
23116 !! wikitext
23117 ;<b>foo:bar
23118 ;-{zh-cn:AAA
23119 !! html/php+tidy
23120 <dl><dt><b>foo:bar</b></dt><b>
23121 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23122 </b></p>
23123 !! html/parsoid
23124 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23125 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23126 !! end
23127
23128 !! test
23129 T153135: Nested language converter markup in definition list (code coverage)
23130 !! options
23131 language=zh variant=zh-cn
23132 !! wikitext
23133 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23134 !! html/php
23135 <dl><dt>AAA foo:bar bat:baz</dt>
23136 <dd>def</dd></dl>
23137
23138 !! html/parsoid
23139 <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>
23140 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23141 </dl>
23142 !! end
23143
23144 # html2wt mode disabled due to <nowiki> insertion.
23145 !! test
23146 T153140: Don't break table handling if language converter markup is in the cell.
23147 !! options
23148 language=sr variant=sr-ec
23149 parsoid=wt2html,wt2wt,html2html
23150 !! wikitext
23151 {|
23152 |-
23153 | -{R|B}-
23154 |}
23155 !! html/php
23156 <table>
23157
23158 <tr>
23159 <td>B
23160 </td></tr></table>
23161
23162 !! html/parsoid
23163 <table>
23164 <tbody>
23165 <tr>
23166 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23167 </tr>
23168 </tbody>
23169 </table>
23170 !! end
23171
23172 !! test
23173 Language converter tricky html2wt cases (1)
23174 !! options
23175 language=sr
23176 parsoid=html2wt,wt2wt
23177 !! html/parsoid
23178 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23179 !! wikitext
23180 -{<nowiki>}-</nowiki>}-
23181 !! html/php
23182 <p>&#125;-
23183 </p>
23184 !! end
23185
23186 !! test
23187 Language converter tricky html2wt cases (2)
23188 !! options
23189 language=sr
23190 parsoid=html2wt,wt2wt
23191 !! html/parsoid
23192 <p>-{foo}-</p>
23193 !! wikitext
23194 <nowiki>-{foo}-</nowiki>
23195 !! html/php
23196 <p>-&#123;foo&#125;-
23197 </p>
23198 !! end
23199
23200 !! test
23201 Language converter tricky html2wt cases (3)
23202 !! options
23203 language=sr
23204 parsoid=html2wt,wt2wt
23205 !! html/parsoid
23206 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23207 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23208 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23209 !! wikitext
23210 -{R||}-
23211
23212 -{R|R|raw}-
23213
23214 -{<nowiki>-{foo}-</nowiki>}-
23215 !! html/php
23216 <p>|
23217 </p><p>R|raw
23218 </p><p>-&#123;foo&#125;-
23219 </p>
23220 !! end
23221
23222 !! test
23223 Language converter tricky html2wt cases (4)
23224 !! options
23225 language=sr
23226 parsoid=html2wt,wt2wt
23227 !! html/parsoid
23228 <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>
23229 !! wikitext
23230 -{R|{{echo|hey}}}-
23231 !! html/php
23232 <p>hey
23233 </p>
23234 !! end
23235
23236 # Note that the <nowiki> escaping added by parsoid for source text,
23237 # destination text, and language names only works on the PHP side
23238 # for *destination text*. (HTML entity escaping wouldn't work
23239 # any better.) This is probably a bug, at least for source texts.
23240 # (For language names PHP uses a precise regexp based on the languages
23241 # it currently knows have variants, which is fragile since this set
23242 # can grow/shrink over time.)
23243 !! test
23244 Language converter tricky html2wt cases (5)
23245 !! options
23246 language=zh variant=zh-cn
23247 !! html/parsoid
23248 <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>
23249 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23250 <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>
23251 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23252 <p>a:b=>c xyz</p>
23253 !! wikitext
23254 -{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
23255
23256 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23257
23258 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23259
23260 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23261
23262 a:b=>c xyz
23263 !! html/php+disabled
23264 <p>foobat;xyz=&gt;zh-cn:abc
23265 </p><p>A
23266 </p><p>0;zh-tw:bar
23267 </p><p>abc
23268 </p><p>a:b=&gt;c 0;zh-tw:bar
23269 </p>
23270 !! end
23271
23272 !! test
23273 T179579: Nowiki and lc interaction
23274 !! options
23275 parsoid=wt2html
23276 language=sr
23277 !! wikitext
23278 -{</nowiki>123}-
23279
23280 -{123<nowiki>|</nowiki>456}-
23281 !! html/parsoid
23282 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23283
23284 <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>
23285 !! end
23286
23287 !! test
23288 T2529: Uncovered bullet
23289 !! wikitext
23290 *Foo {{bullet}}
23291 !! html
23292 <ul><li>Foo</li>
23293 <li>Bar</li></ul>
23294
23295 !! end
23296
23297 !! test
23298 T2529: Uncovered bullet in a deeply nested list
23299 !! wikitext
23300 *******Foo {{bullet}}
23301 !! html
23302 <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>
23303 <li>Bar</li></ul>
23304
23305 !! end
23306
23307 !! test
23308 T2529: Uncovered table already at line-start
23309 !! wikitext
23310 x
23311
23312 {{table}}
23313 y
23314 !! html
23315 <p>x
23316 </p>
23317 <table>
23318 <tr>
23319 <td>1</td>
23320 <td>2
23321 </td></tr>
23322 <tr>
23323 <td>3</td>
23324 <td>4
23325 </td></tr></table>
23326 <p>y
23327 </p>
23328 !! end
23329
23330 !! test
23331 T2529: Uncovered bullet in parser function result
23332 !! wikitext
23333 *Foo {{lc:{{bullet}} }}
23334 !! html
23335 <ul><li>Foo</li>
23336 <li>bar</li></ul>
23337
23338 !! end
23339
23340 !! test
23341 T7678: Double-parsed template argument
23342 !! wikitext
23343 {{lc:{{{1}}}|hello}}
23344 !! html
23345 <p>{{{1}}}
23346 </p>
23347 !! end
23348
23349 !! test
23350 T7678: Double-parsed template invocation
23351 !! wikitext
23352 {{lc:{{paramtest {{!}} param = hello }} }}
23353 !! html
23354 <p>{{paramtest | param = hello }}
23355 </p>
23356 !! end
23357
23358 !! test
23359 Case insensitivity of parser functions for non-ASCII characters (T10143)
23360 !! options
23361 language=cs
23362 title=[[Main Page]]
23363 !! wikitext
23364 {{PRVNÍVELKÉ:ěščř}}
23365 {{prvnívelké:ěščř}}
23366 {{PRVNÍMALÉ:ěščř}}
23367 {{prvnímalé:ěščř}}
23368 {{MALÁ:ěščř}}
23369 {{malá:ěščř}}
23370 {{VELKÁ:ěščř}}
23371 {{velká:ěščř}}
23372 !! html
23373 <p>Ěščř
23374 Ěščř
23375 ěščř
23376 ěščř
23377 ěščř
23378 ěščř
23379 ĚŠČŘ
23380 ĚŠČŘ
23381 </p>
23382 !! end
23383
23384 !! test
23385 Morwen/13: Unclosed link followed by heading
23386 !! wikitext
23387 [[link
23388 ==heading==
23389 !! html
23390 <p>[[link
23391 </p>
23392 <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>
23393
23394 !! end
23395
23396 !! test
23397 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23398 !! wikitext
23399 {{foo|
23400 =heading=
23401 !! html
23402 <p>{{foo|
23403 </p>
23404 <h1><span class="mw-headline" id="heading">heading</span></h1>
23405
23406 !! end
23407
23408 !! test
23409 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23410 !! wikitext
23411 {{foo|
23412 ==heading==
23413 !! html
23414 <p>{{foo|
23415 </p>
23416 <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>
23417
23418 !! end
23419
23420 !! test
23421 Tildes in comments
23422 !! options
23423 pst
23424 !! wikitext
23425 <!-- ~~~~ -->
23426 !! html/php
23427 <!-- ~~~~ -->
23428 !! end
23429
23430 !! test
23431 Paragraphs inside divs (no extra line breaks)
23432 !! wikitext
23433 <div>Line one
23434
23435 Line two</div>
23436 !! html
23437 <div>Line one
23438 Line two</div>
23439
23440 !! end
23441
23442 !! test
23443 Paragraphs inside divs (extra line break on open)
23444 !! wikitext
23445 <div>
23446 Line one
23447
23448 Line two</div>
23449 !! html
23450 <div>
23451 <p>Line one
23452 </p>
23453 Line two</div>
23454
23455 !! end
23456
23457 !! test
23458 Paragraphs inside divs (extra line break on close)
23459 !! wikitext
23460 <div>Line one
23461
23462 Line two
23463 </div>
23464 !! html
23465 <div>Line one
23466 <p>Line two
23467 </p>
23468 </div>
23469
23470 !! end
23471
23472 !! test
23473 Paragraphs inside divs (extra line break on open and close)
23474 !! wikitext
23475 <div>
23476 Line one
23477
23478 Line two
23479 </div>
23480 !! html
23481 <div>
23482 <p>Line one
23483 </p><p>Line two
23484 </p>
23485 </div>
23486
23487 !! end
23488
23489 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23490 !! test
23491 Nesting tags, paragraphs on lines which begin with <div>
23492 !! wikitext
23493 <div></div><strong>A
23494 B</strong>
23495 !! html/php+tidy
23496 <div></div><p><strong>A
23497 </strong></p><strong></strong><p><strong>B</strong>
23498 </p>
23499 !! html/parsoid
23500 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23501 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23502 !! end
23503
23504 # T8200: <blockquote> should behave like <div> with respect to line breaks
23505 !! test
23506 T8200: paragraphs inside blockquotes (no extra line breaks)
23507 !! options
23508 parsoid=wt2html,html2html
23509 !! wikitext
23510 <blockquote>Line one
23511
23512 Line two</blockquote>
23513 !! html
23514 <blockquote>Line one
23515 Line two</blockquote>
23516
23517 !! html+tidy
23518 <blockquote><p>Line one
23519 Line two</p></blockquote>
23520 !! end
23521
23522 !! test
23523 T8200: paragraphs inside blockquotes (extra line break on open)
23524 !! options
23525 parsoid=wt2html,html2html
23526 !! wikitext
23527 <blockquote>
23528 Line one
23529
23530 Line two</blockquote>
23531 !! html
23532 <blockquote>
23533 <p>Line one
23534 </p>
23535 Line two</blockquote>
23536
23537 !! html+tidy
23538 <blockquote>
23539 <p>Line one
23540 </p><p>
23541 Line two</p></blockquote>
23542 !! end
23543
23544 !! test
23545 T8200: paragraphs inside blockquotes (extra line break on close)
23546 !! options
23547 parsoid=wt2html,html2html
23548 !! wikitext
23549 <blockquote>Line one
23550
23551 Line two
23552 </blockquote>
23553 !! html
23554 <blockquote>Line one
23555 <p>Line two
23556 </p>
23557 </blockquote>
23558
23559 !! html+tidy
23560 <blockquote><p>Line one
23561 </p><p>Line two
23562 </p>
23563 </blockquote>
23564 !! end
23565
23566 !! test
23567 T8200: paragraphs inside blockquotes (extra line break on open and close)
23568 !! wikitext
23569 <blockquote>
23570 Line one
23571
23572 Line two
23573 </blockquote>
23574 !! html
23575 <blockquote>
23576 <p>Line one
23577 </p><p>Line two
23578 </p>
23579 </blockquote>
23580
23581 !! end
23582
23583 ## This is a corner case interaction between the paragraph wrapping in the
23584 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23585 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23586 ## of which "div" is one, but do p-wrapping inside them. These are referred
23587 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23588 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23589 !! test
23590 Paragraphs inside blockquotes/divs (no extra line breaks)
23591 !! wikitext
23592 <blockquote><div>Line one
23593
23594 Line two</div></blockquote>
23595 !! html
23596 <blockquote><div>Line one
23597 Line two</div></blockquote>
23598
23599 !! end
23600
23601 !! test
23602 Paragraphs inside blockquotes/divs (extra line break on open)
23603 !! wikitext
23604 <blockquote><div>
23605 Line one
23606
23607 Line two</div></blockquote>
23608 !! html
23609 <blockquote><div>
23610 <p>Line one
23611 </p>
23612 Line two</div></blockquote>
23613
23614 !! end
23615
23616 !! test
23617 Paragraphs inside blockquotes/divs (extra line break on close)
23618 !! wikitext
23619 <blockquote><div>Line one
23620
23621 Line two
23622 </div></blockquote>
23623 !! html
23624 <blockquote><div>Line one
23625 <p>Line two
23626 </p>
23627 </div></blockquote>
23628
23629 !! end
23630
23631 !! test
23632 Paragraphs inside blockquotes/divs (extra line break on open and close)
23633 !! wikitext
23634 <blockquote><div>
23635 Line one
23636
23637 Line two
23638 </div></blockquote>
23639 !! html
23640 <blockquote><div>
23641 <p>Line one
23642 </p><p>Line two
23643 </p>
23644 </div></blockquote>
23645
23646 !! end
23647
23648 !! test
23649 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23650 !! options
23651 wgLinkHolderBatchSize=0
23652 !! wikitext
23653 [[meatball:1]]
23654 [[meatball:2]]
23655 [[meatball:3]]
23656 !! html
23657 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23658 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23659 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23660 </p>
23661 !! end
23662
23663 !! test
23664 Free external link invading image caption
23665 !! wikitext
23666 [[Image:Foobar.jpg|thumb|http://x|hello]]
23667 !! html/php
23668 <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>
23669
23670 !! html/parsoid
23671 <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>
23672 !! end
23673
23674 !! test
23675 T17196: localised external link numbers
23676 !! options
23677 language=fa
23678 !! wikitext
23679 [http://en.wikipedia.org/]
23680 !! html/php
23681 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23682 </p>
23683 !! html/parsoid
23684 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23685 !! end
23686
23687 !! test
23688 Multibyte character in padleft
23689 !! wikitext
23690 {{padleft:-Hello|7|Æ}}
23691 !! html/php
23692 <p>Æ-Hello
23693 </p>
23694 !! html/parsoid
23695 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23696 !! end
23697
23698 !! test
23699 Multibyte character in padright
23700 !! wikitext
23701 {{padright:Hello-|7|Æ}}
23702 !! html/php
23703 <p>Hello-Æ
23704 </p>
23705 !! html/parsoid
23706 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23707 !! end
23708
23709 !!test
23710 formatdate parser function
23711 !! wikitext
23712 {{#formatdate:2009-03-24}}
23713 !! html
23714 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23715 </p>
23716 !! end
23717
23718 !!test
23719 formatdate parser function, with default format
23720 !! wikitext
23721 {{#formatdate:2009-03-24|mdy}}
23722 !! html
23723 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23724 </p>
23725 !! end
23726
23727 !! test
23728 Spacing of numbers in formatted dates
23729 !! wikitext
23730 {{#formatdate:January 15}}
23731 !! html
23732 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23733 </p>
23734 !! end
23735
23736 !! test
23737 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
23738 !! options
23739 language=nl title=[[MediaWiki:Common.css]]
23740 !! wikitext
23741 {{#formatdate:2009-03-24|dmy}}
23742 !! html
23743 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23744 </p>
23745 !! end
23746
23747 #
23748 #
23749 #
23750
23751 #
23752 # Edit comments
23753 #
23754
23755 !! test
23756 Edit comment with link
23757 !! options
23758 comment
23759 !! wikitext
23760 I like the [[Main Page]] a lot
23761 !! html/php
23762 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23763 !!end
23764
23765 !! test
23766 Edit comment with link and link text
23767 !! options
23768 comment
23769 !! wikitext
23770 I like the [[Main Page|best pages]] a lot
23771 !! html/php
23772 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23773 !!end
23774
23775 !! test
23776 Edit comment with link and link text with suffix
23777 !! options
23778 comment
23779 !! wikitext
23780 I like the [[Main Page|best page]]s a lot
23781 !! html/php
23782 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23783 !!end
23784
23785 !! test
23786 Edit comment with section link (non-local, eg in history list)
23787 !! options
23788 comment title=[[Main Page]]
23789 !! wikitext
23790 /* External links */ removed bogus entries
23791 !! html/php
23792 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23793 !!end
23794
23795 !! test
23796 Edit comment with section link and text before it (non-local, eg in history list)
23797 !! options
23798 comment title=[[Main Page]]
23799 !! wikitext
23800 pre-comment text /* External links */ removed bogus entries
23801 !! html/php
23802 pre-comment text <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23803 !!end
23804
23805 !! test
23806 Edit comment with section link (local, eg in diff view)
23807 !! options
23808 comment local title=[[Main Page]]
23809 !! wikitext
23810 /* External links */ removed bogus entries
23811 !! html/php
23812 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23813 !!end
23814
23815 !! test
23816 Edit comment with subpage link (T16080)
23817 !! options
23818 comment
23819 subpage
23820 title=[[Subpage test]]
23821 !! wikitext
23822 Poked at a [[/subpage]] here...
23823 !! html/php
23824 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23825 !!end
23826
23827 !! test
23828 Edit comment with subpage link and link text (T16080)
23829 !! options
23830 comment
23831 subpage
23832 title=[[Subpage test]]
23833 !! wikitext
23834 Poked at a [[/subpage|neat little page]] here...
23835 !! html/php
23836 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23837 !!end
23838
23839 !! test
23840 Edit comment with bogus subpage link in non-subpage NS (T16080)
23841 !! options
23842 comment
23843 title=[[Subpage test]]
23844 !! wikitext
23845 Poked at a [[/subpage]] here...
23846 !! html/php
23847 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...
23848 !!end
23849
23850 !! test
23851 Edit comment with bare anchor link (local, as on diff)
23852 !! options
23853 comment
23854 local
23855 title=[[Main Page]]
23856 !! wikitext
23857 [[#section]]
23858 !! html/php
23859 <a href="#section">#section</a>
23860 !! end
23861
23862 !! test
23863 Edit comment with bare anchor link (non-local, as on history)
23864 !! options
23865 comment
23866 title=[[Main Page]]
23867 !! wikitext
23868 [[#section]]
23869 !! html/php
23870 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23871 !! end
23872
23873 !! test
23874 Anchor starting with underscore
23875 !! options
23876 title=[[Foo]]
23877 !! wikitext
23878 [[#_ref|One]]
23879 !! html/php
23880 <p><a href="#_ref">One</a>
23881 </p>
23882 !! html/parsoid
23883 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23884 !! end
23885
23886 !! test
23887 Id starting with underscore
23888 !! wikitext
23889 <div id="_ref"></div>
23890 !! html/*
23891 <div id="_ref"></div>
23892
23893 !! end
23894
23895 !! test
23896 Edit comment with link with more than one pipe (T99346)
23897 !! options
23898 comment
23899 !! wikitext
23900 [[Main Page|Many|pipes]]
23901 !! html/php
23902 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23903 !! end
23904
23905 !! test
23906 Complex edit comment with link with more than one pipe (T99346)
23907 !! options
23908 comment
23909 !! wikitext
23910 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23911 !! html/php
23912 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;
23913 !! end
23914
23915 !! test
23916 Space normalisation on autocomment (T24784)
23917 !! options
23918 comment
23919 title=[[Main Page]]
23920 !! wikitext
23921 /* __hello__world__ */
23922 !! html/php
23923 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23924 !! end
23925
23926 !! test
23927 percent-encoding and + signs in comments (T28410)
23928 !! options
23929 comment
23930 !! wikitext
23931 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23932 !! html/php
23933 <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>
23934 !! end
23935
23936 # Parsoid doesn't support this yet: see T75581
23937 # but it *should* omit the 'src' attribute if the image is bad.
23938 # PHP side of tests was disabled in
23939 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23940 # because of issues in the PHP parserTests infrastructure
23941 # (but the output below is indeed what the PHP side emits)
23942 !! test
23943 Bad images - basic functionality
23944 !! wikitext
23945 [[File:Bad.jpg]]
23946 !! html/php+disabled
23947 !! html/parsoid
23948 <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>
23949 !! end
23950
23951 !! test
23952 Bad images - T18039: text after bad image disappears
23953 !! wikitext
23954 Foo bar
23955 [[File:Bad.jpg]]
23956 Bar foo
23957 !! html/php+disabled
23958 <p>Foo bar
23959 </p><p>Bar foo
23960 </p>
23961 !! html/parsoid
23962 <p>Foo bar
23963 <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>
23964 Bar foo</p>
23965 !! end
23966
23967 !! test
23968 Verify that displaytitle works (T24501) no displaytitle
23969 !! options
23970 showtitle
23971 !! config
23972 wgAllowDisplayTitle=true
23973 wgRestrictDisplayTitle=false
23974 !! wikitext
23975 this is not the the title
23976 !! html/php
23977 Parser test
23978 <p>this is not the the title
23979 </p>
23980 !! end
23981
23982 !! test
23983 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23984 !! options
23985 showtitle
23986 title=[[Screen]]
23987 !! config
23988 wgAllowDisplayTitle=true
23989 wgRestrictDisplayTitle=false
23990 !! wikitext
23991 this is not the the title
23992 {{DISPLAYTITLE:whatever}}
23993 !! html/php
23994 whatever
23995 <p>this is not the the title
23996 </p>
23997 !! end
23998
23999 !! test
24000 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24001 !! options
24002 showtitle
24003 title=[[Screen]]
24004 !! config
24005 wgAllowDisplayTitle=true
24006 wgRestrictDisplayTitle=true
24007 !! wikitext
24008 this is not the the title
24009 {{DISPLAYTITLE:whatever}}
24010 !! html/php
24011 Screen
24012 <p>this is not the the title
24013 </p>
24014 !! end
24015
24016 !! test
24017 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24018 !! options
24019 showtitle
24020 title=[[Screen]]
24021 !! config
24022 wgAllowDisplayTitle=true
24023 wgRestrictDisplayTitle=true
24024 !! wikitext
24025 this is not the the title
24026 {{DISPLAYTITLE:screen}}
24027 !! html/php
24028 screen
24029 <p>this is not the the title
24030 </p>
24031 !! end
24032
24033 !! test
24034 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24035 !! options
24036 showtitle
24037 title=[[Screen]]
24038 !! config
24039 wgAllowDisplayTitle=false
24040 !! wikitext
24041 this is not the the title
24042 {{DISPLAYTITLE:screen}}
24043 !! html/php
24044 Screen
24045 <p>this is not the the title
24046 <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>
24047 </p>
24048 !! end
24049
24050 !! test
24051 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24052 !! options
24053 showtitle
24054 title=[[Screen]]
24055 !! config
24056 wgAllowDisplayTitle=false
24057 !! wikitext
24058 this is not the the title
24059 !! html/php
24060 Screen
24061 <p>this is not the the title
24062 </p>
24063 !! end
24064
24065 !! test
24066 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24067 !! options
24068 showtitle
24069 title=[[Screen]]
24070 !! config
24071 wgAllowDisplayTitle=true
24072 wgRestrictDisplayTitle=true
24073 !! wikitext
24074 this is not the the title
24075 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24076 !! html/php
24077 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24078 <p>this is not the the title
24079 </p>
24080 !! end
24081
24082 !! test
24083 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24084 !! options
24085 showtitle
24086 title=[[Screen]]
24087 !! config
24088 wgAllowDisplayTitle=true
24089 wgRestrictDisplayTitle=true
24090 !! wikitext
24091 this is not the the title
24092 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24093 !! html/php
24094 <span style="color: red;">s</span>creen
24095 <p>this is not the the title
24096 </p>
24097 !! end
24098
24099 !! test
24100 Page status indicators: Empty name is invalid
24101 !! options
24102 showindicators
24103 !! wikitext
24104 <indicator name=" "></indicator>
24105 <indicator></indicator>
24106 !! html/php
24107 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24108 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24109 </p>
24110 !! end
24111
24112 !! test
24113 Page status indicators: Weird syntaxes that are okay
24114 !! options
24115 showindicators
24116 !! wikitext
24117 <indicator name="empty" />
24118 <indicator name="name"></indicator>
24119 !! html/php
24120 empty=
24121 name=
24122 <p><br />
24123 </p>
24124 !! end
24125
24126 !! test
24127 Page status indicators: Torture test
24128 !! options
24129 showindicators
24130 !! wikitext
24131 <indicator name="01">hello world</indicator>
24132 <indicator name="02">[[Main Page]]</indicator>
24133 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24134 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24135 <indicator name="05">*foo
24136 *bar</indicator>
24137 <indicator name="06"><nowiki>foo</nowiki></indicator>
24138 <indicator name="07"> Preformatted</indicator>
24139 <indicator name="08"><div>Broken tag</indicator>
24140 <indicator name="09">{| class=wikitable
24141 |cell
24142 |}</indicator>
24143 <indicator name="10">Two
24144
24145 paragraphs</indicator>
24146 !! html/php
24147 01=hello world
24148 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24149 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" />
24150 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>
24151 05=<ul><li>foo</li>
24152 <li>bar</li></ul>
24153
24154 06=foo
24155 07=<pre>Preformatted
24156 </pre>
24157 08=<div>Broken tag</div>
24158
24159 09=<table class="wikitable">
24160 <tr>
24161 <td>cell
24162 </td></tr></table>
24163
24164 10=<p>Two
24165 </p><p>paragraphs
24166 </p>
24167 <p><br />
24168 </p><p><br />
24169 </p><p><br />
24170 </p><p><br />
24171 </p><p><br />
24172 </p>
24173 !! end
24174
24175 !! test
24176 preload: check <noinclude> and <includeonly>
24177 !! options
24178 preload
24179 !! wikitext
24180 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24181 !! html/php
24182 Hello kind world.
24183 !! end
24184
24185 !! test
24186 preload: check <onlyinclude>
24187 !! options
24188 preload
24189 !! wikitext
24190 Goodbye <onlyinclude>Hello world</onlyinclude>
24191 !! html/php
24192 Hello world
24193 !! end
24194
24195 !! test
24196 preload: can pass tags through if we want to
24197 !! options
24198 preload
24199 !! wikitext
24200 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24201 !! html/php
24202 <includeonly>Hello world</includeonly>
24203 !! end
24204
24205 !! test
24206 preload: check that it doesn't try to do tricks
24207 !! options
24208 preload
24209 !! wikitext
24210 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24211 !! html/php
24212 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24213 !! end
24214
24215 !! test
24216 Play a bit with r67090 and T5158
24217 !! wikitext
24218 <div style="width:50% !important">&nbsp;</div>
24219 <div style="width:50%&nbsp;!important">&nbsp;</div>
24220 <div style="width:50%&#160;!important">&nbsp;</div>
24221 <div style="border : solid;">&nbsp;</div>
24222 !! html/php
24223 <div style="width:50% !important">&#160;</div>
24224 <div style="width:50% !important">&#160;</div>
24225 <div style="width:50% !important">&#160;</div>
24226 <div style="border&#32;: solid;">&#160;</div>
24227
24228 !! html/parsoid
24229 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24230 <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>
24231 <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>
24232 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24233
24234 !! end
24235
24236 !! test
24237 French spaces in wikitext
24238 !! wikitext
24239 foo ! bar ? bat 50 % is less than 75 %.
24240
24241 Hello : this ; is « something ‹ else › again »
24242 !! html
24243 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24244 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24245 </p>
24246 !! end
24247
24248 # It would be reasonable for Parsoid and PHP to differ here.
24249 # The PHP behavior is arguably a bug.
24250 !! test
24251 Corner case: french spaces in definition list
24252 !! wikitext
24253 ;foo : bar
24254 !! html+tidy
24255 <dl><dt>foo&#160;</dt>
24256 <dd>bar</dd></dl>
24257 !! end
24258
24259 !! test
24260 T5158: Test for French spaces in attributes
24261 !! wikitext
24262 <br style=" clear : both ; " />
24263 !! html/php
24264 <p><br style="clear&#32;: both&#32;;" />
24265 </p>
24266 !! end
24267
24268 !! test
24269 HTML5 data attributes
24270 !! wikitext
24271 <span data-foo="bar">Baz</span>
24272 <p data-abc-def_hij="">Quuz</p>
24273 !! html/php
24274 <p><span data-foo="bar">Baz</span>
24275 </p>
24276 <p data-abc-def_hij="">Quuz</p>
24277
24278 !! html/parsoid
24279 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24280 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24281 !! end
24282
24283 !! test
24284 Strip reserved data attributes
24285 !! wikitext
24286 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24287 !! html/php
24288 <div data-ok="fred">d</div>
24289
24290 !! html/parsoid
24291 <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>
24292 !! end
24293
24294 !! test
24295 percent-encoding and + signs in internal links (T28410)
24296 !! wikitext
24297 [[User:+%]] [[Page+title%]]
24298 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24299 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24300 [[%33%45]] [[%33%45+]]
24301 !! html/php
24302 <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>
24303 <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>
24304 <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>
24305 <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>
24306 </p>
24307 !! html/parsoid
24308 <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>
24309 <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>
24310 <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>
24311 <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>
24312 !! end
24313
24314 !! test
24315 Special characters in embedded file links (T29679)
24316 !! wikitext
24317 [[File:Contains & ampersand.jpg]]
24318 [[File:Does not exist.jpg|Title with & ampersand]]
24319 !! html/php
24320 <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>
24321 <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>
24322 </p>
24323 !! html/parsoid
24324 <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>
24325 <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>
24326 !! end
24327
24328 !! test
24329 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24330 !! wikitext
24331 Text&apos;s been normalized?
24332 !! html
24333 <p>Text&#39;s been normalized?
24334 </p>
24335 !! end
24336
24337 !! test
24338 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24339 !! wikitext
24340 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24341 !! html
24342 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24343 </p>
24344 !! end
24345
24346 !! test
24347 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24348 !! wikitext
24349 [http://www.example.org/ ideograms]
24350 !! html
24351 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24352 </p>
24353 !! end
24354
24355 !! test
24356 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24357 !! wikitext
24358 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24359 !! html
24360 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24361 </p>
24362 !! end
24363
24364 !! article
24365 Mediawiki:loop1
24366 !! text
24367 {{Identical|A}}
24368 !! endarticle
24369
24370 !! article
24371 Mediawiki:loop2
24372 !! text
24373 {{Identical|B}}
24374 !! endarticle
24375
24376 !! article
24377 Template:Identical
24378 !! text
24379 {{int:loop1}}
24380 {{int:loop2}}
24381 !! endarticle
24382
24383 !! test
24384 T33098 Template which includes system messages which includes the template
24385 !! wikitext
24386 {{Identical}}
24387 !! html
24388 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24389 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24390 </p>
24391 !! end
24392
24393 !! test
24394 T33490 Turkish: ucfirst 'blah'
24395 !! options
24396 language=tr
24397 !! wikitext
24398 {{ucfirst:blah}}
24399 !! html
24400 <p>Blah
24401 </p>
24402 !! end
24403
24404 !! test
24405 T33490 Turkish: ucfirst 'ix'
24406 !! options
24407 language=tr
24408 !! wikitext
24409 {{ucfirst:ix}}
24410 !! html
24411 <p>İx
24412 </p>
24413 !! end
24414
24415 !! test
24416 T33490 Turkish: lcfirst 'BLAH'
24417 !! options
24418 language=tr
24419 !! wikitext
24420 {{lcfirst:BLAH}}
24421 !! html
24422 <p>bLAH
24423 </p>
24424 !! end
24425
24426 !! test
24427 T33490 Turkish: ucfırst (with a dotless i)
24428 !! options
24429 language=tr
24430 !! wikitext
24431 {{ucfırst:blah}}
24432 !! html
24433 <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>
24434 </p>
24435 !! end
24436
24437 !! test
24438 T33490 ucfırst (with a dotless i) with English language
24439 !! options
24440 language=en
24441 !! wikitext
24442 {{ucfırst:blah}}
24443 !! html
24444 <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>
24445 </p>
24446 !! end
24447
24448 # Note that Parsoid doesn't emit an explicit TOC.
24449 # Note also that the html2wt direction tends to emit an extra newline
24450 # between the __TOC__ magicword and the first heading unless *both*
24451 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24452 # it's "{}").
24453
24454 !! test
24455 T28375: TOC with italics
24456 !! options
24457 title=[[Main Page]]
24458 !! wikitext
24459 __TOC__
24460 ==''Lost'' episodes==
24461 !! html/php
24462 <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>
24463 <ul>
24464 <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>
24465 </ul>
24466 </div>
24467
24468 <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>
24469
24470 !! html/parsoid
24471 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24472 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24473 !! end
24474
24475 !! test
24476 T28375: TOC with bold
24477 !! options
24478 title=[[Main Page]]
24479 !! wikitext
24480 __TOC__
24481 =='''should be bold''' then normal text==
24482 !! html/php
24483 <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>
24484 <ul>
24485 <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>
24486 </ul>
24487 </div>
24488
24489 <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>
24490
24491 !! html/parsoid
24492 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24493 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24494 !! end
24495
24496 !! test
24497 T35845: Headings become cursive in TOC when they contain an image
24498 !! options
24499 title=[[Main Page]]
24500 !! wikitext
24501 __TOC__
24502 ==Image [[Image:foobar.jpg]]==
24503 !! html/php
24504 <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>
24505 <ul>
24506 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24507 </ul>
24508 </div>
24509
24510 <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>
24511
24512 !! html/parsoid
24513 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24514 <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>
24515 !! end
24516
24517 !! test
24518 T35845 (2): Headings become bold in TOC when they contain a blockquote
24519 !! options
24520 title=[[Main Page]]
24521 !! wikitext
24522 __TOC__
24523 ==<blockquote>Quote</blockquote>==
24524 !! html/php
24525 <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>
24526 <ul>
24527 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24528 </ul>
24529 </div>
24530
24531 <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>
24532
24533 !! html/php+tidy
24534 <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>
24535 <ul>
24536 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24537 </ul>
24538 </div>
24539
24540 <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>
24541 !! html/parsoid
24542 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24543 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24544 !! end
24545
24546 !! test
24547 Unclosed tags in TOC
24548 !! config
24549 wgFragmentMode=[ 'html5', 'legacy' ]
24550 !! options
24551 title=[[Main Page]]
24552 !! wikitext
24553 __TOC__
24554 ==Proof: 2 < 3==
24555 <small>Hanc marginis exiguitas non caperet.</small>
24556 QED
24557 !! html/php
24558 <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>
24559 <ul>
24560 <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>
24561 </ul>
24562 </div>
24563
24564 <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>
24565 <p><small>Hanc marginis exiguitas non caperet.</small>
24566 QED
24567 </p>
24568 !! html/parsoid
24569 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24570 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24571 <p><small>Hanc marginis exiguitas non caperet.</small>
24572 QED</p>
24573 !! end
24574
24575 !! test
24576 Multiple tags in TOC
24577 !! wikitext
24578 __TOC__
24579 ==<i>Foo</i> <b>Bar</b>==
24580
24581 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24582 !! html/php
24583 <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>
24584 <ul>
24585 <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>
24586 <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>
24587 </ul>
24588 </div>
24589
24590 <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>
24591 <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>
24592
24593 !! html/php+tidy
24594 <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>
24595 <ul>
24596 <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>
24597 <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>
24598 </ul>
24599 </div>
24600
24601 <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>
24602 <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>
24603 !! html/parsoid
24604 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24605 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24606
24607 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
24608 !! end
24609
24610 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24611 # html5 tag parsing.
24612 !! test
24613 Tags with parameters in TOC
24614 !! options
24615 parsoid=wt2html
24616 !! wikitext
24617 __TOC__
24618 ==<sup class="in-h2">Hello</sup>==
24619
24620 ==<sup class="a > b">Evilbye</sup>==
24621 !! html/php
24622 <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>
24623 <ul>
24624 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24625 <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>
24626 </ul>
24627 </div>
24628
24629 <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>
24630 <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>
24631
24632 !! html/parsoid
24633 <meta property="mw:PageProp/toc" />
24634 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24635
24636 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24637 !! end
24638
24639 !! test
24640 span tags with directionality in TOC
24641 !! wikitext
24642 __TOC__
24643 ==<span dir="ltr">C++</span>==
24644
24645 ==<span dir="rtl">זבנג!</span>==
24646
24647 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24648
24649 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24650
24651 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24652 !! html/php
24653 <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>
24654 <ul>
24655 <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>
24656 <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>
24657 <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>
24658 <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>
24659 <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>
24660 </ul>
24661 </div>
24662
24663 <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>
24664 <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>
24665 <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>
24666 <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>
24667 <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>
24668
24669 !! html/parsoid
24670 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24671 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24672 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24673 <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>
24674 <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>
24675 <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>
24676 !! end
24677
24678 !! test
24679 T74884: bdi element in ToC
24680 !! wikitext
24681 __TOC__
24682 ==<bdi>test</bdi>==
24683 !! html/php
24684 <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>
24685 <ul>
24686 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24687 </ul>
24688 </div>
24689
24690 <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>
24691
24692 !! html/parsoid
24693 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24694 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24695 !! end
24696
24697 !! test
24698 T35715: s/strike element in ToC
24699 !! wikitext
24700 __TOC__
24701 ==<s>test</s> test <strike>test</strike>==
24702 !! html/php
24703 <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>
24704 <ul>
24705 <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>
24706 </ul>
24707 </div>
24708
24709 <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>
24710
24711 !! html/parsoid
24712 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24713 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24714 !! end
24715
24716 !! test
24717 T198618: style element in ToC
24718 !! options
24719 styletag=1
24720 !! wikitext
24721 __TOC__
24722 ==<style>.foo {}</style>Style<style>.bar {}</style>==
24723 !! html/php
24724 <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>
24725 <ul>
24726 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
24727 </ul>
24728 </div>
24729
24730 <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>
24731
24732 !! html/parsoid
24733 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24734 <h2 id="Style" data-parsoid='{}'><style>.foo {}</style>Style<style>.bar {}</style></h2>
24735 !! end
24736
24737 !! test
24738 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24739 !! wikitext
24740 __TOC__
24741 ==x==
24742 !! html/php
24743 <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>
24744 <ul>
24745 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24746 </ul>
24747 </div>
24748
24749 <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>
24750
24751 !! html/parsoid
24752 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24753 <h2 id="x" data-parsoid='{}'>x</h2>
24754 !! end
24755
24756 !! article
24757 MediaWiki:T34057
24758 !! text
24759 == {{int:headline_sample}} ==
24760 !! endarticle
24761
24762 !! test
24763 T34057: Title needed when expanding <h> nodes.
24764 !! options
24765 title=[[Main Page]]
24766 !! wikitext
24767 {{int:T34057}}
24768 !! html
24769 <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>
24770
24771 !! end
24772
24773 !! test
24774 Strip marker in urlencode
24775 !! wikitext
24776 {{urlencode:x<nowiki/>y}}
24777 {{urlencode:x<nowiki/>y|wiki}}
24778 {{urlencode:x<nowiki/>y|path}}
24779 {{urlencode:x<pre id="one">two</pre>y}}
24780 !! html/php
24781 <p>xy
24782 xy
24783 xy
24784 xy
24785 </p>
24786 !! end
24787
24788 !! test
24789 Strip marker in lc
24790 !! wikitext
24791 {{lc:x<nowiki/>y}}
24792 !! html
24793 <p>xy
24794 </p>
24795 !! end
24796
24797 !! test
24798 Strip marker in uc
24799 !! wikitext
24800 {{uc:x<nowiki/>y}}
24801 !! html
24802 <p>XY
24803 </p>
24804 !! end
24805
24806 !! test
24807 Strip marker in formatNum
24808 !! wikitext
24809 {{formatnum:1<nowiki/>2}}
24810 {{formatnum:1<nowiki/>2|R}}
24811 !! html
24812 <p>12
24813 12
24814 </p>
24815 !! end
24816
24817 !! test
24818 Check noCommafy in formatNum
24819 !! options
24820 language=be-tarask
24821 !! wikitext
24822 {{formatnum:123456.78}}
24823 {{formatnum:123456.78|NOSEP}}
24824 !! html
24825 <p>123 456,78
24826 123456.78
24827 </p>
24828 !! end
24829
24830 !! test
24831 Wrong option for formatNum (T58199)
24832 !! wikitext
24833 {{formatnum:1,234.56|Random}}
24834 {{formatnum:1,234.56|EVERYTHING}}
24835 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24836 !! html
24837 <p>1,234.56
24838 1,234.56
24839 1,234.56
24840 </p>
24841 !! end
24842
24843 !! test
24844 Strip marker in grammar
24845 !! options
24846 language=fi
24847 !! wikitext
24848 {{grammar:elative|foo<nowiki/>bar}}
24849 !! html
24850 <p>foobarista
24851 </p>
24852 !! end
24853
24854 !! test
24855 Strip marker in padleft
24856 !! wikitext
24857 {{padleft:|2|x<nowiki/>y}}
24858 !! html
24859 <p>xy
24860 </p>
24861 !! end
24862
24863 !! test
24864 Strip marker in padright
24865 !! wikitext
24866 {{padright:|2|x<nowiki/>y}}
24867 !! html
24868 <p>xy
24869 </p>
24870 !! end
24871
24872 !! test
24873 Strip marker in anchorencode
24874 !! wikitext
24875 {{anchorencode:x<nowiki/>y}}
24876 !! html/php
24877 <p>xy
24878 </p>
24879 !! html/parsoid
24880 <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>
24881 !! end
24882
24883 !! test
24884 nowiki inside link inside heading (T20295)
24885 !! wikitext
24886 ==[[foo|x<nowiki>y</nowiki>z]]==
24887 !! html
24888 <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>
24889
24890 !! end
24891
24892 !! test
24893 new support for bdi element (T33817)
24894 !! wikitext
24895 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24896 !! html
24897 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24898
24899 !!end
24900
24901 !! test
24902 Ignore pipe between table row attributes
24903 !! wikitext
24904 {|
24905 |quux
24906 |- id=foo | style='color: red'
24907 |bar
24908 |}
24909 !! html
24910 <table>
24911 <tr>
24912 <td>quux
24913 </td></tr>
24914 <tr id="foo" style="color: red">
24915 <td>bar
24916 </td></tr></table>
24917
24918 !! end
24919
24920 !!test
24921 Language parser function
24922 !! wikitext
24923 {{#language:ar}}
24924 !! html
24925 <p>العربية
24926 </p>
24927 !! end
24928
24929 !!test
24930 Padleft and padright (default 0-padding)
24931 !! wikitext
24932 {{padleft:xyz|5}}
24933 {{padright:xyz|5}}
24934 !! html/php
24935 <p>00xyz
24936 xyz00
24937 </p>
24938 !! html/parsoid
24939 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24940 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24941 !! end
24942
24943 !!test
24944 Padleft and padright (partial fill)
24945 !! wikitext
24946 {{padleft:xyz|6|ab}}
24947 {{padright:xyz|6|ab}}
24948 !! html/php
24949 <p>abaxyz
24950 xyzaba
24951 </p>
24952 !! html/parsoid
24953 <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>
24954 <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>
24955 !! end
24956
24957 !!test
24958 Padleft and padright as substr
24959 !! wikitext
24960 {{padleft:|3|abcde}}
24961 {{padright:|3|abcde}}
24962 !! html/php
24963 <p>abc
24964 abc
24965 </p>
24966 !! html/parsoid
24967 <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>
24968 <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>
24969 !! end
24970
24971 !! test
24972 Padleft and padright with non-numerical length (T180403)
24973 !! wikitext
24974 {{padleft:abcdef|junk}}
24975 {{padright:abcdef|junk}}
24976 !! html/php
24977 <p>abcdef
24978 abcdef
24979 </p>
24980 !! end
24981
24982 !!test
24983 Special parser function
24984 !! wikitext
24985 {{#special:RandomPage}}
24986 {{#special:BaDtItLe}}
24987 {{#special:Foobar}}
24988 !! html
24989 <p>Special:Random
24990 Special:Badtitle
24991 Special:Foobar
24992 </p>
24993 !! end
24994
24995 !!test
24996 T36939 - Case insensitive link parsing ([HttP://])
24997 !! wikitext
24998 [HttP://MediaWiki.Org/]
24999 !! html/php
25000 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25001 </p>
25002 !! html/parsoid
25003 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25004 !! end
25005
25006 !!test
25007 T36939 - Case insensitive link parsing ([HttP:// title])
25008 !! wikitext
25009 [HttP://MediaWiki.Org/ MediaWiki]
25010 !! html
25011 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25012 </p>
25013 !! end
25014
25015 !!test
25016 T36939 - Case insensitive link parsing (HttP://)
25017 !! wikitext
25018 HttP://MediaWiki.Org/
25019 !! html/php
25020 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25021 </p>
25022 !! html/parsoid
25023 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25024 !! end
25025
25026 !!test
25027 Disable TOC
25028 !! options
25029 notoc
25030 !! wikitext
25031 Lead
25032 ==Section 1==
25033 ==Section 2==
25034 ==Section 3==
25035 ==Section 4==
25036 ==Section 5==
25037 !! html
25038 <p>Lead
25039 </p>
25040
25041 <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>
25042 <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>
25043 <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>
25044 <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>
25045 <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>
25046
25047 !! end
25048
25049
25050 ###
25051 ### Parsoid-specific tests
25052 ### Parsoid-PHP parser incompatibilities
25053 ###
25054 !!test
25055 1. SOL-sensitive wikitext tokens as template-args
25056 !!options
25057 parsoid=wt2html,wt2wt
25058 !! wikitext
25059 {{echo|*a}}
25060 {{echo|#a}}
25061 {{echo|:a}}
25062 !! html
25063 <span about="#mwt1" typeof="mw:Transclusion">
25064 </span><ul about="#mwt1"><li>a</li>
25065 </ul>
25066 <span about="#mwt2" typeof="mw:Transclusion">
25067 </span><ol about="#mwt2"><li>a</li>
25068 </ol>
25069 <span about="#mwt3" typeof="mw:Transclusion">
25070 </span><dl about="#mwt3"><dd>a</dd>
25071 </dl>
25072 !!end
25073
25074 #### -----------------------------------------------------------------
25075 #### Parsoid-specific functionality tests
25076 #### -----------------------------------------------------------------
25077
25078 # T65642/T68749: Formatting elt fixup around images.
25079 # We know wt2wt will fail, but we expect selser to pass.
25080 # Due to the nature of our testing, wt2wt and selser tests will enter the
25081 # blacklist and we'll catch selser regressions based on changes to the
25082 # blacklist entries for selser tests.
25083 !! test
25084 1. Treebuilder fixup of formatting elt
25085 !! options
25086 parsoid=wt2html,wt2wt
25087 !! wikitext
25088 {|
25089 |
25090 <small>
25091 [[Image:Foobar.jpg|right|Test]]
25092 </small>
25093 |}
25094 !! html/php+tidy
25095 <table>
25096 <tbody><tr>
25097 <td>
25098 <p><small>
25099 </small></p><small>
25100 <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>
25101 </small><p><small></small>
25102 </p>
25103 </td></tr></tbody></table>
25104 !! html/parsoid
25105 <table>
25106 <tbody><tr><td>
25107 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25108 <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>
25109 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25110 </tbody></table>
25111 !! end
25112
25113 !! test
25114 2. Treebuilder fixup of formatting elt
25115 !! options
25116 parsoid=wt2html,wt2wt
25117 !! wikitext
25118 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25119
25120 <small>[[Image:Foobar.jpg|right|300px]]</small>
25121 !! html/php+tidy
25122 <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>
25123 </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>
25124 !! html/parsoid
25125 <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>
25126
25127 <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>
25128 !! end
25129
25130 !! test
25131 3. Treebuilder fixup of formatting elt
25132 !! options
25133 parsoid=wt2html,wt2wt
25134 !! wikitext
25135 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25136 !! html/php+tidy
25137 <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>
25138 </p>
25139 !! html/parsoid
25140 <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>
25141 !! end
25142
25143 !! test
25144 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25145 !! options
25146 parsoid=wt2html,wt2wt
25147 !! wikitext
25148 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25149 !! html/php+tidy
25150 <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>
25151 !! html/parsoid
25152 <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>
25153 !! end
25154
25155 #### ----------------------------------------------------------------
25156 #### Parsoid-only testing of Parsoid's impl of LST
25157 #### Not implemented yet, see
25158 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25159 #### ----------------------------------------------------------------
25160
25161 ## We still need to support serializing the older format while content is stored.
25162 !! test
25163 LST Sections: Backwards compatibility
25164 !! options
25165 parsoid={
25166 "suppressErrors": true,
25167 "modes": ["html2wt"]
25168 }
25169 !! wikitext
25170 <section begin="2011-05-16" />
25171 <section end="2014-04-10 (MW 1.23wmf22)" />
25172 !! html/parsoid
25173 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25174 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25175 !! end
25176
25177 !! test
25178 LST Sections: Newfangled approach
25179 !! wikitext
25180 <section begin="2011-05-16" />
25181 <section end="2014-04-10 (MW 1.23wmf22)" />
25182 !! html/parsoid
25183 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
25184 </span>
25185 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
25186 </span></p>
25187 !! end
25188
25189 #--------- Test stripping of empty nodes in template content ----------
25190
25191 !! test
25192 Empty LI and TR nodes should be stripped from template content
25193 !! wikitext
25194 {{EmptyLITest}}
25195 {{EmptyTRTest}}
25196 !! html/parsoid
25197 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25198 <li>a</li>
25199 <li>b</li>
25200 </ul>
25201 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25202 <tbody>
25203 <tr>
25204 <td>foo</td>
25205 </tr>
25206 <tr>
25207 <td>bar</td>
25208 </tr>
25209 </tbody>
25210 </table>
25211 !! end
25212
25213 !! test
25214 Empty LI and TR nodes should not be stripped from top-level content
25215 !! wikitext
25216 *a
25217 *
25218 *b
25219
25220 {|
25221 |-
25222 |-
25223 |foo
25224 |}
25225 !! html/parsoid
25226 <ul>
25227 <li>a</li>
25228 <li class='mw-empty-elt'></li>
25229 <li>b</li>
25230 </ul>
25231 <table>
25232 <tbody>
25233 <tr class='mw-empty-elt'></tr>
25234 <tr>
25235 <td>foo</td>
25236 </tr>
25237 </tbody>
25238 </table>
25239 !! end
25240
25241 !! test
25242 Empty TR nodes should not be stripped if they have any attributes set
25243 !! wikitext
25244 {{EmptyTRWithHTMLAttrTest}}
25245 !! html/parsoid
25246 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25247 <tr align='center'></tr>
25248 <tr><td>foo</td></tr>
25249 <tr align='center'></tr>
25250 <tr><td>bar</td></tr>
25251 </table>
25252 !! end
25253
25254 #### ----------------------------------------------------------------
25255 #### The following section of tests are primarily to test
25256 #### wikitext escaping capabilities of Parsoid. Given that
25257 #### escaping can be done any number of ways, the wikitext (input)
25258 #### is always adjusted to reflect how Parsoid adds nowiki
25259 #### escape tags.
25260 ####
25261 #### We are marking several tests as parsoid-only since the
25262 #### HTML in the result section is different from what the
25263 #### PHP parser generates for it.
25264 #### ----------------------------------------------------------------
25265
25266
25267 #### --------------- Headings ---------------
25268 #### 0. Unnested
25269 #### 1. Nested inside html <h1>=foo=</h1>
25270 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25271 #### 3. Nested inside html with wikitext split by html tags
25272 #### 4. No escape needed
25273 #### 5. Empty headings <h1></h1>
25274 #### 6. Heading chars in SOL context
25275 #### ----------------------------------------
25276 !! test
25277 Headings: 0. Unnested
25278 !! options
25279 parsoid=html2wt
25280 !! html/parsoid
25281 <p>=foo=</p>
25282
25283 <p> =foo=
25284 <!--cmt-->
25285 =foo=</p>
25286
25287 <p>=foo<i>a</i>=</p>
25288 !! wikitext
25289 <nowiki>=foo=</nowiki>
25290
25291 <nowiki> </nowiki>=foo=
25292 <!--cmt-->
25293 <nowiki>=foo=</nowiki>
25294
25295 =foo''a''<nowiki>=</nowiki>
25296 !!end
25297
25298 # New headings and existing headings are handled differently
25299 !! test
25300 Headings: 1. Nested inside html
25301 !! options
25302 parsoid=html2wt
25303 !! html/parsoid
25304 <h1>=foo=</h1>
25305 <h2>=foo=</h2>
25306 <h3>=foo=</h3>
25307
25308 <h1 data-parsoid=''>=foo=</h1>
25309 <h2 data-parsoid=''>=foo=</h2>
25310 <h3 data-parsoid=''>=foo=</h3>
25311 <h4 data-parsoid=''>=foo=</h4>
25312 <h5 data-parsoid=''>=foo=</h5>
25313 <h6 data-parsoid=''>=foo=</h6>
25314 !! wikitext
25315 = =foo= =
25316
25317 == =foo= ==
25318
25319 === =foo= ===
25320
25321 =<nowiki>=foo=</nowiki>=
25322 ==<nowiki>=foo=</nowiki>==
25323 ===<nowiki>=foo=</nowiki>===
25324 ====<nowiki>=foo=</nowiki>====
25325 =====<nowiki>=foo=</nowiki>=====
25326 ======<nowiki>=foo=</nowiki>======
25327
25328 !!end
25329
25330 !! test
25331 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25332 !! options
25333 parsoid=html2wt
25334 !! html/parsoid
25335 <h1>foo</h1>*bar
25336 <h1>foo</h1>=bar
25337 <h1>foo</h1>=bar=
25338 !! wikitext
25339 = foo =
25340 <nowiki>*</nowiki>bar
25341
25342 = foo =
25343 =bar
25344
25345 = foo =
25346 <nowiki>=bar=</nowiki>
25347 !!end
25348
25349 !! test
25350 Headings: 3. Nested inside html with wikitext split by html tags
25351 !! options
25352 parsoid=html2wt
25353 !! html/parsoid
25354 <h1>=<b>bold</b>foo=</h1>
25355 !! wikitext
25356 = ='''bold'''foo= =
25357 !!end
25358
25359 !! test
25360 Headings: 4a. No escaping needed (testing just h1 and h2)
25361 !! options
25362 parsoid=html2wt
25363 !! html/parsoid
25364 <h1>=foo</h1>
25365 <h1>foo=</h1>
25366 <h1> =foo= </h1>
25367 <h1>=foo= bar</h1>
25368 <h2>=foo</h2>
25369 <h2>foo=</h2>
25370 <h1>=</h1>
25371 <h1><i>=</i>foo=</h1>
25372 !! wikitext
25373 = =foo =
25374
25375 = foo= =
25376
25377 = =foo= =
25378
25379 = =foo= bar =
25380
25381 == =foo ==
25382
25383 == foo= ==
25384
25385 = = =
25386
25387 = ''=''foo= =
25388 !!end
25389
25390 !! test
25391 Headings: 4b. No escaping needed (inside p-tags)
25392 !! options
25393 parsoid=html2wt
25394 !! html/parsoid
25395 <p>=foo= x
25396 =foo= <s></s>
25397 </p>
25398 !! wikitext
25399 =foo= x
25400 =foo= <s></s>
25401 !! html/php
25402 <p>=foo= x
25403 =foo= <s></s>
25404 </p>
25405 !!end
25406
25407 !! test
25408 Headings: 4c. Short headings (1)
25409 !! options
25410 parsoid=html2wt
25411 !! html/parsoid
25412 <p>===
25413 </p>
25414 !! wikitext
25415 <nowiki>===</nowiki>
25416 !! html/php
25417 <p>===
25418 </p>
25419 !! end
25420
25421 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25422 !! test
25423 Headings: 4d. Short headings (2)
25424 !! options
25425 parsoid=wt2html,html2html
25426 !! wikitext
25427 =
25428 ==
25429 ===
25430 ====
25431 =====
25432 !! html/php
25433 <p>=
25434 ==
25435 </p>
25436 <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>
25437 <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>
25438 <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>
25439
25440 !! html/parsoid
25441 <p>=
25442 ==</p>
25443 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25444 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25445 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25446 !! end
25447
25448 !! test
25449 Headings: 5. Empty headings
25450 !! options
25451 parsoid=html2wt
25452 !! html/parsoid
25453 <h1 data-parsoid='{}'></h1>
25454
25455 <h2 data-parsoid='{}'></h2>
25456
25457 <h3 data-parsoid='{}'></h3>
25458
25459 <h4 data-parsoid='{}'></h4>
25460
25461 <h5 data-parsoid='{}'></h5>
25462
25463 <h6 data-parsoid='{}'></h6>
25464 !! wikitext
25465 =<nowiki/>=
25466
25467 ==<nowiki/>==
25468
25469 ===<nowiki/>===
25470
25471 ====<nowiki/>====
25472
25473 =====<nowiki/>=====
25474
25475 ======<nowiki/>======
25476 !!end
25477
25478 !! test
25479 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25480 !! options
25481 parsoid=html2wt
25482 !! html/parsoid
25483 <p>=a=</p>
25484
25485 <p>=a=</p>
25486
25487 <p>=a=</p>
25488 !! wikitext
25489 <nowiki>=a=</nowiki>
25490
25491 <nowiki>=a=</nowiki>
25492
25493 <nowiki>=a=</nowiki>
25494 !!end
25495
25496 !! test
25497 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25498 !! options
25499 parsoid=html2wt
25500 !! html/parsoid
25501 <p>=a=
25502 b</p>
25503
25504 <p>=a=
25505 b</p>
25506
25507 <p>=a=
25508 b</p>
25509 !! wikitext
25510 <nowiki>=a=</nowiki>
25511 b
25512
25513 <nowiki>=a=</nowiki>
25514 b
25515
25516 <nowiki>=a=</nowiki>
25517 b
25518 !!end
25519
25520 !! test
25521 Headings: 6c. Heading chars in SOL context (leading newline break)
25522 !! options
25523 parsoid=html2wt
25524 !! html/parsoid
25525 <p>a
25526 =b=</p>
25527 !! wikitext
25528 a
25529 <nowiki>=b=</nowiki>
25530 !!end
25531
25532 !! test
25533 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25534 !! options
25535 parsoid=html2wt
25536 !! html/parsoid
25537 <!--c0--><p>=a=</p>
25538
25539 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25540 !! wikitext
25541 <!--c0--><nowiki>=a=</nowiki>
25542
25543 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25544 !!end
25545
25546 !! test
25547 Headings: 6d. Heading chars in SOL context (No escaping needed)
25548 !! options
25549 parsoid=html2wt
25550 !! html/parsoid
25551 =a=<div>b</div>
25552 !! wikitext
25553 =a=<div>b</div>
25554 !!end
25555
25556 !! test
25557 Headings: 7. Insert a newline between new content and headings
25558 !! options
25559 parsoid=html2wt
25560 !! html/parsoid
25561 <h2>NEW</h2>
25562 <p>new</p>
25563 <h2 data-parsoid='{}'>A</h2>
25564 <p data-parsoid='{}'>a</p>
25565 !! wikitext
25566 == NEW ==
25567 new
25568
25569 ==A==
25570 a
25571
25572 !! end
25573
25574 !! test
25575 Headings: Used as horizontal rule
25576 !! config
25577 wgFragmentMode=[ 'html5', 'legacy' ]
25578 !! options
25579 parsoid=wt2html
25580 !! wikitext
25581 ===============
25582 !! html/php
25583 <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>
25584
25585 !! html/parsoid
25586 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25587 !! end
25588
25589 #### --------------- Lists ---------------
25590 #### 0. Outside nests (*foo, etc.)
25591 #### 1. Nested inside html <ul><li>*foo</li></ul>
25592 #### 2. Inside definition lists
25593 #### 3. Only bullets at start should be escaped
25594 #### 4. No escapes needed
25595 #### 5. No unnecessary escapes
25596 #### 6. Escape bullets in SOL position
25597 #### 7. Escape bullets in a multi-line context
25598 #### ----------------------------------------
25599
25600 !! test
25601 Lists: 0. Outside nests
25602 !! options
25603 parsoid=html2wt
25604 !! html/parsoid
25605 <p>*foo</p>
25606
25607 <p>#foo</p>
25608
25609 <p>;Foo:bar</p>
25610 !! wikitext
25611 <nowiki>*</nowiki>foo
25612
25613 <nowiki>#</nowiki>foo
25614
25615 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25616 !!end
25617
25618 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25619 ## to test wikitext escaping, and insignificant whitespace diffs
25620 ## cause PHP parser tests to barf
25621 !! test
25622 Lists: 1. Nested inside html (No unnecessary escapes)
25623 !! options
25624 parsoid=html2wt
25625 !! html/parsoid
25626 <ul>
25627 <li>*foo</li>
25628 <li>#foo</li>
25629 <li>:foo</li>
25630 <li>;foo</li>
25631 <li data-parsoid='{}'>*foo</li>
25632 <li data-parsoid='{}'>#foo</li>
25633 <li data-parsoid='{}'>:foo</li>
25634 <li data-parsoid='{}'>;foo</li>
25635 </ul>
25636
25637 <ol>
25638 <li>*foo</li>
25639 <li>#foo</li>
25640 <li>:foo</li>
25641 <li>;foo</li>
25642 <li data-parsoid='{}'>*foo</li>
25643 <li data-parsoid='{}'>#foo</li>
25644 <li data-parsoid='{}'>:foo</li>
25645 <li data-parsoid='{}'>;foo</li>
25646 </ol>
25647 !! wikitext
25648 * *foo
25649 * #foo
25650 * :foo
25651 * ;foo
25652 *<nowiki>*foo</nowiki>
25653 *<nowiki>#foo</nowiki>
25654 *<nowiki>:foo</nowiki>
25655 *<nowiki>;foo</nowiki>
25656
25657 # *foo
25658 # #foo
25659 # :foo
25660 # ;foo
25661 #<nowiki>*foo</nowiki>
25662 #<nowiki>#foo</nowiki>
25663 #<nowiki>:foo</nowiki>
25664 #<nowiki>;foo</nowiki>
25665 !!end
25666
25667 !! test
25668 Lists: 2. Inside definition lists
25669 !! options
25670 parsoid=html2wt
25671 !! html/parsoid
25672 <dl><dt>;foo</dt></dl>
25673 <dl><dt>:foo</dt></dl>
25674 <dl><dt>:foo</dt>
25675 <dd>bar</dd></dl>
25676 <dl><dd>:foo</dd></dl>
25677 !! wikitext
25678 ; ;foo
25679
25680 ; <nowiki>:foo</nowiki>
25681
25682 ; <nowiki>:foo</nowiki>
25683 : bar
25684
25685 : :foo
25686 !!end
25687
25688 !! test
25689 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25690 !! options
25691 parsoid=html2wt
25692 !! html/parsoid
25693 <ul>
25694 <li>*foo*bar</li>
25695 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25696 </ul>
25697 !! wikitext
25698 * *foo*bar
25699 *<nowiki>*foo</nowiki>''it''*bar
25700 !!end
25701
25702 !! test
25703 Lists: 4. No escapes needed
25704 !! options
25705 parsoid=html2wt
25706 !! html/parsoid
25707 <ul>
25708 <li>foo*bar
25709 </li>
25710 </ul>
25711 <ul>
25712 <li><i>foo</i>*bar
25713 </li>
25714 </ul>
25715 <ul>
25716 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25717 </li>
25718 </ul>
25719 <ul>
25720 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25721 </li>
25722 </ul>
25723 !! wikitext
25724 *foo*bar
25725
25726 *''foo''*bar
25727
25728 *[[Foo]]: bar
25729
25730 *[[Foo]]*bar
25731 !!end
25732
25733 !! test
25734 Lists: 5. No unnecessary escapes
25735 !! options
25736 parsoid=html2wt
25737 !! html/parsoid
25738 <ul><li> bar <span>[[foo]]</span></li></ul>
25739 <ul><li> =bar <span>[[foo]]</span></li></ul>
25740 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25741 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25742 <ul><li> =bar <span>foo]]</span>=</li></ul>
25743 <ul><li> <s></s>: a</li></ul>
25744 <ul><li> <i>* foo</i></li></ul>
25745
25746 !! wikitext
25747 * bar <span><nowiki>[[foo]]</nowiki></span>
25748
25749 * =bar <span><nowiki>[[foo]]</nowiki></span>
25750
25751 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25752
25753 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25754
25755 * =bar <span>foo]]</span>=
25756
25757 * <s></s>: a
25758
25759 * ''* foo''
25760 !!end
25761
25762 !! test
25763 Lists: 6. Escape bullets in SOL position
25764 !! options
25765 parsoid=html2wt
25766 !! html/parsoid
25767 <p><!--cmt-->*foo</p>
25768 !! wikitext
25769 <!--cmt--><nowiki>*</nowiki>foo
25770 !!end
25771
25772 !! test
25773 Lists: 7. Escape bullets in a multi-line context
25774 !! options
25775 parsoid=html2wt
25776 !! html/parsoid
25777 <p>a
25778 *b
25779 </p>
25780 !! wikitext
25781 a
25782 <nowiki>*</nowiki>b
25783 !!end
25784
25785 !! test
25786 Lists: 8. Escape colons only if not present in tags
25787 !! options
25788 parsoid=html2wt
25789 !! html/parsoid
25790 <dl><dt>a:b<i>c:d</i></dt></dl>
25791 !! wikitext
25792 ; <nowiki>a:b</nowiki>''c:d''
25793 !! end
25794
25795 #### --------------- HRs ---------------
25796 #### 1. Single line
25797 #### -----------------------------------
25798
25799 !! test
25800 HRs: 1. Single line
25801 !! options
25802 parsoid=html2wt
25803 !! html/parsoid
25804 <hr />----
25805 <hr />=foo=
25806 <hr />*foo
25807 !! wikitext
25808 ----<nowiki>----</nowiki>
25809 ----=foo=
25810 ----*foo
25811 !! end
25812
25813 #### --------------- Tables ---------------
25814 #### 1a. Simple example
25815 #### 1b. No escaping needed (!foo)
25816 #### 1c. No escaping needed (|foo)
25817 #### 1d. No escaping needed (|}foo)
25818 ####
25819 #### 2a. Nested in td (<td>foo|bar</td>)
25820 #### 2b. Nested in td (<td>foo||bar</td>)
25821 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25822 ####
25823 #### 3a. Nested in th (<th>foo!bar</th>)
25824 #### 3b. Nested in th (<th>foo!!bar</th>)
25825 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25826 ####
25827 #### 4a. Escape -
25828 #### 4b. Escape +
25829 #### 4c. No escaping needed
25830 #### --------------------------------------
25831
25832 !! test
25833 Tables: 1a. Simple example
25834 !! options
25835 parsoid=html2wt
25836 !! html/parsoid
25837 <p>{|
25838 |}
25839 </p>
25840 !! wikitext
25841 <nowiki>{|</nowiki>
25842 |}
25843 !! end
25844
25845 !! test
25846 Tables: 1b. No escaping needed
25847 !! options
25848 parsoid=html2wt
25849 !! html/parsoid
25850 <p>!foo
25851 </p>
25852 !! wikitext
25853 !foo
25854 !! end
25855
25856 !! test
25857 Tables: 1c. No escaping needed
25858 !! options
25859 parsoid=html2wt
25860 !! html/parsoid
25861 <p>|foo
25862 </p>
25863 !! wikitext
25864 |foo
25865 !! end
25866
25867 !! test
25868 Tables: 1d. No escaping needed
25869 !! options
25870 parsoid=html2wt
25871 !! html/parsoid
25872 <p>|}foo
25873 </p>
25874 !! wikitext
25875 |}foo
25876 !! end
25877
25878 !! test
25879 Tables: 2a. Nested in td
25880 !! options
25881 parsoid=html2wt
25882 !! html/parsoid
25883 <table><tbody><tr>
25884 <td>foo|bar</td></tr>
25885 <tr><td>x<div>a|b</div></td>
25886 </tbody></table>
25887 !! wikitext
25888 {|
25889 |<nowiki>foo|bar</nowiki>
25890 |-
25891 |x<div><nowiki>a|b</nowiki></div>
25892 |}
25893 !! html/php+tidy
25894 <table>
25895 <tbody><tr>
25896 <td>foo|bar
25897 </td></tr>
25898 <tr>
25899 <td>x<div>a|b</div>
25900 </td></tr></tbody></table>
25901 !! end
25902
25903 !! test
25904 Tables: 2b. Nested in td
25905 !! options
25906 parsoid=html2wt
25907 !! html/parsoid
25908 <table><tbody><tr>
25909 <td>foo||bar</td>
25910 <td>a<i>b||c</i></td>
25911 <td>a<i><div>b||c</div></i></td>
25912 </tr></tbody></table>
25913 !! wikitext
25914 {|
25915 |<nowiki>foo||bar</nowiki>
25916 |a''<nowiki>b||c</nowiki>''
25917 |a''<div><nowiki>b||c</nowiki></div>''
25918 |}
25919 !! html/php
25920 <table>
25921 <tr>
25922 <td>foo||bar
25923 </td>
25924 <td>a<i>b||c</i>
25925 </td>
25926 <td>a<i><div>b||c</div></i>
25927 </td></tr></table>
25928
25929 !! end
25930
25931 !! test
25932 Tables: 2c. Nested in td -- no escaping needed
25933 !! options
25934 parsoid=html2wt
25935 !! html/*
25936 <table>
25937 <tr>
25938 <td>foo!!bar
25939 </td></tr></table>
25940
25941 !! wikitext
25942 {|
25943 |foo!!bar
25944 |}
25945 !! end
25946
25947 !! test
25948 Tables: 3a. Nested in th
25949 !! options
25950 parsoid=html2wt
25951 !! html/*
25952 <table>
25953 <tr>
25954 <th>foo!bar
25955 </th></tr></table>
25956
25957 !! wikitext
25958 {|
25959 !foo!bar
25960 |}
25961 !! end
25962
25963 !! test
25964 Tables: 3b. Nested in th
25965 !! options
25966 parsoid=html2wt
25967 !! html/parsoid
25968 <table><tbody>
25969 <tr><th>foo!!bar</th>
25970 <th><i>foo|bar</i></th>
25971 <th><i>foo!!bar</i></th>
25972 <th><i><span>foo!!bar</span></i></th>
25973 </tr></tbody></table>
25974 !! wikitext
25975 {|
25976 !<nowiki>foo!!bar</nowiki>
25977 !''<nowiki>foo|bar</nowiki>''
25978 !''<nowiki>foo!!bar</nowiki>''
25979 !''<span><nowiki>foo!!bar</nowiki></span>''
25980 |}
25981 !! html/php
25982 <table>
25983 <tr>
25984 <th>foo!!bar
25985 </th>
25986 <th><i>foo|bar</i>
25987 </th>
25988 <th><i>foo!!bar</i>
25989 </th>
25990 <th><i><span>foo!!bar</span></i>
25991 </th></tr></table>
25992
25993 !! end
25994
25995 !! test
25996 Tables: 3c. Nested in th
25997 !! options
25998 parsoid=html2wt
25999 !! html/parsoid
26000 <table><tbody>
26001 <tr><th>foo||bar</th>
26002 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26003 </tr></tbody></table>
26004 !! wikitext
26005 {|
26006 !<nowiki>foo||bar</nowiki>
26007 !<nowiki>foo||bar</nowiki>
26008 |}
26009 !! html/php
26010 <table>
26011 <tr>
26012 <th>foo||bar
26013 </th>
26014 <th>foo||bar
26015 </th></tr></table>
26016
26017 !! end
26018
26019 !! test
26020 Tables: 4a. Escape -
26021 !! options
26022 parsoid=html2wt
26023 !! html/*
26024 <table>
26025 <tr>
26026 <th>-bar
26027 </th></tr>
26028 <tr>
26029 <td>-bar
26030 </td></tr></table>
26031
26032 !! wikitext
26033 {|
26034 !-bar
26035 |-
26036 |<nowiki>-bar</nowiki>
26037 |}
26038 !! end
26039
26040 !! test
26041 Tables: 4b. Escape +
26042 !! options
26043 parsoid=html2wt
26044 !! html/*
26045 <table>
26046 <tr>
26047 <th>+bar
26048 </th></tr>
26049 <tr>
26050 <td>+bar
26051 </td></tr></table>
26052
26053 !! wikitext
26054 {|
26055 !+bar
26056 |-
26057 |<nowiki>+bar</nowiki>
26058 |}
26059 !! end
26060
26061 !! test
26062 Tables: 4c. No escaping needed
26063 !! options
26064 parsoid=html2wt
26065 !! html/parsoid
26066 <table><tbody>
26067 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26068 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26069 <tr><td>foo
26070 <p>bar|baz
26071 +bar
26072 -bar</p></td></tr>
26073 <tr><td>x
26074 <div>a|b</div></td>
26075 </tbody></table>
26076 !! wikitext
26077 {|
26078 |foo-bar
26079 |foo+bar
26080 |-
26081 |''foo''-bar
26082 |''foo''+bar
26083 |-
26084 |foo
26085 bar|baz
26086 +bar
26087 -bar
26088 |-
26089 |x
26090 <div>a|b</div>
26091 |}
26092 !! html/php
26093 <table>
26094 <tr>
26095 <td>foo-bar
26096 </td>
26097 <td>foo+bar
26098 </td></tr>
26099 <tr>
26100 <td><i>foo</i>-bar
26101 </td>
26102 <td><i>foo</i>+bar
26103 </td></tr>
26104 <tr>
26105 <td>foo
26106 <p>bar|baz
26107 +bar
26108 -bar
26109 </p>
26110 </td></tr>
26111 <tr>
26112 <td>x
26113 <div>a|b</div>
26114 </td></tr></table>
26115
26116 !! end
26117
26118 !! test
26119 Tables: 4d. No escaping needed
26120 !! options
26121 parsoid=html2wt
26122 !! html/parsoid
26123 <table>
26124 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26125 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26126 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26127 </tbody></table>
26128 !! wikitext
26129 {|
26130 |[[Foo]]-bar
26131 ||+1
26132 ||-2
26133 |}
26134 !! html/php
26135 <table>
26136 <tr>
26137 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26138 </td>
26139 <td>+1
26140 </td>
26141 <td>-2
26142 </td></tr></table>
26143
26144 !! end
26145
26146 !! test
26147 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26148 !! options
26149 parsoid=html2wt
26150 !! html/parsoid
26151 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26152
26153 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26154
26155 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26156
26157 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26158 !! wikitext
26159 {|
26160 | || align="center" | ||
26161 |}
26162
26163 {|
26164 |
26165 | align="center" |
26166 |
26167 |}
26168
26169 {|
26170 | {{!}}{{!}} align="center" | ||
26171 |}
26172
26173 {|
26174 ! !! align="center" | !!
26175 |}
26176 !! html/php+tidy
26177 <table>
26178 <tbody><tr>
26179 <td></td>
26180 <td align="center"></td>
26181 <td>
26182 </td></tr></tbody></table>
26183 <table>
26184 <tbody><tr>
26185 <td>
26186 </td>
26187 <td align="center">
26188 </td>
26189 <td>
26190 </td></tr></tbody></table>
26191 <table>
26192 <tbody><tr>
26193 <td></td>
26194 <td align="center"></td>
26195 <td>
26196 </td></tr></tbody></table>
26197 <table>
26198 <tbody><tr>
26199 <th></th>
26200 <th align="center"></th>
26201 <th>
26202 </th></tr></tbody></table>
26203 !! end
26204
26205 !! test
26206 T97430: Don't emit empty nowiki pairs around marker meta tags
26207 !! options
26208 parsoid=html2wt
26209 !! html/parsoid
26210 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26211 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26212 !! wikitext
26213 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26214 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26215 !! end
26216
26217 !! test
26218 Unclosed xmlish element in table line shouldn't eat end delimiters
26219 !! options
26220 parsoid=html2wt
26221 !! html/parsoid
26222 <table>
26223 <tbody><tr><td> &lt;foo</td>
26224 <td> bar></td></tr>
26225 </tbody></table>
26226 !! wikitext
26227 {|
26228 | <foo
26229 | bar>
26230 |}
26231 !! html/php
26232 <table>
26233 <tr>
26234 <td>&lt;foo
26235 </td>
26236 <td>bar&gt;
26237 </td></tr></table>
26238
26239 !! end
26240
26241 #### --------------- Links ----------------
26242 #### 1. Quote marks in link text
26243 #### 2. Wikilinks: Escapes needed
26244 #### 3. Wikilinks: No escapes needed
26245 #### 4. Extlinks: Escapes needed
26246 #### 5. Extlinks: No escapes needed
26247 #### --------------------------------------
26248 !! test
26249 Links 1. WikiLinks: No escapes needed
26250 !! options
26251 parsoid=html2wt
26252 !! html/parsoid
26253 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26254 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26255 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26256 !! wikitext
26257 [[Foo|Foo''boo'']]
26258 [[Foo|[Foobar]]]
26259 [[Foo|x [Foobar] x]]
26260 !! html/php
26261 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26262 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26263 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26264 </p>
26265 !! end
26266
26267 !! test
26268 Links 2. WikiLinks: Escapes needed
26269 !! options
26270 parsoid=html2wt
26271 !! html/parsoid
26272 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26273 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26274 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26275 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26276 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26277 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26278 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26279 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26280 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26281 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26282 !! wikitext
26283 [[Foo|<nowiki>Foobar]</nowiki>]]
26284 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26285 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26286 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26287 [[Foo|<nowiki>|Bar</nowiki>]]
26288 [[Foo|<nowiki>]]bar</nowiki>]]
26289 [[Foo|<nowiki>[[bar</nowiki>]]
26290 [[Foo|<nowiki>x [[ y</nowiki>]]
26291 [[Foo|<nowiki>x ]] y</nowiki>]]
26292 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26293 !! html/php
26294 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26295 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26296 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26297 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26298 <a href="/wiki/Foo" title="Foo">|Bar</a>
26299 <a href="/wiki/Foo" title="Foo">]]bar</a>
26300 <a href="/wiki/Foo" title="Foo">[[bar</a>
26301 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26302 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26303 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26304 </p>
26305 !! end
26306
26307 !! test
26308 Links 3. WikiLinks: No escapes needed
26309 !! options
26310 parsoid=html2wt
26311 !! html/parsoid
26312 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26313 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26314 !! wikitext
26315 [[Foo|[Foobar]]
26316 [[Foo|foo|bar]]
26317 !! html/php
26318 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26319 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26320 </p>
26321 !! end
26322
26323 !! test
26324 Links 4. ExtLinks: Escapes needed
26325 !! options
26326 parsoid=html2wt
26327 !! html/parsoid
26328 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26329 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26330 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26331 <p>[http://google.com]</p>
26332 <p>[http://google.com google]</p>
26333 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26334 <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>
26335 !! wikitext
26336 [http://google.com <nowiki>[google]</nowiki>]
26337 [http://google.com <nowiki>google]</nowiki>]
26338 [http://google.com <nowiki>goog] le</nowiki>]
26339
26340 <nowiki>[http://google.com]</nowiki>
26341
26342 <nowiki>[http://google.com google]</nowiki>
26343
26344 [http://google.com<nowiki>]</nowiki>
26345
26346 [{{echo|http://google.com}}<nowiki>]</nowiki>
26347 !! html/php
26348 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26349 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26350 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26351 </p><p>[http://google.com]
26352 </p><p>[http://google.com google]
26353 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26354 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26355 </p>
26356 !! end
26357
26358 !! test
26359 Links 5. ExtLinks: No escapes needed
26360 !! options
26361 parsoid=html2wt
26362 !! html/parsoid
26363 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26364 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26365 !! wikitext
26366 [http://google.com [google]
26367
26368 [[http://google.com]]
26369 !! html/php
26370 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26371 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26372 </p>
26373 !! end
26374
26375 !! test
26376 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26377 !! options
26378 parsoid=html2wt
26379 !! html/parsoid
26380 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26381 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26382 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26383 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26384 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26385 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26386 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26387 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26388 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26389 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26390 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26391 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26392 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26393 </p>
26394 !! wikitext
26395 x<nowiki/>http://example.com<nowiki/>y
26396 http://example.com<nowiki/>?x
26397 http://example.com<nowiki/>&x
26398 http://example.com<nowiki/>'x
26399 http://example.com<nowiki/>,x
26400 http://example.com<nowiki/>.x
26401 http://example.com<nowiki/>;x
26402 http://example.com<nowiki/>:x
26403 http://example.com<nowiki/>;x
26404 http://example.com<nowiki/>!x
26405 http://example.com<nowiki/>=x
26406 http://example.com<nowiki/>(x)
26407 http://example.com(x<nowiki/>)
26408 !! end
26409
26410 !! test
26411 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26412 !! options
26413 parsoid=html2wt
26414 !! html/parsoid
26415 <p>x
26416 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26417 y
26418 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26419 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26420 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26421 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26423 </p>
26424 !! wikitext
26425 x
26426 http://example.com
26427 y
26428 "http://example.com"
26429 (http://example.com)
26430 (http://example.com) foo
26431 http://example.com,
26432 http://example.com, foo
26433 !! html/php
26434 <p>x
26435 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26436 y
26437 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26438 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26439 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26440 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26441 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26442 </p>
26443 !! end
26444
26445 !! test
26446 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26447 !! options
26448 parsoid=html2wt
26449 !! html/parsoid
26450 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26451 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26452 !! wikitext
26453 http://example.com.,;:!?\
26454 -http://example.com:
26455 !! html/php
26456 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26457 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26458 </p>
26459 !! end
26460
26461 !! test
26462 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26463 !! options
26464 parsoid=html2wt
26465 !! html/parsoid
26466 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26467 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26468 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26469 !! wikitext
26470 RFC 123<nowiki/>4
26471 RFC 123<nowiki/>y
26472 X<nowiki/>RFC 123<nowiki/>y
26473 !! end
26474
26475 !! test
26476 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26477 !! options
26478 parsoid=html2wt
26479 !! html/parsoid
26480 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26481 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26482 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26483 </p>
26484 !! wikitext
26485 RFC 123?foo
26486 RFC 123&foo
26487 -RFC 123-
26488 !! html/php
26489 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26490 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26491 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26492 </p>
26493 !! end
26494
26495 !! test
26496 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26497 !! options
26498 parsoid=html2wt
26499 !! html/parsoid
26500 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26501 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26502 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26503 !! wikitext
26504 PMID 123<nowiki/>4
26505 PMID 123<nowiki/>y
26506 X<nowiki/>PMID 123<nowiki/>y
26507 !! end
26508
26509 !! test
26510 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26511 !! options
26512 parsoid=html2wt
26513 !! html/parsoid
26514 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26515 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26516 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26517 </p>
26518 !! wikitext
26519 PMID 123?foo
26520 PMID 123&foo
26521 -PMID 123-
26522 !! html/php
26523 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26524 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26525 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26526 </p>
26527 !! end
26528
26529 !! test
26530 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26531 !! options
26532 parsoid=html2wt
26533 !! html/parsoid
26534 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26535 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26536 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26537 </p>
26538 !! wikitext
26539 ISBN 1234567890<nowiki/>1
26540 ISBN 1234567890<nowiki/>x
26541 a<nowiki/>ISBN 1234567890<nowiki/>b
26542 !! end
26543
26544 !! test
26545 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26546 !! options
26547 parsoid=html2wt
26548 !! html/parsoid
26549 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26550 !! wikitext
26551 -ISBN 1234567890's
26552 !! html/php
26553 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26554 </p>
26555 !! end
26556
26557 !! test
26558 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26559 !! options
26560 parsoid=html2wt
26561 !! html/*
26562 <p>this is not a link: http://example.com
26563 </p>
26564 !! wikitext
26565 this is not a link: <nowiki>http://example.com</nowiki>
26566 !! end
26567
26568 !! test
26569 Links 15. Link trails can't become link prefixes.
26570 !! options
26571 language=is
26572 parsoid=html2wt
26573 !! html/parsoid
26574 <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>
26575 !! wikitext
26576 [[Söfnuður]]-[[00]]
26577 !! html/php
26578 <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>
26579 </p>
26580 !! end
26581
26582 #### --------------- Quotes ---------------
26583 #### 1. Quotes inside <b> and <i>
26584 #### 2. Link fragments separated by <i> and <b> tags
26585 #### 3. Link fragments inside <i> and <b>
26586 #### 4. No escaping needed
26587 #### --------------------------------------
26588 !! test
26589 1a. Quotes inside <b> and <i>
26590 !! options
26591 parsoid=html2wt
26592 !! html/*
26593 <p><i>'foo'</i>
26594 <i>''foo''</i>
26595 <i>'''foo'''</i>
26596 <i>foo</i>'s
26597 <b>'foo'</b>
26598 <b>''foo''</b>
26599 <b>'''foo'''</b>
26600 <b>foo'<i>bar'</i>baz</b>
26601 <b>foo</b>'s
26602 '<i>foo</i>
26603 <i>foo</i>'
26604 <i>foo'</i>'
26605 '<i>foo</i>'
26606 '<b>foo</b>
26607 <b>foo</b>'
26608 '<b>foo</b>'
26609 <i>fools'<span> errand</span></i>
26610 <i><span>fool</span>'s errand</i>
26611 '<i>foo</i> bar '<i>baz</i>
26612 a|!*#-:;+-~[]{}b'<i>x</i>
26613 </p>
26614 !! wikitext
26615 ''<nowiki/>'foo'''
26616 ''<nowiki>''foo''</nowiki>''
26617 ''<nowiki>'''foo'''</nowiki>''
26618 ''foo''<nowiki/>'s
26619 '''<nowiki/>'foo''''
26620 '''<nowiki>''foo''</nowiki>'''
26621 '''<nowiki>'''foo'''</nowiki>'''
26622 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26623 '''foo'''<nowiki/>'s
26624 '''foo''
26625 ''foo''<nowiki/>'
26626 ''foo'''<nowiki/>'
26627 '''foo''<nowiki/>'
26628 ''''foo'''
26629 '''foo'''<nowiki/>'
26630 ''''foo'''<nowiki/>'
26631 ''fools'<span> errand</span>''
26632 ''<span>fool</span>'s errand''
26633 '<nowiki/>''foo'' bar '''baz''
26634 a|!*#-:;+-~[]{}b'''x''
26635 !! end
26636
26637 !! test
26638 1b. Quotes inside <b> and <i> with other tags on same line
26639 !! options
26640 parsoid=html2wt
26641 !! html/parsoid
26642 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26643 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26644 <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>
26645 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26646 '<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>
26647 '<i>foo</i> <div title="name">test</div>
26648 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26649 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26650 <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>
26651 </ol>
26652 !! wikitext
26653 '''a'' foo ''[[bar]]''
26654 ''a''' foo ''[[bar]]''
26655 ''a''' foo '''{{echo|[[bar]]}}'''
26656 [[foo]] x'''[[bar]]''
26657 '''foo'' <ref>test</ref>
26658 '''foo'' <div title="name">test</div>
26659 '''foo'' and <br> bar
26660 <references />
26661 !! end
26662
26663 !! test
26664 2. Link fragments separated by <i> and <b> tags
26665 !! options
26666 parsoid=html2wt
26667 !! html/parsoid
26668 <p>[[<i>foo</i>hello]]</p>
26669 <p>[[<b>foo</b>hello]]</p>
26670 !! wikitext
26671 [[''foo''<nowiki>hello]]</nowiki>
26672
26673 [['''foo'''<nowiki>hello]]</nowiki>
26674 !! end
26675
26676 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26677 # this is one of the shortcomings of this format
26678 !! test
26679 3. Link fragments inside <i> and <b>
26680 !! options
26681 parsoid=html2wt
26682 !! html/parsoid
26683 <p><i>[[foo</i>]]</p>
26684 <p><b>[[foo</b>]]</p>
26685 !! wikitext
26686 ''[[foo''<nowiki>]]</nowiki>
26687
26688 '''[[foo'''<nowiki>]]</nowiki>
26689 !! end
26690
26691 !! test
26692 4. No escaping needed
26693 !! options
26694 parsoid=html2wt
26695 !! html/parsoid
26696 <p>'<span><i>bar</i></span>'
26697 '<span><b>bar</b></span>'
26698 'a:b'foo
26699 </p>
26700 !! wikitext
26701 '<span>''bar''</span>'
26702 '<span>'''bar'''</span>'
26703 'a:b'foo
26704 !! end
26705
26706 #### ----------- Paragraphs ---------------
26707 #### 1. No unnecessary escapes
26708 #### --------------------------------------
26709
26710 !! test
26711 1. No unnecessary escapes
26712 !! options
26713 parsoid=html2wt
26714 !! html/parsoid
26715 <p>bar <span>[[foo]]</span>
26716 </p><p>=bar <span>[[foo]]</span>
26717 </p><p>[[bar <span>[[foo]]</span>
26718 </p><p>]]bar <span>[[foo]]</span>
26719 </p><p>=bar <span>foo]]</span>=
26720 </p>
26721 !! wikitext
26722 bar <span><nowiki>[[foo]]</nowiki></span>
26723
26724 =bar <span><nowiki>[[foo]]</nowiki></span>
26725
26726 [[bar <span><nowiki>[[foo]]</nowiki></span>
26727
26728 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26729
26730 =bar <span>foo]]</span><nowiki>=</nowiki>
26731 !!end
26732
26733 #### ----------------------- PRE --------------------------
26734 !! test
26735 1. Leading whitespace in SOL context should be escaped
26736 !! options
26737 parsoid=html2wt
26738 !! html/parsoid
26739 <p> a</p>
26740
26741 <p> a</p>
26742
26743 <p> a(tab)</p>
26744
26745 <p> a
26746 <!--cmt-->
26747 a</p>
26748
26749 <p>a
26750 b</p>
26751
26752 <p>a
26753 b</p>
26754
26755 <p>a
26756 b</p>
26757 !! wikitext
26758 <nowiki> </nowiki>a
26759
26760 <nowiki> </nowiki> a
26761
26762 a(tab)
26763
26764 <nowiki> </nowiki> a
26765 <!--cmt-->
26766 <nowiki> </nowiki>a
26767
26768 a
26769 <nowiki> </nowiki>b
26770
26771 a
26772 b
26773
26774 a
26775 b
26776 !! html/php
26777 <p> a
26778 </p><p> a
26779 </p><p> a(tab)
26780 </p><p> a
26781 a
26782 </p><p>a
26783 b
26784 </p><p>a
26785 b
26786 </p><p>a
26787 b
26788 </p>
26789 !! end
26790
26791 !! test
26792 2. Leading whitespace in non-indent-pre contexts should not be escaped
26793 !! options
26794 parsoid=html2wt
26795 !! html/parsoid
26796 <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>
26797 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26798 <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>
26799 b</span></li>
26800 </ol>
26801 !! wikitext
26802 foo <ref>''a''
26803 b</ref>
26804 <references />
26805 !! end
26806
26807 !! test
26808 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26809 !! options
26810 parsoid=html2wt
26811 !! html/parsoid
26812 <blockquote>
26813 <p>
26814 a
26815 <span>b</span>
26816 c</p>
26817 </blockquote>
26818 !! wikitext
26819 <blockquote>
26820 a
26821 <span>b</span>
26822 c
26823 </blockquote>
26824 !! end
26825
26826 !! test
26827 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26828 !! options
26829 parsoid=html2wt
26830 !! html/parsoid
26831 <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>
26832 !! wikitext
26833 [[File:Foobar.jpg|thumb|caption]]
26834 !! end
26835
26836 !! test
26837 5. Nowiki escaping should account for indent-pres
26838 !! options
26839 parsoid=html2wt
26840 !! html/parsoid
26841 <pre>==foo==</pre>
26842 !! wikitext
26843 ==foo==
26844 !! end
26845
26846 !! test
26847 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26848 !! options
26849 parsoid=html2wt
26850 !! html/parsoid
26851 <pre>
26852 * foo
26853 * bar
26854 </pre>
26855 !! wikitext
26856 * foo
26857 * bar
26858 !! end
26859
26860 !! test
26861 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
26862 !! options
26863 parsoid = {
26864 "modes": ["html2wt"],
26865 "scrubWikitext": true
26866 }
26867 !! html/parsoid
26868 <p> foo</p>
26869 <p> %foo</p>
26870 <p> *foo</p>
26871 <p> #foo</p>
26872 <p> =foo=</p>
26873 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
26874 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
26875 <p> <!--boo-->*foo</p>
26876 <p><!--boo--> *foo</p>
26877 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
26878 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
26879 !! wikitext
26880 foo
26881
26882 %foo
26883
26884 <nowiki/>*foo
26885
26886 <nowiki/>#foo
26887
26888 <nowiki/>=foo=
26889
26890 [[Category:Foo]]
26891 <nowiki/>*foo
26892
26893 [[Category:Foo]]
26894 <nowiki>*</nowiki>foo
26895
26896 <nowiki/><!--boo-->*foo
26897
26898 <!--boo--><nowiki/>*foo
26899
26900 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
26901
26902 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
26903 !! end
26904
26905 #### --------------- Behavior Switches --------------------
26906
26907 !! test
26908 1. Valid behavior switches should be escaped
26909 !! options
26910 parsoid=html2wt
26911 !! html/parsoid
26912 __TOC__
26913 <i>__TOC__</i>
26914 !! wikitext
26915 <nowiki>__TOC__</nowiki>
26916 ''<nowiki>__TOC__</nowiki>''
26917 !! end
26918
26919 !! test
26920 2. Invalid behavior switches should not be escaped
26921 !! options
26922 parsoid=html2wt
26923 !! html/parsoid
26924 __TOO__
26925 __|__
26926 !! wikitext
26927 __TOO__
26928 __|__
26929 !! end
26930
26931 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26932 !! test
26933 Behavior switches should be SOL-transparent
26934 !! options
26935 parsoid=html2wt
26936 !! html/parsoid
26937 <meta property="mw:PageProp/toc" />
26938
26939 <!-- this one's bogus -->
26940 <pre>__TOO__</pre>
26941
26942 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26943
26944 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26945 !! wikitext
26946 __TOC__
26947
26948 <!-- this one's bogus -->
26949 __TOO__
26950
26951 __TOC__ foo
26952
26953 __TOC__
26954 bar
26955 !! end
26956
26957 #### --------------- HTML tags ---------------
26958 #### 1. a tags
26959 #### 2. other tags
26960 #### 3. multi-line html tag
26961 #### 4. extension tags
26962 #### -----------------------------------------
26963 !! test
26964 1. a tags
26965 !! options
26966 parsoid=html2wt
26967 !! html/parsoid
26968 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26969 !! wikitext
26970 <a href="http://google.com">google</a>
26971 !! end
26972
26973 !! test
26974 2. other tags
26975 !! options
26976 parsoid=html2wt
26977 !! html/parsoid
26978 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26979 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26980 <li> &lt;td&gt;</li></ul>
26981
26982 !! wikitext
26983 * <nowiki><div>foo</div></nowiki>
26984 * <nowiki><div style="color:red">foo</div></nowiki>
26985 * <nowiki><td></nowiki>
26986 !! end
26987
26988 !! test
26989 3. multi-line html tag
26990 !! options
26991 parsoid=html2wt
26992 !! html/parsoid
26993 <p>&lt;div
26994 &gt;foo&lt;/div
26995 &gt;
26996 </p>
26997 !! wikitext
26998 <nowiki><div
26999 >foo</div
27000 ></nowiki>
27001 !! end
27002
27003 !! test
27004 4. extension tags
27005 !! options
27006 parsoid=html2wt
27007 !! html/parsoid
27008 <p>&lt;ref&gt;foo&lt;/ref&gt;
27009 </p><p>&lt;ref&gt;bar
27010 </p><p>baz&lt;/ref&gt;
27011 </p>
27012 !! wikitext
27013 <nowiki><ref>foo</ref></nowiki>
27014
27015 <nowiki><ref>bar</nowiki>
27016
27017 baz<nowiki></ref></nowiki>
27018 !! end
27019
27020 !! test
27021 Parsoid: newline inducing block nodes don't suppress <nowiki>
27022 !! options
27023 parsoid=html2wt
27024 !! html/parsoid
27025 a<h1>foo</h1>
27026 !! wikitext
27027 <nowiki> </nowiki>a
27028
27029 = foo =
27030 !! end
27031
27032 #### --------------- Others ---------------
27033 !! test
27034 Escaping nowikis
27035 !! options
27036 parsoid=html2wt
27037 !! html/parsoid
27038 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27039 </p>
27040 !! wikitext
27041 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27042 !! end
27043
27044 ## The quote-char in the input is necessary for triggering the bug
27045 !! test
27046 (T54035) Nowiki-escaping should not get tripped by " :" in text
27047 !! options
27048 parsoid=html2wt
27049 !! html/parsoid
27050 <p>foo's bar :</p>
27051 !! wikitext
27052 foo's bar :
27053 !! end
27054
27055 #----------- End of wikitext escaping tests --------------
27056
27057 !! test
27058
27059 Tag-like HTML structures are passed through as text
27060 !! wikitext
27061 <x y>
27062
27063 <x.y>
27064
27065 <x-y>
27066
27067 1>2
27068
27069 x<y
27070
27071 a>b
27072
27073 1<d e>f
27074 !! html
27075 <p>&lt;x y&gt;
27076 </p><p>&lt;x.y&gt;
27077 </p><p>&lt;x-y&gt;
27078 </p><p>1&gt;2
27079 </p><p>x&lt;y
27080 </p><p>a&gt;b
27081 </p><p>1&lt;d e&gt;f
27082 </p>
27083 !! end
27084
27085 !! test
27086 HTML tag with necessary entities in attributes
27087 !! wikitext
27088 <span title="&amp;amp;">foo</span>
27089 !! html
27090 <p><span title="&amp;amp;">foo</span>
27091 </p>
27092 !! end
27093
27094 !! test
27095 HTML tag with 'unnecessary' entity encoding in attributes
27096 !! wikitext
27097 <span title="&amp;">foo</span>
27098 !! html
27099 <p><span title="&amp;">foo</span>
27100 </p>
27101 !! end
27102
27103 !! test
27104 HTML tag with broken attribute value quoting
27105 !! options
27106 parsoid=wt2html,html2html
27107 !! wikitext
27108 <span title="Hello world>Foo</span>
27109 !! html/php
27110 <p><span title="Hello world">Foo</span>
27111 </p>
27112 !! html/parsoid
27113 <p><span title="Hello world">Foo</span></p>
27114 !! end
27115
27116 !! test
27117 Self-closed tag with broken attribute value quoting
27118 !! options
27119 parsoid=wt2html,html2html
27120 !! wikitext
27121 <div title="Hello world />Foo
27122 !! html/php+tidy
27123 <div title="Hello world"></div><p>Foo
27124 </p>
27125 !! html/parsoid
27126 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27127 !! end
27128
27129 !! test
27130 Table with broken attribute value quoting
27131 !! options
27132 parsoid=wt2html,html2html
27133 !! wikitext
27134 {|
27135 | title="Hello world|Foo
27136 |}
27137 !! html/php
27138 <table>
27139 <tr>
27140 <td title="Hello world">Foo
27141 </td></tr></table>
27142
27143 !! html/parsoid
27144 <table>
27145 <tr>
27146 <td title="Hello world">Foo
27147 </td></tr></table>
27148
27149 !! end
27150
27151 !! test
27152 Table with broken attribute value quoting on consecutive lines
27153 !! options
27154 parsoid=wt2html,html2html
27155 !! wikitext
27156 {|
27157 | title="Hello world|Foo
27158 | style="color:red|Bar
27159 |}
27160 !! html/php
27161 <table>
27162 <tr>
27163 <td title="Hello world">Foo
27164 </td>
27165 <td style="color:red">Bar
27166 </td></tr></table>
27167
27168 !! html/parsoid
27169 <table><tbody>
27170 <tr>
27171 <td title="Hello world">Foo
27172 </td><td style="color: red">Bar
27173 </td></tr></tbody></table>
27174
27175 !! end
27176
27177 !!test
27178 Accept empty td cell attribute
27179 !! wikitext
27180 {|
27181 | align="center" |foo|| |
27182 |}
27183 !! html
27184 <table>
27185 <tr>
27186 <td align="center">foo</td>
27187 <td>
27188 </td></tr></table>
27189
27190 !!end
27191
27192 !!test
27193 Non-empty attributes in th-cells
27194 !! wikitext
27195 {|
27196 !Foo!! style="color: red" |Bar
27197 |}
27198 !! html
27199 <table>
27200 <tr>
27201 <th>Foo</th>
27202 <th style="color: red">Bar
27203 </th></tr></table>
27204
27205 !!end
27206
27207 !!test
27208 Accept empty attributes in th-cells
27209 !! wikitext
27210 {|
27211 !|foo!!|bar
27212 |}
27213 !! html
27214 <table>
27215 <tr>
27216 <th>foo</th>
27217 <th>bar
27218 </th></tr></table>
27219
27220 !!end
27221
27222 !!test
27223 Empty table rows go away
27224 !! wikitext
27225 {|
27226 |Hello
27227 |there
27228 |- class="foo"
27229 |-
27230 |}
27231 !! html
27232 <table>
27233 <tr>
27234 <td>Hello
27235 </td>
27236 <td>there
27237 </td></tr>
27238
27239 </table>
27240
27241 !! end
27242
27243 ###
27244 ### Parsoid-centric tests for testing RTing of inter-element separators
27245 ### Edge cases not tested by existing parser tests and specific to
27246 ### Parsoid-specific serialization strategies.
27247 ###
27248
27249 !!test
27250 RT-ed inter-element separators should be valid separators
27251 !! wikitext
27252 {|
27253 |- [[foo]]
27254 |}
27255 !! html/php
27256 <table>
27257
27258 </table>
27259
27260 !! html/parsoid
27261 <table>
27262 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27263 </tbody></table>
27264 !!end
27265
27266 # Parsoid-only test of a DOM pass
27267 !!test
27268 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27269 !! wikitext
27270 {|
27271 |<small>foo
27272 bar
27273 |}
27274
27275 {|
27276 |<small>foo<small>
27277 |}
27278 !! html/parsoid
27279 <table>
27280 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27281 <p>bar</p></small></td></tr>
27282 </tbody></table>
27283
27284 <table>
27285 <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>
27286 </tbody></table>
27287 !!end
27288
27289 # Note that the "style" attribute is really a template parameter here.
27290 # The = would have to be {{=}} if you wanted the literal.
27291 !!test
27292 Empty TD followed by TD with tpl-generated attribute
27293 !! wikitext
27294 {|
27295 |-
27296 |
27297 |{{echo|style='color:red'}}|foo
27298 |}
27299 !! html
27300 <table>
27301
27302 <tr>
27303 <td>
27304 </td>
27305 <td>foo
27306 </td></tr></table>
27307
27308 !!end
27309
27310 !!test
27311 Indented table with an empty td
27312 !! wikitext
27313 {|
27314 |-
27315 |
27316 |foo
27317 |}
27318 !! html
27319 <table>
27320
27321 <tr>
27322 <td>
27323 </td>
27324 <td>foo
27325 </td></tr></table>
27326
27327 !!end
27328
27329 ## We have some newline diffs RT-ing this edge case
27330 ## and it is not important enough -- we seem to be emitting
27331 ## at most 2 newlines after a </tr> and this is unrelated to
27332 ## the issue from T85627 that this is testing.
27333 !!test
27334 Indented table with blank lines in between (T85627)
27335 !! options
27336 parsoid=wt2html
27337 !! wikitext
27338 {|
27339 |foo
27340
27341
27342 |}
27343 !! html
27344 <table>
27345
27346 <tr>
27347 <td>foo
27348 </td></tr></table>
27349
27350 !!end
27351
27352 !!test
27353 Indented block & table
27354 !! wikitext
27355 <div>foo</div>
27356 {|
27357 |foo
27358 |}
27359 !! html/php
27360 <div>foo</div>
27361 <table>
27362 <tr>
27363 <td>foo
27364 </td></tr></table>
27365
27366 !! html/parsoid
27367 <div data-parsoid='{"stx":"html"}'>foo</div>
27368 <table><tbody>
27369 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27370 </tbody></table>
27371 !!end
27372
27373 !! test
27374 Indent and comment before table row
27375 !! wikitext
27376 {|
27377 <!--hi-->|-
27378 |there
27379 |}
27380 !! html/php
27381 <table>
27382
27383 <tr>
27384 <td>there
27385 </td></tr></table>
27386
27387 !! html/parsoid
27388 <table>
27389 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27390 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27391 </tbody></table>
27392 !! end
27393
27394 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27395 !!test
27396 Empty TR followed by a template-generated TR
27397 !!options
27398 parsoid
27399 !! wikitext
27400 {|
27401 |-
27402 {{echo|<tr><td>foo</td></tr>}}
27403 |}
27404 !! html
27405 <table>
27406 <tbody>
27407 <tr class='mw-empty-elt'></tr>
27408 <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}}]}'>
27409 <td>foo</td></tr>
27410 </tbody></table>
27411 !!end
27412
27413 ## PHP and parsoid output differ for this, and since this is primarily
27414 ## for testing Parsoid's serializer, marking this Parsoid only
27415 !!test
27416 Empty TR followed by mixed-ws-comment line should RT correctly
27417 !!options
27418 parsoid
27419 !! wikitext
27420 {|
27421 |-
27422 <!--c-->
27423 |-
27424 <!--c--> <!--d-->
27425 |}
27426 !! html
27427 <table>
27428 <tbody>
27429 <tr class='mw-empty-elt'></tr>
27430 <!--c-->
27431 <tr>
27432 <!--c--> </tr><!--d-->
27433 </tbody></table>
27434
27435 !!end
27436
27437 !!test
27438 Multi-line image caption generated by templates with/without trailing newlines
27439 !! wikitext
27440 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27441 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27442 !! html/parsoid
27443 <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>
27444 <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>
27445 !!end
27446
27447 !! test
27448 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27449 !! options
27450 parsoid=html2wt
27451 !! html/parsoid
27452 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
27453
27454 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27455 !! wikitext
27456 <includeonly>foo</includeonly>
27457 new para
27458
27459 [[Category:Foo]]
27460
27461 = new heading =
27462 !! end
27463
27464 ## PHP emits broken html for this, and since this is primarily
27465 ## a Parsoid serializer test, marking this Parsoid only
27466 !!test
27467 Improperly nested inline or quotes tags with whitespace in between
27468 !! wikitext
27469 <span> <s>x</span> </s>
27470 ''' ''x''' ''
27471 !! html/parsoid
27472 <p><span> <s>x</s></span><s> </s>
27473 <b> <i>x</i></b><i> </i>
27474 </p>
27475 !!end
27476
27477 !!test
27478 Encapsulate protected attributes from wt
27479 !! wikitext
27480 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27481
27482 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27483 |ok
27484 |}
27485 !! html/parsoid
27486 <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>
27487
27488 <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">
27489 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27490 </tbody></table>
27491 !!end
27492
27493 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27494 ## Having nested or stray pre tags results in the attempt to add duplicates,
27495 ## causing an assertion fail. This test tries to prevent that situation.
27496 !! test
27497 Ensure ParagraphWrapper can deal with stray closing pre tags
27498 !! options
27499 parsoid=wt2html
27500 !! wikitext
27501 plain text</pre>
27502 !! html/parsoid
27503 <p>plain text</p>
27504 !! end
27505
27506 ## Remex doesn't account for fostered content.
27507 !! test
27508 1. Ensure fostered text content is wrapped in element nodes
27509 !! options
27510 parsoid=wt2html
27511 !! wikitext
27512 <table>hi</table><table>ho</table>
27513 !! html/php+tidy
27514 hi<table></table>ho<table></table>
27515 !! html/parsoid
27516 <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>
27517 !! end
27518
27519 ## Remex doesn't account for fostered content.
27520 !! test
27521 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27522 !! options
27523 parsoid=wt2html,wt2wt
27524 !! wikitext
27525 <table>
27526 <tr> || ||
27527 <td> a
27528 </table>
27529 !! html/php+tidy
27530 || ||
27531 <table>
27532 <tbody><tr><td> a
27533 </td></tr></tbody></table>
27534 !! html/parsoid
27535 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27536 <table data-parsoid='{"stx":"html"}'>
27537 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27538 </td></tr></tbody></table>
27539 !! end
27540
27541 ## Remex doesn't account for fostered content.
27542 !! test
27543 Encapsulation properly handles null DSR information from foster box
27544 !! options
27545 parsoid=wt2html,wt2wt
27546 !! wikitext
27547 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27548 !! html/parsoid
27549 <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>
27550 !! end
27551
27552 ## Remex doesn't account for fostered content.
27553 !! test
27554 1. Encapsulate foster-parented transclusion content
27555 !! options
27556 parsoid=wt2wt,wt2html
27557 !! wikitext
27558 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27559 !! html/php+tidy
27560 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27561 !! html/parsoid
27562 <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>
27563 !! end
27564
27565 !! test
27566 2. Encapsulate foster-parented transclusion content
27567 !! options
27568 parsoid=wt2wt,wt2html
27569 !! wikitext
27570 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27571 !! html/parsoid
27572 <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>
27573 <table>
27574 <tbody>
27575 <tr>
27576 <td>bar</td>
27577 </tr>
27578 </tbody>
27579 </table>
27580 !! end
27581
27582 !! test
27583 3. Encapsulate foster-parented transclusion content
27584 !! options
27585 parsoid=wt2wt,wt2html
27586 !! wikitext
27587 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27588 !! html/parsoid
27589 <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;]}">
27590 <p>foo</p>
27591 </div>
27592 <table>
27593 <tbody>
27594 <tr>
27595 <td>bar</td>
27596 </tr>
27597 </tbody>
27598 </table>
27599 !! end
27600
27601 !! test
27602 4. Encapsulate foster-parented transclusion content
27603 !! options
27604 parsoid=wt2wt,wt2html
27605 !! wikitext
27606 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27607 !! html/parsoid
27608 <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;]}">
27609 <p>foo</p>
27610 </div>
27611 <table>
27612 <tbody>
27613 <tr>
27614 <td>bar</td>
27615 </tr>
27616 </tbody>
27617 </table>
27618 !! end
27619
27620 ## Remex doesn't account for fostered content.
27621 !! test
27622 5. Encapsulate foster-parented transclusion content
27623 !!options
27624 parsoid=wt2wt,wt2html
27625 !! wikitext
27626 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27627 !! html/php+tidy
27628 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27629 !! html/parsoid
27630 <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>
27631 !! end
27632
27633 ## Remex doesn't account for fostered content.
27634 !! test
27635 6. Encapsulate foster-parented transclusion content
27636 !! options
27637 parsoid=wt2wt,wt2html
27638 !! wikitext
27639 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27640 !! html/php+tidy
27641 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27642 !! html/parsoid
27643 <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>
27644 !! end
27645
27646 !! test
27647 7. Encapsulate foster-parented transclusion content
27648 !!options
27649 parsoid=wt2wt,wt2html
27650 !! wikitext
27651 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27652 !! html/parsoid
27653 <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>
27654 <table>
27655 <tbody>
27656 <tr>
27657 <td>bar</td>
27658 </tr>
27659 </tbody>
27660 </table>
27661 !! end
27662
27663 ## Remex doesn't account for fostered content.
27664 # Note that the wt is broken on purpose: the = should be {{=}} if you
27665 # don't want it to be a template parameter key.
27666 !! test
27667 8. Encapsulate foster-parented transclusion content
27668 !! options
27669 parsoid=wt2wt,wt2html
27670 !! wikitext
27671 {{echo|a
27672 }}{|{{echo|style='color:red'}}
27673 |-
27674 |b
27675 |}
27676 !! html/php+tidy
27677 <p>a
27678 </p>
27679 <table>
27680
27681 <tbody><tr>
27682 <td>b
27683 </td></tr></tbody></table>
27684 !! html/parsoid
27685 <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">
27686 </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">
27687 <tbody><tr>
27688 <td>b
27689 </td></tr></tbody></table>
27690 !! end
27691
27692 ## Remex doesn't account for fostered content.
27693 !! test
27694 9. Encapsulate foster-parented transclusion content
27695 !!options
27696 parsoid=wt2wt,wt2html
27697 !! wikitext
27698 <table>{{echo|hi</table>hello}}
27699 !! html/php+tidy
27700 hi<table></table><p>hello
27701 </p>
27702 !! html/parsoid
27703 <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>
27704 !! end
27705
27706 !! test
27707 Table in fosterable position
27708 !!options
27709 parsoid=wt2html
27710 !! wikitext
27711 {{OpenTable}}
27712 <div>
27713 {|
27714 |}
27715 </div>
27716 |}
27717 !! html/parsoid
27718 <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">
27719 </span>
27720 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27721
27722 <table>
27723 </table>
27724 !! end
27725
27726 # Parsoid only for T66747
27727 !! test
27728 Properly encapsulate empty-content transclusions in fosterable positions
27729 !! wikitext
27730 <table>
27731 {{#if:|
27732 <td>foo</td>
27733 }}
27734 </table>
27735 !! html/parsoid
27736 <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"}]]}'>
27737
27738 </table>
27739 !! end
27740
27741 !! test
27742 Always encapsulate foster box when template range is expanded to table
27743 !! options
27744 parsoid=wt2wt
27745 !! wikitext
27746 {|
27747 hello
27748 {{OpenTable}}
27749 |}
27750 !! html/parsoid
27751
27752 !! end
27753
27754 !! test
27755 T115289: Unclosed table
27756 !! wikitext
27757 {{echo|<table>}}<!--c-->[[Category:Two]]
27758 !! html/parsoid
27759 <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>
27760 !! end
27761
27762 !! test
27763 T115289: Don't migrate newlines out of tables with fostered content
27764 !! wikitext
27765 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27766 !! html/parsoid
27767 <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>
27768 !! end
27769
27770 !! test
27771 T73074: More fostering fun
27772 !! wikitext
27773 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27774 !! html/parsoid
27775 <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>
27776 !! end
27777
27778 !!test
27779 Support <object> element with .data attribute
27780 !!options
27781 parsoid=html2wt
27782 !! html/parsoid
27783 <object data="test.swf"></object>
27784 !! wikitext
27785 <object data="test.swf"></object>
27786 !!end
27787
27788 !! test
27789 Don't block XML namespace declaration
27790 !! wikitext
27791 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27792 !! html/php
27793 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27794 </p>
27795 !! html/parsoid
27796 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27797 !! end
27798
27799 # -----------------------------------------------------------------
27800 # The following section of tests are primarily to spec requirements
27801 # around Parsoid's serialization (old, new, edited content)
27802 #
27803 # All these tests are marked Parsoid html2wt and html2html only
27804 # ----------------------------------------------------------------
27805
27806 !! test
27807 Ignore rel attribute in a-tags during serialization to url-links
27808 !! options
27809 parsoid=html2wt
27810 !! html/parsoid
27811 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27812 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27813 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27814 !! wikitext
27815 http://en.wikipedia.org/wiki/Foobar
27816 http://en.wikipedia.org/wiki/Foobar
27817 http://en.wikipedia.org/wiki/Foobar
27818 !! end
27819
27820 # 'mi' is a localinterwiki prefix as well as a language
27821 !! test
27822 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27823 !! options
27824 parsoid=html2wt
27825 !! html/parsoid
27826 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27827 !! wikitext
27828 [[Foo]]
27829 !! end
27830
27831 !! test
27832 Parsoid should accept interwiki shortcuts
27833 !! options
27834 parsoid=html2wt
27835 !! html/parsoid
27836 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27837 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27838 <a href='./fr:Foo'>Foo</a></p>
27839 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27840 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27841 <a href='fr%3AFoo'>Foo</a></p>
27842 <p><a href='FR%3AFoo'>Foo</a>
27843 <a href='./FR:Foo'>Foo</a></p>
27844 !! wikitext
27845 [[:fr:Foo|Foo]]
27846 [[:fr:Foo|Foo]]
27847 [[:fr:Foo|Foo]]
27848
27849 [[:fr:Foo|Foo]]
27850 [[:fr:Foo|Foo]]
27851 [[:fr:Foo|Foo]]
27852
27853 [[:fr:Foo|Foo]]
27854 [[:fr:Foo|Foo]]
27855 !! end
27856
27857 !! test
27858 Parsoid should not accept invalid interwiki shortcuts
27859 !! options
27860 parsoid=html2wt
27861 !! html/parsoid
27862 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27863 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27864 <a href='news:Foo'>Foo</a></p>
27865 !! wikitext
27866 [news:Foo Foo]
27867 [news:Foo Foo]
27868 [news:Foo Foo]
27869 !! end
27870
27871 # See T93839
27872 !! test
27873 New wikilinks should be serialized properly
27874 !! options
27875 parsoid=html2wt
27876 !! html/parsoid
27877 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27878 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27879 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27880 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27881 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27882 !! wikitext
27883 [[Foo]]
27884 [[Foo]]
27885 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27886 http://en.wikipedia.org/wiki/Foo
27887 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27888 !! end
27889
27890 !! test
27891 New wiki links (href variations)
27892 !! options
27893 parsoid=html2wt
27894 !! html/parsoid
27895 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27896 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27897 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27898 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27899 !! wikitext
27900 [[Foo_bar]]
27901 [[Foo_bar]]
27902 [[Foo_bar]]
27903 [[Toxine bactérienne]]
27904 !! end
27905
27906 !! test
27907 New wiki links (content string variations)
27908 !! options
27909 parsoid=html2wt
27910 !! html/parsoid
27911 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27912 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27913 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27914 !! wikitext
27915 [[Foo_bar]]
27916 [[Foo bar]]
27917 [[Foo_bar|./Foo_bar]]
27918 !! end
27919
27920 !! test
27921 New category links (href variations)
27922 !! options
27923 parsoid=html2wt
27924 !! html/parsoid
27925 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27926 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27927 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27928 !! wikitext
27929 [[Category:Toxine bactérienne]]
27930 [[Category:Toxine bactérienne]]
27931 [[Category:Toxine bactérienne]]
27932 !! end
27933
27934 !! test
27935 New sol transparent links don't need indent-pre nowiki protection
27936 !! options
27937 parsoid=html2wt
27938 language=de
27939 !! html/parsoid
27940 <link rel="mw:PageProp/redirect" href="./Main_Page">
27941 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27942 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27943 !! wikitext
27944 #WEITERLEITUNG [[Main Page]]
27945 <!-- this is good --> [[Category:Good]]
27946 <!-- this is great --> [[Kategorie:Great]]
27947 !! end
27948
27949 !! test
27950 New interlanguage links (href variations)
27951 !! options
27952 parsoid=html2wt
27953 !! html/parsoid
27954 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27955 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27956 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27957 !! wikitext
27958 [[es:Toxine bactérienne]]
27959 [[es:Toxine_bactérienne]]
27960 [[es:Toxine_bactérienne]]
27961 !! end
27962
27963 !! test
27964 Image: Modifying size of an image (1)
27965 !! options
27966 parsoid={
27967 "modes": ["wt2wt"],
27968 "changes": [
27969 ["img[height]", "attr", "height", "22"],
27970 ["img[width]", "attr", "width", "200"]
27971 ]
27972 }
27973 !! wikitext
27974 [[Image:Foobar.jpg|230x230px]]
27975 !! wikitext/edited
27976 [[Image:Foobar.jpg|200x200px]]
27977 !!end
27978
27979 !! test
27980 Image: Modifying size of an image (2)
27981 !! options
27982 parsoid={
27983 "modes": ["wt2wt"],
27984 "changes": [
27985 ["img[height]", "attr", "height", "100"],
27986 ["img[width]", "attr", "width", "500"]
27987 ]
27988 }
27989 !! wikitext
27990 [[Image:Foobar.jpg|230x230px]]
27991 !! wikitext/edited
27992 [[Image:Foobar.jpg|500x500px]]
27993 !!end
27994
27995 # Change in size is ignored so long as class='mw-default-size'
27996 !! test
27997 Image: Modifying size of an image (3)
27998 !! options
27999 parsoid={
28000 "modes": ["wt2wt"],
28001 "changes": [
28002 ["figure[class]", "removeClass", "mw-default-size"],
28003 ["figure img", "attr", "height", "19"],
28004 ["figure img", "attr", "width", "170"]
28005 ]
28006 }
28007 !! wikitext
28008 [[Image:Foobar.jpg|thumb]]
28009 !! wikitext/edited
28010 [[Image:Foobar.jpg|thumb|170x170px]]
28011 !!end
28012
28013 !! test
28014 Image: Modifying alignment of an image (T50665)
28015 !! options
28016 parsoid={
28017 "modes": ["wt2wt"],
28018 "changes": [
28019 ["figure[class]", "removeClass", "mw-halign-right"],
28020 ["figure[class]", "addClass", "mw-halign-left"]
28021 ]
28022 }
28023 !! wikitext
28024 [[Image:Foobar.jpg|thumb|caption|right]]
28025 !! wikitext/edited
28026 [[Image:Foobar.jpg|thumb|caption|left]]
28027 !! end
28028
28029 !! test
28030 Image: Modifying mw-default-size of an frameless image (T64805)
28031 !! options
28032 parsoid={
28033 "modes": ["wt2wt"],
28034 "changes": [
28035 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28036 ]
28037 }
28038 !! wikitext
28039 [[Image:Foobar.jpg|frameless|right]]
28040 !! wikitext/edited
28041 [[Image:Foobar.jpg|frameless|right|220x220px]]
28042 !! end
28043
28044 !! test
28045 Image: Modifying valign of an image (T51221)
28046 !! options
28047 parsoid={
28048 "modes": ["wt2wt"],
28049 "changes": [
28050 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28051 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28052 ]
28053 }
28054 !! wikitext
28055 [[File:Foobar.jpg|20px|middle]]
28056 !! wikitext/edited
28057 [[File:Foobar.jpg|20px|text-top]]
28058 !! end
28059
28060 !! test
28061 Image: Modifying alt attribute of an image (T58400)
28062 !! options
28063 parsoid={
28064 "modes": ["wt2wt"],
28065 "changes": [
28066 ["img[alt]", "attr", "alt", "some alternate edited text"]
28067 ]
28068 }
28069 !! wikitext
28070 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28071 !! wikitext/edited
28072 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28073 !!end
28074
28075 !! test
28076 Image: Modifying caption of an image
28077 !! options
28078 parsoid={
28079 "modes": ["wt2wt"],
28080 "changes": [
28081 ["figcaption", "text", "new caption"]
28082 ]
28083 }
28084 !! wikitext
28085 [[Image:Foobar.jpg|thumb|original caption]]
28086 !! wikitext/edited
28087 [[Image:Foobar.jpg|thumb|new caption]]
28088 !!end
28089
28090 !! test
28091 Image: empty alt attribute (T50924)
28092 !! options
28093 parsoid
28094 !! wikitext
28095 [[File:Foobar.jpg|thumb|alt=|bar]]
28096 !! html
28097 <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>
28098 !! end
28099
28100 !! test
28101 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28102 !! options
28103 parsoid=html2wt
28104 language=ar
28105 disabled
28106 !! html/parsoid
28107 <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>
28108 !! wikitext
28109 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28110 !! end
28111
28112 !! test
28113 Image: Block level image should have \n before and after
28114 !! wikitext
28115 123
28116 [[File:Foobar.jpg|right|thumb|150x150px]]
28117 456
28118 !! html/parsoid
28119 <p>123</p>
28120 <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>
28121 <p>456</p>
28122 !! end
28123
28124 !! test
28125 Image: New block level image should have \n before and after (existing content)
28126 !! wikitext
28127 123
28128 [[File:Foobar.jpg|right|thumb|150x150px]]
28129 456
28130 !! html/parsoid
28131 <p>123</p>
28132 <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>
28133 <p>456</p>
28134 !! end
28135
28136 !! test
28137 Image: upright option (parsoid)
28138 !! wikitext
28139 [[File:Foobar.jpg|thumb|upright|caption]]
28140 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28141 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28142 !! html/parsoid
28143 <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>
28144 <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>
28145 <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>
28146 !! end
28147
28148 !! test
28149 Image: upright option is ignored on inline and frame images (parsoid)
28150 !! wikitext
28151 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28152 !! html/parsoid
28153 <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>
28154 !! end
28155
28156 !! test
28157 Image: in template parameter with empty parameter
28158 !! wikitext
28159 {{echo|[[File:Foobar.jpg|link=]]}}
28160 !! html/parsoid
28161 <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>
28162 !! end
28163
28164 !! test
28165 Image: from basic HTML (1)
28166 !! options
28167 parsoid=html2wt
28168 !! html/parsoid
28169 <span typeof="mw:Image">
28170 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28171 </span>
28172 !! wikitext
28173 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28174 !! end
28175
28176 !! test
28177 Image: from basic HTML (2)
28178 !! options
28179 parsoid=html2wt
28180 !! html/parsoid
28181 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28182 !! wikitext
28183 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28184 !! end
28185
28186 !! test
28187 Image: from basic HTML (3)
28188 !! options
28189 parsoid=html2wt
28190 !! html/parsoid
28191 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28192 !! wikitext
28193 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28194 !! end
28195
28196 !! test
28197 Image: from basic HTML (4)
28198 !! options
28199 parsoid=html2wt
28200 !! html/parsoid
28201 <img src="./File:Foobar.jpg">
28202 !! wikitext
28203 [[File:Foobar.jpg|link=]]
28204 !! end
28205
28206 !! test
28207 Image: Invalid title as link
28208 !! wikitext
28209 [[File:Foobar.jpg|link=<]]
28210 !! html/php
28211 <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>
28212 </p>
28213 !! html/parsoid
28214 <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>
28215 !! end
28216
28217 !! test
28218 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28219 !! options
28220 parsoid=html2wt
28221 !! html/parsoid
28222 <ul>
28223 <li><p>foo</p></li>
28224 </ul>
28225 !! wikitext
28226 * foo
28227 !! end
28228
28229 !! test
28230 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28231 !! options
28232 parsoid=html2wt
28233 !! html/parsoid
28234 <ul> <li>foo</li></ul>
28235 !! wikitext
28236 * foo
28237 !! end
28238
28239 !! test
28240 Don't strip leading whitespace when handling indent-pre suppressing tags
28241 !! options
28242 parsoid=html2wt
28243 !! html/parsoid
28244 <table>
28245 <tr><td> indented row</td></tr>
28246 </table>
28247 <blockquote><p>
28248 <b>This is very bold of you!</b>
28249 </p>
28250 <table><tr><td>
28251 indented cell (no pre-wrapping!)
28252 </td></tr></table>
28253 </blockquote>
28254 <p>foo</p>
28255 <div>bar</div>
28256 !! wikitext
28257 {|
28258 | indented row
28259 |}
28260 <blockquote>
28261 '''This is very bold of you!'''
28262
28263 {|
28264 |
28265 indented cell (no pre-wrapping!)
28266 |}
28267 </blockquote>
28268 foo
28269 <div>bar</div>
28270 !! end
28271
28272 !! test
28273 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28274 !! options
28275 parsoid=html2wt
28276 !! html/parsoid
28277 <p>foo</p>
28278 <span>bar</span>
28279
28280 <span>foo2
28281 </span>bar2
28282
28283 <div>foo</div>
28284 <span>bar</span>
28285
28286 <div>
28287 <span>foo</span>
28288 </div>
28289 !! wikitext
28290 foo
28291
28292 <span>bar</span>
28293
28294 <span>foo2
28295 <nowiki> </nowiki></span>bar2
28296
28297 <div>foo</div>
28298 <nowiki> </nowiki><span>bar</span>
28299
28300 <div>
28301 <nowiki> </nowiki><span>foo</span>
28302 </div>
28303 !! end
28304
28305 !! test
28306 Lists: Dont insert newlines in a serialized list item.
28307 !! options
28308 parsoid=html2wt
28309 !! html/parsoid
28310 <ul><li>a<br>b</li><li>c</li></ul>
28311 !! wikitext
28312 * a<br />b
28313 * c
28314 !! end
28315
28316 !! test
28317 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28318 !! options
28319 parsoid={
28320 "modes": ["html2wt"],
28321 "scrubWikitext": false
28322 }
28323 !! html/parsoid
28324 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28325 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28326
28327 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28328 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28329
28330 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28331
28332 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28333 !! wikitext
28334 == hello there [[Category:A1]] ==
28335
28336 == [[Category:A2]] hi pal ==
28337
28338 == <!--foo--> [[Category:A3]] how goes it ==
28339
28340 == it goes well [[Category:A4]] <!--bar--> ==
28341
28342 ==howdy [[Category:A5]]==
28343
28344 == __TOC__ ok ==
28345 !! end
28346
28347 !! test
28348 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28349 !! options
28350 parsoid={
28351 "modes": ["html2wt"],
28352 "scrubWikitext": true
28353 }
28354 !! html/parsoid
28355 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28356 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28357
28358 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28359 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28360
28361 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28362 !! wikitext
28363 == hello there ==
28364 [[Category:A1]]
28365 [[Category:A2]]
28366
28367 == hi pal ==
28368
28369 <!--foo-->[[Category:A3]]
28370
28371 == how goes it ==
28372
28373 == it goes well ==
28374 [[Category:A4]] <!--bar-->
28375
28376 __TOC__
28377
28378 == ok ==
28379 !! end
28380
28381 !! test
28382 Headings: Don't hoist metas that come from templates
28383 !! options
28384 parsoid={
28385 "modes": ["html2wt"],
28386 "scrubWikitext": true
28387 }
28388 !! html/parsoid
28389 <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>
28390 !! wikitext
28391 == {{echo|foo [[Category:Foo]]}} ==
28392 !! end
28393
28394 !! test
28395 Headings: Category in ref isn't hoisted
28396 !! options
28397 parsoid={
28398 "modes": ["html2wt"],
28399 "scrubWikitext": true
28400 }
28401 !! html/parsoid
28402 <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>
28403
28404 <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>
28405 !! wikitext
28406 == foo <ref>bar
28407 [[Category:Baz]] </ref> ==
28408
28409 <references />
28410 !! end
28411
28412 !! test
28413 Parsoid: Serialize positional parameters with = in them as named parameter
28414 !! options
28415 parsoid=html2wt
28416 !! html/parsoid
28417 <p about="#mwt1" typeof="mw:Transclusion"
28418 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28419
28420 <p about="#mwt1" typeof="mw:Transclusion"
28421 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28422
28423 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28424 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28425 <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>
28426 !! wikitext
28427 {{echo|1=f=oo}}
28428
28429 {{echo|1=f=oo|2=bar}}
28430
28431 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28432 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28433 {{echo|<nowiki>f=oo</nowiki>|bar}}
28434 !! end
28435
28436 !! test
28437 Parsoid: Serialize positional parameters with = in extlink as named parameter
28438 !! options
28439 parsoid=html2wt
28440 !! html/parsoid
28441 <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>
28442 !! wikitext
28443 {{echo|1=http://stuff?is=ok}}
28444 !! end
28445
28446 !! test
28447 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28448 !! options
28449 parsoid=html2wt
28450 !! html/parsoid
28451 <div>a<p>b</p></div>
28452 <div>a
28453 <p>b</p></div>
28454 <div>
28455 a
28456 <p>b</p></div>
28457 !! wikitext
28458 <div>a
28459 b
28460 </div>
28461 <div>a
28462 b
28463 </div>
28464 <div>
28465 a
28466
28467 b
28468 </div>
28469 !! end
28470
28471 !! test
28472 Substrings resembling wikitext in hrefs should not get nowiki escapes
28473 !! options
28474 parsoid=html2wt
28475 !! html/parsoid
28476 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28477 !! wikitext
28478 [[Foo''bar''baz]]
28479 !! end
28480
28481 !! test
28482 Enforce single-line context in the serializer
28483 !! options
28484 parsoid=html2wt
28485 !! html/parsoid
28486 <h2>testing
28487 123</h2>
28488
28489 <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">
28490 </span><span about="#mwt1">you</span> </h2>
28491
28492 <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>
28493
28494 <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
28495 there</span></li></ol>
28496
28497 <ul><li>asd
28498 sdf</li></ul>
28499
28500 <ul><li>foo
28501 bar
28502 baz</li>
28503 <li>foo <b>bar</b>
28504 baz</li></ul>
28505
28506 <dl><dt>hi
28507 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28508 ho</dd></dl>
28509
28510 <dl><dd> <table>
28511 <tbody><tr><td> ha
28512 ha
28513 ha</td></tr>
28514 </tbody></table></dd></dl>
28515 !! wikitext
28516 == testing 123 ==
28517
28518 == hi {{bogus|there
28519 you}} ==
28520
28521 == foo <ref>hello
28522 there</ref> ==
28523
28524 <references />
28525
28526 * asd sdf
28527
28528 * foo bar baz
28529 * foo '''bar''' baz
28530
28531 ; hi ho : hi ho
28532
28533 : {|
28534 | ha
28535 ha
28536 ha
28537 |}
28538 !! end
28539
28540 !! test
28541 Serialize new placeholder space without spans
28542 !! options
28543 parsoid=html2wt
28544 !! html/parsoid
28545 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28546
28547 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28548
28549 <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>
28550 !! wikitext
28551 foo : bar
28552
28553 foo : bar
28554
28555 <ref>foo : bar</ref>ok
28556 !! end
28557
28558
28559 #-----------------------
28560 # Tag minimization tests
28561 #-----------------------
28562
28563 !! test
28564 1. I/B quote minimization: wikitext-only tags should be combined
28565 !! options
28566 parsoid=html2wt
28567 !! html/parsoid
28568 <p><i>A</i><i>B</i></p>
28569 <p><b>A</b><b>B</b></p>
28570 <p><i>A</i><b><i>B</i></b></p>
28571 <p><b>A</b><i><b>B</b></i></p>
28572 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28573 <p><i><b>A</b></i><i><b>B</b></i></p>
28574 <p><i><b>A</b></i><b><i>B</i></b></p>
28575 <p><b><i>A</i></b><i><b>B</b></i></p>
28576 !! wikitext
28577 ''AB''
28578
28579 '''AB'''
28580
28581 ''A'''B'''''
28582
28583 '''A''B'''''
28584
28585 '''A''BC''D'''
28586
28587 '''''AB'''''
28588
28589 '''''AB'''''
28590
28591 '''''AB'''''
28592 !! end
28593
28594 !! test
28595 2. I/B quote minimization: wikitext and html tags should not be combined
28596 !! options
28597 parsoid=html2wt
28598 !! html/parsoid
28599 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28600 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28601 !! wikitext
28602 ''A''<i>B</i>
28603
28604 ''A''<nowiki/>'''<i>B</i>'''
28605 !! end
28606
28607 !! test
28608 3. I/B quote minimization: templated content stops minimization
28609 !! options
28610 parsoid=html2wt
28611 !! html/parsoid
28612 <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>
28613 <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>
28614 !! wikitext
28615 ''A''{{echo|''B''}}
28616
28617 ''A''{{echo|'''''B'''''}}
28618 !! end
28619
28620 !! test
28621 4. I/B quote minimization: new content should be mimimized with adjacent old content
28622 !! options
28623 parsoid=html2wt
28624 !! html/parsoid
28625 <p><i>A</i><i>B</i></p>
28626 <p><b>A</b><b>B</b></p>
28627 <p><i>A</i><b><i>B</i></b></p>
28628 !! wikitext
28629 ''AB''
28630
28631 '''AB'''
28632
28633 ''A'''B'''''
28634 !! end
28635
28636 !! test
28637 5a. Merge adjacent quote nodes if they've been edited
28638 !! options
28639 parsoid={
28640 "modes": ["wt2wt", "selser"],
28641 "changes": [
28642 ["p", "contents", "remove", ":contains('b')"]
28643 ]
28644 }
28645 !! wikitext
28646 ''a''b''c''
28647 !! wikitext/edited
28648 ''ac''
28649 !! end
28650
28651 !! test
28652 5b. Merge adjacent quote nodes if they've been edited
28653 !! options
28654 parsoid={
28655 "modes": ["wt2wt", "selser"],
28656 "changes": [
28657 ["#x", "remove"]
28658 ]
28659 }
28660 !! wikitext
28661 ''a''<span id="x">b</span>''c''
28662 !! wikitext/edited
28663 ''ac''
28664 !! end
28665
28666 !! test
28667 1. Merge adjacent link nodes as long as at least one element is new
28668 !! options
28669 parsoid={
28670 "modes": ["html2wt"],
28671 "scrubWikitext": true
28672 }
28673 !! html/parsoid
28674 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28675 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28676 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28677 !! wikitext
28678 [[Football]]
28679 [[Football]]
28680 [[Football|Foot]][[Football|ball]]
28681 !! end
28682
28683 !! test
28684 2. Merge adjacent link nodes and enable additional normalizations
28685 !! options
28686 parsoid={
28687 "modes": ["html2wt"],
28688 "scrubWikitext": true
28689 }
28690 !! html/parsoid
28691 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28692 !! wikitext
28693 ''[[Football]]''
28694 !! end
28695
28696 !! test
28697 3. Don't merge adjacent link nodes if scrubWikitext is false
28698 !! options
28699 parsoid={
28700 "modes": ["html2wt"],
28701 "scrubWikitext": false
28702 }
28703 !! html/parsoid
28704 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28705 !! wikitext
28706 [[Football|Foot]][[Football|ball]]
28707 !! end
28708
28709 !! test
28710 1. Move format tags outside of WikiLink
28711 !! options
28712 parsoid={
28713 "modes": ["html2wt"],
28714 "scrubWikitext": true
28715 }
28716 !! html/parsoid
28717 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28718 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28719 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28720 !! wikitext
28721 ''[[Football]]''
28722 '''''[[Football]]'''''
28723 <u>'''''[[Football]]'''''</u>
28724 !! end
28725
28726 !! test
28727 2. Move format tags outside of WikiLink with mergable A tags
28728 !! options
28729 parsoid={
28730 "modes": ["html2wt"],
28731 "scrubWikitext": true
28732 }
28733 !! html/parsoid
28734 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28735 !! wikitext
28736 '''''[[Football]]'''''
28737 !! end
28738
28739 !! test
28740 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28741 !! options
28742 parsoid={
28743 "modes": ["html2wt"],
28744 "scrubWikitext": true
28745 }
28746 !! html/parsoid
28747 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28748 !! wikitext
28749 <font color="red"><u>'''[[Foo]]'''</u></font>
28750 !! end
28751
28752 !! test
28753 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28754 !! options
28755 parsoid={
28756 "modes": ["html2wt"],
28757 "scrubWikitext": true
28758 }
28759 !! html/parsoid
28760 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28761 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28762 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28763 !! wikitext
28764 [[Foo|<font color="red">Foo</font>]]
28765 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28766 [[Foo|<span class="Bar">Foo</span>]]
28767 !! end
28768
28769 !! test
28770 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28771 !! options
28772 parsoid={
28773 "modes": ["selser"],
28774 "scrubWikitext": true,
28775 "changes": [
28776 ["a", "html", "<i>Foo</i>"]
28777 ]
28778 }
28779 !! wikitext
28780 [[Foo]]
28781 !! wikitext/edited
28782 ''[[Foo]]''
28783 !! end
28784
28785 !! test
28786 6. Regression test: Manual edit test to ensure diff markers are not lost
28787 !! options
28788 parsoid={
28789 "modes": ["selser"],
28790 "scrubWikitext": true,
28791 "changes": [
28792 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28793 ]
28794 }
28795 !! wikitext
28796 ''Foo''
28797 !! wikitext/edited
28798 ''[[Foo]]''
28799 !! end
28800
28801 #------------------------------
28802 # End of tag minimization tests
28803 #------------------------------
28804
28805 !!test
28806 T56262: New entities
28807 !! options
28808 parsoid=html2wt
28809 !! html/parsoid
28810 <span typeof="mw:Entity">&nbsp;</span>
28811 !! wikitext
28812 &nbsp;
28813 !! end
28814
28815 ## Note that there is no wikitext output for 'unknownproperty' ##
28816 ## Unknown magic words are silently dropped ##
28817
28818 !! test
28819 Magic words
28820 !! options
28821 parsoid=html2wt
28822 !! html/parsoid
28823 <meta property='mw:PageProp/toc' />
28824 <meta property='mw:PageProp/notoc' />
28825 <meta property='mw:PageProp/forcetoc' />
28826 <meta property='mw:PageProp/index' />
28827 <meta property='mw:PageProp/noindex' />
28828 <meta property='mw:PageProp/nogallery' />
28829 <meta property='mw:PageProp/noeditsection' />
28830 <meta property='mw:PageProp/notitleconvert' />
28831 <meta property='mw:PageProp/nocontentconvert' />
28832 <meta property='mw:PageProp/unknownproperty' />
28833 !! wikitext
28834 __TOC__
28835 __NOTOC__
28836 __FORCETOC__
28837 __INDEX__
28838 __NOINDEX__
28839 __NOGALLERY__
28840 __NOEDITSECTION__
28841 __NOTITLECONVERT__
28842 __NOCONTENTCONVERT__
28843 !! end
28844
28845 !! test
28846 Consecutive <pre>s should not get merged
28847 !! options
28848 parsoid=html2wt,html2html
28849 !! html/parsoid
28850 <pre>a</pre><pre>b</pre>
28851
28852 <pre>c
28853 </pre><pre>
28854 d</pre>
28855
28856 <pre>e
28857
28858 </pre><pre>
28859
28860 f</pre>
28861 !! wikitext
28862 a
28863
28864 b
28865
28866 c
28867
28868 d
28869
28870 e
28871
28872
28873
28874 f
28875 !! end
28876
28877 !! test
28878 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28879 !! options
28880 parsoid=html2wt
28881 !! html/parsoid
28882 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28883 !! wikitext
28884 [[Special:BookSources/1234567890|ISBN 1234567895]]
28885 !! end
28886
28887 !! test
28888 Edited RFC links not serializable as RFC links should serialize as extlinks
28889 !! options
28890 parsoid=html2wt
28891 !! html/parsoid
28892 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28893 !! wikitext
28894 [https://tools.ietf.org/html/rfc123 New RFC]
28895 !! end
28896
28897 !! test
28898 Edited PMID links not serializable as PMID links should serialize as extlinks
28899 !! options
28900 parsoid=html2wt
28901 !! html/parsoid
28902 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28903 !! wikitext
28904 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28905 !! end
28906
28907 !! test
28908 WTS of autolinks with trailing/surrounding context
28909 !! options
28910 parsoid=html2wt
28911 !! html/parsoid
28912 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28913 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28914 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28915 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28916 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28917 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28918 !! wikitext
28919 http://cscott.net'''foo'''
28920
28921 http://cscott.net<b>foo</b>
28922
28923 '''http://cscott.net'''
28924
28925 '''http://cscott.net '''
28926
28927 '''http://cscott.net<nowiki/>x'''
28928
28929 http://cscott.net<nowiki/>x
28930 !! end
28931
28932 !! test
28933 WTS of autolinks with nowikis (round-trip)
28934 !! wikitext
28935 x<nowiki/>http://cscott.net<nowiki/>x
28936 !! html/parsoid
28937 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28938 !! end
28939
28940 # this is the "easy" test because it leaves in place all the
28941 # data-parsoid information indicating this is an autolink
28942 !! test
28943 WTS of autolinks with escapes (editing)
28944 !! options
28945 parsoid={
28946 "modes": ["wt2wt"],
28947 "changes": [
28948 [ "span", "remove" ]
28949 ]
28950 }
28951 !! wikitext
28952 x<nowiki/>http://cscott.net<nowiki/>x
28953 !! wikitext/edited
28954 x<nowiki/>http://cscott.net<nowiki/>x
28955 !! end
28956
28957 !! test
28958 WTS of edited autolink-like text (T103364)
28959 !! options
28960 parsoid={
28961 "modes": ["wt2wt"],
28962 "changes": [
28963 [ "span[typeof]", "removeAttr", "typeof" ]
28964 ]
28965 }
28966 !! wikitext
28967 Not a link: <nowiki>http://example.com</nowiki>.
28968 !! wikitext/edited
28969 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28970 !! end
28971
28972 !! test
28973 WTS of newly-authored autolink-like text (T103364)
28974 !! options
28975 parsoid=html2wt
28976 !! html/parsoid
28977 <p>http://example.com is not a link.</p>
28978 !! wikitext
28979 <nowiki>http://example.com</nowiki> is not a link.
28980 !! end
28981
28982 !! test
28983 WTS of autolink-like text after an autolink (T108563)
28984 !! options
28985 parsoid=html2wt
28986 !! html/parsoid
28987 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28988 !! wikitext
28989 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28990 !! end
28991
28992 !! test
28993 Magic links inside links (not autolinked)
28994 !! wikitext
28995 [[Foo|http://example.com]]
28996 [[Foo|RFC 1234]]
28997 [[Foo|PMID 1234]]
28998 [[Foo|ISBN 123456789x]]
28999
29000 [http://foo.com http://example.com]
29001 [http://foo.com RFC 1234]
29002 [http://foo.com PMID 1234]
29003 [http://foo.com ISBN 123456789x]
29004 !! html+tidy
29005 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29006 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29007 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29008 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29009 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29010 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29011 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29012 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29013 </p>
29014 !! html/parsoid
29015 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29016 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29017 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29018 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29019
29020 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29021 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29022 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29023 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29024 !! end
29025
29026 !! test
29027 Magic links inside image captions (autolinked)
29028 !! wikitext
29029 [[File:Foobar.jpg|thumb|http://example.com]]
29030 [[File:Foobar.jpg|thumb|RFC 1234]]
29031 [[File:Foobar.jpg|thumb|PMID 1234]]
29032 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29033 !! html+tidy
29034 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
29035 <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>
29036 <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>
29037 <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>
29038 !! html/parsoid
29039 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
29040 <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>
29041 <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>
29042 <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>
29043 !! end
29044
29045 !! test
29046 WTS of magic word text (T109371)
29047 !! options
29048 parsoid=html2wt
29049 !! html/parsoid
29050 <p>RFC 1234</p>
29051 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29052 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29053 !! wikitext
29054 <nowiki>RFC 1234</nowiki>
29055
29056 [http://foo.com RFC 1234]
29057
29058 [[Foo|RFC 1234]]
29059 !! end
29060
29061 !! test
29062 Edited Redirect link should emit a non-piped wikitext link
29063 !! options
29064 parsoid=html2wt
29065 !! html/parsoid
29066 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29067 !! wikitext
29068 #REDIRECT [[Bar]]
29069 !! end
29070
29071 !! test
29072 T75121: Infer extension name from typeOf if data-mw is not present
29073 !! options
29074 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29075 !! html/parsoid
29076 <div typeOf="mw:Extension/foo"></div>
29077 !! wikitext
29078 <foo />
29079 !! end
29080
29081 # Note that the <p> wrapping isn't present in PHP parser output
29082 # The important thing for this test is that P-wrapping doesn't
29083 # interfere with the <nowiki> protection for leading - in <td>
29084 # (which isn't necessary for <th>).
29085 !! test
29086 T88318: p-wrapped dash in table.
29087 !! options
29088 parsoid=html2wt,wt2wt
29089 !! html/parsoid
29090 <table><tbody>
29091 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29092 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29093 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29094 </tbody></table>
29095 !! wikitext
29096 {|
29097 !-
29098 !-
29099 |-
29100 |<nowiki>-</nowiki>
29101 |<nowiki>- </nowiki>
29102 |-
29103 |<small>-</small>
29104 |<br />
29105 -
29106 |<br />-
29107 |}
29108 !! html/php+tidy
29109 <table>
29110 <tbody><tr>
29111 <th>-
29112 </th>
29113 <th>-
29114 </th></tr>
29115 <tr>
29116 <td>-
29117 </td>
29118 <td>-
29119 </td></tr>
29120 <tr>
29121 <td><small>-</small>
29122 </td>
29123 <td><br />
29124 <p>-
29125 </p>
29126 </td>
29127 <td><br />-
29128 </td></tr></tbody></table>
29129 !! end
29130
29131 !! test
29132 T149209: WTS: Handle newlines in table cells properly
29133 !! options
29134 parsoid=html2wt
29135 !! html/parsoid
29136 <table>
29137 <tbody>
29138 <tr><td>a
29139 b
29140 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29141 <tr><td><p>x</p>
29142 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29143 </tbody></table>
29144 <table>
29145 <tbody>
29146 <tr><th>a
29147 b
29148 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29149 <tr><th><p>x</h>
29150 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29151 </tbody></table>
29152 !! wikitext
29153 {|
29154 |a
29155 b
29156 |c
29157 |-
29158 |x
29159 {{!}}y
29160 |}
29161 {|
29162 !a
29163 b
29164 !c
29165 |-
29166 !x
29167 !y
29168 |}
29169 !! end
29170
29171 !! test
29172 T149209: Selser: Handle newlines in table cells properly
29173 !! options
29174 parsoid={
29175 "modes": ["selser"],
29176 "changes": [
29177 [ "#h1", "html", "a\nb\n" ],
29178 [ "#h2", "html", "a\nb\n" ],
29179 [ "#c1", "html", "a\nb\n" ],
29180 [ "#c2", "html", "<p>a</p>" ],
29181 [ "#c3", "html", "<p>a</p>" ],
29182 [ "#c4", "html", "edit-me<p>a</p>" ]
29183 ]
29184 }
29185 !! wikitext
29186 {|
29187 ! id="h1" |edit-me!!1
29188 |-
29189 ! id="h2" |edit-me||2
29190 |-
29191 | id="c1" |edit-me||3
29192 |-
29193 | id="c2" |edit-me||4
29194 |-
29195 | id="c3" |edit-me||p||q||r
29196 |-
29197 | id="c4" |edit-me||p||q||r
29198 |}
29199 !! wikitext/edited
29200 {|
29201 ! id="h1" |a
29202 b
29203 !1
29204 |-
29205 ! id="h2" |a
29206 b
29207 !2
29208 |-
29209 | id="c1" |a
29210 b
29211 |3
29212 |-
29213 | id="c2" |a
29214 |4
29215 |-
29216 | id="c3" |a
29217 |p||q||r
29218 |-
29219 | id="c4" |edit-me
29220 a
29221 |p||q||r
29222 |}
29223 !! end
29224
29225 !! test
29226 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29227 !! options
29228 parsoid=html2wt
29229 !! html/parsoid
29230 <table id='mwAb'>
29231 <td id='mwAc'>foo</td>
29232 <td id='serialize-this'>bar</td>
29233 </table>
29234 !! wikitext
29235 {|
29236 |foo
29237 | id="serialize-this" |bar
29238 |}
29239 !! end
29240
29241 !! test
29242 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29243 !! options
29244 parsoid=html2wt
29245 !! html/parsoid
29246 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29247 !! wikitext
29248 <div id="hello">ok</div>
29249 !! end
29250
29251 !! test
29252 Testing serialization after deletion in references
29253 !! options
29254 parsoid={
29255 "modes": ["wt2wt"],
29256 "changes": [
29257 ["#x", "remove"]
29258 ]
29259 }
29260 !! wikitext
29261 hi <ref><div id="x">ho</div></ref>
29262
29263 <references />
29264 !! wikitext/edited
29265 hi <ref></ref>
29266
29267 <references />
29268 !! end
29269
29270 !!test
29271 Testing serialization after deletion of table cells
29272 !!options
29273 parsoid={
29274 "modes": ["wt2wt", "selser"],
29275 "changes": [
29276 ["#x", "remove"]
29277 ]
29278 }
29279 !!wikitext
29280 {|
29281 !h1 !!h2 !!h3
29282 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29283 |}
29284 !! wikitext/edited
29285 {|
29286 !h1!!h2!!h3
29287 |c2|||c3
29288 |}
29289 !!end
29290
29291 !! test
29292 Testing selser after addition of new row before first row (T125419)
29293 !! options
29294 parsoid={
29295 "modes": ["wt2wt", "selser"],
29296 "changes": [
29297 [ "tr", "before", "<tr><td>X</td></tr>" ]
29298 ]
29299 }
29300 !! wikitext
29301 {|
29302 |a
29303 |}
29304 !! wikitext/edited
29305 {|
29306 |X
29307 |-
29308 |a
29309 |}
29310 !! end
29311
29312 !! test
29313 Serialize new table rows in a HTML table using HTML tags
29314 !! options
29315 parsoid={
29316 "modes": ["wt2wt", "selser"],
29317 "changes": [
29318 [ "tr", "before", "<tr><td>X</td></tr>" ]
29319 ]
29320 }
29321 !! wikitext
29322 <table><tr><td>a</td></tr></table>
29323 !! wikitext/edited
29324 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29325 !! end
29326
29327 !! test
29328 Serialize new table cells in a HTML row using HTML tags
29329 !! options
29330 parsoid={
29331 "modes": ["wt2wt", "selser"],
29332 "changes": [
29333 [ "td", "before", "<td>X</td>" ]
29334 ]
29335 }
29336 !! wikitext
29337 <table><tr><td>a</td></tr></table>
29338 !! wikitext/edited
29339 <table><tr><td>X</td><td>a</td></tr></table>
29340 !! end
29341
29342 !! test
29343 Serialize wikitext list items as HTML list items when embedded in a HTML list
29344 !! options
29345 parsoid=html2wt
29346 !! html
29347 <ul data-parsoid='{"stx": "html"}'>
29348 <li data-parsoid='{}'>a</li>
29349 <li>b</li>
29350 </ul>
29351 !! wikitext
29352 <ul>
29353 <li>a</li>
29354 <li>b</li>
29355 </ul>
29356 !! end
29357
29358 # SSS FIXME: Is this actually a good thing given the
29359 # odd nested list output that is generated by MW?
29360 # <ul><li>foo<ul>..</ul></li></ul> instead of
29361 # <ul><li>foo</li><ul>..</ul></ul>
29362 !! test
29363 Wikitext lists can be nested inside HTML lists
29364 !! options
29365 parsoid=html2wt
29366 !! html
29367 <ul data-parsoid='{"stx": "html"}'>
29368 <li data-parsoid='{"stx": "html"}'>a
29369 <ul><li>b</li></ul>
29370 </li>
29371 </ul>
29372
29373 <ul data-parsoid='{"stx": "html"}'>
29374 <li>x
29375 <ul><li>y</li></ul>
29376 </li>
29377 </ul>
29378 !! wikitext
29379 <ul>
29380 <li>a
29381 * b
29382 </li>
29383 </ul>
29384
29385 <ul>
29386 <li>x
29387 * y
29388 </li>
29389 </ul>
29390 !! end
29391
29392 !! test
29393 WTS change modes
29394 !! options
29395 parsoid={
29396 "modes": ["wt2wt"],
29397 "changes": [
29398 [ "#xyz", "before", "<b>before</b> stuff " ],
29399 [ "#xyz", "after", " stuff <i>after</i>" ],
29400 [ "#xyz", "html", "x <b>y</b> z" ]
29401 ]
29402 }
29403 !! wikitext
29404 <span id="xyz">hello</span>
29405 !! wikitext/edited
29406 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29407 !! end
29408
29409 !! test
29410 Never serialize a-tag as html, regardless of what data-parsoid has to say
29411 !! options
29412 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29413 !! html/parsoid
29414 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29415 !! wikitext
29416 [[Foo]]
29417 !! end
29418
29419 ## SSS FIXME: This is broken output nevertheless.
29420 ## What might be a reasonable non-broken output for this?
29421 ## This is an edge case unlikely to be seen in production
29422 ## that I am not wasting more time on this right now.
29423 !! test
29424 Never serialize a-tag as html, no matter what attributes it has
29425 !! options
29426 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29427 !! html/parsoid
29428 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29429 !! wikitext
29430 [http://boo.org http://boohoo.org]
29431 !! end
29432
29433 # Misnested is an indication that selser can reuse the source but these have
29434 # shown to sneak through on occasion. See T101768.
29435 # The original wikitext here is: [http://test.com [[one]] two three]
29436 !! test
29437 Strip span tags added to mark misnested links
29438 !! options
29439 parsoid=html2wt
29440 !! html/parsoid
29441 <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>
29442 !! wikitext
29443 [http://test.com][[one]] two three
29444 !! end
29445
29446 !! test
29447 Catch regression when unpacking misnested links
29448 !! options
29449 parsoid=wt2html
29450 !! wikitext
29451 {{echo|hi}}[http://example.com [[ho]]]
29452 !! html/parsoid
29453 <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>
29454 !! end
29455
29456 !! test
29457 Catch regression when unpacking with trailing content
29458 !! wikitext
29459 {{echo|Foo <references/> bar}}
29460 !! html/parsoid
29461 <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>
29462 !! end
29463
29464 !! test
29465 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29466 !! options
29467 parsoid=html2wt
29468 !! html/parsoid
29469 <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|}"]}'>
29470 <tbody><tr><td>d
29471 </td></tr>
29472 </tbody></table>
29473 !! wikitext
29474 {{echo|a}}
29475 {|{{echo|c
29476 {{!}}d
29477 }}
29478 |}
29479 !! end
29480
29481 ## This test verifies the presence and computation of this attribute indirectly
29482 ## by making an edit and ensuring that the serialization is correct (which it would be
29483 ## only if firstWikitextNode is properly set).
29484 !! test
29485 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29486 !! options
29487 parsoid= {
29488 "modes": ["wt2wt"],
29489 "changes": [
29490 [ "div#x", "remove" ],
29491 [ "div", "before", "<div>new</div>" ]
29492 ]
29493 }
29494 !! wikitext
29495 <div id="x">foo</div>
29496 {|
29497 {{echo|<div>boo</div>
29498 {{!}}b}}
29499 |c
29500 |}
29501 !! wikitext/edited
29502
29503 <div>new</div>
29504 {|
29505 {{echo|<div>boo</div>
29506 {{!}}b}}
29507 |c
29508 |}
29509 !! end
29510
29511 # --------------------------------------------
29512 # Tests spec'ing wikitext serialization norms |
29513 # --------------------------------------------
29514
29515 !! test
29516 Serialize multi-line indent-pre starting with wikitext syntax
29517 !! options
29518 parsoid=html2wt
29519 !! html/parsoid
29520 <pre>* 1
29521 ** 2
29522 * 3</pre>
29523 !! wikitext
29524 * 1
29525 ** 2
29526 * 3
29527 !! end
29528
29529 !! test
29530 1. Categories should always be serialized on their own line
29531 !! options
29532 parsoid=html2wt
29533 !! html/parsoid
29534 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29535 !! wikitext
29536 foo
29537 [[Category:Foo]]
29538 bar
29539 !! end
29540
29541 !! test
29542 2. Categories that are part of templates should not introduce a line break
29543 !! wikitext
29544 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29545 !! html/parsoid
29546 <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>
29547 !! end
29548
29549 # Careful while editing these next 2 tests. There are \u200f characters
29550 # before and after the <link> tags in the HTML and following some
29551 # of the categories in wikitext
29552 # Do not remove these characters in edits.
29553 #
29554 # As part of the serialization, these bidi characters will get stripped.
29555 !! test
29556 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29557 !! options
29558 parsoid={
29559 "modes": ["html2wt"],
29560 "scrubWikitext": true
29561 }
29562 !! html/parsoid
29563 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29564 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29565 !! wikitext
29566 [[קטגוריה:טקסים]]
29567 [[קטגוריה: שיטות משפט]]
29568 !! end
29569
29570 !! test
29571 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29572 !! options
29573 parsoid={
29574 "modes": ["html2wt"],
29575 "scrubWikitext": true
29576 }
29577 !! html/parsoid
29578 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29579 !! wikitext
29580 [[קטגוריה:טקסים]]
29581 ‏y
29582 !! end
29583
29584 !! test
29585 Lists: Add space after bullets
29586 !! options
29587 parsoid=html2wt
29588 !! html/parsoid
29589 <ul>
29590 <li>foo</li>
29591 <li> bar</li>
29592 <li><span> baz</span></li>
29593 </ul>
29594 !! wikitext
29595 * foo
29596 * bar
29597 * <span> baz</span>
29598 !! end
29599
29600 !! test
29601 1. Headings: Add space before/after == (T53744)
29602 !! options
29603 parsoid=html2wt
29604 !! html/parsoid
29605 <h2>foo</h2>
29606 <h2> bar</h2>
29607 <h2>baz </h2>
29608 <h2><span> baz</span></h2>
29609 !! wikitext
29610 == foo ==
29611
29612 == bar ==
29613
29614 == baz ==
29615
29616 == <span> baz</span> ==
29617 !! end
29618
29619 !! test
29620 2. Headings: Add space before/after == even after hoisted content
29621 !! options
29622 parsoid={
29623 "modes": ["html2wt"],
29624 "scrubWikitext": true
29625 }
29626 !! html/parsoid
29627 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29628 !! wikitext
29629 [[Category:A2]]
29630
29631 == ok ==
29632 !! end
29633
29634 !! test
29635 1. Headings: suppress newly created empty headings
29636 !! options
29637 parsoid={
29638 "modes": ["html2wt"],
29639 "scrubWikitext": true
29640 }
29641 !! html/parsoid
29642 <h2></h2>
29643 !! wikitext
29644 !! end
29645
29646 !! test
29647 2. Headings: don't suppress empty headings if scrubWikitext is false
29648 !! options
29649 parsoid=html2wt
29650 !! html/parsoid
29651 <h2></h2>
29652 !! wikitext
29653 ==<nowiki/>==
29654 !! end
29655
29656 !! test
29657 3. Headings: suppress empty headings on edits
29658 !! options
29659 parsoid={
29660 "modes": ["selser"],
29661 "scrubWikitext": true,
29662 "changes": [
29663 [ "#x", "remove"]
29664 ]
29665 }
29666 !! wikitext
29667 ==<span id="x">foo</span>==
29668 !! wikitext/edited
29669 !! end
29670
29671 !! test
29672 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29673 !! options
29674 parsoid={
29675 "modes": ["html2wt"],
29676 "scrubWikitext": true
29677 }
29678 !! html/parsoid
29679 <h2>foo<br/>bar</h2>
29680 <h2>foo <span><br/>bar</span> baz</h2>
29681 !! wikitext
29682 == foo bar ==
29683
29684 == foo <span> bar</span> baz ==
29685 !! end
29686
29687 !! test
29688 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29689 !! options
29690 parsoid={
29691 "modes": ["html2wt"],
29692 "scrubWikitext": false
29693 }
29694 !! html/parsoid
29695 <h2>foo<br/>bar</h2>
29696 !! wikitext
29697 == foo<br />bar ==
29698 !! end
29699
29700 !! test
29701 1. WT Quote Tags: suppress newly created empty style tags
29702 !! options
29703 parsoid={
29704 "modes": ["html2wt"],
29705 "scrubWikitext": true
29706 }
29707 !! html/parsoid
29708 <i></i><b></b>
29709 !! wikitext
29710 !! end
29711
29712 !! test
29713 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29714 !! options
29715 parsoid=html2wt
29716 !! html/parsoid
29717 <i></i><b></b>
29718 !! wikitext
29719 ''<nowiki/>'''''<nowiki/>'''
29720 !! end
29721
29722 !! test
29723 3. WT Quote Tags: suppress empty style tags on edits
29724 !! options
29725 parsoid={
29726 "modes": ["selser"],
29727 "scrubWikitext": true,
29728 "changes": [
29729 [ "#x", "remove"]
29730 ]
29731 }
29732 !! wikitext
29733 '''<span id="x">foo</span>'''
29734 !! wikitext/edited
29735 !! end
29736
29737 !! test
29738 1. Anchors: suppress newly created empty anchors
29739 !! options
29740 parsoid={
29741 "modes": ["html2wt"],
29742 "scrubWikitext": true
29743 }
29744 !! html/parsoid
29745 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29746 !! wikitext
29747 !! end
29748
29749 !! test
29750 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29751 !! options
29752 parsoid={
29753 "modes": ["html2wt"],
29754 "scrubWikitext": false
29755 }
29756 !! html/parsoid
29757 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29758 !! wikitext
29759 [[Test|<nowiki/>]]
29760 !! end
29761
29762 !! test
29763 3. Anchors: suppress empty anchors on edits
29764 !! options
29765 parsoid={
29766 "modes": ["selser"],
29767 "scrubWikitext": true,
29768 "changes": [
29769 [ "#x", "remove"]
29770 ]
29771 }
29772 !! wikitext
29773 [[Test|<span id="x">foo</span>]]
29774 !! wikitext/edited
29775 !! end
29776
29777 !! test
29778 3a. Anchors: do not suppress numbered extlinks
29779 !! options
29780 parsoid={
29781 "modes": ["wt2wt"],
29782 "scrubWikitext": true
29783 }
29784 !! wikitext
29785 [http://foo.com]
29786 !! html/parsoid
29787 <a rel="mw:ExtLink" href="http://foo.com"></a>
29788 !! end
29789
29790 !! test
29791 3b. Anchors: do not suppress numbered extlinks
29792 !! options
29793 parsoid={
29794 "modes": ["wt2wt"],
29795 "scrubWikitext": true,
29796 "changes": [
29797 [ "#x", "remove"]
29798 ]
29799 }
29800 !! wikitext
29801 [http://foo.com <span id="x">foo</span>]
29802 !! wikitext/edited
29803 [http://foo.com]
29804 !! end
29805
29806 !!test
29807 Normalizations should be restricted to edited content
29808 !!options
29809 parsoid={
29810 "modes": ["selser"],
29811 "scrubWikitext": true,
29812 "changes": [
29813 [ "h1", "before", "<i></i>"]
29814 ]
29815 }
29816 !!wikitext
29817 a
29818 = =
29819 b
29820 !!wikitext/edited
29821 a
29822 = =
29823 b
29824 !!end
29825
29826 !! test
29827 1. Multiple normalizations (html2wt)
29828 !! options
29829 parsoid={
29830 "modes": ["html2wt"],
29831 "scrubWikitext": true
29832 }
29833 !! html
29834 <h2><i></i></h2>
29835 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29836 </a><b><i></i></b>x</p>
29837 !! wikitext
29838
29839 [[foo]]
29840 x
29841
29842 !! end
29843
29844 !! test
29845 2. Multiple normalizations (selser)
29846 !! options
29847 parsoid={
29848 "modes": ["selser"],
29849 "scrubWikitext": true,
29850 "changes": [
29851 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29852 ]
29853 }
29854 !! wikitext
29855 <span id="x">foo</span>
29856 !! wikitext/edited
29857 <span id="x">foo</span>
29858
29859 x
29860 !! end
29861
29862 !! test
29863 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29864 !! options
29865 parsoid={
29866 "modes": ["html2wt"],
29867 "scrubWikitext": true
29868 }
29869 !! html/parsoid
29870 <p> hi</p>
29871 <p> hello</p>
29872 !! wikitext
29873 hi
29874
29875 hello
29876 !! end
29877
29878 !! test
29879 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29880 !! options
29881 parsoid=html2wt
29882 !! html/parsoid
29883 <p> hi</p>
29884 <p> hello</p>
29885 !! wikitext
29886 <nowiki> </nowiki>hi
29887
29888 <nowiki> </nowiki> hello
29889 !! end
29890
29891 !! test
29892 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29893 !! options
29894 parsoid={
29895 "modes": ["html2wt"],
29896 "scrubWikitext": true
29897 }
29898 !! html/parsoid
29899 <p>Foo
29900 bar
29901 baz</p>
29902
29903 <table><tr><td>Foo
29904 bar
29905 baz bang</td></tr></table>
29906
29907 <p><!--boo--> foo
29908 bar</p>
29909
29910 <p> foo
29911 bar<span>boo</span></p>
29912 !! wikitext
29913 Foo
29914 bar
29915 baz
29916
29917 {|
29918 |Foo
29919 bar
29920 baz bang
29921 |}
29922
29923 <!--boo-->foo
29924 bar
29925
29926 foo
29927 bar<span>boo</span>
29928 !! end
29929
29930 !! test
29931 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29932 !! options
29933 parsoid={
29934 "modes": ["selser"],
29935 "scrubWikitext": true,
29936 "changes": [
29937 [ "p", "html", " a\n b" ]
29938 ]
29939 }
29940 !! wikitext
29941 xyz
29942 !! wikitext/edited
29943 a
29944 b
29945 !! end
29946
29947 !! test
29948 1. New links that end in spaces
29949 !! options
29950 parsoid={
29951 "modes": ["html2wt"],
29952 "scrubWikitext": false
29953 }
29954 !! html/parsoid
29955 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29956 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29957 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29958 !! wikitext
29959 [[Berlin ]]<nowiki/>is the capital of Germany.
29960
29961 [[Foo ]]'''bar'''
29962
29963 [[Boston ]] is a city.
29964 !! end
29965
29966 !! test
29967 2. New links that end in spaces
29968 !! options
29969 parsoid={
29970 "modes": ["html2wt"],
29971 "scrubWikitext": true
29972 }
29973 !! html/parsoid
29974 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29975 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29976 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29977 !! wikitext
29978 [[Berlin]] is the capital of Germany.
29979
29980 [[Foo]] '''bar'''
29981
29982 [[Boston]] is a city.
29983 !! end
29984
29985 !! test
29986 1. Table cells with escapable prefixes
29987 !! options
29988 parsoid={
29989 "modes": ["html2wt"],
29990 "scrubWikitext": false
29991 }
29992 !! html
29993 <table>
29994 <tr><td>a</td></tr>
29995 <tr><td>-</td></tr>
29996 <tr><td>+</td></tr>
29997 </table>
29998 !! wikitext
29999 {|
30000 |a
30001 |-
30002 |<nowiki>-</nowiki>
30003 |-
30004 |<nowiki>+</nowiki>
30005 |}
30006 !! end
30007
30008 !! test
30009 2. Table cells with escapable prefixes
30010 !! options
30011 parsoid={
30012 "modes": ["html2wt"],
30013 "scrubWikitext": true
30014 }
30015 !! html
30016 <table>
30017 <tr><td>a</td></tr>
30018 <tr><td>-</td></tr>
30019 <tr><td>+</td></tr>
30020 </table>
30021 !! wikitext
30022 {|
30023 |a
30024 |-
30025 | -
30026 |-
30027 | +
30028 |}
30029 !! end
30030
30031 !! test
30032 3a. Table cells with escapable prefixes after edits
30033 !! options
30034 parsoid={
30035 "modes": ["selser"],
30036 "scrubWikitext": true,
30037 "changes": [
30038 [ "table tbody tr:first-child td:first-child", "remove"]
30039 ]
30040 }
30041 !! wikitext
30042 {|
30043 |a||-
30044 |}
30045 !! wikitext/edited
30046 {|
30047 | -
30048 |}
30049 !! end
30050
30051 !! test
30052 3b. Table cells with escapable prefixes after edits
30053 !! options
30054 parsoid={
30055 "modes": ["selser"],
30056 "scrubWikitext": true,
30057 "changes": [
30058 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30059 [ "#x", "remove" ]
30060 ]
30061 }
30062 !! wikitext
30063 {|
30064 |pqr
30065 |<span id="x">foo</span>+
30066 |}
30067 !! wikitext/edited
30068 {|
30069 | -
30070 | +
30071 |}
30072 !! end
30073
30074 # FIXME: This test will fail because
30075 # normalization doesn't realize that the id attribute
30076 # will eliminate the escapable scenario
30077 !! test
30078 4a. Table cells without escapable prefixes after edits
30079 !! options
30080 parsoid={
30081 "modes": ["selser"],
30082 "scrubWikitext": true,
30083 "changes": [
30084 [ "#x", "html", "-" ]
30085 ]
30086 }
30087 !! wikitext
30088 {|
30089 | id="x" |abcd
30090 |}
30091 !! wikitext/edited
30092 {|
30093 | id="x" |-
30094 |}
30095 !! end
30096
30097 ## This tests normalizer's ability to discriminate between
30098 ## cells having identical content.
30099 !! test
30100 4b. Table cells without escapable prefixes after edits
30101 !! options
30102 parsoid={
30103 "modes": ["selser"],
30104 "scrubWikitext": true,
30105 "changes": [
30106 [ "td", "html", "-" ]
30107 ]
30108 }
30109 !! wikitext
30110 {|
30111 |a||b
30112 |}
30113 !! wikitext/edited
30114 {|
30115 | -||-
30116 |}
30117 !! end
30118
30119 ## This tests normalizer's ability to not be tripped by
30120 ## comments (and whitespace)
30121 !! test
30122 4c. Table cells without escapable prefixes after edits
30123 !! options
30124 parsoid={
30125 "modes": ["selser"],
30126 "scrubWikitext": true,
30127 "changes": [
30128 [ "table tbody tr td:first-child", "remove" ]
30129 ]
30130 }
30131 !! wikitext
30132 {|
30133 |-
30134 <!--foo--> |a||-
30135 |}
30136 !! wikitext/edited
30137 {|
30138 |-
30139 <!--foo--> | -
30140 |}
30141 !! end
30142
30143 ## This tests normalizer's ability to handle HTML cells
30144 !! test
30145 4d. Table cells without escapable prefixes after edits
30146 !! options
30147 parsoid={
30148 "modes": ["selser"],
30149 "scrubWikitext": true,
30150 "changes": [
30151 [ "td", "html", "-" ]
30152 ]
30153 }
30154 !! wikitext
30155 <table>
30156 <tr><td>a</td></tr>
30157 </table>
30158 !! wikitext/edited
30159 <table>
30160 <tr><td>-</td></tr>
30161 </table>
30162 !! end
30163
30164 ## T111151 Remove font elements without attributes
30165 !! test
30166 5a. font tags without attributes should be dropped in scrubWikitext mode
30167 !! options
30168 parsoid={
30169 "modes": ["html2wt"],
30170 "scrubWikitext": true
30171 }
30172 !! html
30173 <font>foo</font>
30174 <font><font>bar</font></font>
30175 <font class="x">boo</font>
30176 !! wikitext
30177 foo
30178 bar
30179 <font class="x">boo</font>
30180 !! end
30181
30182 !! test
30183 5b. font tags should not be dropped without scrubWikitext being enabled
30184 !! options
30185 parsoid={
30186 "modes": ["html2wt"],
30187 "scrubWikitext": false
30188 }
30189 !! html
30190 <font>foo</font>
30191 !! wikitext
30192 <font>foo</font>
30193 !! end
30194
30195 !! test
30196 Escape nowiki DOM elements
30197 !! options
30198 parsoid=html2wt
30199 !! html/parsoid
30200 <nowiki><i>foo</i></nowiki>
30201 !! wikitext
30202 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30203 !! end
30204
30205 # This is meant to be an interim fix while we go about figuring out
30206 # how to not introduce these trailing <nowiki/>s in the first place.
30207 !! test
30208 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30209 !! options
30210 parsoid=html2wt
30211 !! html/parsoid
30212 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30213 y</p>
30214 <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>
30215 <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>
30216 !! wikitext
30217 x
30218 y
30219
30220 {{echo|
30221 1 = <nowiki/>}}
30222
30223 {{echo|
30224 1 = <nowiki/>
30225 }}
30226 !! end
30227
30228 !! test
30229 New list is serialized on newlines
30230 !! options
30231 parsoid=html2wt
30232 !! html/parsoid
30233 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30234 <li>Yesterday</li>
30235 <li>Today</li>
30236 <li>Tomorrow</li>
30237 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30238 !! wikitext
30239 The quick brown fox jumps over the lazy dog.
30240
30241 * Yesterday
30242 * Today
30243 * Tomorrow
30244
30245 The quick onyx goblin jumps over the lazy dwarf.
30246 !! end
30247
30248 !! test
30249 New lists in formatting elements serialized w/o newlines
30250 !! options
30251 parsoid=html2wt
30252 !! html/parsoid
30253 <small>
30254
30255 <ul>
30256 <li>123</li>
30257 </ul>
30258
30259 </small>
30260
30261 <small><ul><li>hi</li></ul></small>
30262 !! wikitext
30263 <small>
30264 * 123
30265 </small>
30266
30267 <small>
30268 * hi
30269 </small>
30270 !! end
30271
30272 !! test
30273 New list in table doesn't need newlines
30274 !! options
30275 parsoid=html2wt
30276 !! html/parsoid
30277 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30278 !! wikitext
30279 {|
30280 |
30281 * test
30282 * 123
30283 |}
30284 !! end
30285
30286 # ---------------------------------------------------
30287 # End of tests spec'ing wikitext serialization norms |
30288 # ---------------------------------------------------
30289
30290 # T104032
30291 !! test
30292 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30293 !! options
30294 parsoid=html2wt
30295 !! html/parsoid
30296 a<p>b</p>
30297 <b>c</b><p>d</p>
30298 <table><tr>
30299 <td>a<p>b</p></td>
30300 <td><b>c</b><p>d</p></td>
30301 </tr></table>
30302 !! wikitext
30303 a
30304
30305 b
30306
30307 '''c'''
30308
30309 d
30310 {|
30311 |a
30312 b
30313 |'''c'''
30314 d
30315 |}
30316 !! end
30317
30318 !! test
30319 Anchor without href scenarios
30320 !! options
30321 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30322 !! html/parsoid
30323 <a class="bc"></a>
30324 <a class="no">dice</a>
30325 <a name="foo"></a>
30326 !! wikitext
30327
30328 dice
30329 <span name="foo"></span>
30330 !! end
30331
30332 !! test
30333 New transclusion added after a list should be serialized after the list
30334 !! options
30335 parsoid=html2wt
30336 !! html/parsoid
30337 <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>
30338 !! wikitext
30339 * a
30340 {{echo|foo}}
30341 !! end
30342
30343 # -----------------------------------------------------------------
30344 # End of section for Parsoid-only html2wt tests for serialization
30345 # of new content
30346 # -----------------------------------------------------------------
30347
30348 # -----------------------------------------------------------------
30349 # The following section of tests are primarily to spec behavior of
30350 # the selective serializer. All these tests have manual selser
30351 # changes. The automated selser changes for all tests handle the
30352 # wide variation of changes, but these tests here capture specs
30353 # deterministically.
30354 # ----------------------------------------------------------------
30355
30356 ## T90517
30357 !! test
30358 Selser: New comments should not be lost
30359 !! options
30360 parsoid={
30361 "modes": ["selser"],
30362 "changes": [
30363 [ "#a", "after", "<!--c1-->" ],
30364 [ "#b", "before", "<!--c2-->" ]
30365 ]
30366 }
30367 !! wikitext
30368 <span id="a">a</span>
30369
30370 <span id="b">b</span>
30371 !! wikitext/edited
30372 <span id="a">a</span><!--c1-->
30373
30374 <!--c2--><span id="b">b</span>
30375 !! end
30376
30377 ## T89383
30378 !! test
30379 Selser: Check for validity of DSR before using it
30380 !! options
30381 parsoid={
30382 "modes": ["selser"],
30383 "changes": [
30384 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30385 ]
30386 }
30387 !! wikitext
30388 <span id="a">a</span>
30389 !! wikitext/edited
30390 {{DISPLAYTITLE:foo}}
30391 <span id="a">a</span>
30392 !! end
30393
30394 !! test
30395 1. DOMDiff: Changes to <ref> content should be looked up using id
30396 !! options
30397 parsoid={
30398 "modes": ["selser"],
30399 "changes": [
30400 ["#X", "after", "bar"],
30401 ["#Y", "after", "baz"]
30402 ]
30403 }
30404 !! wikitext
30405 X <ref><span id="X">foo</span></ref>
30406 Y <ref name="a" />
30407 <references>
30408 <ref name="a"><span id="Y">foo</span></ref>
30409 </references>
30410 !! wikitext/edited
30411 X <ref><span id="X">foo</span>bar</ref>
30412 Y <ref name="a" />
30413 <references>
30414 <ref name="a"><span id="Y">foo</span>baz</ref>
30415 </references>
30416 !! end
30417
30418 !! test
30419 2. DOMDiff: Changes to <ref> content should be looked up using id
30420 !! options
30421 parsoid={
30422 "modes": ["selser"],
30423 "changes": [
30424 ["#Z", "after", "bar"]
30425 ]
30426 }
30427 !! wikitext
30428 A <ref>foo bar for a</ref>
30429 B <ref group="X" name="b" />
30430
30431 <references />
30432
30433 <references group="X">
30434 <ref name="b"><span id="Z">foo</span></ref>
30435 </references>
30436 !! wikitext/edited
30437 A <ref>foo bar for a</ref>
30438 B <ref group="X" name="b" />
30439
30440 <references />
30441
30442 <references group="X">
30443 <ref name="b"><span id="Z">foo</span>bar</ref>
30444 </references>
30445 !! end
30446
30447 !! test
30448 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30449 !! options
30450 parsoid={
30451 "modes": ["selser"],
30452 "changes": [
30453 [ "div:first-child", "text", "bar" ]
30454 ]
30455 }
30456 !! wikitext
30457 <div style="{{1x|color:red;}}%">foo</div>
30458 !! wikitext/edited
30459 <div style="{{1x|color:red;}}%">bar</div>
30460 !! end
30461
30462 !! test
30463 Empty LI (T49673)
30464 !! wikitext
30465 *a
30466 *
30467 *
30468 *b
30469 !! html+tidy
30470 <ul><li>a</li>
30471 <li class="mw-empty-elt"></li>
30472 <li class="mw-empty-elt"></li>
30473 <li>b</li></ul>
30474 !! end
30475
30476 !! test
30477 Thumbnail output
30478 !! wikitext
30479 [[File:Thumb.png|thumb]]
30480 !! html/php+tidy
30481 <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>
30482 !! html/parsoid
30483 <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>
30484 !! end
30485
30486 !! test
30487 unclosed internal link XSS (T137264)
30488 !! wikitext
30489 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30490 !! html/php
30491 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30492 </p>
30493 !! html/parsoid
30494 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30495 !! end
30496
30497 !! test
30498 Validating that <style> isn't eaten by tidy (T167349)
30499 !! options
30500 styletag=1
30501 !! wikitext
30502 <div class="foo">
30503 <style>.foo::before { content: "<foo>"; }</style>
30504 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30505 </div>
30506 !! html/php+tidy
30507 <div class="foo">
30508 <style>.foo::before { content: "<foo>"; }</style>
30509 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30510 </div>
30511 !! end
30512
30513 !! test
30514 Validating that <style> isn't wrapped in a paragraph (T186965)
30515 !! options
30516 styletag=1
30517 !! wikitext
30518 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30519
30520 <style>.foo::before { content: "<foo>"; }</style>
30521
30522 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30523
30524 But if it's on a line with other content, let it be wrapped.
30525
30526 <style>.foo::before { content: "<foo>"; }</style> bar
30527
30528 foo <style>.foo::before { content: "<foo>"; }</style>
30529
30530 foo <style>.foo::before { content: "<foo>"; }</style> bar
30531
30532 And the same if we have non-paragraph-breaking whitespace
30533
30534 foo
30535 <style>.foo::before { content: "<foo>"; }</style>
30536 bar
30537 !! html/php
30538 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30539 </p>
30540 <style>.foo::before { content: "<foo>"; }</style>
30541 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30542 <p>But if it's on a line with other content, let it be wrapped.
30543 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30544 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30545 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30546 </p><p>And the same if we have non-paragraph-breaking whitespace
30547 </p><p>foo
30548 <style>.foo::before { content: "<foo>"; }</style>
30549 bar
30550 </p>
30551 !! end
30552
30553 !! test
30554 Validating that <link> isn't wrapped in a paragraph (T186965)
30555 !! options
30556 styletag=1
30557 !! wikitext
30558 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30559
30560 <link rel="foo" href="bar"/>
30561
30562 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30563
30564 But if it's on a line with other content, let it be wrapped.
30565
30566 <link rel="foo" href="bar"/> bar
30567
30568 foo <link rel="foo" href="bar"/>
30569
30570 foo <link rel="foo" href="bar"/> bar
30571
30572 And the same if we have non-paragraph-breaking whitespace
30573
30574 foo
30575 <link rel="foo" href="bar"/>
30576 bar
30577 !! html/php
30578 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30579 </p>
30580 <link rel="foo" href="bar"/>
30581 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30582 <p>But if it's on a line with other content, let it be wrapped.
30583 </p><p><link rel="foo" href="bar"/> bar
30584 </p><p>foo <link rel="foo" href="bar"/>
30585 </p><p>foo <link rel="foo" href="bar"/> bar
30586 </p><p>And the same if we have non-paragraph-breaking whitespace
30587 </p><p>foo
30588 <link rel="foo" href="bar"/>
30589 bar
30590 </p>
30591 !! end
30592
30593 !! test
30594 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30595 !! config
30596 wgFragmentMode=[ 'html5', 'legacy' ]
30597 !! wikitext
30598 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30599 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30600 !! html/php
30601 <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>
30602 <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>
30603 </p>
30604 !! html/parsoid
30605 <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>
30606 <p><a rel="mw:WikiLink" href="./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"},"sa":{"href":"#A&amp;B&amp;amp;C&amp;amp;amp;D&amp;amp;amp;amp;E"}}'>#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a></p>
30607 !! end
30608
30609 !! test
30610 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30611 !! config
30612 wgFragmentMode=[ 'legacy' ]
30613 !! wikitext
30614 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30615 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30616 !! html/php
30617 <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>
30618 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30619 </p>
30620 !! end
30621
30622 !! test
30623 Decoding of HTML entities in embedded HTML tags
30624 !! wikitext
30625 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30626 !! html/php
30627 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30628
30629 !! html/parsoid
30630 <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>
30631 !! end
30632
30633 !! test
30634 Decoding of HTML entities in indicator names for IDs (T104196)
30635 !! options
30636 parsoid=wt2html,html2html
30637 showindicators
30638 !! wikitext
30639 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30640 !! html/php
30641 1&2&3&amp;4&amp;amp;5=Indicator
30642
30643 !! html/parsoid
30644 <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>
30645 !! end
30646
30647 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30648 !! test
30649 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30650 !! options
30651 showindicators
30652 !! wikitext
30653 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30654 !! html/php
30655 1&2&3&amp;4&amp;amp;5=Indicator
30656
30657 !! html/parsoid
30658 <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>
30659 !! end
30660
30661 # This fragment mode is what Parsoid supports.
30662 !! test
30663 HTML5 ids: fallback to legacy
30664 !! config
30665 wgFragmentMode=[ 'html5', 'legacy' ]
30666 !! wikitext
30667 ==Foo bar==
30668
30669 ==foo Bar==
30670
30671 ==Тест==
30672
30673 ==Тест==
30674
30675 ==тест==
30676
30677 ==Hey < # " > % : '==
30678 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30679
30680 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30681
30682 <!-- These two links should produce identical HTML -->
30683 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30684
30685 !! html/php
30686 <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>
30687 <ul>
30688 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30689 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30690 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30691 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30692 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30693 <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>
30694 </ul>
30695 </div>
30696
30697 <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>
30698 <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>
30699 <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>
30700 <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>
30701 <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>
30702 <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>
30703 <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>
30704 </p><p>💩 <span id="💩"></span>
30705 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30706 </p>
30707 !! html/parsoid
30708 <h2 id="Foo_bar">Foo bar</h2>
30709
30710 <h2 id="foo_Bar_2">foo Bar</h2>
30711
30712 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30713
30714 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30715
30716 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30717
30718 <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>
30719 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Main_Page#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Main_Page#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Main_Page#тест">#тест</a> <a rel="mw:WikiLink" href="./Main_Page#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Hey_&lt;_#_\"_>_%_:_&#39;"},"sa":{"href":"#Hey &lt; # \" > % : &#39;"}}'>#Hey &lt; # " > % : '</a></p>
30720
30721 <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>
30722
30723 <!-- These two links should produce identical HTML -->
30724 <p><a rel="mw:WikiLink" href="./Main_Page#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Main_Page#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
30725 !! end
30726
30727 # Parsoid doesn't support this mode
30728 !! test
30729 HTML5 ids: legacy with a fallback to modern
30730 !! config
30731 wgFragmentMode=[ 'legacy', 'html5' ]
30732 !! wikitext
30733 ==Foo bar==
30734
30735 ==foo Bar==
30736
30737 ==Тест==
30738
30739 ==Тест==
30740
30741 ==тест==
30742
30743 ==Hey < # " > % : '==
30744 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30745
30746 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30747
30748 <!-- These two links should produce identical HTML -->
30749 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30750
30751 !! html/php
30752 <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>
30753 <ul>
30754 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30755 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30756 <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>
30757 <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>
30758 <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>
30759 <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>
30760 </ul>
30761 </div>
30762
30763 <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>
30764 <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>
30765 <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>
30766 <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>
30767 <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>
30768 <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>
30769 <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>
30770 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30771 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30772 </p>
30773 !! end
30774
30775 # Parsoid doesn't support this mode.
30776 !! test
30777 HTML5 ids: no legacy
30778 !! config
30779 wgFragmentMode=[ 'html5' ]
30780 !! wikitext
30781 ==Foo bar==
30782
30783 ==foo Bar==
30784
30785 ==Тест==
30786
30787 ==Тест==
30788
30789 ==тест==
30790
30791 ==Hey < # " > % : '==
30792 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30793
30794 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30795
30796 <!-- These two links should produce identical HTML -->
30797 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30798
30799 !! html/php
30800 <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>
30801 <ul>
30802 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30803 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30804 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30805 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30806 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30807 <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>
30808 </ul>
30809 </div>
30810
30811 <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>
30812 <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>
30813 <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>
30814 <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>
30815 <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>
30816 <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>
30817 <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>
30818 </p><p>💩 <span id="💩"></span>
30819 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30820 </p>
30821 !! end
30822
30823 !! test
30824 T90902: Normalize weird characters in section IDs
30825 !! config
30826 wgFragmentMode=[ 'html5', 'legacy' ]
30827 !! wikitext
30828 ==Foo&nbsp;bar==
30829 [[#Foo&nbsp;bar]]
30830
30831 !! html/php
30832 <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>
30833 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30834 </p>
30835 !! html/parsoid
30836 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30837 <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
30838 !! end
30839
30840 !! test
30841 T51672: Test for brackets in attributes of elements in external link texts
30842 !! wikitext
30843 [http://example.com/ link <span title="title with [brackets]">span</span>]
30844 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30845
30846 !! html/php
30847 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30848 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30849 </p>
30850 !! html/parsoid
30851 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30852 <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>
30853 !! end
30854
30855 !! test
30856 T72875: Test for brackets in attributes of elements in internal link texts
30857 !! wikitext
30858 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30859 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30860
30861 !! html/php
30862 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30863 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30864 </p>
30865 !! html/parsoid
30866 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30867 <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>
30868 !! end
30869
30870 !! test
30871 T179544: {{anchorencode:}} output should be always usable in links
30872 !! config
30873 wgFragmentMode=[ 'html5' ]
30874 !! wikitext
30875 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30876 !! html/php
30877 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30878 </p>
30879 !! html/parsoid
30880 <p><span id="[foo]" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"id":"[foo]"},"sa":{"id":"{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[10,32,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'></span><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Main_Page#[foo]" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#[foo]"},"sa":{"href":"#{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"#&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[44,66,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt2\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'>#[foo]</a></p>
30881 !! end
30882
30883 ## ------------------------------
30884 ## Parsoid section-wrapping tests
30885 ## ------------------------------
30886 !! test
30887 Section wrapping for well-nested sections (no leading content)
30888 !! options
30889 parsoid={
30890 "wrapSections": true
30891 }
30892 !! wikitext
30893 =1=
30894 a
30895
30896 =2=
30897 b
30898
30899 ==2.1==
30900 c
30901
30902 ==2.2==
30903 d
30904
30905 ===2.2.1===
30906 e
30907
30908 =3=
30909 f
30910 !! html/parsoid
30911 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30912 <p>a</p>
30913
30914 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30915 <p>b</p>
30916
30917 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30918 <p>c</p>
30919
30920 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30921 <p>d</p>
30922
30923 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30924 <p>e</p>
30925
30926 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30927 <p>f</p>
30928
30929 </section>
30930 !! end
30931
30932 !! test
30933 Section wrapping for well-nested sections (with leading content)
30934 !! options
30935 parsoid={
30936 "wrapSections": true
30937 }
30938 !! wikitext
30939 Para 1.
30940
30941 Para 2 with a <div>nested in it</div>
30942
30943 Para 3.
30944
30945 =1=
30946 a
30947
30948 =2=
30949 b
30950
30951 ==2.1==
30952 c
30953 !! html/parsoid
30954 <section data-mw-section-id="0"><p>Para 1.</p>
30955
30956 <p>Para 2 with a </p><div>nested in it</div>
30957
30958 <p>Para 3.</p>
30959
30960 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30961 <p>a</p>
30962
30963 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30964 <p>b</p>
30965
30966 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30967 <p>c</p>
30968
30969 </section></section>
30970 !! end
30971
30972 !! test
30973 Section wrapping with template-generated sections (good nesting 1)
30974 !! options
30975 parsoid={
30976 "wrapSections": true
30977 }
30978 !! wikitext
30979 =1=
30980 a
30981
30982 {{echo|1=
30983 ==1.1==
30984 b
30985 }}
30986
30987 ==1.2==
30988 c
30989
30990 =2=
30991 d
30992 !! html/parsoid
30993 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30994 <p>a</p>
30995
30996 <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">
30997 </span><p about="#mwt1">b</p>
30998 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30999 <p>c</p>
31000
31001 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31002 <p>d</p></section>
31003 !! end
31004
31005 # In this example, the template scope is mildly expanded to incorporate the
31006 # trailing newline after the transclusion since that is part of section 1.1.1
31007 !! test
31008 Section wrapping with template-generated sections (good nesting 2)
31009 !! options
31010 parsoid={
31011 "wrapSections": true,
31012 "modes": ["wt2html", "wt2wt"]
31013 }
31014 !! wikitext
31015 =1=
31016 a
31017
31018 {{echo|1=
31019 ==1.1==
31020 b
31021 ===1.1.1===
31022 d
31023 }}
31024 =2=
31025 e
31026 !! html/parsoid
31027 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31028 <p>a</p>
31029
31030 <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">
31031 </span><p about="#mwt1">b</p><span about="#mwt1">
31032 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31033 </span><p about="#mwt1">d</p><span about="#mwt1">
31034 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31035 <p>e</p></section>
31036 !! end
31037
31038 # In this example, the template scope is mildly expanded to incorporate the
31039 # trailing newline after the transclusion since that is part of section 1.2.1
31040 !! test
31041 Section wrapping with template-generated sections (good nesting 3)
31042 !! options
31043 parsoid={
31044 "wrapSections": true,
31045 "modes": ["wt2html", "wt2wt"]
31046 }
31047 !! wikitext
31048 =1=
31049 a
31050
31051 {{echo|1=
31052 x
31053 ==1.1==
31054 b
31055 ==1.2==
31056 c
31057 ===1.2.1===
31058 d
31059 }}
31060 =2=
31061 e
31062 !! html/parsoid
31063 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31064 <p>a</p>
31065
31066 <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">
31067 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31068 </span><p about="#mwt1">b</p><span about="#mwt1">
31069 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31070 </span><p about="#mwt1">c</p><span about="#mwt1">
31071 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31072 </span><p about="#mwt1">d</p><span about="#mwt1">
31073 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31074 <p>e</p></section>
31075 !! end
31076
31077 # Because of section-wrapping and template-wrapping interactions,
31078 # the scope of the template is expanded so that the template markup
31079 # is valid in the presence of <section> tags.
31080 # This exercises the s1 is null scenario in the wrapSections code
31081 !! test
31082 Section wrapping with template-generated sections (bad nesting 1)
31083 !! options
31084 parsoid={
31085 "wrapSections": true
31086 }
31087 !! wikitext
31088 <div>
31089 a
31090
31091 {{echo|
31092 =1=
31093 b
31094 }}
31095
31096 c
31097 </div>
31098 !! html/parsoid
31099 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31100 <p>a</p>
31101
31102 <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"]}'>
31103 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31104 </span><p about="#mwt1">b
31105 </p><span about="#mwt1">
31106
31107 </span><p about="#mwt1">c</p><span about="#mwt1">
31108 </span></section></div></section>
31109 !! end
31110
31111 # Because of section-wrapping and template-wrapping interactions,
31112 # the scope of the template is expanded so that the template markup
31113 # is valid in the presence of <section> tags.
31114 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31115 !! test
31116 Section wrapping with template-generated sections (bad nesting 2)
31117 !! options
31118 parsoid={
31119 "wrapSections": true
31120 }
31121 !! wikitext
31122 =1=
31123 a
31124
31125 {{echo|1=
31126 =2=
31127 b
31128 ==2.1==
31129 c
31130 }}
31131
31132 d
31133
31134 =3=
31135 e
31136 !! html/parsoid
31137 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31138 <p>a</p>
31139
31140 </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">
31141 </span><p about="#mwt1">b</p><span about="#mwt1">
31142 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31143 </span><p about="#mwt1">c</p><span about="#mwt1">
31144
31145 </span><p about="#mwt1">d</p><span about="#mwt1">
31146
31147 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31148 <p>e</p></section>
31149 !! end
31150
31151 # Because of section-wrapping and template-wrapping interactions,
31152 # additional template wrappers are added to <section> tags
31153 # so that template wrapping semantics are valid whether section
31154 # tags are retained or stripped. But, the template scope can expand
31155 # greatly when accounting for section tags.
31156 # This exercises the s1 and s2 are in different subtrees scenario
31157 !! test
31158 Section wrapping with template-generated sections (bad nesting 3)
31159 !! options
31160 parsoid={
31161 "wrapSections": true,
31162 "modes": ["wt2html", "wt2wt"]
31163 }
31164 !! wikitext
31165 =1=
31166 a
31167
31168 {{echo|1=
31169 ==1.2==
31170 b
31171 =2=
31172 c
31173 }}
31174
31175 d
31176
31177 =3=
31178 e
31179 !! html/parsoid
31180 <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>
31181 <p>a</p>
31182
31183 <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">
31184 </span><p about="#mwt1">b</p><span about="#mwt1">
31185 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31186 </span><p about="#mwt1">c</p>
31187
31188 <p>d</p>
31189 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31190 <p>e</p></section>
31191 !! end
31192
31193 !! test
31194 Section wrapping with uneditable lead section + div wrapping multiple sections
31195 !! options
31196 parsoid={
31197 "wrapSections": true
31198 }
31199 !! wikitext
31200 foo
31201
31202 <div style="border:1px solid red;">
31203 =1=
31204 a
31205
31206 ==1.1==
31207 b
31208
31209 =2=
31210 c
31211 </div>
31212
31213 =3=
31214 d
31215
31216 ==3.1==
31217 e
31218 !! html/parsoid
31219 <section data-mw-section-id="-1"><p>foo</p>
31220
31221 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31222 <section data-mw-section-id="1"><h1 id="1">1</h1>
31223 <p>a</p>
31224
31225 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31226 <p>b</p>
31227
31228 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31229 <p>c</p>
31230 </section></div>
31231
31232 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31233 <p>d</p>
31234
31235 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31236 <p>e</p>
31237 </section></section>
31238 !! end
31239
31240 !! test
31241 Section wrapping with editable lead section + div overlapping multiple sections
31242 !! options
31243 parsoid={
31244 "wrapSections": true
31245 }
31246 !! wikitext
31247 foo
31248
31249 =1=
31250 a
31251 <div style="border:1px solid red;">
31252 b
31253
31254 ==1.1==
31255 c
31256
31257 =2=
31258 d
31259 </div>
31260 e
31261
31262 =3=
31263 f
31264
31265 ==3.1==
31266 g
31267 !! html/parsoid
31268 <section data-mw-section-id="0"><p>foo</p>
31269
31270 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31271 <p>a</p>
31272 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31273 <p>b</p>
31274
31275 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31276 <p>c</p>
31277
31278 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31279 <p>d</p>
31280 </section></div>
31281 <p>e</p>
31282
31283 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31284 <p>f</p>
31285
31286 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31287 <p>g</p>
31288 </section></section>
31289 !! end
31290
31291 !! test
31292 HTML header tags should not be wrapped in section tags
31293 !! options
31294 parsoid={
31295 "wrapSections": true
31296 }
31297 !! wikitext
31298 foo
31299
31300 <h1>a</h1>
31301
31302 =b=
31303
31304 <h1>c</h1>
31305
31306 =d=
31307 !! html/parsoid
31308 <section data-mw-section-id="0"><p>foo</p>
31309
31310 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31311
31312 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31313
31314 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31315
31316 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31317 !! end
31318
31319 !! test
31320 Lead section containing only whitespace and comments.
31321 !! options
31322 parsoid={
31323 "wrapSections": true
31324 }
31325 !! wikitext
31326
31327 <!-- this is a comment, presumably significant to editors -->
31328 =1=
31329 a
31330
31331 =2=
31332 b
31333 !! html/parsoid
31334 <section data-mw-section-id="0" data-parsoid="{}">
31335 <!-- this is a comment, presumably significant to editors -->
31336 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31337 <p>a</p>
31338
31339 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31340 <p>b</p></section>
31341 !! end
31342
31343 !! test
31344 Pseudo-sections emitted by templates should have id -2
31345 !! options
31346 parsoid={
31347 "wrapSections": true
31348 }
31349 !! wikitext
31350 foo
31351 {{echo|<div>
31352 ==a==
31353 ==b==
31354 </div>
31355 }}
31356 !! html/parsoid
31357 <section data-mw-section-id="-1"><p>foo</p>
31358 </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}}]}'>
31359 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31360 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31361 </section></div><span about="#mwt1">
31362 </span></section>
31363 !! end
31364
31365 ##########################################################################
31366 Tests demonstrating white-space insensitivity in input wikitext
31367 for wikitext headings, wikitext list items, and wikitext table captions,
31368 headings, and cells. HTML versions of the same should preserve whitespace.
31369 ##########################################################################
31370 !! test
31371 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31372 !! options
31373 parsoid={
31374 "modes": ["wt2html"],
31375 "preserveIEW": true
31376 }
31377 !! wikitext
31378 __NOTOC__
31379 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31380 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31381 == <!--Headings with fallback ids--> Личная жизнь ==
31382 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31383 ; <!--term to define--> term : <!--term's definition--> definition
31384 {|
31385 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31386 |-
31387 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31388 |-
31389 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31390 |-
31391 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31392 |-
31393 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31394 |}
31395 : {|
31396 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31397 |} foo <!--c1-->
31398 !! html/php+tidy
31399 <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>
31400 <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>
31401 <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>
31402 <ul><li>List item</li></ul>
31403 <dl><dt>term&#160;</dt>
31404 <dd>definition</dd></dl>
31405 <table>
31406 <caption>Table Caption
31407 </caption>
31408 <tbody><tr>
31409 <th>Table Heading 1</th>
31410 <th>Table Heading 2
31411 </th></tr>
31412 <tr>
31413 <td>Table Cell 1</td>
31414 <td>Table Cell 2
31415 </td></tr>
31416 <tr>
31417 <td>class="foo"</td>
31418 <td>Table Cell 3
31419 </td></tr>
31420 <tr>
31421 <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
31422 </td></tr></tbody></table>
31423 <dl><dd><table>
31424 <tbody><tr>
31425 <td>Table Cell 1</td>
31426 <td>Table Cell 2
31427 </td></tr></tbody></table> foo</dd></dl>
31428 !! html/parsoid
31429 <meta property="mw:PageProp/notoc">
31430 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31431 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31432 <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>
31433 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31434 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31435 <table>
31436 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31437 <tbody><tr>
31438 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31439 <tr>
31440 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31441 <tr>
31442 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31443 <tr>
31444 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31445 </tbody></table>
31446 <dl><dd><table>
31447 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31448 </tbody></table> foo<!--c1--></dd></dl>
31449 !! end
31450
31451 # Looks like <caption> is not accepted in HTML
31452 !! test
31453 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31454 !! options
31455 parsoid={
31456 "modes": ["wt2html"],
31457 "preserveIEW": true
31458 }
31459 !! wikitext
31460 __NOTOC__
31461 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31462 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31463 <table>
31464 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31465 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31466 </table>
31467 !! html/php+tidy
31468 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31469 <ul><li> List item </li></ul>
31470 <table>
31471 <tbody><tr><th> Table Heading </th><th></th></tr>
31472 <tr><td> Table Cell </td><th></th></tr>
31473 </tbody></table>
31474 !! html/parsoid
31475 <meta property="mw:PageProp/notoc"/>
31476 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31477 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31478 <table>
31479 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31480 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31481 </tbody></table>
31482 !! end
31483
31484 !! test
31485 Do not trim whitespace in links and quotes
31486 !! options
31487 parsoid={
31488 "modes": ["wt2html"],
31489 "preserveIEW": true
31490 }
31491 !! wikitext
31492 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31493 [[Foo| some text ]]
31494 !! html/php+tidy
31495 <p>foo <i> italic </i> and <b> bold </b>
31496 <a href="/wiki/Foo" title="Foo"> some text </a>
31497 </p>
31498 !! html/parsoid
31499 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31500 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31501 !! end
31502
31503 !! test
31504 Remove p tags surrounding a single element in a figcaption
31505 !! options
31506 parsoid=html2wt
31507 !! wikitext
31508 [[File:Foobar.jpg|right|200x200px|Caption]]
31509 !! html/parsoid
31510 <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>
31511 !! end
31512
31513 !! test
31514 Selser preserves lack of newline before list and allows newline after the list
31515 !! options
31516 parsoid={
31517 "modes": ["selser"],
31518 "scrubWikitext": true,
31519 "changes": [
31520 [ "ul", "after", "<p>footer</p>" ]
31521 ]
31522 }
31523 !! wikitext
31524 header
31525 *foo
31526 *bar
31527 !! wikitext/edited
31528 header
31529 *foo
31530 *bar
31531
31532 footer
31533 !! end
31534
31535
31536 !! test
31537 Selser does not introduce newlines between unedited paragraph preceding the list
31538 !! options
31539 parsoid={
31540 "modes": ["selser"],
31541 "changes": [
31542 [ "table tbody tr td p:last-child", "empty" ]
31543 ]
31544 }
31545 !! wikitext
31546 {|
31547 |
31548 header
31549 *foo
31550 *bar
31551 footer
31552 |}
31553 !! wikitext/edited
31554 {|
31555 |
31556 header
31557 *foo
31558 *bar
31559
31560 |}
31561 !! end
31562
31563 !! test
31564 Selser does not introduce newlines between unedited paragraph following the list
31565 !! options
31566 parsoid={
31567 "modes": ["selser"],
31568 "changes": [
31569 [ "table tbody tr td p:first-child", "empty" ]
31570 ]
31571 }
31572 !! wikitext
31573 {|
31574 |
31575 header
31576 *foo
31577 *bar
31578 footer
31579 |}
31580 !! wikitext/edited
31581 {|
31582 |
31583
31584 *foo
31585 *bar
31586 footer
31587 |}
31588 !! end
31589
31590 !! test
31591 Remove a list item but do not insert newline above list
31592 !! options
31593 parsoid={
31594 "modes": ["selser"],
31595 "changes": [
31596 [ "ul li:last-child", "remove" ]
31597 ]
31598 }
31599 !! wikitext
31600 header
31601 *foo
31602 *bar
31603 footer
31604 !! wikitext/edited
31605 header
31606 *foo
31607 footer
31608 !! end