Accept BCP 47 codes in LanguageConverter rules
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:redirect to foo
67 !! text
68 #REDIRECT [[Template:Foo]]
69 !! endarticle
70
71 !! article
72 Template:Blank
73 !! text
74 !! endarticle
75
76 !! article
77 Template:pipe
78 !! text
79 |
80 !! endarticle
81
82 !! article
83 Template:=
84 !! text
85 <nowiki>=</nowiki>
86 !! endarticle
87
88 !!article
89 MediaWiki:bad image list
90 !!text
91 * [[File:Bad.jpg]] except [[Nasty page]]
92 !!endarticle
93
94 !! article
95 Template:inner list
96 !! text
97 * item 1
98 !! endarticle
99
100 !! article
101 Template:tbl-start
102 !! text
103 {|
104 !! endarticle
105
106 !! article
107 Template:tbl-end
108 !! text
109 |}
110 !! endarticle
111
112 !! article
113 Template:echo
114 !! text
115 {{{1}}}
116 !! endarticle
117
118 !! article
119 Template:echo3
120 !! text
121 {{{1}}}
122 {{{1}}}
123 {{{1}}}
124 !! endarticle
125
126 // For Serbian; localize Template namespace
127 !! article
128 Шаблон:Echo
129 !! text
130 {{{1}}}
131 !! endarticle
132
133 !! article
134 Template:echo_with_span
135 !! text
136 <span>{{{1}}}</span>
137 !! endarticle
138
139 !! article
140 Template:echo_with_div
141 !! text
142 <div>{{{1}}}</div>
143 !! endarticle
144
145 !! article
146 Template:echo with depth
147 !! text
148 {{echo|{{{1}}}}}
149 !! endarticle
150
151 !! article
152 Template:blank_param
153 !! text
154 {{{1}}}
155 {{{}}}
156 !! endarticle
157
158 !! article
159 Template:table_attribs
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"|Foo
163 !! endarticle
164
165 !! article
166 Template:table_attribs_2
167 !! text
168 <noinclude>
169 |</noinclude>style="color:red;"|Foo
170 |Bar||Baz
171 !! endarticle
172
173 !! article
174 Template:table_attribs_3
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
178 !! endarticle
179
180 !! article
181 Template:table_attribs_4
182 !! text
183 | style="background-color:#DC241f;" width="10px" |
184 !! endarticle
185
186 !! article
187 Template:table_attribs_5
188 !! text
189 <noinclude>
190 |</noinclude>style="color:red;"||Bar
191 !! endarticle
192
193 !! article
194 Template:table_attribs_6
195 !! text
196 style="background: <nowiki>
197
198
199 red;</nowiki>" |
200 !! endarticle
201
202 !! article
203 Template:table_attribs_7
204 !! text
205 <noinclude>
206 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
207 !! endarticle
208
209 !! article
210 Template:table_header_cells
211 !! text
212 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
213 !! endarticle
214
215 !! article
216 Template:table_cells
217 !! text
218 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:PartialTable
223 !! text
224 {|
225 |-
226 !! endarticle
227
228 !! article
229 Template:image_attribs
230 !! text
231 <noinclude>
232 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
233 !! endarticle
234
235 ## See T48811 for details
236 !! article
237 Template:mixed_attr_content_template
238 !! text
239 style="color:red;" title="T48811"
240 |-
241 |foo
242 !! endarticle
243
244 !! article
245 Template:definition_list
246 !! text
247 one
248 ::two
249 !! endarticle
250
251 !! article
252 A?b
253 !! text
254 Weirdo titles!
255 !! endarticle
256
257 !!article
258 Template:Bullet
259 !!text
260 *Bar
261 !!endarticle
262
263 !!article
264 Template:OpenTable
265 !!text
266 {|
267 !!endarticle
268
269 !!article
270 Template:EmptyLITest
271 !!text
272 *a
273 *
274 *
275 *b
276 !!endarticle
277
278 !!article
279 Template:EmptyTRTest
280 !!text
281 {|
282 |-
283 |-
284 |foo
285 |-
286 |-
287 |bar
288 |}
289 !!endarticle
290
291 !!article
292 Template:EmptyTRWithHTMLAttrTest
293 !!text
294 <table>
295 <tr align="center"></tr>
296 <tr><td>foo</td></tr>
297 <tr align="center"></tr>
298 <tr><td>bar</td></tr>
299 </table>
300 !!endarticle
301
302 !! article
303 Template:With: Colon
304 !! text
305 Template with colon
306 !! endarticle
307
308 ###
309 ### Basic tests
310 ###
311
312 !! test
313 Blank input
314 !! wikitext
315 !! html
316 !! end
317
318 !! test
319 Simple paragraph
320 !! wikitext
321 This is a simple paragraph.
322 !! html
323 <p>This is a simple paragraph.
324 </p>
325 !! end
326
327 !! test
328 Paragraphs with extra newline spacing
329 !! wikitext
330 a
331
332 b (+2 nls)
333
334
335 c (+3 nls)
336
337
338
339 d (+4 nls)
340
341
342
343
344 e (+5 nls)
345 !! html
346 <p>a
347 </p><p>b (+2 nls)
348 </p><p><br />
349 c (+3 nls)
350 </p><p><br />
351 </p><p>d (+4 nls)
352 </p><p><br />
353 </p><p><br />
354 e (+5 nls)
355 </p>
356 !! end
357
358 !! test
359 Paragraphs with newline spacing with comment lines in between
360 !! wikitext
361 ----
362 a
363 <!--foo-->
364 b
365 ----
366 a
367 <!--foo--><!--More than 1 comment, still stripped-->
368 b
369 ----
370 a
371 <!--foo--> <!----> <!-- bar -->
372 b
373 ----
374 a
375 <!--foo-->
376
377 b
378 ----
379 a
380
381 <!--foo-->
382 b
383 ----
384 a
385 <!--foo-->
386
387
388 b
389 ----
390 a
391
392
393 <!--foo-->
394 b
395 ----
396 !! html
397 <hr />
398 <p>a
399 b
400 </p>
401 <hr />
402 <p>a
403 b
404 </p>
405 <hr />
406 <p>a
407 b
408 </p>
409 <hr />
410 <p>a
411 </p><p>b
412 </p>
413 <hr />
414 <p>a
415 </p><p>b
416 </p>
417 <hr />
418 <p>a
419 </p><p><br />
420 b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br />
425 b
426 </p>
427 <hr />
428
429 !! end
430
431 !! test
432 Paragraphs with newline spacing with non-empty white-space lines in between
433 !! wikitext
434 ----
435 a
436
437 b
438 ----
439 a
440
441
442 b
443 ----
444 !! html
445 <hr />
446 <p>a
447 </p><p>b
448 </p>
449 <hr />
450 <p>a
451 </p><p><br />
452 b
453 </p>
454 <hr />
455
456 !! end
457
458 !! test
459 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
460 !! wikitext
461 ----
462 a
463 <!--foo-->
464 b
465 ----
466 a
467 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
468 b
469 ----
470 a
471
472 <!--foo-->
473 <!--bar-->
474 b
475 ----
476 a
477
478 <!--foo-->
479 <!--bar-->
480
481 b
482 ----
483 !! html
484 <hr />
485 <p>a
486 b
487 </p>
488 <hr />
489 <p>a
490 b
491 </p>
492 <hr />
493 <p>a
494 </p><p>b
495 </p>
496 <hr />
497 <p>a
498 </p><p><br />
499 b
500 </p>
501 <hr />
502
503 !! end
504
505 !! test
506 Extra newlines: More paragraphs with indented comment
507 !! wikitext
508 a
509
510 <!--boo-->
511
512 b
513 !! html
514 <p>a
515 </p><p><br />
516 b
517 </p>
518 !!end
519
520 !! test
521 Extra newlines followed by heading
522 !! wikitext
523 a
524
525
526 =b=
527 [[a]]
528
529
530 =b=
531 !! html
532 <p>a
533 </p><p><br />
534 </p>
535 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
536 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
537 </p><p><br />
538 </p>
539 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
540
541 !! end
542
543 !! test
544 Extra newlines between heading and content are swallowed (Parsoid does not)
545 !! wikitext
546 =b=
547
548
549
550 [[a]]
551 !! html/php+tidy
552 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
553 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
554 </p>
555 !! html/parsoid
556 <h1 id="b">b</h1>
557 <p>
558 <br></p>
559
560 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
561 !! end
562
563 !! test
564 Extra new lines before and after lists are preserved
565 !! wikitext
566 a
567
568
569 *b
570
571
572 c
573 !! html/php+tidy
574 <p>a
575 </p><p><br />
576 </p>
577 <ul><li>b</li></ul>
578 <p><br />
579 c
580 </p>
581 !! html/parsoid
582 <p>a</p>
583 <p>
584 <br></p>
585 <ul><li>b</li></ul>
586 <p>
587 <br>
588 c</p>
589 !! end
590
591 # Parsoid regression test
592 !!test
593 Multiple newlines after tables are converted to p-br-p tags
594 !!options
595 parsoid=wt2html,wt2wt
596 !!wikitext
597 {|
598 |x
599 |}
600
601
602
603
604 =b=
605 !!html/php+tidy
606 <table>
607 <tbody><tr>
608 <td>x
609 </td></tr></tbody></table>
610 <p><br />
611 </p><p><br />
612 </p>
613 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
614 !!html/parsoid
615 <table>
616 <tbody>
617 <tr>
618 <td>x</td>
619 </tr>
620 </tbody>
621 </table>
622 <p><br/></p>
623 <p><br/></p>
624 <h1 id="b">b</h1>
625 !!end
626
627 !! test
628 Heading with line break in nowiki
629 !! options
630 parsoid=wt2html
631 !! config
632 wgFragmentMode=[ 'html5', 'legacy' ]
633 !! wikitext
634 ==A <nowiki>B
635 C</nowiki>==
636 !! html/php
637 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
638 C">A B
639 C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
640
641 !! html/parsoid
642 <h2 id="A_B
643 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
644 C</span></h2>
645 !! end
646
647 !! test
648 Parsing an URL
649 !! wikitext
650 http://fr.wikipedia.org/wiki/🍺
651 <!-- EasterEgg we love beer, better be able be able to link to it -->
652 !! html
653 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
654 </p>
655 !! end
656
657 !! test
658 Simple list
659 !! wikitext
660 *Item 1
661 *Item 2
662 !! html
663 <ul><li>Item 1</li>
664 <li>Item 2</li></ul>
665
666 !! end
667
668 !! test
669 Italics and bold
670 !! wikitext
671 *plain
672 *plain''italic''plain
673 *plain''italic''plain''italic''plain
674 *plain'''bold'''plain
675 *plain'''bold'''plain'''bold'''plain
676 *plain''italic''plain'''bold'''plain
677 *plain'''bold'''plain''italic''plain
678 *plain''italic'''bold-italic'''italic''plain
679 *plain'''bold''bold-italic''bold'''plain
680 *plain'''''bold-italic'''italic''plain
681 *plain'''''bold-italic''bold'''plain
682 *plain''italic'''bold-italic'''''plain
683 *plain'''bold''bold-italic'''''plain
684 *plain l'''italic''plain
685 *plain l''''bold''' plain
686 !! html
687 <ul><li>plain</li>
688 <li>plain<i>italic</i>plain</li>
689 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
690 <li>plain<b>bold</b>plain</li>
691 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
692 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
693 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
694 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
695 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
696 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
697 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
698 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
699 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
700 <li>plain l'<i>italic</i>plain</li>
701 <li>plain l'<b>bold</b> plain</li></ul>
702
703 !! end
704
705 # this example taken from the [[simple:Moon]] article (T49326)
706 !! test
707 Italics and possessives (1)
708 !! wikitext
709 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
710 !! html
711 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
712 </p>
713 !! end
714
715 # this example taken from [[en:Flaming Pie]] (T51926)
716 !! test
717 Italics and possessives (2)
718 !! wikitext
719 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
720 !! html
721 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
722 </p>
723 !! end
724
725 # this example taken from [[en:Dictionary]] (T51926)
726 !! test
727 Italics and possessives (3)
728 !! wikitext
729 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
730 !! html
731 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
732 </p>
733 !! end
734
735
736 ###
737 ### 2-quote opening sequence tests
738 ###
739 !! test
740 Italics and bold: 2-quote opening sequence: (2,2)
741 !! wikitext
742 ''foo''
743 !! html
744 <p><i>foo</i>
745 </p>
746 !!end
747
748 !! test
749 Italics and bold: 2-quote opening sequence: (2,3)
750 !! wikitext
751 ''foo'''
752 !! html/*
753 <p><i>foo'</i>
754 </p>
755 !!end
756
757 !! test
758 Italics and bold: 2-quote opening sequence: (2,4)
759 !! options
760 parsoid=wt2html
761 !! wikitext
762 ''foo''''
763 !! html/*
764 <p><i>foo''</i>
765 </p>
766 !!end
767
768 # same html as previous, but wikitext adjusted to match parsoid html2wt
769 !! test
770 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
771 !! wikitext
772 ''foo<nowiki>''</nowiki>''
773 !! html
774 <p><i>foo''</i>
775 </p>
776 !! end
777
778 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
779 !! test
780 Italics and bold: 2-quote opening sequence: (2,5)
781 !! options
782 parsoid=wt2html
783 !! wikitext
784 ''foo'''''
785 !! html/php
786 <p><i>foo</i>
787 </p>
788 !! html/parsoid
789 <p><i>foo</i><b></b>
790 </p>
791 !!end
792
793 # same html as previous, but wikitext adjusted to match parsoid html2wt
794 !! test
795 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
796 !! wikitext
797 ''foo'''''<nowiki/>'''
798 !! html/php
799 <p><i>foo</i>
800 </p>
801 !! html/parsoid
802 <p><i>foo</i><b></b>
803 </p>
804 !! end
805
806
807 ###
808 ### 3-quote opening sequence tests
809 ###
810
811 !! test
812 Italics and bold: 3-quote opening sequence: (3,2)
813 !! wikitext
814 '''foo''
815 !! html/*
816 <p>'<i>foo</i>
817 </p>
818 !!end
819
820 !! test
821 Italics and bold: 3-quote opening sequence: (3,3)
822 !! wikitext
823 '''foo'''
824 !! html
825 <p><b>foo</b>
826 </p>
827 !!end
828
829 !! test
830 Italics and bold: 3-quote opening sequence: (3,4)
831 !! wikitext
832 '''foo''''
833 !! html/*
834 <p><b>foo'</b>
835 </p>
836 !!end
837
838 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
839 !! test
840 Italics and bold: 3-quote opening sequence: (3,5)
841 !! options
842 parsoid=wt2html
843 !! wikitext
844 '''foo'''''
845 !! html/php
846 <p><b>foo</b>
847 </p>
848 !! html/parsoid
849 <p><b>foo</b><i></i>
850 </p>
851 !!end
852
853 # same html as previous, but wikitext adjusted to match parsoid html2wt
854 !! test
855 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
856 !! wikitext
857 '''foo'''''<nowiki/>''
858 !! html/php
859 <p><b>foo</b>
860 </p>
861 !! html/parsoid
862 <p><b>foo</b><i></i>
863 </p>
864 !! end
865
866
867 ###
868 ### 4-quote opening sequence tests
869 ###
870
871 !! test
872 Italics and bold: 4-quote opening sequence: (4,2)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 ''''foo''
877 !! html/*
878 <p>''<i>foo</i>
879 </p>
880 !!end
881
882 # same html as previous, but wikitext adjusted to match parsoid html2wt
883 !! test
884 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
885 !! wikitext
886 <nowiki>''</nowiki>''foo''
887 !! html
888 <p>''<i>foo</i>
889 </p>
890 !! end
891
892 !! test
893 Italics and bold: 4-quote opening sequence: (4,3)
894 !! wikitext
895 ''''foo'''
896 !! html/*
897 <p>'<b>foo</b>
898 </p>
899 !!end
900
901 !! test
902 Italics and bold: 4-quote opening sequence: (4,4)
903 !! options
904 parsoid=wt2html
905 !! wikitext
906 ''''foo''''
907 !! html/*
908 <p>'<b>foo'</b>
909 </p>
910 !!end
911
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
915 !! wikitext
916 '<nowiki/>'''foo''''
917 !! html
918 <p>'<b>foo'</b>
919 </p>
920 !! end
921
922 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
923 !! test
924 Italics and bold: 4-quote opening sequence: (4,5)
925 !! options
926 parsoid=wt2html
927 !! wikitext
928 ''''foo'''''
929 !! html/php
930 <p>'<b>foo</b>
931 </p>
932 !! html/parsoid
933 <p>'<b>foo</b><i></i>
934 </p>
935 !!end
936
937 # same html as previous, but wikitext adjusted to match parsoid html2wt
938 !! test
939 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
940 !! wikitext
941 '<nowiki/>'''foo'''''<nowiki/>''
942 !! html/php
943 <p>'<b>foo</b>
944 </p>
945 !! html/parsoid
946 <p>'<b>foo</b><i></i>
947 </p>
948 !! end
949
950
951 ###
952 ### 5-quote opening sequence tests
953 ###
954
955 !! test
956 Italics and bold: 5-quote opening sequence: (5,2)
957 !! options
958 parsoid=wt2html
959 !! wikitext
960 '''''foo''
961 !! html/*
962 <p><b><i>foo</i></b>
963 </p>
964 !!end
965
966 # same html as previous, but wikitext adjusted to match parsoid html2wt
967 !! test
968 Italics and bold: 5-quote opening sequence: (5,2+3)
969 !! wikitext
970 '''''foo'''''
971 !! html/*
972 <p><i><b>foo</b></i>
973 </p>
974 !! end
975
976 !! test
977 Italics and bold: 5-quote opening sequence: (5,3)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''''foo'''
982 !! html/*
983 <p><i><b>foo</b></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: 5-quote opening sequence: (5,3+2)
990 !! wikitext
991 '''''foo'''''
992 !! html
993 <p><i><b>foo</b></i>
994 </p>
995 !! end
996
997 !! test
998 Italics and bold: 5-quote opening sequence: (5,4)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''''foo''''
1003 !! html/*
1004 <p><i><b>foo'</b></i>
1005 </p>
1006 !!end
1007
1008 !! test
1009 Italics and bold: 5-quote opening sequence: (5,5)
1010 !! wikitext
1011 '''''foo'''''
1012 !! html
1013 <p><i><b>foo</b></i>
1014 </p>
1015 !!end
1016
1017 !! test
1018 Italics and bold: 5-quote opening sequence: (5,6)
1019 !! wikitext
1020 '''''foo''''''
1021 !! html/*
1022 <p><i><b>foo'</b></i>
1023 </p>
1024 !! end
1025
1026 ###
1027 ### multiple quote sequences in a line
1028 ###
1029
1030 !! test
1031 Italics and bold: multiple quote sequences: (2,4,2)
1032 !! options
1033 parsoid=wt2html
1034 !! wikitext
1035 ''foo''''bar''
1036 !! html/*
1037 <p><i>foo'<b>bar</b></i>
1038 </p>
1039 !! end
1040
1041 # same html as previous, but wikitext adjusted to match parsoid html2wt
1042 !! test
1043 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1044 !! wikitext
1045 ''foo'<nowiki/>'''bar'''''
1046 !! html
1047 <p><i>foo'<b>bar</b></i>
1048 </p>
1049 !! end
1050
1051 !! test
1052 Italics and bold: multiple quote sequences: (2,4,3)
1053 !! options
1054 parsoid=wt2html
1055 !! wikitext
1056 ''foo''''bar'''
1057 !! html/*
1058 <p><i>foo'<b>bar</b></i>
1059 </p>
1060 !! end
1061
1062 # same html as previous, but wikitext adjusted to match parsoid html2wt
1063 !! test
1064 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1065 !! wikitext
1066 ''foo'<nowiki/>'''bar'''''
1067 !! html
1068 <p><i>foo'<b>bar</b></i>
1069 </p>
1070 !! end
1071
1072 !! test
1073 Italics and bold: multiple quote sequences: (2,4,4)
1074 !! options
1075 parsoid=wt2html
1076 !! wikitext
1077 ''foo''''bar''''
1078 !! html/*
1079 <p><i>foo'<b>bar'</b></i>
1080 </p>
1081 !! end
1082
1083 # same html as previous, but wikitext adjusted to match parsoid html2wt
1084 !! test
1085 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1086 !! wikitext
1087 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1088 !! html
1089 <p><i>foo'<b>bar'</b></i>
1090 </p>
1091 !! end
1092
1093 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1094 !! test
1095 Italics and bold: multiple quote sequences: (3,4,2)
1096 !! options
1097 parsoid=wt2html
1098 !! wikitext
1099 '''foo''''bar''
1100 !! html/php
1101 <p><b>foo'</b>bar
1102 </p>
1103 !! html/parsoid
1104 <p><b>foo'</b>bar<i></i>
1105 </p>
1106 !! end
1107
1108 # same html as previous, but wikitext adjusted to match parsoid html2wt
1109 !! test
1110 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1111 !! wikitext
1112 '''foo''''bar''<nowiki/>''
1113 !! html/php
1114 <p><b>foo'</b>bar
1115 </p>
1116 !! html/parsoid
1117 <p><b>foo'</b>bar<i></i>
1118 </p>
1119 !! end
1120
1121 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1122 !! test
1123 Italics and bold: multiple quote sequences: (3,4,3)
1124 !! options
1125 parsoid=wt2html
1126 !! wikitext
1127 '''foo''''bar'''
1128 !! html/php
1129 <p><b>foo'</b>bar
1130 </p>
1131 !! html/parsoid
1132 <p><b>foo'</b>bar<b></b>
1133 </p>
1134 !! end
1135
1136 # same html as previous, but wikitext adjusted to match parsoid html2wt
1137 !! test
1138 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1139 !! wikitext
1140 '''foo''''bar'''<nowiki/>'''
1141 !! html/php
1142 <p><b>foo'</b>bar
1143 </p>
1144 !! html/parsoid
1145 <p><b>foo'</b>bar<b></b>
1146 </p>
1147 !! end
1148
1149 ###
1150 ### other quote tests
1151 ###
1152 !! test
1153 Italics and bold: other quote tests: (2,3,5)
1154 !! wikitext
1155 ''this is about '''foo's family'''''
1156 !! html
1157 <p><i>this is about <b>foo's family</b></i>
1158 </p>
1159 !!end
1160
1161
1162 !! test
1163 Italics and bold: other quote tests: (2,(3,3),2)
1164 !! wikitext
1165 ''this is about '''foo's''' family''
1166 !! html
1167 <p><i>this is about <b>foo's</b> family</i>
1168 </p>
1169 !!end
1170
1171
1172 !! test
1173 Italics and bold: other quote tests: (3,2,3,2)
1174 !! options
1175 parsoid=wt2html
1176 !! wikitext
1177 '''this is about ''foo'''s family''
1178 !! html/*
1179 <p><b>this is about <i>foo</i></b><i>s family</i>
1180 </p>
1181 !!end
1182
1183
1184 # same html as previous, but wikitext adjusted to match parsoid html2wt
1185 !! test
1186 Italics and bold: other quote tests: (3,2,3+2+2,2)
1187 !! wikitext
1188 '''this is about ''foo'''''<nowiki/>''s family''
1189 !! html
1190 <p><b>this is about <i>foo</i></b><i>s family</i>
1191 </p>
1192 !! end
1193
1194
1195 !! test
1196 Italics and bold: other quote tests: (3,2,3,3)
1197 !! wikitext
1198 '''this is about ''foo'''s family'''
1199 !! html/*
1200 <p>'<i>this is about </i>foo<b>s family</b>
1201 </p>
1202 !!end
1203
1204
1205 !! test
1206 Italics and bold: other quote tests: (3,(2,2),3)
1207 !! wikitext
1208 '''this is about ''foo's'' family'''
1209 !! html
1210 <p><b>this is about <i>foo's</i> family</b>
1211 </p>
1212 !!end
1213
1214
1215 !! test
1216 Italicized possessive
1217 !! wikitext
1218 The ''[[Main Page]]'''s talk page.
1219 !! html/php
1220 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1221 </p>
1222 !! html/parsoid
1223 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1224 !! end
1225
1226 !! test
1227 Quote balancing context should be restricted to td/th cells on the same wikitext line
1228 !! options
1229 parsoid=wt2html,wt2wt
1230 !! wikitext
1231 {|
1232 !''a!!''b
1233 |''a||''b
1234 |}
1235 !! html+tidy
1236 <table>
1237 <tbody><tr>
1238 <th><i>a</i></th>
1239 <th><i>b</i>
1240 </th>
1241 <td><i>a</i></td>
1242 <td><i>b</i>
1243 </td></tr></tbody></table>
1244 !! end
1245
1246 ###
1247 ### Non-html5 tags
1248 ###
1249
1250 !! test
1251 Non-html5 tags should be accepted
1252 !! wikitext
1253 <center>''foo''</center>
1254 <big>''foo''</big>
1255 <font>''foo''</font>
1256 <strike>''foo''</strike>
1257 <tt>''foo''</tt>
1258 !! html
1259 <center><i>foo</i></center>
1260 <p><big><i>foo</i></big>
1261 <font><i>foo</i></font>
1262 <strike><i>foo</i></strike>
1263 <tt><i>foo</i></tt>
1264 </p>
1265 !! end
1266
1267 !! test
1268 <wbr> is valid wikitext (T54468)
1269 !! wikitext
1270 <wbr>
1271 !! html
1272 <p><wbr />
1273 </p>
1274 !! end
1275
1276 # <strike> is HTML4, <s> is HTML4/5.
1277 !! test
1278 <s> or <strike> for strikethrough
1279 !! wikitext
1280 <strike>strike</strike>
1281
1282 <s>s</s>
1283 !! html
1284 <p><strike>strike</strike>
1285 </p><p><s>s</s>
1286 </p>
1287 !! end
1288
1289 ## a not permitted
1290 ## i,b,br omitted
1291 !! test
1292 Text-level semantic html elements in wikitext
1293 !! wikitext
1294 <em>text</em>
1295 <strong>text</strong>
1296 <small>text</small>
1297 <s>text</s>
1298 <cite>text</cite>
1299 <q>text</q>
1300 <dfn>text</dfn>
1301 <abbr>text</abbr>
1302 <data>text</data>
1303 <time>text</time>
1304 <code>text</code>
1305 <var>text</var>
1306 <samp>text</samp>
1307 <kbd>text</kbd>
1308 <sub>text</sub>
1309 <u>text</u>
1310 <mark>text</mark>
1311 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1312 <bdi>text</bdi>
1313 <bdo>text</bdo>
1314 <span>text</span>
1315 <wbr />
1316 !! html
1317 <p><em>text</em>
1318 <strong>text</strong>
1319 <small>text</small>
1320 <s>text</s>
1321 <cite>text</cite>
1322 <q>text</q>
1323 <dfn>text</dfn>
1324 <abbr>text</abbr>
1325 <data>text</data>
1326 <time>text</time>
1327 <code>text</code>
1328 <var>text</var>
1329 <samp>text</samp>
1330 <kbd>text</kbd>
1331 <sub>text</sub>
1332 <u>text</u>
1333 <mark>text</mark>
1334 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1335 <bdi>text</bdi>
1336 <bdo>text</bdo>
1337 <span>text</span>
1338 <wbr />
1339 </p>
1340 !! end
1341
1342 # test cases taken from
1343 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1344 !! test
1345 Ruby markup (W3C-style)
1346 !! wikitext
1347 ;Mono-ruby for individual base characters
1348 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1349 ;Group ruby
1350 :<ruby>今日<rt>きょう</rt></ruby>
1351 ;Jukugo ruby
1352 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1353 ;Inline ruby
1354 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1355 ;Double-sided ruby
1356 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1357
1358 <ruby>
1359 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1360 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1361 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1362 </ruby>
1363 !! html
1364 <dl><dt>Mono-ruby for individual base characters</dt>
1365 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1366 <dt>Group ruby</dt>
1367 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1368 <dt>Jukugo ruby</dt>
1369 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1370 <dt>Inline ruby</dt>
1371 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1372 <dt>Double-sided ruby</dt>
1373 <dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1374 <p><ruby>
1375 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1376 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1377 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1378 </ruby>
1379 </p>
1380 !! end
1381
1382 # The next two test different paths in the sanitizer.
1383 !! test
1384 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1385 !! wikitext
1386 <blockquote|>a</blockquote>
1387
1388 <b→> doesn't terminate </b→>
1389
1390 <bä> doesn't terminate </bä>
1391
1392 <boo> doesn't terminate </boo>
1393
1394 <s.foo> doesn't terminate </s.foo>
1395
1396 <sub-ID#1>
1397 !! html/php
1398 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1399 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1400 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1401 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1402 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1403 </p><p>&lt;sub-ID#1&gt;
1404 </p>
1405 !! end
1406
1407 !! test
1408 Non-word characters don't terminate tag names
1409 !! wikitext
1410 <blockquote|>a</blockquote>
1411
1412 <b→> doesn't terminate </b→>
1413
1414 <bä> doesn't terminate </bä>
1415
1416 <boo> doesn't terminate </boo>
1417
1418 <s.foo> doesn't terminate </s.foo>
1419
1420 <sub-ID#1>
1421 !! html+tidy
1422 <p>&lt;blockquote|&gt;a
1423 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1424 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1425 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1426 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1427 </p><p>&lt;sub-ID#1&gt;
1428 </p>
1429 !! end
1430
1431 ###
1432 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1433 ### This checks that HTML5 tags (with non-word characters in the tag
1434 ### name) make it safely through the parser -- the Sanitizer will
1435 ### munge them later, as it should.
1436 ###
1437 !! test
1438 Non-word characters are valid in extension tags (T19663)
1439 !! wikitext
1440 <tåg>tåg</tåg>
1441 !! html/php
1442 <pre>
1443 'tåg'
1444 array (
1445 )
1446 </pre>
1447
1448 !! html/parsoid
1449 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1450 !! end
1451
1452 !! test
1453 Isolated close tags should be treated as literal text (T54760)
1454 !! options
1455 parsoid=wt2html
1456 !! wikitext
1457 </b>
1458
1459 <s.foo>s</s>
1460 !! html+tidy
1461 <p class="mw-empty-elt">
1462 </p><p>&lt;s.foo&gt;s
1463 </p>
1464 !! end
1465
1466 ###
1467 ### Special characters
1468 ###
1469
1470 !! test
1471 Bare pipe character (T54363)
1472 !! wikitext
1473 |
1474 !! html
1475 <p>|
1476 </p>
1477 !! end
1478
1479 !! test
1480 Bare pipe character from a template (T54363)
1481 !! wikitext
1482 {{pipe}}
1483 !! html
1484 <p>|
1485 </p>
1486 !! end
1487
1488 ###
1489 ### <nowiki> test cases
1490 ###
1491
1492 !! test
1493 <nowiki> unordered list
1494 !! wikitext
1495 <nowiki>* This is not an unordered list item.</nowiki>
1496 !! html/php
1497 <p>* This is not an unordered list item.
1498 </p>
1499 !! html/parsoid
1500 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1501 !! end
1502
1503 !! test
1504 <nowiki> spacing
1505 !! wikitext
1506 <nowiki>Lorem ipsum dolor
1507
1508 sed abit.
1509 sed nullum.
1510
1511 :and a colon
1512 </nowiki>
1513 !! html/php
1514 <p>Lorem ipsum dolor
1515
1516 sed abit.
1517 sed nullum.
1518
1519 :and a colon
1520
1521 </p>
1522 !! html/parsoid
1523 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1524
1525 sed abit.
1526 sed nullum.
1527
1528 :and a colon
1529 </span></p>
1530 !! end
1531
1532 !! test
1533 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1534 !! wikitext
1535 <nowiki><span class="error"></nowiki>
1536 !! html/php
1537 <p>&lt;span class="error"&gt;
1538 </p>
1539 !! html/parsoid
1540 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1541 !! end
1542
1543 !! test
1544 nowiki 3
1545 !! wikitext
1546 :There is not nowiki.
1547 :There is <nowiki>nowiki</nowiki>.
1548
1549 #There is not nowiki.
1550 #There is <nowiki>nowiki</nowiki>.
1551
1552 *There is not nowiki.
1553 *There is <nowiki>nowiki</nowiki>.
1554 !! html/php
1555 <dl><dd>There is not nowiki.</dd>
1556 <dd>There is nowiki.</dd></dl>
1557 <ol><li>There is not nowiki.</li>
1558 <li>There is nowiki.</li></ol>
1559 <ul><li>There is not nowiki.</li>
1560 <li>There is nowiki.</li></ul>
1561
1562 !! html/parsoid
1563 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1564 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1565
1566 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1567 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1568
1569 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1570 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1571 !! end
1572
1573 !! test
1574 Entities inside <nowiki>
1575 !! wikitext
1576 <nowiki>&lt;</nowiki>
1577 !! html/php
1578 <p>&lt;
1579 </p>
1580 !! html/parsoid
1581 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1582 !! end
1583
1584 !! test
1585 Entities inside template parameters
1586 !! wikitext
1587 {{echo|&ndash;}}
1588 !! html/php+tidy
1589 <p>&#8211;
1590 </p>
1591 !! html/parsoid
1592 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1593 !! end
1594
1595 !! test
1596 Properly escape nowiki when combined with other wiki markup
1597 !! options
1598 parsoid=html2wt
1599 !! html/parsoid
1600 <p>* &lt;/nowiki&gt; tag</p>
1601 !! wikitext
1602 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1603 !! end
1604
1605 !! test
1606 T93824: Put escaped HTML tags inside nowiki
1607 !! options
1608 parsoid=html2wt
1609 !! html/parsoid
1610 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1611 !! wikitext
1612 <nowiki><h2>foo</h2></nowiki>
1613 !! end
1614
1615 !! test
1616 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1617 !! options
1618 parsoid=html2wt
1619 !! html/parsoid
1620 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1621 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1622 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1623 !! wikitext
1624 This text: L'[[Foo]]
1625 This text: L<nowiki>''</nowiki>[[Foo]]
1626 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1627 !! end
1628
1629 # This test fails because wikitext whitespace is not normalized before comparing.
1630 !! test
1631 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1632 !! options
1633 parsoid=html2wt
1634 !! html/parsoid
1635 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1636 </p>
1637 !! wikitext
1638 This text : L<nowiki>''</nowiki>[[Foo]]
1639 !! end
1640
1641 # This test and the next one are html2wt only as they test that incorrect wikitext
1642 # passed in template arguments gets escaped or wrapped in nowikis where required.
1643 !! test
1644 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1645 !! options
1646 parsoid=html2wt
1647 !! html/parsoid
1648 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1649 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1650 !! wikitext
1651 {{echo|foo{{!}}bar}}
1652 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1653 !! end
1654
1655 !! test
1656 T53961: Output correct nowikis in template arguments
1657 !! options
1658 parsoid=html2wt
1659 !! html/parsoid
1660 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1661 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1662 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1663 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1664 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1665 !! wikitext
1666 {{echo|a [ b}}
1667 {{echo|<nowiki>a }} b</nowiki>}}
1668 {{echo|<nowiki>a [[ b</nowiki>}}
1669 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1670 {{echo|a <nowiki>}</nowiki>}}
1671 !! end
1672
1673 !! test
1674 Cases where "!!" needs nowiki protection
1675 !! options
1676 parsoid=html2wt
1677 !! html/parsoid
1678 <table>
1679 <tr><th>this needs protection !! here</th></tr>
1680 </table>
1681
1682 <table>
1683 <tr><th>this does not need
1684 protection !! here</th></tr>
1685 </table>
1686 !! wikitext
1687 {|
1688 !<nowiki>this needs protection !! here</nowiki>
1689 |}
1690
1691 {|
1692 !this does not need
1693 protection !! here
1694 |}
1695 !! end
1696
1697 ###
1698 ### Comments
1699 ###
1700 !! test
1701 Comments and Indent-Pre
1702 !! wikitext
1703 <!-- comment 1 --> asdf
1704
1705 <!-- comment 1 --> asdf
1706 <!-- comment 2 -->
1707
1708 <!-- comment 1 --> asdf
1709 <!-- comment 2 -->xyz
1710
1711 <!-- comment 1 --> asdf
1712 <!-- comment 2 --> xyz
1713 !! html
1714 <pre>asdf
1715 </pre>
1716 <pre>asdf
1717 </pre>
1718 <pre>asdf
1719 </pre>
1720 <p>xyz
1721 </p>
1722 <pre>asdf
1723 xyz
1724 </pre>
1725 !! end
1726
1727 !! test
1728 Comment test 2a
1729 !! wikitext
1730 asdf
1731 <!-- comment 1 -->
1732 jkl
1733 !! html
1734 <p>asdf
1735 jkl
1736 </p>
1737 !! end
1738
1739 !! test
1740 Comment test 2b
1741 !! wikitext
1742 asdf
1743 <!-- comment 1 -->
1744
1745 jkl
1746 !! html
1747 <p>asdf
1748 </p><p>jkl
1749 </p>
1750 !! end
1751
1752 !! test
1753 Comment test 3
1754 !! wikitext
1755 asdf
1756 <!-- comment 1 -->
1757 <!-- comment 2 -->
1758 jkl
1759 !! html
1760 <p>asdf
1761 jkl
1762 </p>
1763 !! end
1764
1765 !! test
1766 Comment test 4
1767 !! wikitext
1768 asdf<!-- comment 1 -->jkl
1769 !! html
1770 <p>asdfjkl
1771 </p>
1772 !! end
1773
1774 !! test
1775 Comment spacing
1776 !! wikitext
1777 a
1778 <!-- foo --> b <!-- bar -->
1779 c
1780 !! html
1781 <p>a
1782 </p>
1783 <pre> b
1784 </pre>
1785 <p>c
1786 </p>
1787 !! end
1788
1789 !! test
1790 Comment whitespace
1791 !! wikitext
1792 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1793 !! html
1794
1795 !! end
1796
1797 !! test
1798 Comment semantics and delimiters
1799 !! wikitext
1800 <!-- --><!----><!-----><!------>
1801 !! html/php
1802
1803 !! html/parsoid
1804 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1805 !! end
1806
1807 !! test
1808 Comment semantics and delimiters, redux
1809 !! wikitext
1810 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1811 -- foo -- funky huh? ... -->
1812 !! html/php
1813
1814 !! html/parsoid
1815 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1816 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1817 !! end
1818
1819 !! test
1820 Comment semantics and delimiters: directors cut
1821 !! wikitext
1822 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1823 everything starting with < followed by !-- until the first -- and > we see,
1824 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1825 -->-->
1826 !! html/php
1827 <p>--&gt;
1828 </p>
1829 !! html/parsoid
1830 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1831 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1832 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1833 --><p>--></p>
1834 !! end
1835
1836 !! test
1837 Comment semantics: nesting
1838 !! wikitext
1839 <!--<!-- no, we're not going to do anything fancy here -->-->
1840 !! html/php
1841 <p>--&gt;
1842 </p>
1843 !! html/parsoid
1844 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1845 !! end
1846
1847 # Parsoid closes the unclosed comment, even if it means a slight
1848 # round-trip diff.
1849 !! test
1850 Comment semantics: unclosed comment at end
1851 !! options
1852 parsoid=wt2html,html2html
1853 !! wikitext
1854 <!--This comment will run out to the end of the document
1855 !! html/php
1856
1857 !! html/parsoid
1858 <!--This comment will run out to the end of the document-->
1859 !! end
1860
1861 !! test
1862 Comment semantics: normalize comments to play nice with XML and browsers
1863 !! wikitext
1864 <!-- Browsers --!> think this is closed -->
1865 <!--> This would normally be text -->
1866 <!---> As would this -->
1867 <!-- XML doesn't like trailing dashes -------->
1868 <!-- Nor doubled hyphens -- anywhere in the data -->
1869 But this is not a comment.
1870 !! html/php
1871 <p>But this is not a comment.
1872 </p>
1873 !! html/parsoid
1874 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1875 <!--&#x3E; This would normally be text -->
1876 <!--&#x2D;&#x3E; As would this -->
1877 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1878 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1879 <p>But this is not a comment.</p>
1880 !! end
1881
1882 !! test
1883 Comment semantics: round-trip even text which contains encoded -->
1884 !! wikitext
1885 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1886 !! html/parsoid
1887 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1888 !! end
1889
1890 !! test
1891 Comment in template title
1892 !! wikitext
1893 {{f<!---->oo}}
1894 !! html
1895 <p>FOO
1896 </p>
1897 !! end
1898
1899 !! test
1900 Comment on its own line post-expand
1901 !! wikitext
1902 a
1903 {{blank}}<!---->
1904 b
1905 !! html
1906 <p>a
1907 </p><p>b
1908 </p>
1909 !! end
1910
1911 !! test
1912 Comment on its own line post-expand with non-significant whitespace
1913 !! wikitext
1914 a
1915 {{blank}} <!---->
1916 b
1917 !! html
1918 <p>a
1919 </p><p>b
1920 </p>
1921 !! end
1922
1923 !! test
1924 post-expand include size being exceeded
1925 !! options
1926 maxincludesize=20
1927 !! wikitext
1928 {{echo3|1234567890}}
1929 !! html
1930 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1931 </p>
1932 !! end
1933
1934 !! test
1935 max template depth being reached
1936 !! options
1937 maxtemplatedepth=1
1938 !! wikitext
1939 {{echo with depth|too deep!}}
1940 !! html
1941 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1942 </p>
1943 !! end
1944
1945 !! test
1946 multiple templates that are redirects
1947 !! wikitext
1948 {{redirect to foo}}
1949 {{redirect to foo}}
1950 !! html
1951 <p>FOO
1952 FOO
1953 </p>
1954 !! end
1955
1956 !! test
1957 Multiple comments should still parse as SOL-transparent
1958 !! options
1959 parsoid=wt2html,wt2wt
1960 !! wikitext
1961 <!--c1-->*a
1962 <!--c2--><!--c3--><!--c4-->*b
1963 !! html/php
1964 <ul><li>a</li>
1965 <li>b</li></ul>
1966
1967 !! html/parsoid
1968 <!--c1--><ul>
1969 <li>a
1970 </li>
1971 <!--c2--><!--c3--><!--c4-->
1972 <li>b
1973 </li>
1974 </ul>
1975 !! end
1976
1977 ## Make sure ">" gets escaped in comments to avoid XSS
1978 !! test
1979 IE conditional comments
1980 !! wikitext
1981 <!--[if lt IE 9]>
1982 <script>alert('hi');</script>
1983 <![endif]-->
1984 !! html/parsoid
1985 <!--[if lt IE 9]&#x3E;
1986 <script&#x3E;alert('hi');</script&#x3E;
1987 <![endif]-->
1988 !! end
1989
1990 ###
1991 ### paragraph wrapping tests
1992 ###
1993
1994 !! test
1995 No block tags
1996 !! wikitext
1997 a
1998
1999 b
2000 !! html
2001 <p>a
2002 </p><p>b
2003 </p>
2004 !! end
2005
2006 !! test
2007 Block tag on one line (<div>)
2008 !! wikitext
2009 a <div>foo</div>
2010
2011 b
2012 !! html
2013 a <div>foo</div>
2014 <p>b
2015 </p>
2016 !! html+tidy
2017 <p>a </p><div>foo</div>
2018 <p>b
2019 </p>
2020 !! end
2021
2022 !! test
2023 No p-wrappable content
2024 !! options
2025 parsoid=wt2html,html2html
2026 !! wikitext
2027 <span><div>x</div></span>
2028 <span><s><div>x</div></s></span>
2029 <small><em></em></small><span><s><div>x</div></s></span>
2030 !! html+tidy
2031 <span><div>x</div></span>
2032 <span><s><div>x</div></s></span>
2033 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2034 !! end
2035
2036 # T177612: Parsoid-only test
2037 !! test
2038 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2039 !! wikitext
2040 {{echo|<span><div>x</div></span>}}
2041 x
2042 !! html/parsoid
2043 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
2044 <p>x</p>
2045 !! end
2046
2047 !! test
2048 Block tag on one line (<blockquote>)
2049 !! wikitext
2050 a <blockquote>foo</blockquote>
2051
2052 b
2053 !! html
2054 a <blockquote>foo</blockquote>
2055 <p>b
2056 </p>
2057 !! html+tidy
2058 <p>a </p><blockquote><p>foo</p></blockquote>
2059 <p>b
2060 </p>
2061 !! end
2062
2063 !! test
2064 Block tag on both lines (<div>)
2065 !! wikitext
2066 a <div>foo</div>
2067
2068 b <div>foo</div>
2069 !! html
2070 a <div>foo</div>
2071 b <div>foo</div>
2072
2073 !! html+tidy
2074 <p>a </p><div>foo</div><p>
2075 b </p><div>foo</div>
2076 !! end
2077
2078 !! test
2079 Block tag on both lines (<blockquote>)
2080 !! wikitext
2081 a <blockquote>foo</blockquote>
2082
2083 b <blockquote>foo</blockquote>
2084 !! html
2085 a <blockquote>foo</blockquote>
2086 b <blockquote>foo</blockquote>
2087
2088 !! html+tidy
2089 <p>a </p><blockquote><p>foo</p></blockquote><p>
2090 b </p><blockquote><p>foo</p></blockquote>
2091 !! end
2092
2093 !! test
2094 Multiple lines without block tags
2095 !! wikitext
2096 <div>foo</div> a
2097 b
2098 c
2099 d<!--foo--> e
2100 x <div>foo</div> z
2101 !! html
2102 <div>foo</div> a
2103 <p>b
2104 c
2105 d e
2106 </p>
2107 x <div>foo</div> z
2108
2109 !! html+tidy
2110 <div>foo</div><p> a
2111 </p><p>b
2112 c
2113 d e
2114 </p><p>
2115 x </p><div>foo</div><p> z
2116 </p>
2117 !! end
2118
2119 !! test
2120 Empty lines between lines with block tags
2121 !! wikitext
2122 <div></div>
2123
2124
2125 <div></div>a
2126
2127 b
2128 <div>a</div>b
2129
2130 <div>b</div>d
2131
2132
2133 <div>e</div>
2134 !! html
2135 <div></div>
2136 <p><br />
2137 </p>
2138 <div></div>a
2139 <p>b
2140 </p>
2141 <div>a</div>b
2142 <div>b</div>d
2143 <p><br />
2144 </p>
2145 <div>e</div>
2146
2147 !! html+tidy
2148 <div></div>
2149 <p><br />
2150 </p>
2151 <div></div><p>a
2152 </p><p>b
2153 </p>
2154 <div>a</div><p>b
2155 </p><div>b</div><p>d
2156 </p><p><br />
2157 </p>
2158 <div>e</div>
2159 !! html/parsoid
2160 <div data-parsoid='{"stx":"html"}'></div>
2161
2162 <p><br /></p>
2163 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2164
2165 <p>b</p>
2166 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2167
2168 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2169
2170 <p><br /></p>
2171 <div data-parsoid='{"stx":"html"}'>e</div>
2172 !! end
2173
2174 !! test
2175 Unclosed HTML p-tags should be handled properly
2176 !! wikitext
2177 <div><p>foo</div>
2178 a
2179
2180 b
2181 !! html/php+tidy
2182 <div><p>foo</p></div>
2183 <p>a
2184 </p><p>b
2185 </p>
2186 !! html/parsoid
2187 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2188 <p>a</p>
2189 <p>b</p>
2190 !! end
2191
2192 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2193 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2194 ## them for now.
2195 !! test
2196 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2197 !! options
2198 parsoid=wt2html
2199 !! wikitext
2200 a [[Category:A1]] [[Category:A2]]
2201 [[Category:A3]]
2202 [[Category:A4]]
2203 !! html/parsoid
2204 <p>a</p>
2205 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2206 !! end
2207
2208 !! test
2209 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2210 !! options
2211 parsoid=wt2html
2212 !! wikitext
2213 [[Category:A1]]a
2214 !! html/parsoid
2215 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2216 !! end
2217
2218 !! test
2219 No paragraph necessary for SOL transparent template
2220 !! wikitext
2221 <span><div>foo</div></span>
2222 [[Category:Foo]]
2223
2224 <span><div>foo</div></span>
2225 {{echo|[[Category:Foo]]}}
2226 !! html/php
2227 <span><div>foo</div></span>
2228 <span><div>foo</div></span>
2229
2230 !! html/parsoid
2231 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2232 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2233
2234 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2235 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
2236 !! end
2237
2238 !! test
2239 Avoid expanding multiline sol transparent template ranges unnecessarily
2240 !! wikitext
2241 hi
2242
2243
2244 {{echo|<br/>
2245 }}
2246
2247 [[Category:Ho]]
2248 !! html/php
2249 <p>hi
2250 </p><p><br />
2251 <br />
2252 </p>
2253 !! html/parsoid
2254 <p>hi</p>
2255
2256 <p><br />
2257 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2258 </span></p>
2259
2260 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2261 !! end
2262
2263 !! test
2264 Paragraph wrapping following unclosed table
2265 !! options
2266 parsoid=wt2html,html2html
2267 !! wikitext
2268 {|
2269 |-
2270
2271 {|
2272 | x
2273 |}
2274
2275 a
2276
2277 b
2278
2279 c
2280 !! html/php+tidy
2281 <table>
2282
2283
2284 </table><table>
2285 <tbody><tr>
2286 <td>x
2287 </td></tr></tbody></table>
2288 <p>a
2289 </p><p>b
2290 </p><p>c
2291 </p>
2292 !! html/parsoid
2293 <table data-parsoid='{"autoInsertedEnd":true}'>
2294 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2295
2296 </tbody></table><table>
2297 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2298 </tbody></table>
2299
2300 <p>a</p>
2301
2302 <p>b</p>
2303
2304 <p>c</p>
2305 !! end
2306
2307 !! test
2308 Paragraph wrapping suppressed in html p
2309 !! options
2310 parsoid=wt2html,html2html
2311 !! wikitext
2312 <p>
2313
2314
2315 hi
2316
2317
2318
2319 </p>
2320 !! html/php+tidy
2321 <p>
2322
2323
2324 hi
2325
2326
2327
2328 </p>
2329 !! html/parsoid
2330 <p data-parsoid='{"stx":"html"}'>
2331
2332
2333 hi
2334
2335
2336
2337 </p>
2338 !! end
2339
2340 !! test
2341 Dangling table row doesn't prevent p-wrapping
2342 !! options
2343 parsoid=wt2html,html2html
2344 !! wikitext
2345 {|
2346 | hi
2347 |-
2348 |} ho
2349 !! html/parsoid
2350 <table>
2351 <tbody><tr><td>hi</td></tr>
2352 <tr class="mw-empty-elt"></tr>
2353 </tbody></table><p> ho</p>
2354 !! end
2355
2356 ###
2357 ### Preformatted text
2358 ###
2359
2360 !! test
2361 Preformatted text
2362 !! wikitext
2363 This is some
2364 Preformatted text
2365 With ''italic''
2366 And '''bold'''
2367 And a [[Main Page|link]]
2368 !! html
2369 <pre>This is some
2370 Preformatted text
2371 With <i>italic</i>
2372 And <b>bold</b>
2373 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2374 </pre>
2375 !! end
2376
2377 !! test
2378 Tabs don't trigger preformatted text
2379 !! wikitext
2380 This is not
2381 preformatted text.
2382 This is preformatted text.
2383 So is this.
2384 !! html/php
2385 <p> This is not
2386 preformatted text.
2387 </p>
2388 <pre>This is preformatted text.
2389 So is this.
2390 </pre>
2391 !! html/parsoid
2392 <p> This is not
2393 preformatted text.</p>
2394 <pre>This is preformatted text.
2395 So is this.</pre>
2396 !! end
2397
2398 !! test
2399 Space before tab needs nowiki pre protection
2400 !! options
2401 parsoid=html2wt
2402 !! html/parsoid
2403 <p> a</p>
2404 !! wikitext
2405 <nowiki> </nowiki> a
2406 !! end
2407
2408 !! test
2409 Ident preformatting with inline content
2410 !! wikitext
2411 a
2412 ''b''
2413 !! html
2414 <pre>a
2415 <i>b</i>
2416 </pre>
2417 !! end
2418
2419 !! test
2420 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2421 !! wikitext
2422 <pre><nowiki>
2423 <b>
2424 <cite>
2425 <em>
2426 </nowiki></pre>
2427 !! html
2428 <pre>
2429 &lt;b&gt;
2430 &lt;cite&gt;
2431 &lt;em&gt;
2432 </pre>
2433
2434 !! end
2435
2436 !! test
2437 Regression with preformatted in <center>
2438 !! wikitext
2439 <center>
2440 Blah
2441 </center>
2442 !! html
2443 <center>
2444 <pre>Blah
2445 </pre>
2446 </center>
2447
2448 !! end
2449
2450 !! test
2451 T54763: Preformatted in <blockquote>
2452 !! wikitext
2453 <blockquote>
2454 Blah
2455 {|
2456 |
2457 indented cell (no pre-wrapping!)
2458 |}
2459 </blockquote>
2460 !! html
2461 <blockquote>
2462 <p> Blah
2463 </p>
2464 <table>
2465 <tr>
2466 <td>
2467 <p> indented cell (no pre-wrapping!)
2468 </p>
2469 </td></tr></table>
2470 </blockquote>
2471
2472 !! end
2473
2474 !! test
2475 T53086: Double newlines in blockquotes should be turned into paragraphs
2476 !! wikitext
2477 <blockquote>
2478 Foo
2479
2480 Bar
2481 </blockquote>
2482 !! html
2483 <blockquote>
2484 <p>Foo
2485 </p><p>Bar
2486 </p>
2487 </blockquote>
2488
2489 !! end
2490
2491 !! test
2492 T17491: <ins>/<del> in blockquote
2493 !! wikitext
2494 <blockquote>
2495 Foo <del>bar</del> <ins>baz</ins> quux
2496 </blockquote>
2497 !! html
2498 <blockquote>
2499 <p>Foo <del>bar</del> <ins>baz</ins> quux
2500 </p>
2501 </blockquote>
2502
2503 !! html+tidy
2504 <blockquote>
2505 <p>Foo <del>bar</del> <ins>baz</ins> quux
2506 </p>
2507 </blockquote>
2508 !! end
2509
2510 !! test
2511 T17491: <ins>/<del> in blockquote (2)
2512 !! wikitext
2513 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2514 </blockquote>
2515 !! html
2516 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2517 </blockquote>
2518
2519 !! html+tidy
2520 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2521 </p></blockquote>
2522 !! end
2523
2524 !! test
2525 <pre> with attributes (T5202)
2526 !! wikitext
2527 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2528 !! html
2529 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2530
2531 !! end
2532
2533 !! test
2534 <pre> with width attribute (T5202)
2535 !! wikitext
2536 <pre width="8">Narrow screen goodies</pre>
2537 !! html
2538 <pre width="8">Narrow screen goodies</pre>
2539
2540 !! end
2541
2542 !! test
2543 <pre> with forbidden attribute (T5202)
2544 !! wikitext
2545 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2546 !! html
2547 <pre width="8">Narrow screen goodies</pre>
2548
2549 !! end
2550
2551 !! test
2552 Entities inside <pre>
2553 !! wikitext
2554 <pre>&lt;</pre>
2555 !! html
2556 <pre>&lt;</pre>
2557
2558 !! end
2559
2560 !! test
2561 <pre> with forbidden attribute values (T5202)
2562 !! wikitext
2563 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2564 !! html
2565 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2566
2567 !! end
2568
2569 !! test
2570 <nowiki> inside <pre> (T15238)
2571 !! wikitext
2572 <pre>
2573 <nowiki>
2574 </pre>
2575 <pre>
2576 <nowiki></nowiki>
2577 </pre>
2578 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2579 !! html
2580 <pre>
2581 &lt;nowiki&gt;
2582 </pre>
2583 <pre>
2584
2585 </pre>
2586 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2587
2588 !! end
2589
2590 !! test
2591 <nowiki> inside of #tag:pre
2592 !! wikitext
2593 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2594 !! html/php
2595 <pre>Foo &#8594;bar</pre>
2596
2597 !! html/parsoid
2598 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2599 !! end
2600
2601 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2602 ## aren't enclosed in nowikis.
2603 !! test
2604 <nowiki> and <pre> preference (first one wins)
2605 !! options
2606 parsoid=wt2html
2607 !! wikitext
2608 <pre>
2609 <nowiki>
2610 </pre>
2611 </nowiki>
2612 </pre>
2613
2614 <nowiki>
2615 <pre>
2616 <nowiki>
2617 </pre>
2618 </nowiki>
2619 </pre>
2620
2621 !! html/php
2622 <pre>
2623 &lt;nowiki&gt;
2624 </pre>
2625 <p>&lt;/nowiki&gt;
2626 &lt;/pre&gt;
2627 </p><p>
2628 &lt;pre&gt;
2629 &lt;nowiki&gt;
2630 &lt;/pre&gt;
2631
2632 &lt;/pre&gt;
2633 </p>
2634 !! html/parsoid
2635 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2636 </pre>
2637 <p>&lt;/nowiki></p>
2638
2639
2640 <p><span typeof="mw:Nowiki">
2641 &lt;pre>
2642 &lt;nowiki>
2643 &lt;/pre>
2644 </span></p>
2645 !! end
2646
2647 !! test
2648 </pre> inside nowiki
2649 !! wikitext
2650 <nowiki></pre></nowiki>
2651 !! html
2652 <p>&lt;/pre&gt;
2653 </p>
2654 !! end
2655
2656 !! test
2657 Empty pre; pre inside other HTML tags (T56946)
2658 !! wikitext
2659 a
2660
2661 <div><pre>
2662 foo
2663 </pre></div>
2664 <pre></pre>
2665 !! html/php+tidy
2666 <p>a
2667 </p>
2668 <div><pre>foo
2669 </pre></div>
2670 <pre></pre>
2671 !! html/parsoid
2672 <p>a</p>
2673
2674 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2675 </pre></div>
2676 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2677 !! end
2678
2679 !! test
2680 HTML pre followed by indent-pre
2681 !! wikitext
2682 <pre>foo</pre>
2683 bar
2684 !! html
2685 <pre>foo</pre>
2686 <pre>bar
2687 </pre>
2688 !! end
2689
2690 !! test
2691 Block tag pre
2692 !! wikitext
2693 <p><pre>foo</pre></p>
2694 !! html/php+tidy
2695 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2696 !! html/parsoid
2697 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2698 !! end
2699
2700 !!test
2701 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2702 !! wikitext
2703 {{echo|}}
2704 !! html
2705
2706 !!end
2707
2708 !!test
2709 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2710 !! wikitext
2711 {{echo|
2712 foo}}
2713 !! html
2714 <p>foo
2715 </p>
2716 !!end
2717
2718 !! test
2719 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2720 !! wikitext
2721 {{echo|a
2722 b}}
2723 !! html
2724 <pre>a
2725 </pre>
2726 <p>b
2727 </p>
2728 !!end
2729
2730 !! test
2731 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2732 !! wikitext
2733 {{echo|a
2734 b
2735 c
2736 d
2737 e
2738 }}
2739 !! html
2740 <pre>a
2741 </pre>
2742 <p>b
2743 c
2744 </p>
2745 <pre>d
2746 </pre>
2747 <p>e
2748 </p>
2749 !!end
2750
2751 !!test
2752 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2753 !! wikitext
2754 {{echo| foo}}
2755
2756 {{echo| foo}}{{echo| bar}}
2757
2758 {{echo| foo}}
2759 {{echo| bar}}
2760
2761 {{echo|<!--cmt--> foo}}
2762
2763 <!--cmt-->{{echo| foo}}
2764
2765 {{echo|{{echo| }}bar}}
2766 !! html
2767 <pre>foo
2768 </pre>
2769 <pre>foo bar
2770 </pre>
2771 <pre>foo
2772 bar
2773 </pre>
2774 <pre>foo
2775 </pre>
2776 <pre>foo
2777 </pre>
2778 <pre>bar
2779 </pre>
2780 !!end
2781
2782 !! test
2783 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2784 !! wikitext
2785 {{echo| }}a
2786
2787 {{echo|
2788 }}a
2789
2790 {{echo|
2791 b}}
2792
2793 {{echo|a
2794 }}b
2795
2796 {{echo|a
2797 }} b
2798 !! html
2799 <pre>a
2800 </pre>
2801 <p><br />
2802 </p>
2803 <pre>a
2804 </pre>
2805 <p><br />
2806 </p>
2807 <pre>b
2808 </pre>
2809 <p>a
2810 </p>
2811 <pre>b
2812 </pre>
2813 <p>a
2814 </p>
2815 <pre>b
2816 </pre>
2817 !!end
2818
2819 ## Hmm, should Parsoid rt this?
2820 !! test
2821 Pres with newline attributes
2822 !! options
2823 parsoid=wt2html,html2html
2824 !! wikitext
2825 <pre class="one
2826 two">hi</pre>
2827 !! html/php
2828 <pre class="one two">hi</pre>
2829
2830 !! html/parsoid
2831 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2832 !! end
2833
2834 !! test
2835 Things that look like <pre> tags aren't treated as such
2836 !! wikitext
2837 Barack Obama <President> of the United States
2838 <President></President>
2839 !! html
2840 <p>Barack Obama &lt;President&gt; of the United States
2841 &lt;President&gt;&lt;/President&gt;
2842 </p>
2843 !! end
2844
2845 ## Remex doesn't account for fostered content.
2846 ## The difference between Parsoid and the PHP parser can be attributed to core
2847 ## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
2848 ## tokenize unmatched extension tags that shadow html tags as strings to ease
2849 ## an escaping mechanism. See the comment in `maybeExtensionTag`.
2850 !! test
2851 Handle broken pre-like tags (T66025)
2852 !! options
2853 parsoid=wt2html
2854 !! wikitext
2855 {{echo|<pre <pre>x</pre>}}
2856
2857 <table><pre </table>
2858 !! html/php
2859 <pre>x</pre>
2860 <table>&lt;pre </table>
2861
2862 !! html/php+tidy
2863 <pre>x</pre>
2864 &lt;pre <table></table>
2865 !! html/parsoid
2866 <pre typeof="mw:Transclusion mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html","a":{"&lt;pre":null},"sa":{"&lt;pre":""},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2867
2868 <pre data-parsoid='{"stx":"html","src":"&lt;pre &lt;/table>","tagWidths":[13,0],"a":{"&lt;":null,"table":null},"sa":{"&lt;":"","table":""},"fostered":true,"autoInsertedEnd":true}'></pre><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'></table>
2869 !! end
2870
2871 ## Similar to the above, but shows the difference between extension and html tags
2872 !! test
2873 Less than in attribute position
2874 !! wikitext
2875 <pre <pre>123</pre>
2876
2877 <div <div>123</div>
2878 !! html/php+tidy
2879 <pre>123</pre><p>
2880 &lt;div </p><div>123</div>
2881 !! html/parsoid
2882 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"&lt;pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
2883
2884 &lt;div </p><div>123</div>
2885 !! end
2886
2887 !! test
2888 Parsoid: handle pre with space after attribute
2889 !! options
2890 parsoid=wt2html
2891 !! wikitext
2892 <pre style="width:50%;" >{{echo|foo}}</pre>
2893 !! html/php
2894 <pre style="width:50%;">{{echo|foo}}</pre>
2895
2896 !! html/parsoid
2897 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2898 !! end
2899
2900 !! test
2901 Self-closed pre
2902 !! wikitext
2903 <pre />
2904 !! html/php
2905 <pre></pre>
2906
2907 !! html/parsoid
2908 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
2909 !! end
2910
2911 !! test
2912 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2913 !! options
2914 parsoid=wt2html
2915 !! wikitext
2916 {|
2917 <td>
2918 <td>
2919 </td>
2920
2921
2922
2923 |}
2924 !! html
2925 <table>
2926
2927 <tbody>
2928 <tr>
2929 <td></td>
2930
2931 <td>
2932 </td></tr>
2933
2934
2935
2936 </tbody></table>
2937 !! end
2938
2939
2940 #--------------------------------------------------------------------
2941 # Transclusion parameter whitespace stripping tests
2942 # Behavior is different for positional and named parameters
2943 #--------------------------------------------------------------------
2944 !! test
2945 Templates: Strip leading and trailing whitespace from named-param values
2946 !! wikitext
2947 {{echo|1= a }}
2948
2949 {{echo|1= {{echo|b}} }}
2950
2951 {{echo| 1 =
2952 c }}
2953
2954 {{echo| 1 =
2955 * d
2956 }}
2957 !! html
2958 <p>a
2959 </p><p>b
2960 </p><p>c
2961 </p>
2962 <ul><li>d</li></ul>
2963
2964 !! end
2965
2966 !! test
2967 Templates: Don't strip whitespace from positional-param values
2968 !! wikitext
2969 {{echo|a }}
2970
2971 {{echo|{{echo|b}} }}
2972
2973 {{echo| c
2974 }}
2975
2976 {{echo| {{echo|d}}
2977 }}
2978
2979 {{echo|
2980 e}}
2981
2982 {{echo|
2983 *f}}
2984
2985 {{echo|
2986 }}g
2987 !! html
2988 <p>a
2989 </p><p>b
2990 </p>
2991 <pre>c
2992 </pre>
2993 <p><br />
2994 </p>
2995 <pre>d
2996 </pre>
2997 <p><br />
2998 </p>
2999 <pre>e
3000 </pre>
3001 <p><br />
3002 </p>
3003 <ul><li>f</li></ul>
3004 <p><br />
3005 </p>
3006 <pre>g
3007 </pre>
3008 !! end
3009
3010 !! test
3011 Templates: Don't recognize targets split by newlines
3012 !! options
3013 parsoid=wt2html
3014 !! wikitext
3015 {{ech
3016 o|foo}}
3017 !! html/php
3018 <p>{{ech
3019 o|foo}}
3020 </p>
3021 !! html/parsoid
3022 <p>{{ech
3023 o|foo}}</p>
3024 !! end
3025
3026 !! test
3027 Templates: Recognize targets when newlines and comments don't split the target
3028 !! options
3029 parsoid=wt2html
3030 !! wikitext
3031 {{
3032 <!--X--> ech<!--X-->o<!--X-->
3033 <!--X--> <!--X-->
3034
3035 |foo}}
3036 !! html/php
3037 <p>foo
3038 </p>
3039 !! html/parsoid
3040 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3041 !! end
3042
3043 !! test
3044 Templates: Handle empty comment-and-ws-only lines correctly
3045 !! wikitext
3046 {{echo|foo
3047 <!--should be ignored-->
3048 <!--should be ignored as well-->
3049 bar}}
3050 !! html/php
3051 <p>foo
3052 bar
3053 </p>
3054 !! html/parsoid
3055 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
3056 !! end
3057
3058 !! test
3059 Templates: Handle comments in the target
3060 !! wikitext
3061 {{echo
3062 <!-- should be ignored -->
3063 |foo}}
3064
3065 {{echo
3066 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3067 |foo}}
3068
3069 {{echo<!-- should be ignored -->
3070 |foo}}
3071
3072 {{echo<!-- should be ignored -->|foo}}
3073
3074 {{<!-- should be ignored -->echo|foo}}
3075 !! html/php
3076 <p>foo
3077 </p><p>foo
3078 </p><p>foo
3079 </p><p>foo
3080 </p><p>foo
3081 </p>
3082 !! html/parsoid
3083 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3084
3085 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3086
3087 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3088
3089 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3090
3091 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3092 !! end
3093
3094 !! test
3095 Templates: Handle comments in parameter names (T69657)
3096 !! wikitext
3097 {{echo|1
3098 <!-- should be ignored -->
3099 =foo}}
3100
3101 {{echo|
3102 <!-- should be ignored -->
3103 1 = foo}}
3104
3105 {{echo|1<!-- should be ignored -->=foo}}
3106
3107 {{echo|<!-- should be ignored -->1=foo}}
3108 !! html/php
3109 <p>foo
3110 </p><p>foo
3111 </p><p>foo
3112 </p><p>foo
3113 </p>
3114 !! html/parsoid
3115 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3116
3117 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
3118
3119 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
3120
3121 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
3122 !! end
3123
3124 !! test
3125 Templates: Other wikitext in parameter names (T69657)
3126 !! wikitext
3127 {{echo|''1''=foo}}
3128 !! html/php
3129 <p>{{{1}}}
3130 </p>
3131 !! html/parsoid
3132 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3133 !! end
3134
3135 !! test
3136 Templates: With colons
3137 !! wikitext
3138 {{With: Colon}}
3139 !! html/php
3140 <p>Template with colon
3141 </p>
3142 !! html/parsoid
3143 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
3144 !! end
3145
3146 #--------------------------------------------------------------------
3147 # Transclusion parameter escaping tests
3148 #--------------------------------------------------------------------
3149
3150 !! test
3151 Templates: Parsoid parameter escaping test 1
3152 !! wikitext
3153 {{echo|[foo]|{{echo|[bar]}}}}
3154 !! html/php+tidy
3155 <p>[foo]
3156 </p>
3157 !! html/parsoid
3158 <p about="#mwt1" typeof="mw:Transclusion"
3159 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3160 !! end
3161
3162 !! test
3163 Parsoid: Pipes in external links in template parameter
3164 !! wikitext
3165 {{echo|[{{echo|http://example.com}} link]}}
3166 !! html/php+tidy
3167 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3168 </p>
3169 !! html/parsoid
3170 <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
3171 !! end
3172
3173 !! test
3174 Parsoid: pipe in transclusion parameter
3175 !! wikitext
3176 {{echo|http://foo.com/a&#124;b}}
3177 !! html/php+tidy
3178 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3179 </p>
3180 !! html/parsoid
3181 <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
3182 !! end
3183
3184 !! test
3185 Parsoid: Pipe in external link target and content in template parameter
3186 !! options
3187 parsoid=html2wt,wt2wt
3188 !! wikitext
3189 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3190 !! html/php+tidy
3191 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3192 </p>
3193 !! html/parsoid
3194 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3195 typeof="mw:Transclusion"
3196 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3197 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3198 !! end
3199
3200 !! test
3201 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3202 !! options
3203 parsoid
3204 !! wikitext
3205 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3206 !! html
3207 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
3208 !! end
3209
3210 !! test
3211 Templates: Don't escape already nowiki-escaped text in template parameters
3212 !! options
3213 parsoid=html2wt,wt2wt
3214 !! wikitext
3215 {{echo|foo<nowiki>|</nowiki>bar}}
3216 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3217 {{echo|<nowiki></nowiki>}}
3218 !! html/php+tidy
3219 <p>foo|bar
3220 &lt;div&gt;
3221
3222 </p>
3223 !! html/parsoid
3224 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
3225 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
3226 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
3227 </p>
3228 !! end
3229
3230 ## T54824
3231 !! test
3232 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3233 !! options
3234 parsoid=html2wt,wt2wt
3235 !! wikitext
3236 {{echo|{{echo|1=bar}}}}
3237 !! html/php+tidy
3238 <p>bar
3239 </p>
3240 !! html/parsoid
3241 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
3242 !! end
3243
3244 ## T58733
3245 !! test
3246 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3247 !! wikitext
3248 {{echo|a : b}}
3249 !! html/php+tidy
3250 <p>a&#160;: b
3251 </p>
3252 !! html/parsoid
3253 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
3254 !! end
3255
3256 ## T73412
3257 !! test
3258 Templates: Preserve blank parameter names
3259 !! wikitext
3260 {{echo|=foo}}
3261 !! html/php+tidy
3262 <p>{{{1}}}
3263 </p>
3264 !! html/parsoid
3265 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3266 !! end
3267
3268 !! test
3269 Templates: Preserve blank parameter names in other positions
3270 !! wikitext
3271 {{blank_param|bar|=foo}}
3272 !! html/php+tidy
3273 <p>bar
3274 foo
3275 </p>
3276 !! html/parsoid
3277 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3278 foo</p>
3279 !! end
3280
3281 ###
3282 ### Parsoid-centric tests for testing RT edge cases for pre
3283 ###
3284
3285 !!test
3286 1a. Indent-Pre and Comments
3287 !! wikitext
3288 a
3289 <!--a-->
3290 c
3291 !! html
3292 <pre>a
3293 </pre>
3294 <p>c
3295 </p>
3296 !!end
3297
3298 !!test
3299 1b. Indent-Pre and Comments
3300 !! wikitext
3301 a
3302 <!--a-->
3303 c
3304 !! html
3305 <pre>a
3306 </pre>
3307 <p>c
3308 </p>
3309 !!end
3310
3311 !!test
3312 1c. Indent-Pre and Comments
3313 !! wikitext
3314 <!--a--> a
3315
3316 <!--a--> a
3317 !! html
3318 <pre> a
3319 </pre>
3320 <pre> a
3321 </pre>
3322 !!end
3323
3324 !!test
3325 1d. Indent-Pre and Comments
3326 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3327 !! wikitext
3328 <!--a--> a
3329
3330 <!--b-->b
3331 !! html
3332 <pre>a
3333 </pre>
3334 <pre>b
3335 </pre>
3336 !!end
3337
3338 !!test
3339 2a. Indent-Pre and tables
3340 !! wikitext
3341 {|
3342 |-
3343 !h1!!h2
3344 |foo||bar
3345 |}
3346 !! html
3347 <table>
3348
3349 <tr>
3350 <th>h1</th>
3351 <th>h2
3352 </th>
3353 <td>foo</td>
3354 <td>bar
3355 </td></tr></table>
3356
3357 !!end
3358
3359 !!test
3360 2b. Indent-Pre and tables
3361 !! wikitext
3362 {|
3363 |-
3364 |foo
3365 |}
3366 !! html
3367 <table>
3368
3369 <tr>
3370 <td>foo
3371 </td></tr></table>
3372
3373 !!end
3374
3375 !!test
3376 2c. Indent-Pre and tables (T44252)
3377 !! wikitext
3378 {|
3379 |+foo
3380 ! |bar
3381 |}
3382 !! html
3383 <table>
3384 <caption>foo
3385 </caption>
3386 <tr>
3387 <th>bar
3388 </th></tr></table>
3389
3390 !!end
3391
3392 !!test
3393 2d. Indent-Pre and tables
3394 !! wikitext
3395 a
3396 {|
3397 |b
3398 |}
3399 !! html/php
3400 <pre>a
3401 </pre>
3402 <table>
3403 <tr>
3404 <td>b
3405 </td></tr></table>
3406
3407 !! html/parsoid
3408 <pre>a</pre>
3409 <table>
3410 <tbody><tr><td> b</td></tr>
3411 </tbody></table>
3412 !!end
3413
3414 !!test
3415 2e. Indent-Pre and table-line syntax
3416 !! wikitext
3417 a
3418 | b
3419 | c
3420 !! html/php
3421 <pre>a
3422 | b
3423 | c
3424 </pre>
3425 !!end
3426
3427 !!test
3428 2f. Indent-pre started by table-line syntax
3429 !! wikitext
3430 a
3431 | b
3432 | c
3433 !! html/php
3434 <p>a
3435 </p>
3436 <pre>| b
3437 | c
3438 </pre>
3439 !! html/parsoid
3440 <p>a</p>
3441 <pre>
3442 | b
3443 | c</pre>
3444 !!end
3445
3446 !! test
3447 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3448 !! wikitext
3449 <table>
3450 <tr>
3451 <td>
3452 Text that should be rendered preformatted
3453 </td>
3454 </tr>
3455 </table>
3456 !! html
3457 <table>
3458 <tr>
3459 <td>
3460 <pre>Text that should be rendered preformatted
3461 </pre>
3462 </td>
3463 </tr>
3464 </table>
3465
3466 !! end
3467
3468 !! test
3469 2h. Indent pre in tables
3470 !! options
3471 parsoid=wt2html,html2html
3472 !! wikitext
3473 {|
3474 !
3475 foo
3476 !
3477 bar
3478 |-
3479 |
3480 baz
3481 {{!}}
3482 bam
3483 |}
3484 !! html/php
3485 <table>
3486 <tr>
3487 <th>
3488 <pre>foo
3489 </pre>
3490 </th>
3491 <th>
3492 <pre>bar
3493 </pre>
3494 </th></tr>
3495 <tr>
3496 <td>
3497 <pre>baz
3498 </pre>
3499 </td>
3500 <td>
3501 <pre>bam
3502 </pre>
3503 </td></tr></table>
3504
3505 !! html/parsoid
3506 <table>
3507 <tbody><tr><th>
3508 <pre>foo</pre>
3509 </th><th>
3510 <pre>bar</pre>
3511 </th></tr><tr>
3512 <td>
3513 <pre>baz</pre>
3514 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3515 <pre>bam</pre>
3516 </td></tr></tbody></table>
3517 !! end
3518
3519 !! test
3520 3a. Indent-Pre and block tags (single-line html)
3521 !! wikitext
3522 a <p> foo </p>
3523 b <div> foo </div>
3524 c <blockquote> foo </blockquote>
3525 <span> foo </span>
3526 !! html
3527 a <p> foo </p>
3528 b <div> foo </div>
3529 c <blockquote> foo </blockquote>
3530 <pre><span> foo </span>
3531 </pre>
3532 !! html/php+tidy
3533 <p> a </p><p> foo </p><p>
3534 b </p><div> foo </div><p>
3535 c </p><blockquote><p> foo </p></blockquote>
3536 <pre><span> foo </span>
3537 </pre>
3538 !! html/parsoid
3539 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3540 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3541 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3542 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3543 !! end
3544
3545 !! test
3546 3b. Indent-Pre and block tags (multi-line html)
3547 !! wikitext
3548 a <span>foo</span>
3549 <!-- comment --> b <div> foo </div>
3550 !! html/php
3551 <pre>a <span>foo</span>
3552 </pre>
3553 b <div> foo </div>
3554
3555 !! html/parsoid
3556 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3557 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3558 !! html/php+tidy
3559 <pre>a <span>foo</span>
3560 </pre><p>
3561 b </p><div> foo </div>
3562 !! end
3563
3564 !!test
3565 3c. Indent-Pre and block tags (pre-content on separate line)
3566 !! wikitext
3567 <p>
3568 foo
3569 </p>
3570
3571 <div>
3572 foo
3573 </div>
3574
3575 <center>
3576 foo
3577 </center>
3578
3579 <blockquote>
3580 foo
3581 </blockquote>
3582
3583 <blockquote>
3584 <pre>
3585 foo
3586 </pre>
3587 </blockquote>
3588
3589 <table><tr><td>
3590 foo
3591 </td></tr></table>
3592
3593 <ul><li>
3594 foo
3595 </li></ul>
3596
3597 !! html
3598 <p>
3599 foo
3600 </p>
3601 <div>
3602 <pre>foo
3603 </pre>
3604 </div>
3605 <center>
3606 <pre>foo
3607 </pre>
3608 </center>
3609 <blockquote>
3610 <p> foo
3611 </p>
3612 </blockquote>
3613 <blockquote>
3614 <pre>
3615 foo
3616 </pre>
3617 </blockquote>
3618 <table><tr><td>
3619 <pre>foo
3620 </pre>
3621 </td></tr></table>
3622 <ul><li>
3623 foo
3624 </li></ul>
3625
3626 !!end
3627
3628 !! test
3629 4. Indent-Pre and extension tags
3630 !! options
3631 parsoid=wt2html,html2html
3632 !! wikitext
3633 a <tag />
3634 !! html/php+tidy
3635 <p> a </p><pre>NULL
3636 array (
3637 )
3638 </pre>
3639 !! html/parsoid
3640 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3641 !! end
3642
3643 !! test
3644 5. Indent-Pre and html pre
3645 !! wikitext
3646 <pre class="123">hi</pre>
3647 !! html/php
3648 <pre class="123">hi</pre>
3649
3650 !! html/parsoid
3651 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3652 !! end
3653
3654 !!test
3655 Render paragraphs when indent-pre is suppressed in blocklevels
3656 !! wikitext
3657 <blockquote>
3658 foo
3659
3660 bar
3661 </blockquote>
3662 !! html
3663 <blockquote>
3664 <p> foo
3665 </p><p> bar
3666 </p>
3667 </blockquote>
3668
3669 !!end
3670
3671 !!test
3672 4. Multiple spaces at start-of-line
3673 !! wikitext
3674 <p> foo </p>
3675 foo
3676 {|
3677 |foo
3678 |}
3679 !! html
3680 <p> foo </p>
3681 <pre> foo
3682 </pre>
3683 <table>
3684 <tr>
3685 <td>foo
3686 </td></tr></table>
3687
3688 !!end
3689
3690 ## NOTE: the leading white-space chars on empty line are significant
3691 !! test
3692 5a. White-space in indent-pre
3693 !! wikitext
3694 a<br />
3695
3696 b
3697 !! html
3698 <pre>a<br />
3699
3700 b
3701 </pre>
3702 !! end
3703
3704 ## NOTE: the leading white-space chars on empty line are significant
3705 !! test
3706 5b. White-space in indent-pre
3707 !! wikitext
3708 a
3709
3710 b
3711
3712
3713 c
3714 !! html
3715 <pre>a
3716
3717 b
3718
3719
3720 c
3721 </pre>
3722 !! end
3723
3724 !! test
3725 5c. White-space in indent-pre
3726 !! wikitext
3727 ''a''
3728 ''b''
3729 ''c''
3730 !! html
3731 <pre><i>a</i>
3732 <i>b</i>
3733 <i>c</i>
3734 </pre>
3735 !! end
3736
3737 !! test
3738 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3739 !! wikitext
3740 a
3741
3742 <!-- continue -->
3743 b
3744
3745 c
3746
3747 d
3748 !! html
3749 <pre>a
3750
3751 b
3752 </pre>
3753 <pre>c
3754
3755 </pre>
3756 <p>d
3757 </p>
3758 !! end
3759
3760 !! test
3761 7a. Indent-pre and category links
3762 !! options
3763 parsoid=wt2html,wt2wt
3764 !! wikitext
3765 [[Category:foo]] <!-- No pre-wrapping -->
3766 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3767 !! html/php+tidy
3768 !! html/parsoid
3769 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3770 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3771 !! end
3772
3773 ## We used to, but no longer wt2wt this test since the default serializer
3774 ## will normalize all categories to serialize on their own line.
3775 ## This wikitext usage is going to be fairly uncommon in production and
3776 ## selser will take care of preserving formatting in those scenarios.
3777 !! test
3778 7b. Indent-pre and category links
3779 !! options
3780 parsoid=wt2html
3781 !! wikitext
3782 [[Category:foo]] a
3783 [[Category:foo]] {{echo|b}}
3784 !! html/parsoid
3785 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3786 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3787 !! end
3788
3789 !! test
3790 Indent-Pre: Newlines in comments shouldn't affect sol state
3791 !! wikitext
3792 a <!--
3793 foo
3794 --> b
3795 !! html/php+tidy
3796 <p>a b
3797 </p>
3798 !! html/parsoid
3799 <p>a <!--
3800 foo
3801 --> b</p>
3802 !! end
3803
3804 ###
3805 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3806 ###
3807
3808 !!test
3809 HTML-pre: 1. embedded newlines
3810 !! wikitext
3811 <pre>foo</pre>
3812
3813 <pre>
3814 foo
3815 </pre>
3816
3817 <pre>
3818
3819 foo
3820 </pre>
3821
3822 <pre>
3823
3824
3825 foo
3826 </pre>
3827 !! html/php+tidy
3828 <pre>foo</pre>
3829 <pre>foo
3830 </pre>
3831 <pre>
3832
3833 foo
3834 </pre>
3835 <pre>
3836
3837
3838 foo
3839 </pre>
3840 !! html/parsoid
3841 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3842
3843 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3844 </pre>
3845
3846 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3847
3848 foo
3849 </pre>
3850
3851 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3852
3853
3854 foo
3855 </pre>
3856 !!end
3857
3858 !! test
3859 HTML-pre: big spaces
3860 !! wikitext
3861 <pre>
3862
3863
3864
3865
3866 haha
3867
3868
3869
3870
3871 haha
3872
3873
3874
3875
3876 </pre>
3877 !! html/php+tidy
3878 <pre>
3879
3880
3881
3882
3883 haha
3884
3885
3886
3887
3888 haha
3889
3890
3891
3892
3893 </pre>
3894 !! html/parsoid
3895 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3896
3897
3898
3899
3900 haha
3901
3902
3903
3904
3905 haha
3906
3907
3908
3909
3910 </pre>
3911 !! end
3912
3913 !!test
3914 HTML-pre: 2: indented text
3915 !! wikitext
3916 <pre>
3917 foo
3918 </pre>
3919 !! html
3920 <pre>
3921 foo
3922 </pre>
3923
3924 !!end
3925
3926 !!test
3927 HTML-pre: 3: other wikitext
3928 !! wikitext
3929 <pre>
3930 * foo
3931 # bar
3932 = no-h =
3933 '' no-italic ''
3934 [[ NoLink ]]
3935 </pre>
3936 !! html/php
3937 <pre>
3938 * foo
3939 # bar
3940 = no-h =
3941 '' no-italic ''
3942 [[ NoLink ]]
3943 </pre>
3944
3945 !! html/parsoid
3946 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3947 # bar
3948 = no-h =
3949 '' no-italic ''
3950 [[ NoLink ]]
3951 </pre>
3952 !!end
3953
3954 ###
3955 ### Definition lists
3956 ###
3957 !! test
3958 Simple definition
3959 !! wikitext
3960 ;name :Definition
3961 !! html
3962 <dl><dt>name</dt>
3963 <dd>Definition</dd></dl>
3964
3965 !! end
3966
3967 !! test
3968 Definition list for indentation only
3969 !! wikitext
3970 :Indented text
3971 !! html
3972 <dl><dd>Indented text</dd></dl>
3973
3974 !! end
3975
3976 !! test
3977 Definition list with no space
3978 !! wikitext
3979 ;name:Definition
3980 !! html
3981 <dl><dt>name</dt>
3982 <dd>Definition</dd></dl>
3983
3984 !!end
3985
3986 !! test
3987 Definition list with URL link
3988 !! wikitext
3989 ;http://example.com/ :definition
3990 !! html
3991 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
3992 <dd>definition</dd></dl>
3993
3994 !! end
3995
3996 !! test
3997 Definition list with bracketed URL link
3998 !! wikitext
3999 ;[http://www.example.com/ Example]:Something about it
4000 !! html
4001 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4002 <dd>Something about it</dd></dl>
4003
4004 !! end
4005
4006 !! test
4007 Definition list with wikilink containing colon
4008 !! wikitext
4009 ;[[Help:FAQ]]:The least-read page on Wikipedia
4010 !! html
4011 <dl><dt><a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
4012 <dd>The least-read page on Wikipedia</dd></dl>
4013
4014 !! end
4015
4016 # At Brion's and JeLuF's insistence... :)
4017 !! test
4018 Definition list with news link containing colon
4019 !! wikitext
4020 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4021 !! html/php
4022 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4023 <dd>This isn't even a real newsgroup!</dd></dl>
4024
4025 !! html/parsoid
4026 <dl><dt><a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
4027 !! end
4028
4029 !! test
4030 Malformed definition list with colon
4031 !! wikitext
4032 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4033 !! html
4034 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
4035
4036 !! end
4037
4038 !! test
4039 Definition lists: colon in external link text
4040 !! wikitext
4041 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4042 !! html
4043 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4044 <dd>OK, I made that up</dd></dl>
4045
4046 !! end
4047
4048 !! test
4049 Definition lists: colon in HTML attribute
4050 !! wikitext
4051 ;<b style="display: inline">bold</b>
4052 !! html
4053 <dl><dt><b style="display: inline">bold</b></dt></dl>
4054
4055 !! end
4056
4057 !! test
4058 Definition lists: self-closed tag
4059 !! wikitext
4060 ;one<br/>two :two-line fun
4061 !! html
4062 <dl><dt>one<br />two</dt>
4063 <dd>two-line fun</dd></dl>
4064
4065 !! end
4066
4067 !! test
4068 Definition lists: ignore colons inside tags
4069 !! wikitext
4070 ;one <b>two : tag <i>fun:</i>:</b>:def
4071 !! html
4072 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4073 <dd>def</dd></dl>
4074
4075 !! end
4076
4077 !! test
4078 Definition lists: excess closed tags
4079 !! wikitext
4080 ;one</b>two :bad tag fun
4081 !! html/php+tidy
4082 <dl><dt>onetwo</dt>
4083 <dd>bad tag fun</dd></dl>
4084 !! html/parsoid
4085 <dl>
4086 <dt>onetwo</dt>
4087 <dd>bad tag fun</dd>
4088 </dl>
4089 !! end
4090
4091 !! test
4092 T13748: Literal closing tags
4093 !! wikitext
4094 <dl>
4095 <dt>test 1</dt>
4096 <dd>test test test test test</dd>
4097 <dt>test 2</dt>
4098 <dd>test test test test test</dd>
4099 </dl>
4100 !! html
4101 <dl>
4102 <dt>test 1</dt>
4103 <dd>test test test test test</dd>
4104 <dt>test 2</dt>
4105 <dd>test test test test test</dd>
4106 </dl>
4107
4108 !! end
4109
4110 !! test
4111 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4112 !! wikitext
4113 <ul><li>
4114 ;term :description
4115 *unordered
4116 </li></ul>
4117 !! html
4118 <ul><li>
4119 <dl><dt>term</dt>
4120 <dd>description</dd></dl>
4121 <ul><li>unordered</li></ul>
4122 </li></ul>
4123
4124 !! end
4125
4126 !! test
4127 Definition list with empty definition and following paragraph
4128 !! wikitext
4129 ;term:
4130
4131 Paragraph text
4132 !! html
4133 <dl><dt>term</dt>
4134 <dd></dd></dl>
4135 <p>Paragraph text
4136 </p>
4137 !! end
4138
4139 !! test
4140 Nested definition lists using html syntax
4141 !! wikitext
4142 <dl><dt>x</dt>
4143 <dd>a</dd>
4144 <dd>b</dd></dl>
4145 !! html
4146 <dl><dt>x</dt>
4147 <dd>a</dd>
4148 <dd>b</dd></dl>
4149
4150 !! end
4151
4152 !! test
4153 Definition Lists: No nesting: Multiple dd's
4154 !! wikitext
4155 ;x
4156 :a
4157 :b
4158 !! html
4159 <dl><dt>x</dt>
4160 <dd>a</dd>
4161 <dd>b</dd></dl>
4162
4163 !! end
4164
4165 !! test
4166 Definition Lists: Indentation: Regular
4167 !! wikitext
4168 :i1
4169 ::i2
4170 :::i3
4171 !! html
4172 <dl><dd>i1
4173 <dl><dd>i2
4174 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4175
4176 !! end
4177
4178 !! test
4179 Definition Lists: Indentation: Missing 1st level
4180 !! wikitext
4181 ::i2
4182 :::i3
4183 !! html
4184 <dl><dd><dl><dd>i2
4185 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4186
4187 !! end
4188
4189 !! test
4190 Definition Lists: Indentation: Multi-level indent
4191 !! wikitext
4192 :::i3
4193 !! html
4194 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4195
4196 !! end
4197
4198 !! test
4199 Definition Lists: Hacky use to indent tables
4200 !! wikitext
4201 ::{|
4202 |foo
4203 |bar
4204 |}
4205 this text
4206 should be left alone
4207 !! html
4208 <dl><dd><dl><dd><table>
4209 <tr>
4210 <td>foo
4211 </td>
4212 <td>bar
4213 </td></tr></table></dd></dl></dd></dl>
4214 <p>this text
4215 should be left alone
4216 </p>
4217 !! end
4218
4219 !! test
4220 Definition Lists: Hacky use to indent tables (with content following table)
4221 !! wikitext
4222 :{|
4223 |foo
4224 |bar
4225 |} <!--c1--> this text should be part of the dl
4226 !! html/php+tidy
4227 <dl><dd><table>
4228 <tbody><tr>
4229 <td>foo
4230 </td>
4231 <td>bar
4232 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4233 !! html/parsoid
4234 <dl><dd><table>
4235 <tbody><tr>
4236 <td>foo
4237 </td>
4238 <td>bar
4239 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4240 !! end
4241
4242 !! test
4243 Definition Lists: Hacky use to indent tables, with comments (T65979)
4244 !! wikitext
4245 <!-- foo -->
4246 ::{|
4247 |foo
4248 |bar
4249 |}<!-- bar -->
4250 this text
4251 should be left alone
4252 !! html/parsoid
4253 <!-- foo -->
4254 <dl><dd><dl><dd><table><tr>
4255 <td>foo</td>
4256 <td>bar</td>
4257 </tr></table><!-- bar --></dd></dl></dd></dl>
4258 <p>this text
4259 should be left alone</p>
4260 !! end
4261
4262 !! test
4263 Definition Lists: Hacky use to indent tables, with comment before table
4264 !!options
4265 parsoid=wt2html
4266 !! wikitext
4267 ::<!-- foo -->{|
4268 |foo
4269 |}
4270 !! html/parsoid
4271 <dl><dd><dl><dd><!-- foo --><table><tr>
4272 <td>foo</td>
4273 </tr></table></dd></dl></dd></dl>
4274 !! end
4275
4276 # The trailing whitespace in this test is to catch a regression in
4277 # Parsoid after T54473.
4278 !! test
4279 Definition Lists: Hacky use to indent tables (WS-insensitive)
4280 !! wikitext
4281 :{|
4282 |a
4283 |}
4284 !! html/php
4285 <dl><dd><table>
4286 <tr>
4287 <td>a
4288 </td></tr></table></dd></dl>
4289
4290 !! html/parsoid
4291 <dl><dd><table>
4292 <tbody><tr><td>a</td></tr>
4293 </tbody></table></dd></dl>
4294 !! end
4295
4296 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4297 ## as an empty dt item. It also ignores all but the last ";" when followed
4298 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4299 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4300 ## ";"s.
4301 ##
4302 ## Ex: ";;t2 ::d2" is transformed into:
4303 ##
4304 ## <dl>
4305 ## <dt>t2 </dt>
4306 ## <dd>
4307 ## <dl>
4308 ## <dt></dt>
4309 ## <dd>d2</dd>
4310 ## </dl>
4311 ## </dd>
4312 ## </dl>
4313 ##
4314 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4315 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4316 ##
4317 ## <dl>
4318 ## <dt>
4319 ## <dl>
4320 ## <dt>t2 </dt>
4321 ## <dd>:d2</dd>
4322 ## </dl>
4323 ## </dt>
4324 ## </dl>
4325 ##
4326 ## All Parsoid only definition list tests have this difference.
4327 ##
4328 ## See also: https://phabricator.wikimedia.org/T8569
4329 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4330
4331 !! test
4332 Table / list interaction: indented table with lists in table contents
4333 !! wikitext
4334 :{|
4335 |-
4336 |a
4337
4338 *b
4339 |-
4340 |c
4341
4342 *d
4343 |}
4344 !! html
4345 <dl><dd><table>
4346
4347 <tr>
4348 <td>a
4349 <ul><li>b</li></ul>
4350 </td></tr>
4351 <tr>
4352 <td>c
4353 <ul><li>d</li></ul>
4354 </td></tr></table></dd></dl>
4355
4356 !! end
4357
4358 !!test
4359 Table / list interaction: lists nested in tables nested in indented lists
4360 !! wikitext
4361 :{|
4362 |
4363 :a
4364 :b
4365 |
4366 *c
4367 *d
4368 |}
4369
4370 *e
4371 *f
4372 !! html
4373 <dl><dd><table>
4374 <tr>
4375 <td>
4376 <dl><dd>a</dd>
4377 <dd>b</dd></dl>
4378 </td>
4379 <td>
4380 <ul><li>c</li>
4381 <li>d</li></ul>
4382 </td></tr></table></dd></dl>
4383 <ul><li>e</li>
4384 <li>f</li></ul>
4385
4386 !!end
4387
4388 !! test
4389 Definition Lists: Nesting: Multi-level (Parsoid only)
4390 !! wikitext
4391 ;t1 :d1
4392 ;;t2 ::d2
4393 ;;;t3 :::d3
4394 !! html/parsoid
4395 <dl>
4396 <dt>t1 </dt>
4397 <dd>d1</dd>
4398 <dt>
4399 <dl>
4400 <dt>t2 </dt>
4401 <dd>:d2</dd>
4402 <dt>
4403 <dl>
4404 <dt>t3 </dt>
4405 <dd>::d3</dd>
4406 </dl>
4407 </dt>
4408 </dl>
4409 </dt>
4410 </dl>
4411
4412
4413 !! end
4414
4415
4416 !! test
4417 Definition Lists: Nesting: Test 2
4418 !! wikitext
4419 ;t1
4420 ::d2
4421 !! html+tidy
4422 <dl><dt>t1</dt>
4423 <dd>
4424 <dl><dd>d2</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 !! test
4429 Definition Lists: Nesting: Test 3
4430 !! wikitext
4431 :;t1
4432 ::::d2
4433 !! html+tidy
4434 <dl><dd><dl><dt>t1</dt>
4435 <dd>
4436 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4437 !! end
4438
4439
4440 !! test
4441 Definition Lists: Nesting: Test 4
4442 !! wikitext
4443 ::;t3
4444 :::d3
4445 !! html
4446 <dl><dd><dl><dd><dl><dt>t3</dt>
4447 <dd>d3</dd></dl></dd></dl></dd></dl>
4448
4449 !! end
4450
4451
4452 ## The Parsoid team believes the following three test exposes a
4453 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4454 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4455 ## It also exposes a "misfeature" in tidy, which doesn't like
4456 ## <dl> tags with a single <dt> child; it converts the <dt> into
4457 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4458 !! test
4459 Definition Lists: Mixed Lists: Test 1
4460 !! wikitext
4461 :;*foo
4462 ::*bar
4463 :;baz
4464 !! html/php
4465 <dl><dd><dl><dt><ul><li>foo</li>
4466 <li>bar</li></ul></dt></dl>
4467 <dl><dt>baz</dt></dl></dd></dl>
4468
4469 !! html/php+tidy
4470 <dl><dd><dl><dt><ul><li>foo</li>
4471 <li>bar</li></ul></dt></dl>
4472 <dl><dt>baz</dt></dl></dd></dl>
4473 !! html/parsoid
4474 <dl>
4475 <dd><dl>
4476 <dt><ul>
4477 <li>foo
4478 </li>
4479 </ul></dt>
4480 <dd><ul>
4481 <li>bar
4482 </li>
4483 </ul></dd>
4484 <dt>baz</dt>
4485 </dl></dd>
4486 </dl>
4487 !! end
4488
4489 !! test
4490 Definition Lists: Mixed Lists: Test 2
4491 !! wikitext
4492 *:d1
4493 *:d2
4494 !! html
4495 <ul><li><dl><dd>d1</dd>
4496 <dd>d2</dd></dl></li></ul>
4497
4498 !! end
4499
4500
4501 !! test
4502 Definition Lists: Mixed Lists: Test 3
4503 !! wikitext
4504 *:::d1
4505 *:::d2
4506 !! html
4507 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4508 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4509
4510 !! end
4511
4512
4513 !! test
4514 Definition Lists: Mixed Lists: Test 4
4515 !! wikitext
4516 *;d1 :d2
4517 *;d3 :d4
4518 !! html
4519 <ul><li><dl><dt>d1</dt>
4520 <dd>d2</dd>
4521 <dt>d3</dt>
4522 <dd>d4</dd></dl></li></ul>
4523
4524 !! end
4525
4526
4527 !! test
4528 Definition Lists: Mixed Lists: Test 5
4529 !! wikitext
4530 *:d1
4531 *::d2
4532 !! html
4533 <ul><li><dl><dd>d1
4534 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4535
4536 !! end
4537
4538
4539 !! test
4540 Definition Lists: Mixed Lists: Test 6
4541 !! wikitext
4542 #*:d1
4543 #*:::d3
4544 !! html
4545 <ol><li><ul><li><dl><dd>d1
4546 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4547
4548 !! end
4549
4550
4551 !! test
4552 Definition Lists: Mixed Lists: Test 7
4553 !! wikitext
4554 :*d1
4555 :*d2
4556 !! html
4557 <dl><dd><ul><li>d1</li>
4558 <li>d2</li></ul></dd></dl>
4559
4560 !! end
4561
4562
4563 !! test
4564 Definition Lists: Mixed Lists: Test 8
4565 !! wikitext
4566 :*d1
4567 ::*d2
4568 !! html
4569 <dl><dd><ul><li>d1</li></ul>
4570 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4571
4572 !! end
4573
4574
4575 !! test
4576 Definition Lists: Mixed Lists: Test 9
4577 !! wikitext
4578 *;foo :bar
4579 !! html
4580 <ul><li><dl><dt>foo</dt>
4581 <dd>bar</dd></dl></li></ul>
4582
4583 !! end
4584
4585
4586 !! test
4587 Definition Lists: Mixed Lists: Test 10
4588 !! wikitext
4589 *#;foo :bar
4590 !! html
4591 <ul><li><ol><li><dl><dt>foo</dt>
4592 <dd>bar</dd></dl></li></ol></li></ul>
4593
4594 !! end
4595
4596 # The Parsoid team disagrees with the PHP parser's seemingly-random
4597 # rules regarding dd/dt on the next few tests. Parsoid is more
4598 # consistent, and recognizes the shared nesting and keeps the
4599 # still-open tags around until the nesting is complete.
4600
4601 # This is a regression test for T175099
4602 !! test
4603 Definition Lists: Mixed Lists: Test 11
4604 !! wikitext
4605 ;a
4606 :*b
4607 !! html/php
4608 <dl><dt>a</dt>
4609 <dd>
4610 <ul><li>b</li></ul></dd></dl>
4611
4612 !! html/parsoid
4613 <dl><dt>a
4614 <dd><ul><li>b</li></ul></dd></dl>
4615 !! end
4616
4617 # FIXME: Maybe get rid of this test?
4618 !! test
4619 Definition Lists: Mixed Lists: Test 12
4620 !! wikitext
4621 *#*#;*;;foo :bar
4622 *#*#;boo :baz
4623 !! html/php
4624 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4625 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4626 <dl><dt>boo</dt>
4627 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4628
4629 !! html/php+tidy
4630 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4631 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4632 <dl><dt>boo</dt>
4633 <dd>baz</dd></dl></li></ol></li></ul>
4634 !! html/parsoid
4635 <ul>
4636 <li>
4637 <ol>
4638 <li>
4639 <ul>
4640 <li>
4641 <ol>
4642 <li>
4643 <dl>
4644 <dt>
4645 <ul>
4646 <li>
4647 <dl>
4648 <dt>
4649 <dl>
4650 <dt>foo</dt>
4651 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4652 </dl></dt>
4653 </dl></li>
4654 </ul></dt>
4655 <dt>boo</dt>
4656 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4657 </dl></li>
4658 </ol></li>
4659 </ul></li>
4660 </ol></li>
4661 </ul>
4662 !! end
4663
4664 !! test
4665 Definition Lists: Mixed Lists: Test 13
4666 !! wikitext
4667 *#*#;*;;foo : bar
4668 *#*#;boo : baz
4669 !! html+tidy
4670 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4671 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4672 <dl><dt>boo&#160;</dt>
4673 <dd>baz</dd></dl></li></ol></li></ul>
4674 !! end
4675
4676 # FIXME: Maybe get rid of this test?
4677 # From whitelist:
4678 # * The test is wrong, there are two colons where there should be :;
4679 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4680 !! test
4681 Definition Lists: Weird Ones: Test 1
4682 !! wikitext
4683 *#;*::;;foo :bar (who uses this?)
4684 !! html/php+tidy
4685 <ul><li><ol><li><dl><dt>foo</dt>
4686 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4687 !! html/parsoid
4688 <ul>
4689 <li>
4690 <ol>
4691 <li>
4692 <dl>
4693 <dt>
4694 <ul>
4695 <li>
4696 <dl>
4697 <dd>
4698 <dl>
4699 <dd>
4700 <dl>
4701 <dt>
4702 <dl>
4703 <dt>foo</dt>
4704 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4705 </dl></dt>
4706 </dl></dd>
4707 </dl></dd>
4708 </dl></li>
4709 </ul></dt>
4710 </dl></li>
4711 </ol></li>
4712 </ul>
4713 !! end
4714
4715 !! test
4716 Definition Lists: colons occurring in tags
4717 !! wikitext
4718 ;a:b
4719 ;'''a:b'''
4720 ;<i>a:b</i>
4721 ;<span>a:b</span>
4722 ;<div>a:b</div>
4723 ;<div>a
4724 :b</div>
4725 ;{{echo|a:b}}
4726 ;{{echo|''a:b''}}
4727 ;;;''a:b''
4728 !! html+tidy
4729 <dl><dt>a</dt>
4730 <dd>b</dd>
4731 <dt><b>a:b</b></dt>
4732 <dt><i>a:b</i></dt>
4733 <dt><span>a:b</span></dt>
4734 <dt><div>a:b</div></dt>
4735 <dt><div>a</div></dt>
4736 <dd>b</dd>
4737 <dt>a</dt>
4738 <dd>b</dd>
4739 <dt><i>a:b</i></dt></dl>
4740 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4741 !! html/parsoid
4742 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4743 <dt><b>a:b</b></dt>
4744 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4745 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4746 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4747 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4748 <dd>b</dd>
4749 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4750 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4751 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4752 !! end
4753
4754 # Parsoid's output differs here again because it shares
4755 # nesting between the two lists unlike the PHP parser.
4756 # Unsure which is more desirable.
4757 !! test
4758 Definition Lists: colons and tables 1
4759 !! wikitext
4760 :{|
4761 |x
4762 |}
4763 :{|
4764 |y
4765 |}
4766 !! html/php
4767 <dl><dd><table>
4768 <tr>
4769 <td>x
4770 </td></tr></table></dd></dl>
4771 <dl><dd><table>
4772 <tr>
4773 <td>y
4774 </td></tr></table></dd></dl>
4775
4776 !! html/parsoid
4777 <dl><dd><table>
4778 <tr>
4779 <td>x
4780 </td></tr></table></dd>
4781 <dd><table>
4782 <tr>
4783 <td>y
4784 </td></tr></table></dd></dl>
4785 !! end
4786
4787 # FIXME: Does this need a html/php section?
4788 !! test
4789 Definition Lists: template interaction
4790 !! wikitext
4791 ::{{definition_list}}
4792
4793 :one
4794 ::{{definition_list}}
4795 :::two
4796 :::three
4797 ::four
4798 !! html/parsoid
4799 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4800 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4801
4802 <dl><dd data-parsoid='{}'>one
4803 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4804 </span><dd about="#mwt2">two
4805 <dl><dd>two</dd>
4806 <dd>three</dd></dl></dd>
4807 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4808 !! end
4809
4810
4811 ###
4812 ### External links
4813 ###
4814 !! test
4815 External links: non-bracketed
4816 !! wikitext
4817 Non-bracketed: http://example.com
4818 !! html
4819 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4820 </p>
4821 !! end
4822
4823 # parsoid doesn't explicitly mark autonumbered links, see T55505
4824 !! test
4825 External links: numbered
4826 !! wikitext
4827 Numbered: [http://example.com]
4828 Numbered: [http://example.net]
4829 Numbered: [http://example.com]
4830 !! html/php
4831 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4832 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4833 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4834 </p>
4835 !! html/parsoid
4836 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4837 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4838 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4839 !!end
4840
4841 !! test
4842 External links: specified text
4843 !! wikitext
4844 Specified text: [http://example.com link]
4845 !! html
4846 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4847 </p>
4848 !!end
4849
4850 !! test
4851 External links: trail
4852 !! wikitext
4853 Linktrails should not work for external links: [http://example.com link]s
4854 !! html
4855 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: dollar sign in URL
4861 !! wikitext
4862 http://example.com/1$2345
4863 !! html
4864 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4865 </p>
4866 !! end
4867
4868 # parsoid doesn't explicitly mark autonumbered links, see T55505
4869 !! test
4870 External links: dollar sign in URL (autonumber)
4871 !! wikitext
4872 [http://example.com/1$2345]
4873 !! html/php
4874 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4875 </p>
4876 !! html/parsoid
4877 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4878 !!end
4879
4880 !! test
4881 External links: open square bracket forbidden in URL (T6377)
4882 !! options
4883 parsoid=wt2html,wt2wt,html2html
4884 !! wikitext
4885 http://example.com/1[2345
4886 !! html/php
4887 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4888 </p>
4889 !! html/parsoid
4890 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4891 !! end
4892
4893 !! test
4894 External links: open square bracket forbidden in URL (named) (T6377)
4895 !! options
4896 parsoid=wt2html,html2html
4897 !! wikitext
4898 [http://example.com/1[2345]
4899 !! html/php
4900 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4901 </p>
4902 !! html/parsoid
4903 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4904 !!end
4905
4906 # parsoid adds a space before the link name
4907 !! test
4908 External links: open square bracket forbidden in URL (named) (T6377)
4909 Parsoid variant.
4910 !! wikitext
4911 [http://example.com/1 [2345]
4912 !! html
4913 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4914 </p>
4915 !!end
4916
4917 !! test
4918 External links: nowiki in URL link text (T8230)
4919 !! wikitext
4920 [http://example.com/ <nowiki>''example site''</nowiki>]
4921 !! html
4922 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4923 </p>
4924 !! end
4925
4926 !! test
4927 External links: newline forbidden in text (T8230 regression check)
4928 !! wikitext
4929 [http://example.com/ first
4930 second]
4931 !! html
4932 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4933 second]
4934 </p>
4935 !!end
4936
4937 !! test
4938 External links: Pipe char between url and text
4939 !! wikitext
4940 [http://example.com | link]
4941 !! html
4942 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4943 </p>
4944 !!end
4945
4946 !! test
4947 External links: protocol-relative URL in brackets
4948 !! wikitext
4949 [//example.com/ Test]
4950 !! html
4951 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4952 </p>
4953 !! end
4954
4955 # parsoid doesn't explicitly mark autonumbered links, see T55505
4956 !! test
4957 External links: protocol-relative URL in brackets without text
4958 !! wikitext
4959 [//example.com]
4960 !! html/php
4961 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4962 </p>
4963 !! html/parsoid
4964 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4965 !! end
4966
4967 !! test
4968 External links: protocol-relative URL in free text is left alone
4969 !! wikitext
4970 //example.com/Foo
4971 !! html
4972 <p>//example.com/Foo
4973 </p>
4974 !!end
4975
4976 !! test
4977 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4978 !! wikitext
4979 foo//example.com/Foo
4980 !! html
4981 <p>foo//example.com/Foo
4982 </p>
4983 !! end
4984
4985 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4986 !! test
4987 External links: with no contents
4988 !! options
4989 parsoid=wt2html,wt2wt
4990 !! wikitext
4991 [http://en.wikipedia.org/wiki/Foo]
4992
4993 [[wikipedia:Foo|Bar]]
4994
4995 [[wikipedia:Foo|<span>Bar</span>]]
4996 !! html/php
4997 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4998 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4999 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
5000 </p>
5001 !! html/parsoid
5002 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
5003 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
5004 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5005 !! end
5006
5007 !! test
5008 External links: Free with trailing punctuation
5009 !! wikitext
5010 http://example.com,
5011 http://example.com;
5012 http://example.com\
5013 http://example.com.
5014 http://example.com:
5015 http://example.com!
5016 http://example.com?
5017 http://example.com)
5018 http://example.com/url_with_(brackets)
5019 (http://example.com/url_without_brackets)
5020 http://example.com/url_with_entity&amp;
5021 http://example.com/url_with_entity&#x26;
5022 http://example.com/url_with_entity&#038;
5023 http://example.com/url_with_entity&nbsp;
5024 http://example.com/url_with_entity&#xA0;
5025 http://example.com/url_with_entity&#160;
5026 http://example.com/url_with_entity&lt;
5027 http://example.com/url_with_entity&#x3C;
5028 http://example.com/url_with_entity&#60;
5029 !! html/php
5030 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5031 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5032 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5033 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5034 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5035 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5036 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5037 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5038 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5039 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5040 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5041 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5042 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5043 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5044 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5045 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5046 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5047 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5048 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5049 </p>
5050 !! html/parsoid
5051 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
5052 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5053 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5054 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5055 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5056 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5057 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5058 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5060 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5061 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5062 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5063 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5064 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
5065 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
5066 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
5067 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
5068 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5069 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5070 !! end
5071
5072 !! test
5073 External links: tricky Parsoid html2html case
5074 !! options
5075 parsoid=wt2html,wt2wt,html2html
5076 !! wikitext
5077 http://example.com/url_with_entity&amp;amp;
5078 !! html/php
5079 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
5080 </p>
5081 !! html/parsoid
5082 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
5083 !! end
5084
5085 !! test
5086 External links: Free with trailing quotes (T113666)
5087 !! wikitext
5088 '''News:''' Stuff here
5089
5090 news:'a'b''c''d e
5091 !! html/php
5092 <p><b>News:</b> Stuff here
5093 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5094 </p>
5095 !! html/parsoid
5096 <p><b>News:</b> Stuff here</p>
5097 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
5098 !! end
5099
5100 !! test
5101 External links: with entity
5102 !! wikitext
5103 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5104 !! html/php
5105 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5106 </p>
5107 !! html/parsoid
5108 <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
5109 !! end
5110
5111 !! test
5112 External links: Lone protocols are never linked (T105697)
5113 !! wikitext
5114 http://
5115 http://;
5116 (http://)
5117 bitcoin:
5118 bitcoin:;
5119 (bitcoin:)
5120 !! html
5121 <p>http://
5122 http://;
5123 (http://)
5124 bitcoin:
5125 bitcoin:;
5126 (bitcoin:)
5127 </p>
5128 !! end
5129
5130 !! test
5131 External links: No preceding word characters allowed (T67278)
5132 !! wikitext
5133 NOPEhttp://example.com
5134 N0http://example.com
5135 ok:http://example.com
5136 ok-http://example.com
5137 !! html
5138 <p>NOPEhttp://example.com
5139 N0http://example.com
5140 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5141 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5142 </p>
5143 !! end
5144
5145 !! test
5146 External links: nofollow domain exception
5147 !! wikitext
5148 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5149 !! html
5150 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
5151 </p>
5152 !!end
5153
5154 !! test
5155 External image
5156 !! wikitext
5157 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5158 !! html
5159 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5160 </p>
5161 !! end
5162
5163 !! test
5164 External image from https
5165 !! wikitext
5166 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5167 !! html
5168 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5169 </p>
5170 !! end
5171
5172 !! test
5173 External image (when not allowed)
5174 !! options
5175 wgAllowExternalImages=0
5176 !! wikitext
5177 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5178 !! html
5179 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
5180 </p>
5181 !! end
5182
5183 !! test
5184 Link to non-http image, no img tag
5185 !! wikitext
5186 Link to non-http image, no img tag: ftp://example.com/test.jpg
5187 !! html
5188 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
5189 </p>
5190 !! end
5191
5192 !! test
5193 External links: terminating separator
5194 !! wikitext
5195 Terminating separator: http://example.com/thing,
5196 !! html
5197 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5198 </p>
5199 !! end
5200
5201 !! test
5202 External links: intervening separator
5203 !! wikitext
5204 Intervening separator: http://example.com/1,2,3
5205 !! html
5206 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5207 </p>
5208 !! end
5209
5210 !! test
5211 External links: old bug with URL in query
5212 !! wikitext
5213 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5214 !! html
5215 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5216 </p>
5217 !! end
5218
5219 !! test
5220 External links: old URL-in-URL bug, mixed protocols
5221 !! wikitext
5222 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5223 !! html
5224 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5225 </p>
5226 !!end
5227
5228 # Since Parsoid is starting to emit canonical wikitext for links,
5229 # [http://example.com http://example.com] will not RT back to that
5230 # form anymore.
5231 !! test
5232 External links: URL in text
5233 !! options
5234 parsoid=wt2html
5235 !! wikitext
5236 URL in text: [http://example.com http://example.com]
5237 !! html/php
5238 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5239 </p>
5240 !! html/parsoid
5241 <p>URL in text: <a rel="mw:ExtLink" class="external text" href="http://example.com">http://example.com</a></p>
5242 !! end
5243
5244 !! test
5245 External links: Clickable images
5246 !! wikitext
5247 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5248 !! html/php
5249 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
5250 </p>
5251 !! html/parsoid
5252 <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5253 !! end
5254
5255 !! test
5256 External links: raw ampersand
5257 !! wikitext
5258 Old &amp; use: http://x&y
5259 !! html
5260 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5261 </p>
5262 !! end
5263
5264 !! test
5265 External links: encoded ampersand
5266 !! wikitext
5267 Old &amp; use: http://x&amp;y
5268 !! html/php
5269 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5270 </p>
5271 !! html/parsoid
5272 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
5273 !! end
5274
5275 !! test
5276 External links: encoded equals (T8102)
5277 !! wikitext
5278 http://example.com/?foo&#61;bar
5279 !! html/php
5280 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5281 </p>
5282 !! html/parsoid
5283 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5284 !! end
5285
5286 ##
5287 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5288 ## does it number them. As discussed in T55505, we can identify
5289 ## autonumbered links via CSS.
5290 ##
5291
5292 !! test
5293 External links: [raw ampersand]
5294 !! wikitext
5295 Old &amp; use: [http://x&y]
5296 !! html/php
5297 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5298 </p>
5299 !! html/parsoid
5300 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5301 !! end
5302
5303 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5304 # mode will return the [raw ampersand] wikitext
5305 !! test
5306 External links: [encoded ampersand]
5307 !! options
5308 parsoid=wt2html,wt2wt,html2html
5309 !! wikitext
5310 Old &amp; use: [http://x&amp;y]
5311 !! html/php
5312 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5313 </p>
5314 !! html/parsoid
5315 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5316 !! end
5317
5318 !! test
5319 External links: [raw equals]
5320 !! wikitext
5321 [http://example.com/?foo=bar]
5322 !! html/php
5323 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5327 !! end
5328
5329 # note that parsoid html is identical to [raw equals] case; so html2wt
5330 # mode will return the [raw equals] wikitext
5331 !! test
5332 External links: [encoded equals] (T8102)
5333 !! options
5334 parsoid=wt2html,wt2wt,html2html
5335 !! wikitext
5336 [http://example.com/?foo&#61;bar]
5337 !! html/php
5338 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5342 !! end
5343
5344 # xxx parsoid strips the IDN character, so the round-trip tests will
5345 # obviously fail and are disabled. --cscott
5346 !! test
5347 External links: [IDN ignored character reference in hostname; strip it right off]
5348 !! options
5349 parsoid=wt2html,wt2wt,html2html
5350 !! wikitext
5351 [http://e&zwnj;xample.com/]
5352 !! html/php
5353 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5354 </p>
5355 !! html/parsoid
5356 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5357 !! end
5358
5359 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5360 # Where an external link could easily circumvent the sanitization of the text of
5361 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5362 # test demands a higher standard. That's a bit strange.
5363 #
5364 # Example:
5365 #
5366 # http://e‌xample.com -> [http://example.com|http://example.com]
5367 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5368 #
5369 # The first example is sanitized, but the second is not. Any security benefits
5370 # from this production are trivial to circumvent. Either remove this test and
5371 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5372 # the test accordingly.
5373 #
5374 # All our love,
5375 # The Parsoid team.
5376 # xxx parsoid strips the IDN character, so the round-trip tests will
5377 # obviously fail and are disabled. --cscott
5378 !! test
5379 External links: IDN ignored character reference in hostname; strip it right off
5380 !! options
5381 parsoid=wt2html,html2html
5382 !! wikitext
5383 http://e&zwnj;xample.com/
5384 !! html/php
5385 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5386 </p>
5387 !! html/parsoid
5388 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5389 !! end
5390
5391 !! test
5392 External links: www.jpeg.org (T2554)
5393 !! wikitext
5394 http://www.jpeg.org
5395 !! html
5396 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5397 </p>
5398 !! end
5399
5400 # parsoid doesn't explicitly mark autonumbered links, see T55505
5401 !! test
5402 External links: URL within URL (T2002)
5403 !! wikitext
5404 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5405 !! html/php
5406 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5407 </p>
5408 !! html/parsoid
5409 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5410 !! end
5411
5412 !! test
5413 T2361: URL inside bracketed URL
5414 !! wikitext
5415 [http://www.example.com/foo http://www.example.com/bar]
5416 !! html
5417 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5418 </p>
5419 !! end
5420
5421 !! test
5422 T2361: URL within URL, not bracketed
5423 !! wikitext
5424 http://www.example.com/foo?=http://www.example.com/bar
5425 !! html
5426 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5427 </p>
5428 !! end
5429
5430 !! test
5431 T2289: ">"-token in URL-tail
5432 !! wikitext
5433 http://www.example.com/<hello>
5434 !! html
5435 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5436 </p>
5437 !!end
5438
5439 !! test
5440 T2289: literal ">"-token in URL-tail
5441 !! wikitext
5442 http://www.example.com/<b>html</b>
5443 !! html/php
5444 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5445 </p>
5446 !! html/parsoid
5447 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5448 !! end
5449
5450 !! test
5451 T2289: ">"-token in bracketed URL
5452 !! wikitext
5453 [http://www.example.com/<hello> stuff]
5454 !! html
5455 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5456 </p>
5457 !!end
5458
5459 !! test
5460 T2289: literal ">"-token in bracketed URL
5461 !! wikitext
5462 [http://www.example.com/<b>html</b> stuff]
5463 !! html
5464 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5465 </p>
5466 !!end
5467
5468 !! test
5469 T2289: literal double quote at end of URL
5470 !! wikitext
5471 http://www.example.com/"hello"
5472 !! html
5473 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5474 </p>
5475 !!end
5476
5477 !! test
5478 T2289: literal double quote in bracketed URL
5479 !! wikitext
5480 [http://www.example.com/"hello" stuff]
5481 !! html
5482 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5483 </p>
5484 !!end
5485
5486 !! test
5487 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5488 !! wikitext
5489 [http://www.example.com test]
5490 !! html
5491 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5492 </p>
5493 !! end
5494
5495 !! test
5496 External links: link text with spaces
5497 !! wikitext
5498 [http://www.example.com a b c]
5499 [http://www.example.com ''a'' ''b'']
5500 !! html
5501 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5502 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5503 </p>
5504 !! end
5505
5506 # Note edge case difference between PHP and Parsoid here.
5507 !! test
5508 External links: wiki links within external link (T5695)
5509 !! options
5510 parsoid=wt2html,html2html
5511 !! wikitext
5512 [http://example.com [[wikilink]] embedded in ext link]
5513
5514 [http://example.com test [[wikilink]] embedded in ext link]
5515 !! html/php
5516 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5517 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5518 </p>
5519 !! html/parsoid
5520 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5521 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5522 !! end
5523
5524 !! test
5525 T2787: Links with one slash after the url protocol are invalid
5526 !! wikitext
5527 http:/example.com
5528
5529 [http:/example.com title]
5530 !! html
5531 <p>http:/example.com
5532 </p><p>[http:/example.com title]
5533 </p>
5534 !! end
5535
5536 !! test
5537 Bracketed external links with template-generated invalid target
5538 !! wikitext
5539 [{{echo|http:/example.com}} title]
5540 !! html
5541 <p>[http:/example.com title]
5542 </p>
5543 !! end
5544
5545 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5546 !! test
5547 Broken wikilinks (but not external links) prevent templates from closing
5548 !! options
5549 parsoid=wt2html
5550 !! wikitext
5551 [http://example.com x
5552
5553 {{echo|[http://example.com x}}
5554
5555 [[Foo
5556
5557 {{echo|[[Foo}}
5558 !! html/php
5559 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5560 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5561 </p><p>[[Foo
5562 </p><p>{{echo|[[Foo}}
5563 </p>
5564 !! html/parsoid
5565 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5566 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5567 <p>[[Foo</p>
5568 <p>{{echo|[[Foo}}</p>
5569 !! end
5570
5571 !! test
5572 Wikilinks with embedded newlines are not broken
5573 !! wikitext
5574 {{echo|[[ Foo
5575 B
5576 C]]}}
5577 !! html/php
5578 <p>[[ Foo
5579 B
5580 C]]
5581 </p>
5582 !! html/parsoid
5583 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5584 !! end
5585
5586 !! test
5587 Broken templates
5588 !! options
5589 parsoid=wt2html
5590 !! wikitext
5591 {{echo|[[Foo|}}]]
5592
5593 [[Foo|{{echo|]]}}
5594 !! html/php
5595 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5596 </p><p>[[Foo|]]
5597 </p>
5598 !! html/parsoid
5599 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5600 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5601 !! end
5602
5603 !! test
5604 T4702: Mismatched <i>, <b> and <a> tags are invalid
5605 !! wikitext
5606 ''[http://example.com text'']
5607 [http://example.com '''text]'''
5608 ''Something [http://example.com in italic'']
5609 ''Something [http://example.com mixed''''', even bold]'''
5610 '''''Now [http://example.com both''''']
5611 !! html
5612 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5613 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5614 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5615 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5616 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5617 </p>
5618 !! end
5619
5620
5621 !! test
5622 T6781: %26 in URL
5623 !! wikitext
5624 http://www.example.com/?title=AT%26T
5625 !! html/php
5626 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5627 </p>
5628 !! html/parsoid
5629 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5630 !! end
5631
5632 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5633 # % is actually legal in HTML5. Any change in output would need testing though.
5634 !! test
5635 T6781, T7267: %25 in URL
5636 !! wikitext
5637 http://www.example.com/?title=100%25_Bran
5638 !! html/php
5639 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5640 </p>
5641 !! html/parsoid
5642 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5643 !! end
5644
5645 !! test
5646 T6781, T7267: %28, %29 in URL
5647 !! wikitext
5648 http://www.example.com/?title=Ben-Hur_%281959_film%29
5649 !! html/php
5650 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5651 </p>
5652 !! html/parsoid
5653 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5654 !! end
5655
5656
5657 !! test
5658 T6781: %26 in autonumber URL
5659 !! wikitext
5660 [http://www.example.com/?title=AT%26T]
5661 !! html/php
5662 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5663 </p>
5664 !! html/parsoid
5665 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5666 !! end
5667
5668 !! test
5669 T6781, T7267: %26 in autonumber URL
5670 !! wikitext
5671 [http://www.example.com/?title=100%25_Bran]
5672 !! html/php
5673 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5674 </p>
5675 !! html/parsoid
5676 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5677 !! end
5678
5679 !! test
5680 T6781, T7267: %28, %29 in autonumber URL
5681 !! wikitext
5682 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5683 !! html/php
5684 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5685 </p>
5686 !! html/parsoid
5687 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5688 !! end
5689
5690
5691 !! test
5692 T6781: %26 in bracketed URL
5693 !! wikitext
5694 [http://www.example.com/?title=AT%26T link]
5695 !! html/php
5696 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5697 </p>
5698 !! html/parsoid
5699 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5700 !! end
5701
5702 !! test
5703 T6781, T7267: %25 in bracketed URL
5704 !! wikitext
5705 [http://www.example.com/?title=100%25_Bran link]
5706 !! html
5707 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5708 </p>
5709 !! end
5710
5711 !! test
5712 T6781, T7267: %28, %29 in bracketed URL
5713 !! wikitext
5714 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5715 !! html/php
5716 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5717 </p>
5718 !! html/parsoid
5719 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5720 !! end
5721
5722 !! test
5723 External link containing a period in the anchor. (T65947)
5724 !! wikitext
5725 [//foo.org/bar#baz. bang]
5726
5727 [//foo.org/bar. bang]
5728 !! html/php
5729 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5730 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5731 </p>
5732 !! html/parsoid
5733 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5734 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5735 !! end
5736
5737 !! test
5738 External link containing a single quote. (T65947)
5739 !! wikitext
5740 [//foo.org/bar'baz]
5741
5742 [//foo.org/bar'baz bang]
5743 !! html/php
5744 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5745 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5746 </p>
5747 !! html/parsoid
5748 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5749 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5750 !! end
5751
5752 !! test
5753 External link containing double-single-quotes in text '' (T6598 sanity check)
5754 !! wikitext
5755 Some [http://example.com/ pretty ''italics'' and stuff]!
5756 !! html
5757 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5758 </p>
5759 !! end
5760
5761 !! test
5762 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5763 !! wikitext
5764 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5765 !! html
5766 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5767 </p>
5768 !! end
5769
5770 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5771 !! test
5772 External link containing double-single-quotes with no space separating the url from text in italics
5773 !! wikitext
5774 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5775 !! html/php+tidy
5776 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
5777 </p>
5778 !! html/parsoid
5779 <p><a rel="mw:ExtLink" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5780 !! end
5781
5782 !! test
5783 External link with comments in link text
5784 !! wikitext
5785 [http://www.google.com Google <!-- comment -->]
5786 !! html/php
5787 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5788 </p>
5789 !! html/parsoid
5790 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5791 !! end
5792
5793 !! test
5794 External link to bare IPv4 address
5795 !! wikitext
5796 [http://192.168.0.1 Link]
5797 !! html/php
5798 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5799 </p>
5800 !! html/parsoid
5801 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5802 !! end
5803
5804 !! test
5805 URL-encoding in URL functions (single parameter)
5806 !! wikitext
5807 {{localurl:Some page|amp=&}}
5808 !! html
5809 <p>/index.php?title=Some_page&amp;amp=&amp;
5810 </p>
5811 !! end
5812
5813 !! test
5814 URL-encoding in URL functions (multiple parameters)
5815 !! wikitext
5816 {{localurl:Some page|q=?&amp=&}}
5817 !! html
5818 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5819 </p>
5820 !! end
5821
5822 !! test
5823 Brackets in urls
5824 !! wikitext
5825 http://example.com/index.php?foozoid%5B%5D=bar
5826
5827 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5828 !! html/php
5829 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5830 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5831 </p>
5832 !! html/parsoid
5833 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5834
5835 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5836 !! end
5837
5838 !! test
5839 IPv6 urls, autolink format (T23261)
5840 !! wikitext
5841 http://[2404:130:0:1000::187:2]/index.php
5842
5843 Examples from RFC 2373, section 2.2:
5844
5845 *http://[1080::8:800:200C:417A]/unicast
5846 *http://[FF01::101]/multicast
5847 *http://[::1]/loopback
5848 *http://[::]/unspecified
5849 *http://[::13.1.68.3]/ipv4compat
5850 *http://[::FFFF:129.144.52.38]/ipv4compat
5851
5852 Examples from RFC 2732, section 2:
5853
5854 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5855 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5856 *http://[3ffe:2a00:100:7031::1]
5857 *http://[1080::8:800:200C:417A]/foo
5858 *http://[::192.9.5.5]/ipng
5859 *http://[::FFFF:129.144.52.38]:80/index.html
5860 *http://[2010:836B:4179::836B:4179]
5861 !! html/php
5862 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5863 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5864 </p>
5865 <ul><li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5866 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5867 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5868 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5869 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5870 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5871 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5872 </p>
5873 <ul><li><a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5874 <li><a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5875 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5876 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5877 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5878 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5879 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5880
5881 !! html/parsoid
5882 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5883
5884 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5885 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5886 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5887 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5888 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5889 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5890 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5891
5892 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5893 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5894 <li><a rel="mw:ExtLink" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5895 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5896 <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5897 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5898 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5899 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5900 !! end
5901
5902 !! test
5903 IPv6 urls, bracketed format (T23261)
5904 !! wikitext
5905 [http://[2404:130:0:1000::187:2]/index.php test]
5906
5907 Examples from RFC 2373, section 2.2:
5908
5909 *[http://[1080::8:800:200C:417A] unicast]
5910 *[http://[FF01::101] multicast]
5911 *[http://[::1]/ loopback]
5912 *[http://[::] unspecified]
5913 *[http://[::13.1.68.3] ipv4compat]
5914 *[http://[::FFFF:129.144.52.38] ipv4compat]
5915
5916 Examples from RFC 2732, section 2:
5917
5918 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5919 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5920 *[http://[3ffe:2a00:100:7031::1] 3]
5921 *[http://[1080::8:800:200C:417A]/foo 4]
5922 *[http://[::192.9.5.5]/ipng 5]
5923 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5924 *[http://[2010:836B:4179::836B:4179] 7]
5925 !! html/php
5926 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5927 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5928 </p>
5929 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5930 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5931 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5932 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5933 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5934 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5935 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5936 </p>
5937 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5938 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5939 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5940 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5941 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5942 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5943 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5944
5945 !! html/parsoid
5946 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5947
5948 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5949 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5950 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5951 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5952 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5953 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5954 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5955
5956 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5957 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5958 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5959 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5960 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5961 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5962 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5963 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5964 !! end
5965
5966 !! test
5967 Non-extlinks in brackets
5968 !! wikitext
5969 [foo]
5970 [foo bar]
5971 [foo ''bar'']
5972 [fool's] errand
5973 [fool's errand]
5974 [{{echo|foo}}]
5975 [{{echo|foo}} bar]
5976 [{{echo|foo}} ''bar'']
5977 [{{echo|foo}}l's] errand
5978 [{{echo|foo}}l's errand]
5979 [url={{echo|foo}}]
5980 [url=http://example.com]
5981 [http:// bare protocols don't count]
5982 !! html/php
5983 <p>[foo]
5984 [foo bar]
5985 [foo <i>bar</i>]
5986 [fool's] errand
5987 [fool's errand]
5988 [foo]
5989 [foo bar]
5990 [foo <i>bar</i>]
5991 [fool's] errand
5992 [fool's errand]
5993 [url=foo]
5994 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5995 [http:// bare protocols don't count]
5996 </p>
5997 !! html/parsoid
5998 <p>[foo]
5999 [foo bar]
6000 [foo <i>bar</i>]
6001 [fool's] errand
6002 [fool's errand]
6003 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6004 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
6005 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
6006 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
6007 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
6008 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6009 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6010 [http:// bare protocols don't count]</p>
6011 !! end
6012
6013 !! test
6014 Percent encoding in external links
6015 !! wikitext
6016 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6017 !! html/php
6018 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6019 </p>
6020 !! html/parsoid
6021 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6022 !! end
6023
6024 !! test
6025 Use url link syntax for links where the content is equal the link target
6026 !! wikitext
6027 http://example.com
6028 !! html/php
6029 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6030 </p>
6031 !! html/parsoid
6032 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6033 !! end
6034
6035 !! test
6036 Parenthesis in external links, especially URL links
6037 !! wikitext
6038 http://example.com)
6039
6040 http://example.com/test)
6041
6042 http://example.com/(test)
6043
6044 http://example.com/((test)
6045
6046 (http://example.com/(test))
6047
6048 (http://example.com/(test)))))
6049
6050 http://example.com/a)b
6051
6052 [http://example.com) foo]
6053 !! html/php
6054 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6055 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6056 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6057 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6058 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6059 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6060 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6061 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6062 </p>
6063 !! html/parsoid
6064 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6065 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6066 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6067 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6068 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6069 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6070 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6071 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6072 !! end
6073
6074 !! test
6075 Parenthesis in external links, w/ transclusion or comment
6076 !! wikitext
6077 (http://example.com/{{echo|hi}})
6078
6079 (http://example.com<!-- hi -->)
6080 !! html/php
6081 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6082 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6083 </p>
6084 !! html/parsoid
6085 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
6086
6087 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
6088 !! end
6089
6090 !! test
6091 Serialize <a> tags with invalid link targets as plain text
6092 !! options
6093 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6094 !! html/parsoid
6095 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6096 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6097 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6098 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6099 !! wikitext
6100 text
6101 <nowiki>*</nowiki>text
6102 <nowiki>[[foo]]</nowiki>
6103 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6104 !! end
6105
6106 !! test
6107 mw:ExtLink -vs- mw:WikiLink (T94723)
6108 !! options
6109 parsoid=html2wt
6110 !! html/parsoid
6111 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6112 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6113 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6114 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6115 <p>
6116 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6117 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6118 </p>
6119 !! wikitext
6120 [[Foo|Bar]]
6121 [[Foo|Bar]]
6122 [[:en:Foo|Bar]]
6123 [[:en:Foo|Bar]]
6124
6125 [[:en:European_Robin|European Robin]]
6126 [[:en:European_Robin|European Robin]]
6127 !! end
6128
6129 !! test
6130 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6131 !! options
6132 parsoid=wt2wt
6133 !! wikitext
6134 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6135 !! html/parsoid
6136 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6137 !! end
6138
6139
6140 ###
6141 ### Quotes
6142 ###
6143
6144 !! test
6145 Quotes
6146 !! wikitext
6147 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6148
6149 Normal text. '''''Bold italic text.''''' Normal text.
6150 !! html
6151 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6152 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6153 </p>
6154 !! end
6155
6156 !! test
6157 Quotes wrapping HTML table
6158 !! wikitext
6159 '''<table><tr><td>hi</td></tr></table>'''
6160 !! html/php+tidy
6161 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6162 !! html/parsoid
6163 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6164 !! end
6165
6166 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6167 # parser strips. The wikitext contains just the first half of the bold
6168 # quote pair.
6169 !! test
6170 Unclosed and unmatched quotes
6171 !! wikitext
6172 '''''Bold italic text '''with bold deactivated''' in between.'''''
6173
6174 '''''Bold italic text ''with italic deactivated'' in between.'''''
6175
6176 '''Bold text..
6177
6178 ..spanning two paragraphs (should not work).'''
6179
6180 '''Bold tag left open
6181
6182 ''Italic tag left open
6183
6184 Normal text.
6185
6186 <!-- Unmatching number of opening, closing tags: -->
6187 '''This year''''s election ''should'' beat '''last year''''s.
6188
6189 ''Tom'''s car is bigger than ''Susan'''s.
6190
6191 Plain ''italic'''s plain
6192 !! html/php
6193 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6194 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6195 </p><p><b>Bold text..</b>
6196 </p><p>..spanning two paragraphs (should not work).
6197 </p><p><b>Bold tag left open</b>
6198 </p><p><i>Italic tag left open</i>
6199 </p><p>Normal text.
6200 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6201 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6202 </p><p>Plain <i>italic'</i>s plain
6203 </p>
6204 !! html/parsoid
6205 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6206 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6207 </p><p><b>Bold text..</b>
6208 </p><p>..spanning two paragraphs (should not work).<b></b>
6209 </p><p><b>Bold tag left open</b>
6210 </p><p><i>Italic tag left open</i>
6211 </p><p>Normal text.
6212 </p>
6213 <!-- Unmatching number of opening, closing tags: -->
6214 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6215 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6216 </p><p>Plain <i>italic'</i>s plain
6217 </p>
6218 !! end
6219
6220 ###
6221 ### Tables
6222 ###
6223 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6224 ###
6225
6226 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6227 # is the bare minimum required by the spec, see:
6228 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6229 # Parsoid team replies: empty table tags are legal in HTML5
6230 !! test
6231 A table with no data.
6232 !! options
6233 parsoid=wt2html
6234 !! wikitext
6235 {||}
6236 !! html/php
6237
6238 !! html/parsoid
6239 <table></table>
6240
6241 !! end
6242
6243 !! test
6244 A table with stray table end tags on start tag line (wt2html)
6245 !! options
6246 parsoid=wt2html
6247 !! wikitext
6248 {|style="color: red;"|}
6249
6250 {|style="color: red;" |}
6251 |foo
6252 |}
6253
6254 {|style="color: red;"|} id="foo"
6255 |foo
6256 |}
6257
6258 {|style="color: red;" |} id="foo"
6259 |foo
6260 |}
6261 !! html
6262 <table style="color: red;"></table>
6263
6264 <table style="color: red;">
6265 <tbody><tr>
6266 <td>foo</td>
6267 </tr></tbody>
6268 </table>
6269
6270 <table style="color: red;" id="foo">
6271 <tbody><tr>
6272 <td>foo</td>
6273 </tr></tbody>
6274 </table>
6275
6276 <table style="color: red;" id="foo">
6277 <tbody><tr>
6278 <td>foo</td>
6279 </tr></tbody>
6280 </table>
6281
6282 !! end
6283
6284 !! test
6285 A table with no data (take 2)
6286 !! wikitext
6287 {|
6288 |}
6289 !! html/parsoid
6290 <table></table>
6291 !! end
6292
6293 # A table with nothing but a caption is invalid XHTML, we might want to render
6294 # this as <p>caption</p>
6295 # Parsoid team replies: table with only a caption is legal in HTML5
6296 !! test
6297 A table with nothing but a caption
6298 !! wikitext
6299 {|
6300 |+caption
6301 |}
6302 !! html/php
6303 <table>
6304 <caption>caption
6305 </caption><tr><td></td></tr></table>
6306
6307 !! html/parsoid
6308 <table><caption>caption</caption></table>
6309 !! end
6310
6311 !! test
6312 A table with caption with default-spaced attributes and a table row
6313 !! wikitext
6314 {|
6315 |+ style="color: red;" |caption1
6316 |-
6317 |foo
6318 |}
6319 !! html
6320 <table>
6321 <caption style="color: red;">caption1
6322 </caption>
6323 <tr>
6324 <td>foo
6325 </td></tr></table>
6326
6327 !! end
6328
6329 !! test
6330 A table with captions with non-default spaced attributes and a table row
6331 !! wikitext
6332 {|
6333 |+style="color: red;"|caption2
6334 |+ style="color: red;"|caption3
6335 |-
6336 |foo
6337 |}
6338 !! html
6339 <table>
6340 <caption style="color: red;">caption2
6341 </caption>
6342 <caption style="color: red;">caption3
6343 </caption>
6344 <tr>
6345 <td>foo
6346 </td></tr></table>
6347
6348 !! end
6349
6350 !! test
6351 Table td-cell syntax variations
6352 !! wikitext
6353 {|
6354 |foo bar foo|baz
6355 |foo bar foo||baz
6356 |style='color:red;'|baz
6357 |style='color:red;'||baz
6358 |}
6359 !! html
6360 <table>
6361 <tr>
6362 <td>baz
6363 </td>
6364 <td>foo bar foo</td>
6365 <td>baz
6366 </td>
6367 <td style="color:red;">baz
6368 </td>
6369 <td>style='color:red;'</td>
6370 <td>baz
6371 </td></tr></table>
6372
6373 !! end
6374
6375 !! test
6376 Simple table
6377 !! wikitext
6378 {|
6379 |1||2
6380 |-
6381 |3||4
6382 |}
6383 !! html
6384 <table>
6385 <tr>
6386 <td>1</td>
6387 <td>2
6388 </td></tr>
6389 <tr>
6390 <td>3</td>
6391 <td>4
6392 </td></tr></table>
6393
6394 !! end
6395
6396 !! test
6397 Simple table but with multiple dashes for row wikitext
6398 !! wikitext
6399 {|
6400 |foo
6401 |-----
6402 |bar
6403 |}
6404 !! html
6405 <table>
6406 <tr>
6407 <td>foo
6408 </td></tr>
6409 <tr>
6410 <td>bar
6411 </td></tr></table>
6412
6413 !! end
6414
6415 !! test
6416 Multiplication table
6417 !! wikitext
6418 {| border="1" cellpadding="2"
6419 |+Multiplication table
6420 |-
6421 !&times;!!1!!2!!3
6422 |-
6423 !1
6424 |1||2||3
6425 |-
6426 !2
6427 |2||4||6
6428 |-
6429 !3
6430 |3||6||9
6431 |-
6432 !4
6433 |4||8||12
6434 |-
6435 !5
6436 |5||10||15
6437 |}
6438 !! html
6439 <table border="1" cellpadding="2">
6440 <caption>Multiplication table
6441 </caption>
6442 <tr>
6443 <th>&#215;</th>
6444 <th>1</th>
6445 <th>2</th>
6446 <th>3
6447 </th></tr>
6448 <tr>
6449 <th>1
6450 </th>
6451 <td>1</td>
6452 <td>2</td>
6453 <td>3
6454 </td></tr>
6455 <tr>
6456 <th>2
6457 </th>
6458 <td>2</td>
6459 <td>4</td>
6460 <td>6
6461 </td></tr>
6462 <tr>
6463 <th>3
6464 </th>
6465 <td>3</td>
6466 <td>6</td>
6467 <td>9
6468 </td></tr>
6469 <tr>
6470 <th>4
6471 </th>
6472 <td>4</td>
6473 <td>8</td>
6474 <td>12
6475 </td></tr>
6476 <tr>
6477 <th>5
6478 </th>
6479 <td>5</td>
6480 <td>10</td>
6481 <td>15
6482 </td></tr></table>
6483
6484 !! end
6485
6486 !! test
6487 Accept "||" in table headings
6488 !! wikitext
6489 {|
6490 !h1||h2
6491 |}
6492 !! html
6493 <table>
6494 <tr>
6495 <th>h1</th>
6496 <th>h2
6497 </th></tr></table>
6498
6499 !! end
6500
6501 !! test
6502 Accept "!!" in table data
6503 !! wikitext
6504 {|
6505 |Foo!!||
6506 |}
6507 !! html
6508 <table>
6509 <tr>
6510 <td>Foo!!</td>
6511 <td>
6512 </td></tr></table>
6513
6514 !! html/parsoid
6515 <table>
6516 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6517 </tbody></table>
6518 !! end
6519
6520 !! test
6521 Accept "||" in indented table headings
6522 !! wikitext
6523 :{|
6524 !h1||h2
6525 |}
6526 !! html
6527 <dl><dd><table>
6528 <tr>
6529 <th>h1</th>
6530 <th>h2
6531 </th></tr></table></dd></dl>
6532
6533 !! end
6534
6535 !! test
6536 Accept "!!" in templates
6537 !! wikitext
6538 {|
6539 !a {{echo|b!!c}}
6540 |}
6541 !! html/php
6542 <table>
6543 <tr>
6544 <th>a b</th>
6545 <th>c
6546 </th></tr></table>
6547
6548 !! html/parsoid
6549 <table>
6550 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6551 !! end
6552
6553 !! test
6554 Accept "!!" in table headings after newline
6555 !! wikitext
6556 {|
6557 !a
6558 b!!c
6559 |}
6560 !! html/php
6561 <table>
6562 <tr>
6563 <th>a
6564 <p>b!!c
6565 </p>
6566 </th></tr></table>
6567
6568 !! html/parsoid
6569 <table>
6570 <tbody><tr><th>a
6571 <p>b!!c</p></th></tr>
6572 </tbody></table>
6573 !! end
6574
6575 !! test
6576 Accept "!!" in table data of mixed wikitext / html syntax
6577 !! wikitext
6578 {|
6579 !a
6580 <tr><td>b!!c</td></tr>
6581 |}
6582 !! html/php+tidy
6583 <table>
6584 <tbody><tr>
6585 <th>a
6586 </th></tr><tr><td>b!!c</td></tr>
6587 </tbody></table>
6588 !! html/parsoid
6589 <table>
6590 <tbody><tr><th>a</th></tr>
6591 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6592 </tbody></table>
6593 !! end
6594
6595 !! test
6596 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6597 !! wikitext
6598 {|
6599 !|h1
6600 ||a
6601 |}
6602 !! html
6603 <table>
6604 <tr>
6605 <th>h1
6606 </th>
6607 <td>a
6608 </td></tr></table>
6609
6610 !! end
6611
6612 !!test
6613 Accept "| !" at start of line in tables (ignore !-attribute)
6614 !! wikitext
6615 {|
6616 |-
6617 |!style="color:red"|bar
6618 |}
6619 !! html
6620 <table>
6621
6622 <tr>
6623 <td>bar
6624 </td></tr></table>
6625
6626 !!end
6627
6628 !!test
6629 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6630 !! wikitext
6631 {|
6632 |-
6633 |style='color:red;'|+1
6634 |style='color:blue;'|-1
6635 |-
6636 |1||2||3
6637 |1||+2||-3
6638 |-
6639 | +1
6640 | -1
6641 |}
6642 !! html
6643 <table>
6644
6645 <tr>
6646 <td style="color:red;">+1
6647 </td>
6648 <td style="color:blue;">-1
6649 </td></tr>
6650 <tr>
6651 <td>1</td>
6652 <td>2</td>
6653 <td>3
6654 </td>
6655 <td>1</td>
6656 <td>+2</td>
6657 <td>-3
6658 </td></tr>
6659 <tr>
6660 <td>+1
6661 </td>
6662 <td>-1
6663 </td></tr></table>
6664
6665 !!end
6666
6667 !! test
6668 Table rowspan
6669 !! wikitext
6670 {| border=1
6671 |Cell 1, row 1
6672 |rowspan=2|Cell 2, row 1 (and 2)
6673 |Cell 3, row 1
6674 |-
6675 |Cell 1, row 2
6676 |Cell 3, row 2
6677 |}
6678 !! html
6679 <table border="1">
6680 <tr>
6681 <td>Cell 1, row 1
6682 </td>
6683 <td rowspan="2">Cell 2, row 1 (and 2)
6684 </td>
6685 <td>Cell 3, row 1
6686 </td></tr>
6687 <tr>
6688 <td>Cell 1, row 2
6689 </td>
6690 <td>Cell 3, row 2
6691 </td></tr></table>
6692
6693 !! end
6694
6695 !! test
6696 Nested table
6697 !! wikitext
6698 {| border=1
6699 | &alpha;
6700 |
6701 {| bgcolor=#ABCDEF border=2
6702 |nested
6703 |-
6704 |table
6705 |}
6706 |the original table again
6707 |}
6708 !! html
6709 <table border="1">
6710 <tr>
6711 <td>&#945;
6712 </td>
6713 <td>
6714 <table bgcolor="#ABCDEF" border="2">
6715 <tr>
6716 <td>nested
6717 </td></tr>
6718 <tr>
6719 <td>table
6720 </td></tr></table>
6721 </td>
6722 <td>the original table again
6723 </td></tr></table>
6724
6725 !! end
6726
6727 !! test
6728 Invalid attributes in table cell (T3830)
6729 !! wikitext
6730 {|
6731 |Cell:|broken
6732 |}
6733 !! html
6734 <table>
6735 <tr>
6736 <td>broken
6737 </td></tr></table>
6738
6739 !! end
6740
6741 !! test
6742 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6743 !! wikitext
6744 {|
6745 |title="foo" |bar
6746 |title="foo<nowiki>|</nowiki>" |bar
6747 |title="foo<nowiki>|</nowiki>" bar
6748 |}
6749 !! html/php
6750 <table>
6751 <tr>
6752 <td title="foo">bar
6753 </td>
6754 <td title="foo&#124;">bar
6755 </td>
6756 <td>title="foo|" bar
6757 </td></tr></table>
6758
6759 !! html/parsoid
6760 <table>
6761 <tbody><tr><td title="foo">bar</td>
6762 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6763 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6764 </tbody></table>
6765 !! end
6766
6767 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6768 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6769 # *2wt modes will fail.
6770 !! test
6771 Table security: embedded pipes
6772 !! options
6773 parsoid=wt2html,html2html
6774 !! wikitext
6775 {|
6776 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6777 !! html/php
6778 <table>
6779 <tr>
6780 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6781 <td>]" onmouseover="alert(document.cookie)"&gt;test
6782 </td>
6783 </tr>
6784 </table>
6785
6786 !! html/parsoid
6787 <table><tbody>
6788 <tr>
6789 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6790 !! end
6791
6792 !! test
6793 Element attributes with double ! should not be broken up by <th>
6794 !! wikitext
6795 {|
6796 !hi <div class="!!">ha</div> ho
6797 |}
6798 !! html/php
6799 <table>
6800 <tr>
6801 <th>hi <div class="!!">ha</div> ho
6802 </th></tr></table>
6803
6804 !! html/parsoid
6805 <table>
6806 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6807 </tbody></table>
6808 !! end
6809
6810 !! test
6811 ! and || in element attributes should not be parsed as <th>/<td>
6812 !! wikitext
6813 {|
6814 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6815 |}
6816 !! html/php
6817 <table>
6818 <tr>
6819 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6820 </td></tr></table>
6821
6822 !! html/parsoid
6823 <table>
6824 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6825 </tbody></table>
6826 !! end
6827
6828 # FIXME: The output seems broken. Filed as T110268.
6829 !! test
6830 ! and || in td attributes should not be parsed as <th>/<td>
6831 !! options
6832 parsoid=wt2html
6833 !! wikitext
6834 {|
6835 |style="color: red !important;" data-contrived="put this here ||"|foo
6836 |}
6837 !! html/php
6838 <table>
6839 <tr>
6840 <td>style="color: red !important;" data-contrived="put this here</td>
6841 <td>foo
6842 </td></tr></table>
6843
6844 !! html/parsoid
6845 <table>
6846 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6847 </tbody></table>
6848 !! end
6849
6850 !! test
6851 Break on | in element attribute in template
6852 !! options
6853 parsoid=wt2html,html2html
6854 !! wikitext
6855 {{echo|1=<div class="hi|ho">ha</div>}}
6856 !! html/php
6857 <p>ho"&gt;ha&lt;/div&gt;
6858 </p>
6859 !! html/parsoid
6860 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</p>
6861 !! end
6862
6863 !! test
6864 Break on | in element attribute name in template
6865 !! wikitext
6866 {{echo|<div cla|ss="hiho">ha</div>}}
6867 !! html/parsoid
6868 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6869 !! end
6870
6871 !! test
6872 Don't break on | in extension attribute in template
6873 !! wikitext
6874 {{echo|<ref name="hi|ho">ha</ref>}}
6875
6876 <references />
6877 !! html/parsoid
6878 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6879
6880 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Main_Page#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6881 !! end
6882
6883 ## We don't support roundtripping of these attributes in Parsoid.
6884 ## Selective serialization takes care of preventing dirty diffs.
6885 ## But, on edits, we dirty-diff the invalid attribute text.
6886 !! test
6887 Invalid text in table attributes should be discarded
6888 !! options
6889 parsoid=wt2html
6890 !! wikitext
6891 {| <span>boo</span> style='border:1px solid black'
6892 | <span>boo</span> style='color:blue' |1
6893 |<span>boo</span> style='color:blue'|2
6894 |}
6895 !! html/php
6896 <table style="border:1px solid black">
6897 <tr>
6898 <td style="color:blue">1
6899 </td>
6900 <td style="color:blue">2
6901 </td></tr></table>
6902
6903 !! html/parsoid
6904 <table style="border:1px solid black">
6905 <tr>
6906 <td style="color:blue">1</td>
6907 <td style="color:blue">2</td>
6908 </tr>
6909 </table>
6910 !! end
6911
6912 !! test
6913 Invalid text in table attributes should be preserved by selective serializer
6914 !! options
6915 parsoid={
6916 "modes": ["selser"],
6917 "changes": [
6918 ["td:first-child", "text", "abc"],
6919 ["td + td", "text", "xyz"]
6920 ]
6921 }
6922 !! wikitext
6923 {| <span>boo</span> style='border:1px solid black'
6924 | <span>boo</span> style='color:blue' | 1
6925 |<span>boo</span> style='color:blue'| 2
6926 |}
6927 !! wikitext/edited
6928 {| <span>boo</span> style='border:1px solid black'
6929 | <span>boo</span> style='color:blue' | abc
6930 |<span>boo</span> style='color:blue'| xyz
6931 |}
6932 !! end
6933
6934 !! test
6935 1. Template-generated table cell attributes and cell content
6936 !! wikitext
6937 {|
6938 |{{table_attribs}}
6939 | {{table_attribs}}
6940 || {{table_attribs_5}}
6941 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6942 |align=center {{table_attribs}}
6943 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6944 |}
6945 !! html
6946 <table>
6947 <tr>
6948 <td style="color:red;">Foo
6949 </td>
6950 <td style="color:red;">Foo
6951 </td>
6952 <td>style="color:red;"</td>
6953 <td>Bar
6954 </td>
6955 <td style="color:red;">Foo
6956 </td>
6957 <td align="center" style="color:red;">Foo
6958 </td>
6959 <td align="center" style="color:red;">Foo
6960 </td></tr></table>
6961
6962 !! end
6963
6964 !! test
6965 2. Template-generated table cell attributes and cell content
6966 !! wikitext
6967 {|
6968 |{{table_attribs_2}}
6969 |}
6970 !! html/php
6971 <table>
6972 <tr>
6973 <td style="color:red;">Foo
6974 </td>
6975 <td>Bar</td>
6976 <td>Baz
6977 </td></tr></table>
6978
6979 !! html/parsoid
6980 <table>
6981 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6982 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6983 </tbody></table>
6984 !! end
6985
6986 !! test
6987 3. Template-generated table cell attributes and cell content
6988 !! wikitext
6989 {|
6990 !align=center {{table_header_cells}}
6991 |-
6992 |align=center {{table_cells}}
6993 |}
6994 !! html/php
6995 <table>
6996 <tr>
6997 <th align="center" style="color:red;">Foo</th>
6998 <th style="color:red;"><i>Bar</i></th>
6999 <th style="color:brown;"><i>Foo</i> and Baz
7000 </th></tr>
7001 <tr>
7002 <td align="center" style="color:red;">Foo</td>
7003 <td style="color:red;"><i>Bar</i></td>
7004 <td style="color:brown;"><i>Foo</i> and Baz
7005 </td></tr></table>
7006
7007 !! html/parsoid
7008 <table>
7009 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
7010 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
7011 </tbody></table>
7012 !! end
7013
7014 !! test
7015 4. Template-generated table cell attributes and cell content inside a templated table
7016 !! wikitext
7017 {{tbl-start}}
7018 !align=center {{table_header_cells}}
7019 |-
7020 |align=center {{table_cells}}
7021 {{tbl-end}}
7022 !! html/php
7023 <table>
7024 <tr>
7025 <th align="center" style="color:red;">Foo</th>
7026 <th style="color:red;"><i>Bar</i></th>
7027 <th style="color:brown;"><i>Foo</i> and Baz
7028 </th></tr>
7029 <tr>
7030 <td align="center" style="color:red;">Foo</td>
7031 <td style="color:red;"><i>Bar</i></td>
7032 <td style="color:brown;"><i>Foo</i> and Baz
7033 </td></tr></table>
7034
7035 !! html/parsoid
7036 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
7037 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
7038 <tr>
7039 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
7040 </tbody></table>
7041 !! end
7042
7043 ## Edge case fix to prevent future regressions
7044 !! test
7045 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7046 !! wikitext
7047 {|
7048 |{{table_attribs_7}}
7049 |}
7050 <references />
7051 !! html/parsoid
7052 <table>
7053 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7054 </tbody></table>
7055 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
7056 !! end
7057
7058 !! test
7059 Table with row followed by newlines and table heading
7060 !! options
7061 parsoid=wt2html,html2html
7062 !! wikitext
7063 {|
7064 |-
7065
7066 !foo
7067 |}
7068 !! html/*
7069 <table>
7070
7071
7072 <tr>
7073 <th>foo
7074 </th></tr></table>
7075
7076 !! end
7077
7078 !! test
7079 Table with empty line following the start tag
7080 !! options
7081 parsoid=wt2html,html2html
7082 !! wikitext
7083 {|
7084
7085 |-
7086 |foo
7087 |}
7088 !! html/*
7089 <table>
7090
7091
7092 <tr>
7093 <td>foo
7094 </td></tr></table>
7095
7096 !! end
7097
7098 !! test
7099 Table attributes with empty value
7100 !! options
7101 parsoid=wt2html,html2html
7102 !! wikitext
7103 {|
7104 | style=|hello
7105 |}
7106 !! html/php
7107 <table>
7108 <tr>
7109 <td style="">hello
7110 </td></tr></table>
7111
7112 !! html/parsoid
7113 <table>
7114 <tbody><tr><td style="">hello</td></tr>
7115 </tbody></table>
7116 !! end
7117
7118 !! test
7119 Wikitext table with a lot of comments
7120 !! wikitext
7121 {|
7122 <!-- c0 -->
7123 |foo
7124 <!-- c1 -->
7125 |-<!-- c2 -->
7126 <!-- c3 -->
7127 |<!-- c4 -->
7128 <!-- c5 -->
7129 |}
7130 !! html
7131 <table>
7132 <tr>
7133 <td>foo
7134 </td></tr>
7135 <tr>
7136 <td>
7137 </td></tr></table>
7138
7139 !! end
7140
7141 !! test
7142 Wikitext table comments represented in parsoid dom
7143 !! wikitext
7144 {|<!--c1--><!--c2-->
7145 |-<!--c3-->
7146 |x
7147 |}
7148 !! html/php+tidy
7149 <table>
7150
7151 <tbody><tr>
7152 <td>x
7153 </td></tr></tbody></table>
7154 !! html/parsoid
7155 <table><!--c1--><!--c2-->
7156 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7157 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7158 </tbody></table>
7159 !! end
7160
7161 !! test
7162 Wikitext table with double-line table cell
7163 !! wikitext
7164 {|
7165 |a
7166 b
7167 |}
7168 !! html
7169 <table>
7170 <tr>
7171 <td>a
7172 <p>b
7173 </p>
7174 </td></tr></table>
7175
7176 !! end
7177
7178 !! test
7179 Table cell with a single comment
7180 !! wikitext
7181 {|
7182 |<!-- c1 -->
7183 |a
7184 |}
7185 !! html
7186 <table>
7187 <tr>
7188 <td>
7189 </td>
7190 <td>a
7191 </td></tr></table>
7192
7193 !! end
7194
7195 !! test
7196 Table-cell after a comment-only-empty-line
7197 !! wikitext
7198 {|
7199 |a
7200 <!--c1-->
7201 <!--c2-->|b
7202 |}
7203 !! html
7204 <table>
7205 <tr>
7206 <td>a
7207 </td>
7208 <td>b
7209 </td></tr></table>
7210
7211 !! html/parsoid
7212 <table>
7213 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7214 <!--c1-->
7215 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7216 </tbody></table>
7217
7218 !! end
7219
7220 !! test
7221 Build table with {{!}}
7222 !! wikitext
7223 {{{!}} class="wikitable"
7224 !header
7225 !second header
7226 {{!}}- style="color:red;"
7227 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7228 {{!}}}
7229 !! html
7230 <table class="wikitable">
7231 <tr>
7232 <th>header
7233 </th>
7234 <th>second header
7235 </th></tr>
7236 <tr style="color:red;">
7237 <td>data</td>
7238 <td style="color:red;">second data
7239 </td></tr></table>
7240
7241 !! end
7242
7243 !! test
7244 Build table with pipe as data
7245 !! wikitext
7246 {| class="wikitable"
7247 !header
7248 !second header
7249 |- style="color:red;"
7250 |data|| style="color:red;" |second data
7251 |-
7252 | style="color:red;" |data with | || style="color:red;" | second data with |
7253 |-
7254 ||data with | |||second data with |
7255 |}
7256 !! html
7257 <table class="wikitable">
7258 <tr>
7259 <th>header
7260 </th>
7261 <th>second header
7262 </th></tr>
7263 <tr style="color:red;">
7264 <td>data</td>
7265 <td style="color:red;">second data
7266 </td></tr>
7267 <tr>
7268 <td style="color:red;">data with |</td>
7269 <td style="color:red;">second data with |
7270 </td></tr>
7271 <tr>
7272 <td>data with |</td>
7273 <td>second data with |
7274 </td></tr></table>
7275
7276 !! end
7277
7278 !! test
7279 Build table with wikilink
7280 !! wikitext
7281 {| class="wikitable"
7282 !header||second header
7283 |- style="color:red;"
7284 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7285 |-
7286 |data||second data [[Main Page|link|text with pipe]]
7287 |}
7288 !! html
7289 <table class="wikitable">
7290 <tr>
7291 <th>header</th>
7292 <th>second header
7293 </th></tr>
7294 <tr style="color:red;">
7295 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7296 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7297 </td></tr>
7298 <tr>
7299 <td>data</td>
7300 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7301 </td></tr></table>
7302
7303 !! end
7304
7305 # The expected HTML structure in this test is debatable. The PHP parser does
7306 # not parse this kind of table at all. The main focus for Parsoid is on
7307 # round-tripping, so this output is ok for now. TODO: revisit!
7308 !! test
7309 Wikitext table with html-syntax row
7310 !! wikitext
7311 {|
7312 |-
7313 <td>foo</td>
7314 |}
7315 !! html/parsoid
7316 <table>
7317 <tbody>
7318 <tr>
7319 <td>foo</td></tr></tbody></table>
7320 !! end
7321
7322 ## Remex doesn't account for fostered content.
7323 !! test
7324 Fostered content in tables: Plain text
7325 !! options
7326 parsoid=wt2html
7327 !! wikitext
7328 {|
7329 |-
7330 a
7331 |}
7332 !! html/php
7333 <table>
7334
7335 a
7336 </table>
7337
7338 !! html/php+tidy
7339
7340
7341 a
7342 <table></table>
7343 !! html/parsoid
7344 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7345 a</p>
7346 <table>
7347 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7348 !! end
7349
7350 !! test
7351 Fostered content in tables: Lists
7352 !! options
7353 parsoid=wt2html,html2html
7354 !! wikitext
7355 {|
7356 |-
7357 *a
7358 |}
7359 !! html/php
7360 <table>
7361
7362 <ul><li>a</li></ul>
7363 </table>
7364
7365 !! html/php+tidy
7366 <ul><li>a</li></ul><table>
7367
7368
7369 </table>
7370 !! html/parsoid
7371 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7372 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7373
7374 </tr></tbody></table>
7375 !! end
7376
7377 !! test
7378 Template generated table cell with attributes
7379 !! wikitext
7380 {|
7381 |-
7382 {{table_attribs_4}} ||a||b
7383 |}
7384 !! html/php+tidy
7385 <table>
7386
7387 <tbody><tr>
7388 <td style="background-color:#DC241f;" width="10px"></td>
7389 <td>a</td>
7390 <td>b
7391 </td></tr></tbody></table>
7392 !! html/parsoid
7393 <table>
7394 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7395 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
7396 !! end
7397
7398 !! test
7399 Parsoid: Round-trip tables directly followed by content (T53219)
7400 !! options
7401 parsoid=wt2html,wt2wt
7402 !! wikitext
7403 {|
7404 |foo
7405 |} bar
7406
7407 {|
7408 |baz
7409 |}<b>quux</b>
7410 !! html+tidy
7411 <table>
7412 <tbody><tr>
7413 <td>foo
7414 </td></tr></tbody></table><p> bar
7415 </p><table>
7416 <tbody><tr>
7417 <td>baz
7418 </td></tr></tbody></table><p><b>quux</b>
7419 </p>
7420 !! end
7421
7422 !! test
7423 Parsoid: Default to a newline after tables in new content (T53219)
7424 !! options
7425 parsoid=html2wt
7426 !! html/parsoid
7427 <table><tbody>
7428 <tr><td>foo</td></tr></tbody></table> bar
7429 <table><tbody>
7430 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7431 !! wikitext
7432 {|
7433 |foo
7434 |}
7435 <nowiki> </nowiki>bar
7436 {|
7437 |baz
7438 |}
7439 '''quux'''
7440 !! end
7441
7442 !! test
7443 Parsoid: Row-syntax table headings followed by comment & table cells
7444 !! options
7445 parsoid=wt2html,wt2wt
7446 !! wikitext
7447 {|
7448 !foo||bar
7449 <!-- foo --> ||baz||quux
7450 |}
7451 !! html/php
7452 <table>
7453 <tr>
7454 <th>foo</th>
7455 <th>bar
7456 </th>
7457 <td>baz</td>
7458 <td>quux
7459 </td></tr></table>
7460
7461 !! html/parsoid
7462 <table>
7463 <tbody><tr><th>foo</th><th>bar
7464 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7465 </tbody></table>
7466 !! end
7467
7468 !!test
7469 Parsoid: Recover better from broken table attributes
7470 !!options
7471 parsoid=wt2html
7472 !!wikitext
7473 {| class="foo
7474 | class="bar" |
7475 foo
7476 |}
7477 !!html/php+tidy
7478 <table class="foo">
7479 <tbody><tr>
7480 <td class="bar">
7481 <p>foo
7482 </p>
7483 </td></tr></tbody></table>
7484 !!html/parsoid
7485 <table class="foo">
7486 <tr>
7487 <td class="bar">
7488 <p>foo</p></td></tr>
7489 </tbody></table>
7490 !!end
7491
7492 !! test
7493 Tables: Digest broken attributes on table and tr tag
7494 !! options
7495 parsoid=wt2html
7496 !! wikitext
7497 {| || |} ++
7498 |- || || ++ --
7499 |- > [
7500 |}
7501 !! html
7502 <table>
7503 <tbody>
7504 <tr class='mw-empty-elt'></tr>
7505 <tr class='mw-empty-elt'></tr>
7506 </tbody></table>
7507 !! end
7508
7509 !! test
7510 Table with missing opening <tr> tag
7511 !! options
7512 parsoid=wt2html,wt2wt
7513 !! wikitext
7514 <table>
7515 <td>foo</td>
7516 </tr>
7517 </table>
7518 !! html+tidy
7519 <table>
7520 <tbody><tr><td>foo</td>
7521 </tr>
7522 </tbody></table>
7523 !! end
7524
7525 # T137406: Whitespace in the HTML
7526 !! test
7527 1. Generate correct wikitext for tables with thead/tbody/tfoot
7528 !! options
7529 parsoid=html2wt
7530 !! html/parsoid
7531 <table>
7532 <caption>Test</caption>
7533 <thead>
7534 <tr>
7535 <th>Month</th>
7536 <th>Savings</th>
7537 </tr>
7538 </thead>
7539 <tbody>
7540 <tr>
7541 <td>January</td>
7542 <td>$100</td>
7543 </tr>
7544 <tr>
7545 <td>February</td>
7546 <td>$80</td>
7547 </tr>
7548 </tbody>
7549 <tfoot>
7550 <tr>
7551 <td>Sum</td>
7552 <td>$180</td>
7553 </tr>
7554 </tfoot>
7555 </table>
7556 !! wikitext
7557 {|
7558 |+Test
7559 !Month
7560 !Savings
7561 |-
7562 |January
7563 |$100
7564 |-
7565 |February
7566 |$80
7567 |-
7568 |Sum
7569 |$180
7570 |}
7571 !! html/php+tidy
7572 <table>
7573 <caption>Test
7574 </caption>
7575 <tbody><tr>
7576 <th>Month
7577 </th>
7578 <th>Savings
7579 </th></tr>
7580 <tr>
7581 <td>January
7582 </td>
7583 <td>$100
7584 </td></tr>
7585 <tr>
7586 <td>February
7587 </td>
7588 <td>$80
7589 </td></tr>
7590 <tr>
7591 <td>Sum
7592 </td>
7593 <td>$180
7594 </td></tr></tbody></table>
7595 !! end
7596
7597 # T137406: No whitespace in the HTML
7598 !! test
7599 2. Generate correct wikitext for tables with thead/tbody/tfoot
7600 !! options
7601 parsoid=html2wt
7602 !! html/parsoid
7603 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7604 !! wikitext
7605 {|
7606 !heading
7607 |-
7608 |foo
7609 |}
7610 !! end
7611
7612 !! test
7613 Wikitext tables can be nested inside HTML tables
7614 !! options
7615 parsoid=html2wt
7616 !! html
7617 <table data-parsoid='{"stx":"html"}'>
7618 <tr><td>
7619 <table>
7620 <tr><td>foo</td></tr>
7621 </table>
7622 </td></tr>
7623 </table>
7624 !! wikitext
7625 <table>
7626 <tr><td>
7627 {|
7628 |foo
7629 |}
7630 </td></tr>
7631 </table>
7632 !! end
7633
7634 ###
7635 ### Internal links
7636 ###
7637 !! test
7638 Plain link, capitalized
7639 !! wikitext
7640 [[Main Page]]
7641 !! html
7642 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7643 </p>
7644 !! end
7645
7646 !! test
7647 Plain link, uncapitalized
7648 !! wikitext
7649 [[main Page]]
7650 !! html
7651 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7652 </p>
7653 !! end
7654
7655 !! test
7656 Piped link
7657 !! wikitext
7658 [[Main Page|The Main Page]]
7659 !! html
7660 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7661 </p>
7662 !! end
7663
7664 !! test
7665 Piped link with comment in link text
7666 !! wikitext
7667 [[Main Page|The Main<!--front--> Page]]
7668 !! html
7669 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7670 </p>
7671 !! end
7672
7673 !! test
7674 Piped link with multiple pipe characters in link text
7675 !! wikitext
7676 [[Main Page||The|Main|Page|]]
7677 !! html/php
7678 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7679 </p>
7680 !! html/parsoid
7681 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7682 !! end
7683
7684 !! test
7685 Piped link with no link text
7686 !! wikitext
7687 [[Thomas Bek (bishop of St David's)|]]
7688 !! html/php
7689 <p>[[Thomas Bek (bishop of St David's)|]]
7690 </p>
7691 !! html/parsoid
7692 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7693 !! end
7694
7695 !! test
7696 Piped link with empty link text
7697 !! wikitext
7698 [[Main Page|<nowiki/>]] - empty nowiki
7699 [[Main Page| ]] - empty space
7700 [[Main Page|&nbsp;]] - empty non breaking space
7701 !! html/php
7702 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7703 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7704 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7705 </p>
7706 !! html/parsoid
7707 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7708 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7709 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7710 !! end
7711
7712 !! test
7713 Broken link
7714 !! wikitext
7715 [[Zigzagzogzagzig]]
7716 !! html
7717 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7718 </p>
7719 !! end
7720
7721 !! test
7722 Broken link with fragment
7723 !! wikitext
7724 [[Zigzagzogzagzig#zug]]
7725 !! html
7726 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7727 </p>
7728 !! end
7729
7730 !! test
7731 Special page link with fragment
7732 !! wikitext
7733 [[Special:Version#anchor]]
7734 !! html
7735 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7736 </p>
7737 !! end
7738
7739 !! test
7740 Nonexistent special page link with fragment
7741 !! wikitext
7742 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7743 !! html
7744 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7745 </p>
7746 !! end
7747
7748 !! test
7749 Link with prefix
7750 !! wikitext
7751 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7752 !! html
7753 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7754 </p>
7755 !! end
7756
7757 !! test
7758 Link with suffix
7759 !! wikitext
7760 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7761 !! html
7762 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7763 </p>
7764 !! end
7765
7766 !! article
7767 prefixed article
7768 !! text
7769 Some text
7770 !! endarticle
7771
7772 !! test
7773 T45661: Piped links with identical prefixes
7774 !! wikitext
7775 [[prefixed article|prefixed articles with spaces]]
7776
7777 [[prefixed article|prefixed articlesaoeu]]
7778
7779 [[Main Page|Main Page test]]
7780 !! html
7781 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7782 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7783 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7784 </p>
7785 !! end
7786
7787
7788 !! test
7789 Link with HTML entity in suffix / tail
7790 !! wikitext
7791 [[Main Page]]&quot;, [[Main Page]]&#97;
7792 !! html/php
7793 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7794 </p>
7795 !! html/parsoid
7796 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7797 !! end
7798
7799 !! test
7800 Link with 3 brackets
7801 !! wikitext
7802 [[[Main Page]]]
7803 Foo [[[Main Page]]]
7804 !! html
7805 <p>[[[Main Page]]]
7806 Foo [[[Main Page]]]
7807 </p>
7808 !! end
7809
7810 !! test
7811 Link with 4 brackets
7812 !! wikitext
7813 [[[[Main Page]]]]
7814 !! html
7815 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7816 </p>
7817 !! end
7818
7819 !! test
7820 Piped link with 3 brackets
7821 !! wikitext
7822 [[[main page|the main page]]]
7823 !! html
7824 <p>[[[main page|the main page]]]
7825 </p>
7826 !! end
7827
7828 !! test
7829 Piped link with extlink-like text
7830 !! wikitext
7831 [[Main Page|[bar]]]
7832 [[Main Page|This is a [bar]]]
7833 [[Main Page|[bar]]
7834 !! html/php
7835 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7836 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7837 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7838 </p>
7839 !! html/parsoid
7840 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7841 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7842 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7843 !! end
7844
7845 !! test
7846 Link with multiple pipes
7847 !! wikitext
7848 [[Main Page|The|Main|Page]]
7849 !! html
7850 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7851 </p>
7852 !! end
7853
7854 !! test
7855 Anchor containing a #. (T65430)
7856 !! config
7857 wgFragmentMode=[ 'html5', 'legacy' ]
7858 !! wikitext
7859 [[Main Page#And#Link]]
7860 !! html/php
7861 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7862 </p>
7863 !! html/parsoid
7864 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7865 !! end
7866
7867 !! test
7868 Link to namespaces
7869 !! wikitext
7870 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7871 !! html
7872 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Link with space in namespace
7878 !! wikitext
7879 [[User talk:Foo bar]]
7880 !! html
7881 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7882 </p>
7883 !! end
7884
7885 !! article
7886 MemoryAlpha:AlphaTest
7887 !! text
7888 This is an article in the MemoryAlpha namespace
7889 (which shadows the memoryalpha interwiki link).
7890 !! endarticle
7891
7892 !! test
7893 Namespace takes precedence over interwiki link (T53680)
7894 !! wikitext
7895 [[MemoryAlpha:AlphaTest]]
7896 !! html
7897 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7898 </p>
7899 !! end
7900
7901 # The previous test doesn't work correctly in html2*, due to not recognizing the
7902 # link as an internal one. This one checks for the correct behavior.
7903 !! test
7904 Link to namespace preferred over interwiki with correct rel attribute
7905 !! options
7906 parsoid=html2wt,html2html
7907 !! html/parsoid
7908 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7909 !! wikitext
7910 [[MemoryAlpha:AlphaTest]]
7911 !! end
7912
7913 !! test
7914 Piped link to namespace
7915 !! wikitext
7916 [[Meta:Disclaimers|The disclaimers]]
7917 !! html
7918 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7919 </p>
7920 !! end
7921
7922 !! test
7923 Link containing }
7924 !! wikitext
7925 [[Usually caused by a typo (oops}]]
7926 !! html
7927 <p>[[Usually caused by a typo (oops}]]
7928 </p>
7929 !! end
7930
7931 !! article
7932 7% Solution
7933 !! text
7934 Just a test of an article title containing a percent.
7935 !! endarticle
7936
7937 !! test
7938 Link containing % (not as a hex sequence)
7939 !! wikitext
7940 [[7% Solution]]
7941 [[7% Solution|7%25 Solution]]
7942 !! html/php
7943 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7944 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7948 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7949 !! end
7950
7951 # note that the parsoid HTML is identical to the previous test output,
7952 # so the previous test ensures that the html2wt mode will generate the
7953 # "not as a hex sequence" wikitext.
7954 !! test
7955 Link containing % as a single hex sequence interpreted to char
7956 !! options
7957 parsoid=wt2wt,wt2html,html2html
7958 !! wikitext
7959 [[7%25 Solution]]
7960 [[7%25 Solution|7%25 Solution]]
7961 !! html/php
7962 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7963 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7964 </p>
7965 !! html/parsoid
7966 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7967 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7968 !!end
7969
7970 !! test
7971 Link containing % as a double hex sequence interpreted to hex sequence
7972 !! wikitext
7973 [[7%2525 Solution]]
7974 !! html
7975 <p>[[7%2525 Solution]]
7976 </p>
7977 !!end
7978
7979 ## Example for such a section: == < ==
7980 !! test
7981 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7982 !! config
7983 wgFragmentMode=[ 'html5', 'legacy' ]
7984 !! wikitext
7985 [[%23%3c]][[%23%3e]]
7986 !! html/php
7987 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
7991 !! end
7992
7993 ## Example for such a section: == < ==
7994 !! test
7995 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7996 !! config
7997 wgFragmentMode=[ 'legacy' ]
7998 !! wikitext
7999 [[%23%3c]][[%23%3e]]
8000 !! html/php
8001 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8002 </p>
8003 !! end
8004
8005 !! test
8006 Link containing "<#" and ">#" as a hex sequences
8007 !! wikitext
8008 [[%3c%23]][[%3e%23]]
8009 !! html
8010 <p>[[%3c%23]][[%3e%23]]
8011 </p>
8012 !! end
8013
8014 !! test
8015 Link containing an equals sign
8016 !! wikitext
8017 [[Special:BookSources/isbn=4-00-026157-6]]
8018 !! html/php
8019 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
8020 </p>
8021 !! html/parsoid
8022 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
8023 !! end
8024
8025 !! article
8026 Foo~bar
8027 !! text
8028 Just a test of an article title containing a tilde.
8029 !! endarticle
8030
8031 # note that links containing signatures, like [[Foo~~~~]], are
8032 # massaged by the pre-save transform (PST) and so the tildes are never
8033 # seen by the parser.
8034 !! test
8035 Link containing a tilde
8036 !! wikitext
8037 [[Foo~bar]]
8038 !! html/php
8039 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8040 </p>
8041 !! html/parsoid
8042 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8043 !! end
8044
8045 !! test
8046 Link containing double-single-quotes '' (T6598)
8047 !! wikitext
8048 [[Lista d''e paise d''o munno]]
8049 !! html/php
8050 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
8051 </p>
8052 !! html/parsoid
8053 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
8054 !! end
8055
8056 !! test
8057 Link containing double quotes and spaces
8058 !! wikitext
8059 [[Cool "Gator"]]
8060 !! html/php
8061 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
8062 </p>
8063 !! html/parsoid
8064 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8065 !! end
8066
8067 !! test
8068 File containing double quotes and spaces
8069 !! wikitext
8070 [[File:Cool "Gator".png]]
8071 !! html/parsoid
8072 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
8073 !! end
8074
8075 !! test
8076 Redirect containing double quotes and spaces
8077 !! wikitext
8078 #REDIRECT [[Cool "Gator"]]
8079 !! html/parsoid
8080 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8081 !! end
8082
8083 !! test
8084 Link containing double-single-quotes '' in text (T6598 sanity check)
8085 !! wikitext
8086 Some [[Link|pretty ''italics'' and stuff]]!
8087 !! html/php
8088 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
8089 </p>
8090 !! html/parsoid
8091 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8092 !! end
8093
8094 !! test
8095 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8096 !! wikitext
8097 ''Some [[Link|pretty ''italics'' and stuff]]!''
8098 !! html
8099 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
8100 </p>
8101 !! end
8102
8103 !! test
8104 Link with double quotes in title part (literal) and alternate part (interpreted)
8105 !! wikitext
8106 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8107
8108 [[''Pentecoste'']]
8109
8110 [[''Pentecoste''|Pentecoste]]
8111
8112 [[''Pentecoste''|''Pentecoste'']]
8113 !! html/php
8114 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
8115 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
8116 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
8117 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
8118 </p>
8119 !! html/parsoid
8120 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
8121 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8122 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8123 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8124 !! end
8125
8126 !! test
8127 Broken image links with HTML captions (T41700)
8128 !! wikitext
8129 [[File:Nonexistent|<script></script>]]
8130 [[File:Nonexistent|100x100px|<script></script>]]
8131 [[File:Nonexistent|&lt;]]
8132 [[File:Nonexistent|a<i>b</i>c]]
8133 !! html/php
8134 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8135 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8136 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8137 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8138 </p>
8139 !! html/parsoid
8140 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8141 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8142 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
8143 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
8144 !! end
8145
8146 !! test
8147 Plain link to URL
8148 !! wikitext
8149 [[http://www.example.com]]
8150 !! html/php
8151 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8152 </p>
8153 !! html/parsoid
8154 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8155 !! end
8156
8157 !! test
8158 Plain link to URL with link text
8159 !! wikitext
8160 [[http://www.example.com Link text]]
8161 !! html
8162 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8163 </p>
8164 !! end
8165
8166 !! test
8167 Plain link to protocol-relative URL
8168 !! wikitext
8169 [[//www.example.com]]
8170 !! html/php
8171 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8172 </p>
8173 !! html/parsoid
8174 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8175 !! end
8176
8177 !! test
8178 Plain link to protocol-relative URL with link text
8179 !! wikitext
8180 [[//www.example.com Link text]]
8181 !! html
8182 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8183 </p>
8184 !! end
8185
8186 !! test
8187 Plain link to page with question mark in title
8188 !! wikitext
8189 [[A?b]]
8190
8191 [[A?b|Baz]]
8192 !! html
8193 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8194 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8195 </p>
8196 !! end
8197
8198 # I'm fairly sure the expected result here is wrong.
8199 # We want these to be URL links, not pseudo-pages with URLs for titles....
8200 # However the current output is also pretty screwy.
8201 #
8202 # ----
8203 # I'm changing it to match the current output--it arguably makes more
8204 # sense in the light of the test above. Old expected result was:
8205 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8206 #</p>
8207 # But I think this test is bordering on "garbage in, garbage out" anyway.
8208 # -- wtm
8209 !! test
8210 Piped link to URL
8211 !! wikitext
8212 Piped link to URL: [[http://www.example.com|an example URL]]
8213 !! html/php
8214 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8215 </p>
8216 !! html/parsoid
8217 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8218 !! end
8219
8220 !! test
8221 Plain link in template argument
8222 !! options
8223 parsoid=wt2html
8224 !! wikitext
8225 {{echo|[http://www.example.com |123]}}
8226
8227 {{echo|[[http://www.example.com |123]]}}
8228
8229 {{echo|[[http://www.example.com |123]}}
8230
8231 {{echo|[http://www.example.com |123]]}}
8232 !! html/php
8233 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8234 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8235 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8236 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8237 </p>
8238 !! html/parsoid
8239 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8240
8241 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
8242
8243 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8244
8245 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8246 !! end
8247
8248 !! test
8249 T2002: [[page|http://url/]] should link to page, not http://url/
8250 !! wikitext
8251 [[Main Page|http://url/]]
8252 !! html/php
8253 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8254 </p>
8255 !! html/parsoid
8256 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8257 !! end
8258
8259 # Parsoid does not mark self-links, by design.
8260 !! test
8261 T2337: Escaped self-links should be bold
8262 !! options
8263 title=[[Bug462]]
8264 !! wikitext
8265 [[Bu&#103;462]] [[Bug462]]
8266 !! html/php+tidy
8267 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8268 </p>
8269 !! html/parsoid
8270 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8271 !! end
8272
8273 !! test
8274 Self-link to section should not be bold
8275 !! options
8276 title=[[Main Page]]
8277 !! wikitext
8278 [[Main Page#section]]
8279 !! html
8280 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8281 </p>
8282 !! end
8283
8284 !! article
8285 00
8286 !! text
8287 This is 00.
8288 !! endarticle
8289
8290 !!test
8291 Self-link to numeric title
8292 !!options
8293 title=[[0]]
8294 !! wikitext
8295 [[0]]
8296 !! html
8297 <p><a class="mw-selflink selflink">0</a>
8298 </p>
8299 !!end
8300
8301 !!test
8302 Link to numeric-equivalent title
8303 !!options
8304 title=[[0]]
8305 !! wikitext
8306 [[00]]
8307 !! html
8308 <p><a href="/wiki/00" title="00">00</a>
8309 </p>
8310 !!end
8311
8312 !! test
8313 <nowiki> inside a link
8314 !! wikitext
8315 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8316 !! html
8317 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8318 </p>
8319 !! end
8320
8321 !! test
8322 Non-breaking spaces in title
8323 !! wikitext
8324 [[&nbsp; Main &nbsp; Page &nbsp;]]
8325 !! html
8326 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8327 </p>
8328 !!end
8329
8330 # Add new article for the test below so that it doesn't red-link
8331 !! article
8332 Foo bar baz
8333 !! text
8334 boo
8335 !! endarticle
8336
8337 !! test
8338 Multiple spaces in titles should normalize to a single underscore
8339 !! options
8340 parsoid=wt2html,wt2wt
8341 !! wikitext
8342 [[Foo bar baz|x]]
8343 [[Foo bar baz|x]]
8344 [[Foo bar baz|x]]
8345 !! html/php
8346 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8347 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8348 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8349 </p>
8350 !! html/parsoid
8351 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8352 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8353 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8354 </p>
8355 !! end
8356
8357 !! test
8358 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8359 !! options
8360 language=ca
8361 !! wikitext
8362 '''[[Main Page]]'''
8363 !! html
8364 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8365 </p>
8366 !! end
8367
8368 !! test
8369 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8370 !! options
8371 language=ca
8372 !! wikitext
8373 ''[[Main Page]]''
8374 !! html
8375 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8376 </p>
8377 !! end
8378
8379 !! test
8380 Internal link with en linktrail: no apostrophes (T29473)
8381 !! options
8382 language=en
8383 !! wikitext
8384 [[Something]]'nice
8385 !! html
8386 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8387 </p>
8388 !! end
8389
8390 !! test
8391 Internal link with ca linktrail with apostrophes (T29473)
8392 !! options
8393 language=ca
8394 !! wikitext
8395 [[Something]]'nice
8396 !! html
8397 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8398 </p>
8399 !! end
8400
8401 !! test
8402 Internal link with kaa linktrail with apostrophes (T29473)
8403 !! options
8404 language=kaa
8405 !! wikitext
8406 [[Something]]'nice
8407 !! html
8408 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8409 </p>
8410 !! end
8411
8412 !! test
8413 Link with multiple ":" in a subpage-supporting namespace (T65636)
8414 !! wikitext
8415 [[User:Foo/Test/63636:Bar|Test]]
8416 !! html/php
8417 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
8418 </p>
8419 !! html/parsoid
8420 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8421 !! end
8422
8423 ## Mainly a sanity check for Parsoid
8424 !! test
8425 Handle title parsing for subpages
8426 !! options
8427 title=[[/123123]]
8428 subpage
8429 !! wikitext
8430 123
8431 !! html/php
8432 <p>123
8433 </p>
8434 !! html/parsoid
8435 <p>123</p>
8436 !! end
8437
8438 !! article
8439 User:Test/123
8440 !! text
8441 test 123
8442 !! endarticle
8443
8444 !! test
8445 Link to a subpage from a namespace other than main
8446 !! options
8447 title=[[User:Test]]
8448 subpage
8449 !! wikitext
8450 [[/123]]
8451 !! html/php
8452 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8453 </p>
8454 !! html/parsoid
8455 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8456 !! end
8457
8458 !! test
8459 Ensure that transclusion titles are not url-decoded
8460 !! options
8461 subpage title=[[Test]]
8462 parsoid=wt2html
8463 !! wikitext
8464 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8465 !! html/php
8466 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8467 </p>
8468 !! html/parsoid
8469 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8470 !! end
8471
8472 !! test
8473 Purely hash wikilink
8474 !! options
8475 title=[[User:Test/123]]
8476 subpage
8477 !! wikitext
8478 [[#a|b]]
8479 !! html/php
8480 <p><a href="#a">b</a>
8481 </p>
8482 !! html/parsoid
8483 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8484 !! end
8485
8486 !! test
8487 Serialization of purely hash wikilink
8488 !! options
8489 title=[[User:Test/123]]
8490 subpage
8491 parsoid=html2wt
8492 !! html/parsoid
8493 <p><a href="#a">[[</a></p>
8494 !! wikitext
8495 [[#a|<nowiki>[[</nowiki>]]
8496 !! html/php
8497 <p><a href="#a">[[</a>
8498 </p>
8499 !! end
8500
8501 !! test
8502 1. Interaction of linktrail and template encapsulation
8503 !! wikitext
8504 {{echo|[[Foo]]}}l
8505 !! html/parsoid
8506 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8507 !! end
8508
8509 !! test
8510 2. Interaction of linktrail and template encapsulation
8511 !! options
8512 parsoid
8513 !! wikitext
8514 {{echo|Some [[Fool]]}}s
8515 !! html
8516 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8517 !! end
8518
8519 !! test
8520 3. Interaction of linktrail and template encapsulation
8521 !! options
8522 parsoid
8523 !! wikitext
8524 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8525 !! html
8526 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8527 !! end
8528
8529 !! article
8530 Söfnuður
8531 !! text
8532 Test.
8533 !! endarticle
8534
8535 !! test
8536 Internal link with is link prefix
8537 !! options
8538 language=is
8539 !! wikitext
8540 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8541 !! html
8542 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8543 </p>
8544 !! end
8545
8546 !! article
8547 Mótmælendatrú
8548 !! text
8549 Test.
8550 !! endarticle
8551
8552 !! test
8553 Internal link with is link trail and link prefix
8554 !! options
8555 language=is
8556 !! wikitext
8557 [[mótmælendatrú|xxx]]ar
8558 [[mótmælendatrú]]ar
8559 mótmælenda[[söfnuður]]
8560 mótmælenda[[söfnuður|söfnuðir]]
8561 mótmælenda[[söfnuður|söfnuðir]]xxx
8562 !! html
8563 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8564 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8565 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8566 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8567 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8568 </p>
8569 !! end
8570
8571 !! test
8572 Parsoid link trail escaping
8573 !! options
8574 parsoid=html2wt,html2html
8575 !! html/parsoid
8576 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8577 !! wikitext
8578 [[apple]]<nowiki/>s
8579 !! end
8580
8581 !! test
8582 Parsoid link prefix escaping
8583 !! options
8584 language=is
8585 parsoid=html2wt,html2html
8586 !! html/parsoid
8587 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8588 !! wikitext
8589 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8590 !! end
8591
8592 !! test
8593 Parsoid link bracket escaping
8594 !! options
8595 parsoid=html2wt,html2html
8596 !! html/parsoid
8597 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8598 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8599 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8600 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8601 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8602 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8603 !! wikitext
8604 [[Test]]
8605
8606 [<nowiki/>[[Test]]]
8607
8608 [[[[Test]]]]
8609
8610 [[[<nowiki/>[[Test]]]]]
8611
8612 [[[[[[Test]]]]]]
8613
8614 [[[[[<nowiki/>[[Test]]]]]]]
8615 !! end
8616
8617 !! test
8618 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8619 !! wikitext
8620 [[Foo| bar]]
8621
8622 [[Foo| ''bar'']]
8623
8624 [http://wp.org foo]
8625
8626 [http://wp.org ''foo'']
8627 !! html
8628 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8629 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8630 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8631 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8632 </p>
8633 !! end
8634
8635 !! test
8636 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8637 !! wikitext
8638 [[Foo|{{echo|a}} b {{echo|c}}]]
8639 !! html/parsoid
8640 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8641 !! end
8642
8643 !! test
8644 Link with angle bracket after anchor
8645 !! config
8646 wgFragmentMode=[ 'html5', 'legacy' ]
8647 !! wikitext
8648 [[Foo#<bar>]]
8649 !! html/php
8650 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8651 </p>
8652 !! html/parsoid
8653 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8654 !! end
8655
8656 !! test
8657 Link with angle bracket after anchor (legacy)
8658 !! config
8659 wgFragmentMode=[ 'legacy' ]
8660 !! wikitext
8661 [[Foo#<bar>]]
8662 !! html/php
8663 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8664 </p>
8665 !! end
8666
8667 ###
8668 ### Interwiki links (see maintenance/interwiki.sql)
8669 ###
8670
8671 !! test
8672 Inline interwiki link
8673 !! options
8674 parsoid=wt2html,wt2wt,html2html
8675 !! wikitext
8676 [[MeatBall:SoftSecurity]]
8677 !! html/php
8678 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8679 </p>
8680 !! html/parsoid
8681 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8682 !! end
8683
8684 !! test
8685 Inline interwiki link with empty title (T4372)
8686 !! options
8687 parsoid=wt2html,wt2wt,html2html
8688 !! wikitext
8689 [[MeatBall:]]
8690 !! html/php
8691 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8692 </p>
8693 !! html/parsoid
8694 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8695 !! end
8696
8697 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8698 !! test
8699 Interwiki link encoding conversion (T3636)
8700 !! options
8701 parsoid=wt2html,wt2wt
8702 !! wikitext
8703 *[[Wikipedia:ro:Olteni&#0355;a]]
8704 *[[Wikipedia:ro:Olteni&#355;a]]
8705 !! html
8706 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
8707 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
8708
8709 !! html/php+tidy
8710 <ul>
8711 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8712 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8713 </ul>
8714 !! html/parsoid
8715 <ul>
8716 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8717 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8718 </ul>
8719 !! end
8720
8721 !! test
8722 Interwiki link with fragment (T4130)
8723 !! wikitext
8724 [[MeatBall:SoftSecurity#foo]]
8725 !! html
8726 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8727 </p>
8728 !! end
8729
8730 !! test
8731 Link scenarios with escaped fragments
8732 !! config
8733 wgFragmentMode=[ 'html5', 'legacy' ]
8734 !! wikitext
8735 [[#Is this great?]]
8736 [[Foo#Is this great?]]
8737 [[meatball:Foo#Is this great?]]
8738 !! html/php
8739 <p><a href="#Is_this_great?">#Is this great?</a>
8740 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8741 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8742 </p>
8743 !! html/parsoid
8744 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8745 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8746 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8747 !! end
8748
8749 !! test
8750 Link scenarios with escaped fragments (legacy)
8751 !! config
8752 wgFragmentMode=[ 'legacy' ]
8753 !! wikitext
8754 [[#Is this great?]]
8755 [[Foo#Is this great?]]
8756 [[meatball:Foo#Is this great?]]
8757 !! html/php
8758 <p><a href="#Is_this_great.3F">#Is this great?</a>
8759 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8760 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8761 </p>
8762 !! end
8763
8764 # Ideally the wikipedia: prefix here should be proto-relative too
8765 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8766 # define the 'en' prefix, and originally the test used 'wikipedia',
8767 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8768 # article.
8769 !! test
8770 Different interwiki prefixes mapping to the same URL
8771 !! wikitext
8772 [[:en:Foo]]
8773
8774 [[:en:Foo|Foo]]
8775
8776 [[wikipedia:Foo]]
8777
8778 [[:wikipedia:Foo|Foo]]
8779
8780 [[wikipedia:en:Foo]]
8781
8782 [[:wikipedia:en:Foo]]
8783
8784 [[ wikiPEdia :Foo]]
8785 !! html/parsoid
8786 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8787
8788 <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8789
8790 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8791
8792 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8793
8794 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8795
8796 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8797
8798 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
8799 !! end
8800
8801 !! test
8802 Interwiki links that cannot be represented in wiki syntax
8803 !! wikitext
8804 [[meatball:ok]]
8805 [[meatball:ok#foo|ok with fragment]]
8806 [[meatball:ok_as_well?|ok ending with ? mark]]
8807 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8808 [http://de.wikipedia.org/wiki/#foo is just fragment]
8809
8810 !! html/php
8811 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8812 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8813 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8814 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8815 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8816 </p>
8817 !! html/parsoid
8818 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8819 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8820 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" title="meatball:ok as well?">ok ending with ? mark</a>
8821 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8822 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8823 !! end
8824
8825 !! test
8826 Interwiki links: trail
8827 !! wikitext
8828 [[wikipedia:Foo|Ba]]r
8829 !! html/php
8830 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8831 </p>
8832 !! html/parsoid
8833 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8834 !! end
8835
8836 !! test
8837 Local interwiki link
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 [[local:Template:Foo]]
8842 !! html/php
8843 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8844 </p>
8845 !! html/parsoid
8846 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8847 !! end
8848
8849 # Parsoid does not mark self-links, by design.
8850 !! test
8851 Local interwiki link: self-link to current page
8852 !! options
8853 title=[[Main Page]]
8854 parsoid=wt2html,wt2wt,html2html
8855 !! wikitext
8856 [[local:Main Page]]
8857 !! html/php
8858 <p><a class="mw-selflink selflink">local:Main Page</a>
8859 </p>
8860 !! html/parsoid
8861 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8862 !! end
8863
8864 !! test
8865 Local interwiki link: prefix only (T66167)
8866 !! options
8867 parsoid=wt2html,wt2wt,html2html
8868 !! wikitext
8869 [[local:]]
8870 !! html/php
8871 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8872 </p>
8873 !! html/parsoid
8874 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8875 !! end
8876
8877 !! test
8878 Local interwiki link: with additional interwiki prefix (T63357)
8879 !! options
8880 parsoid=wt2html,wt2wt,html2html
8881 !! wikitext
8882 [[local:meatball:Hello]]
8883 !! html/php
8884 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8885 </p>
8886 !! html/parsoid
8887 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8888 !! end
8889
8890 !! test
8891 Multiple local interwiki link prefixes
8892 !! wikitext
8893 [[local:local:local:local:mi:local:Foo]]
8894 !! options
8895 parsoid=wt2html,wt2wt,html2html
8896 !! html/php
8897 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8898 </p>
8899 !! html/parsoid
8900 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8901 !! end
8902
8903 !! test
8904 Interwiki link with percent encoded target
8905 !! wikitext
8906 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8907 !! html/php
8908 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8909 </p>
8910 !! html/parsoid
8911 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa" title="es:Nueva Guipúzcoa" data-parsoid='{"stx":"piped","a":{"href":"http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa"},"sa":{"href":":es:Nueva Guip%C3%BAzcoa"},"isIW":true}'>Nueva Guipúzcoa</a></p>
8912 !! end
8913
8914 ###
8915 ### Interlanguage links
8916 ### Language links (so that searching for '### language' matches..)
8917 ###
8918
8919 !! test
8920 Interlanguage link
8921 !! wikitext
8922 Blah blah blah
8923 [[zh:Chinese]]
8924 !! html/php
8925 <p>Blah blah blah
8926 </p>
8927 !! html/parsoid
8928 <p>Blah blah blah</p>
8929 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8930 !! end
8931
8932 ## parsoid html2wt will lose the space variations
8933 !! test
8934 Interlanguage link with spacing
8935 !! options
8936 parsoid=wt2html,wt2wt,html2html
8937 !! wikitext
8938 Blah blah blah
8939 [[ zh : Chinese ]]
8940 !! html/php
8941 <p>Blah blah blah
8942 </p>
8943 !! html/parsoid
8944 <p>Blah blah blah</p>
8945 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8946 !! end
8947
8948 !! test
8949 Double interlanguage link
8950 !! wikitext
8951 Blah blah blah
8952 [[es:Spanish]]
8953 [[zh:Chinese]]
8954 !! html/php
8955 <p>Blah blah blah
8956 </p>
8957 !! html/parsoid
8958 <p>Blah blah blah</p>
8959 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8960 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8961 !! end
8962
8963 ## parsoid html2wt will lose the space variations
8964 !! test
8965 Interlanguage link variations
8966 !! options
8967 parsoid=wt2html,wt2wt,html2html
8968 !! wikitext
8969 Blah blah blah
8970 [[ es :Spanish]]
8971 [[ ZH :Chinese]]
8972 [[es:Foo_bar]]
8973 !! html/php
8974 <p>Blah blah blah
8975 </p>
8976 !! html/parsoid
8977 <p>Blah blah blah</p>
8978 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8979 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8980 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8981 !! end
8982
8983 !! test
8984 Escaping of interlanguage links (T129218, T156308)
8985 !! wikitext
8986 Blah blah blah
8987 [[:es:Spanish]]
8988 [[ : zh : Chinese ]]
8989 !! html/php
8990 <p>Blah blah blah
8991 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8992 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8993 </p>
8994 !! html/parsoid
8995 <p>Blah blah blah
8996 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8997 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8998 !! end
8999
9000 !! test
9001 Multiple colons escaping interlanguage links
9002 !! options
9003 parsoid=wt2html
9004 !! wikitext
9005 [[:es:Spanish]]
9006 [[::es:Spanish]]
9007 [[:::es:Spanish]]
9008 !! html/php
9009 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9010 [[::es:Spanish]]
9011 [[:::es:Spanish]]
9012 </p>
9013 !! html/parsoid
9014 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9015 [[::es:Spanish]]
9016 [[:::es:Spanish]]</p>
9017 !! end
9018
9019 ## parsoid html2wt will normalize the space to _
9020 !! test
9021 Space and question mark encoding in interlanguage links (T95473)
9022 !! options
9023 parsoid=wt2html,wt2wt,html2html
9024 !! wikitext
9025 Blah blah blah
9026 [[es:Foo bar?]]
9027 !! html/php
9028 <p>Blah blah blah
9029 </p>
9030 !! html/parsoid
9031 <p>Blah blah blah</p>
9032 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9033 !! end
9034
9035 !! test
9036 Interlanguage link, with prefix links
9037 !! options
9038 language=ln
9039 !! wikitext
9040 Blah blah blah
9041 [[zh:Chinese]]
9042 !! html/php
9043 <p>Blah blah blah
9044 </p>
9045 !! html/parsoid
9046 <p>Blah blah blah</p>
9047 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9048 !! end
9049
9050 !! test
9051 Double interlanguage link, with prefix links (T10897)
9052 !! options
9053 language=ln
9054 !! wikitext
9055 Blah blah blah
9056 [[es:Spanish]]
9057 [[zh:Chinese]]
9058 !! html/php
9059 <p>Blah blah blah
9060 </p>
9061 !! html/parsoid
9062 <p>Blah blah blah</p>
9063 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9064 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9065 !! end
9066
9067 !! test
9068 "Extra" interlanguage links (T34189 / gerrit 111390)
9069 !! wikitext
9070 Blah blah blah
9071 [[mul:Article]]
9072 !! html/php
9073 <p>Blah blah blah
9074 </p>
9075 !! html/parsoid
9076 <p>Blah blah blah</p>
9077 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9078 !! end
9079
9080 ## PHP parser tests script needs an update
9081 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9082 !! test
9083 Language links render as inline links if $wgInterwikiMagic=false
9084 !! options
9085 wgInterwikiMagic=false
9086 parsoid=wt2html,wt2wt,html2html
9087 !! wikitext
9088 Blah blah blah
9089 [[zh:Chinese]]
9090 !! html/parsoid
9091 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9092 !! end
9093
9094 ## PHP parser tests script needs an update
9095 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9096 !! test
9097 Language links render as inline links in the Talk namespace
9098 !! options
9099 title=Talk:Foo
9100 parsoid=wt2html,wt2wt,html2html
9101 !! wikitext
9102 Blah blah blah
9103 [[zh:Chinese]]
9104 !! html/parsoid
9105 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9106 !! end
9107
9108 !! test
9109 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9110 !! options
9111 language=ln
9112 !! wikitext
9113 [[WW&nbsp;II]]
9114 !! html
9115 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
9116 </p>
9117 !! end
9118
9119 !! test
9120 Parsoid T55221: Wikilinks should be properly entity-escaped
9121 !! options
9122 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9123 !! html/parsoid
9124 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9125 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9126 !! wikitext
9127 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9128
9129 He&amp;nbsp;llo He&amp;nbsp;llo
9130 !! html/php
9131 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9132 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9133 </p>
9134 !! end
9135
9136 # html2wt will fail because of title normalization without data-parsoid
9137 !! test
9138 Parsoid: handle constructor well
9139 !! options
9140 parsoid=wt2html,wt2wt
9141 !! wikitext
9142 [[constructor]]
9143
9144 [[constructor:foo]]
9145 !! html/php
9146 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9147 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
9148 </p>
9149 !! html/parsoid
9150 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9151
9152 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
9153 !! end
9154
9155 !! test
9156 Template parameter named "constructor"
9157 !! wikitext
9158 {{echo| constructor = |hi}}
9159 !! html/parsoid
9160 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"constructor","named":true,"spc":[" "," ",""," "]},{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"},"constructor":{"wt":""}},"i":0}}]}'>hi</p>
9161 !! end
9162
9163 !! article
9164 ko:
9165 !! text
9166 Test.
9167 !! endarticle
9168
9169 # Note that `ko` isn't a known interlanguage prefix
9170 !! test
9171 Parsoid: recognize interlanguage links without a target page
9172 !! options
9173 ill
9174 !! wikitext
9175 [[es:]]
9176
9177 [[ko:]]
9178 !! html/php
9179 es:
9180 !! html/parsoid
9181 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9182
9183 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9184 !! end
9185
9186 # Note that `ko` isn't a known interwiki prefix
9187 !! test
9188 Parsoid: recognize interwiki links without a target page
9189 !! options
9190 parsoid=wt2html,wt2wt,html2html
9191 !! wikitext
9192 [[:es:]]
9193
9194 [[:ko:]]
9195 !! html/php
9196 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9197 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9198 </p>
9199 !! html/parsoid
9200 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9201 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9202 !! end
9203
9204 !! test
9205 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9206 !! wikitext
9207 [[mi:Foo]]
9208 !! html/php
9209 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9210 </p>
9211 !! html/parsoid
9212 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9213 !! end
9214
9215 !! test
9216 Interlanguage link with preceding local interwiki link (T70085)
9217 !! options
9218 parsoid=wt2html,wt2wt,html2html
9219 !! wikitext
9220 Blah blah blah
9221 [[local:es:Spanish]]
9222 !! html/php
9223 <p>Blah blah blah
9224 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9225 </p>
9226 !! html/parsoid
9227 <p>Blah blah blah
9228 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9229 !! end
9230
9231 !! test
9232 Looks like an interlanguage link, but is actually a local interwiki
9233 !! options
9234 parsoid=wt2html,wt2wt,html2html
9235 !! wikitext
9236 Blah blah blah
9237 [[mi:Template:Foo]]
9238 !! html/php
9239 <p>Blah blah blah
9240 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9241 </p>
9242 !! html/parsoid
9243 <p>Blah blah blah
9244 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9245 !! end
9246
9247 ###
9248 ### Redirects, Parsoid-only
9249 ###
9250
9251 !! test
9252 1. Simple redirect to page
9253 !! wikitext
9254 #REDIRECT [[Main Page]]
9255 !! html/parsoid
9256 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9257 !! end
9258
9259 !! test
9260 2. Other redirect variants
9261 !! wikitext
9262 #REDIRECT [[Main_Page]]
9263 !! html/parsoid
9264 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9265 !! end
9266
9267 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9268 # This tests the Parsoid bail-out code.
9269 !! test
9270 3. Other redirect variants
9271 !! options
9272 parsoid=wt2html
9273 !! wikitext
9274 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9275 !! html/parsoid
9276 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9277 !! end
9278
9279 !! test
9280 4. Redirect to a templated destination
9281 !! wikitext
9282 #REDIRECT [[{{echo|Foo}}bar]]
9283 !! html/parsoid
9284 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9285 !! end
9286
9287 !! test
9288 Empty redirect
9289 !! options
9290 parsoid=wt2html,wt2wt
9291 !! wikitext
9292 #REDIRECT [[]]
9293 !! html/parsoid
9294 <ol>
9295 <li>REDIRECT [[]]</li></ol>
9296 !! end
9297
9298 !! test
9299 Optional colon in #REDIRECT
9300 !! options
9301 # the colon is archaic syntax. we support it for wt2html, but we
9302 # don't care that it roundtrips back to the modern syntax.
9303 parsoid=wt2html,html2html
9304 !! wikitext
9305 #REDIRECT:[[Main Page]]
9306 !! html/parsoid
9307 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9308 !! end
9309
9310 !! test
9311 Whitespace in #REDIRECT with optional colon
9312 !! options
9313 # the colon and gratuitous whitespace is archaic syntax. we support
9314 # it for wt2html, but we don't care that it roundtrips back to the
9315 # modern syntax (without extra whitespace)
9316 parsoid=wt2html,html2html
9317 !! wikitext
9318
9319 #REDIRECT
9320 :
9321 [[Main Page]]
9322 !! html/parsoid
9323 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9324 !! end
9325
9326 !! test
9327 Piped link in #REDIRECT
9328 !! options
9329 # content after piped link is ignored. we support this syntax,
9330 # but don't care that the piped link is lost when we roundtrip this.
9331 parsoid=wt2html
9332 !! wikitext
9333 #REDIRECT [[Main Page|bar]]
9334 !! html/parsoid
9335 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9336 !! end
9337
9338 !! test
9339 Redirect to category (T104502)
9340 !! options
9341 parsoid=wt2html,wt2wt
9342 !! wikitext
9343 #REDIRECT [[Category:Foo]]
9344 !! html/parsoid
9345 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9346 !! end
9347
9348 !! test
9349 Redirect to category with URL encoding (T104502)
9350 !! options
9351 parsoid=wt2html
9352 !! wikitext
9353 #REDIRECT [[Category%3AFoo]]
9354 !! html/parsoid
9355 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9356 !! end
9357
9358 !! test
9359 Redirect to category page
9360 !! wikitext
9361 #REDIRECT [[:Category:Foo]]
9362 !! html/parsoid
9363 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9364 !! end
9365
9366 !! test
9367 Redirect to image page (1)
9368 !! wikitext
9369 #REDIRECT [[File:Wiki.png]]
9370 !! html/parsoid
9371 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9372 !! end
9373
9374 !! test
9375 Redirect to image page (2)
9376 !! wikitext
9377 #REDIRECT [[Image:Wiki.png]]
9378 !! html/parsoid
9379 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9380 !! end
9381
9382 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9383 # Next test confirms this.
9384 !! test
9385 Redirect to language (1) (T104918)
9386 !! options
9387 parsoid=wt2html,wt2wt,html2html
9388 !! wikitext
9389 #REDIRECT [[en:File:Wiki.png]]
9390 !! html/parsoid
9391 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9392 !! end
9393
9394 !! test
9395 Redirect to language (2) (T104918)
9396 !! wikitext
9397 #REDIRECT [[:en:File:Wiki.png]]
9398 !! html/parsoid
9399 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9400 !! end
9401
9402 !! test
9403 Redirect to interwiki (T104918)
9404 !! wikitext
9405 #REDIRECT [[meatball:File:Wiki.png]]
9406 !! html/parsoid
9407 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9408 !! end
9409
9410 !! test
9411 Non-English #REDIRECT
9412 !! options
9413 language=is
9414 !! wikitext
9415 #TILVÍSUN [[Main Page]]
9416 !! html/parsoid
9417 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9418 !! end
9419
9420 !! test
9421 Redirect syntax under text isn't considered a redirect
9422 !! wikitext
9423 some text
9424
9425 #redirect [[Main Page]]
9426 !! html/parsoid
9427 <p>some text</p>
9428 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
9429 !! end
9430
9431 !! test
9432 New redirect
9433 !! options
9434 parsoid=html2wt
9435 !! html/parsoid
9436 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9437 !! wikitext
9438 #REDIRECT [[Foo]]
9439 Foo
9440 !! end
9441
9442 !! test
9443 Redirect followed by block on the same line
9444 !! options
9445 parsoid=wt2html
9446 !! wikitext
9447 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9448 !! html/parsoid
9449 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9450 !! end
9451
9452 !! test
9453 Redirect followed by a newline
9454 !! wikitext
9455 #REDIRECT [[Main Page]]
9456 A newline
9457 !! html/parsoid
9458 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9459 <p>A newline</p>
9460 !! end
9461
9462 !! test
9463 Redirect followed by multiple newlines
9464 !! wikitext
9465 #REDIRECT [[Main Page]]
9466
9467
9468 A newline
9469 !! html/parsoid
9470 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9471
9472 <p><br/>
9473 A newline</p>
9474 !! end
9475
9476 !! test
9477 Drop duplicate redirects
9478 !! options
9479 parsoid=html2wt
9480 !! html/parsoid
9481 <link rel="mw:PageProp/redirect" href="./Foo"/>
9482 <link rel="mw:PageProp/redirect" href="./Bar"/>
9483 <link rel="mw:PageProp/redirect" href="./Baz"/>
9484 !! wikitext
9485 #REDIRECT [[Foo]]
9486 !! end
9487
9488 ##
9489 ## XHTML tidiness
9490 ###
9491
9492 !! test
9493 <br> to <br />
9494 !! wikitext
9495 1<br>2<br />3
9496 !! html
9497 <p>1<br />2<br />3
9498 </p>
9499 !! end
9500
9501 !! test
9502 Broken br tag sanitization
9503 !! wikitext
9504 </br>
9505 !! html/php
9506 <p>&lt;/br&gt;
9507 </p>
9508 !! end
9509
9510 # TODO: Fix html2html mode (T53055)!
9511 !! test
9512 Parsoid: Broken br tag recognition
9513 !! options
9514 parsoid=wt2html
9515 !! wikitext
9516 </br>
9517
9518 <br/ >
9519 !! html+tidy
9520 <p><br />
9521 </p><p><br />
9522 </p>
9523 !! end
9524
9525 !! test
9526 Incorrecly removing closing slashes from correctly formed XHTML
9527 !! wikitext
9528 <br style="clear:both;" />
9529 !! html
9530 <p><br style="clear:both;" />
9531 </p>
9532 !! end
9533
9534 !! test
9535 Failing to transform badly formed HTML into correct XHTML
9536 !! wikitext
9537 <br style="clear: left;">
9538 <br style="clear: right;">
9539 <br style="clear: both;">
9540 !! html
9541 <p><br style="clear: left;" />
9542 <br style="clear: right;" />
9543 <br style="clear: both;" />
9544 </p>
9545 !!end
9546
9547 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9548 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9549 !! test
9550 Handling html with a div self-closing tag
9551 !! wikitext
9552 <div title />
9553 <div title/>
9554 <div title/ >
9555 <div title=bar />
9556 <div title=bar/>
9557 <div title=bar/ >
9558 !! html/php
9559 <p>&lt;div title /&gt;
9560 &lt;div title/&gt;
9561 </p>
9562 <div>
9563 <p>&lt;div title=bar /&gt;
9564 &lt;div title=bar/&gt;
9565 </p>
9566 <div title="bar/"></div>
9567 </div>
9568
9569 !! html/parsoid
9570 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9571 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9572 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9573 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9574 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9575 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9576 !! end
9577
9578 !! test
9579 Elements with solidus in various attribute positions
9580 !! options
9581 parsoid=wt2html,html2html
9582 !! wikitext
9583 <div cla/ss="123">ha</div>
9584
9585 <div / class="123">ha</div>
9586
9587 <div class= / "123">ha</div>
9588 !! html/php+tidy
9589 <div>ha</div>
9590 <div class="123">ha</div>
9591 <div class="/">ha</div>
9592 !! html/parsoid
9593 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9594
9595 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9596
9597 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9598 !! end
9599
9600 !! test
9601 Handling html with a br self-closing tag
9602 !! wikitext
9603 <br title />
9604 <br title/>
9605 <br title/ >
9606 <br title=bar />
9607 <br title=bar/>
9608 <br title=bar/ >
9609 !! html/php
9610 <p><br title="" />
9611 <br title="" />
9612 <br />
9613 <br title="bar" />
9614 <br title="bar" />
9615 <br title="bar/" />
9616 </p>
9617 !! html/parsoid
9618 <p><br title="" />
9619 <br title="" />
9620 <br title="" />
9621 <br title="bar" />
9622 <br title="bar" />
9623 <br title="bar/" />
9624 </p>
9625 !! end
9626
9627 !! test
9628 Horizontal ruler (should it add that extra space?)
9629 !! wikitext
9630 <hr>
9631 <hr >
9632 foo <hr
9633 > bar
9634 !! html+tidy
9635 <hr />
9636 <hr /><p>
9637 foo </p><hr /><p> bar
9638 </p>
9639 !! end
9640
9641 !! test
9642 Horizontal ruler -- 4+ dashes render hr
9643 !! wikitext
9644 ----
9645 !! html
9646 <hr />
9647
9648 !! end
9649
9650 !! test
9651 Horizontal ruler -- eats additional dashes on the same line
9652 !! wikitext
9653 ---------
9654 !! html
9655 <hr />
9656
9657 !! end
9658
9659 !! test
9660 Horizontal ruler -- does not collapse dashes on consecutive lines
9661 !! wikitext
9662 ----
9663 ----
9664 !! html
9665 <hr />
9666 <hr />
9667
9668 !! end
9669
9670 !! test
9671 Horizontal ruler -- <4 dashes render as plain text
9672 !! wikitext
9673 ---
9674 !! html
9675 <p>---
9676 </p>
9677 !! end
9678
9679 !! test
9680 Horizontal ruler -- Supports content following dashes on same line
9681 !! wikitext
9682 ---- Foo
9683 !! html
9684 <hr /> Foo
9685
9686 !! html+tidy
9687 <hr /><p> Foo
9688 </p>
9689 !! end
9690
9691 ###
9692 ### Block-level elements
9693 ###
9694 !! test
9695 Common list
9696 !! wikitext
9697 *Common list
9698 *item 2
9699 *item 3
9700 !! html
9701 <ul><li>Common list</li>
9702 <li>item 2</li>
9703 <li>item 3</li></ul>
9704
9705 !! end
9706
9707 !! test
9708 Numbered list
9709 !! wikitext
9710 #Numbered list
9711 #item 2
9712 #item 3
9713 !! html
9714 <ol><li>Numbered list</li>
9715 <li>item 2</li>
9716 <li>item 3</li></ol>
9717
9718 !! end
9719
9720 # the switch from level 3 to ordered should not introduce a newline between
9721 !! test
9722 Mixed list
9723 !! wikitext
9724 *Mixed list
9725 *#with numbers
9726 **and bullets
9727 *#and numbers
9728 *bullets again
9729 **bullet level 2
9730 ***bullet level 3
9731 ***#Number on level 4
9732 **bullet level 2
9733 **#Number on level 3
9734 **#Number on level 3
9735 *#number level 2
9736 *Level 1
9737 ***Level 3
9738 #**Level 3, but ordered
9739 !! html
9740 <ul><li>Mixed list
9741 <ol><li>with numbers</li></ol>
9742 <ul><li>and bullets</li></ul>
9743 <ol><li>and numbers</li></ol></li>
9744 <li>bullets again
9745 <ul><li>bullet level 2
9746 <ul><li>bullet level 3
9747 <ol><li>Number on level 4</li></ol></li></ul></li>
9748 <li>bullet level 2
9749 <ol><li>Number on level 3</li>
9750 <li>Number on level 3</li></ol></li></ul>
9751 <ol><li>number level 2</li></ol></li>
9752 <li>Level 1
9753 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9754 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9755
9756 !! end
9757
9758 !! test
9759 1. Nested mixed wikitext and html list
9760 !! wikitext
9761 *hi
9762 *<ul><li>ho</li></ul>
9763 *hi
9764 **ho
9765 !! html/php
9766 <ul><li>hi</li>
9767 <li><ul><li>ho</li></ul></li>
9768 <li>hi
9769 <ul><li>ho</li></ul></li></ul>
9770
9771 !! html/parsoid
9772 <ul><li>hi</li>
9773 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9774 <li>hi
9775 <ul><li>ho</li></ul></li></ul>
9776 !! end
9777
9778 !! test
9779 2. Nested mixed wikitext and html list (incompatible)
9780 !! wikitext
9781 ;hi
9782 :{{echo|<li>ho</li>}}
9783 !! html/php
9784 <dl><dt>hi</dt>
9785 <dd><li>ho</li></dd></dl>
9786
9787 !! html/parsoid
9788 <dl><dt>hi</dt>
9789 <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9790 !! end
9791
9792 !! test
9793 Nested lists 1
9794 !! wikitext
9795 *foo
9796 **bar
9797 !! html
9798 <ul><li>foo
9799 <ul><li>bar</li></ul></li></ul>
9800
9801 !! end
9802
9803 !! test
9804 Nested lists 2
9805 !! wikitext
9806 **foo
9807 *bar
9808 !! html
9809 <ul><li><ul><li>foo</li></ul></li>
9810 <li>bar</li></ul>
9811
9812 !! end
9813
9814 !! test
9815 Nested lists 3 (first element empty)
9816 !! wikitext
9817 *
9818 **bar
9819 !! html
9820 <ul><li>
9821 <ul><li>bar</li></ul></li></ul>
9822
9823 !! end
9824
9825 !! test
9826 Nested lists 4 (first element empty)
9827 !! wikitext
9828 **
9829 *bar
9830 !! html
9831 <ul><li><ul><li></li></ul></li>
9832 <li>bar</li></ul>
9833
9834 !! end
9835
9836 !! test
9837 Nested lists 5 (both elements empty)
9838 !! wikitext
9839 **
9840 *
9841 !! html
9842 <ul><li><ul><li></li></ul></li>
9843 <li></li></ul>
9844
9845 !! end
9846
9847 !! test
9848 Nested lists 6 (both elements empty)
9849 !! wikitext
9850 *
9851 **
9852 !! html
9853 <ul><li>
9854 <ul><li></li></ul></li></ul>
9855
9856 !! end
9857
9858 !! test
9859 Nested lists 7 (skip initial nesting levels)
9860 !! wikitext
9861 ***foo
9862 !! html
9863 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9864
9865 !! end
9866
9867 !! test
9868 Nested lists 8 (multiple nesting transitions)
9869 !! wikitext
9870 *foo
9871 ***bar
9872 **baz
9873 *boo
9874 !! html
9875 <ul><li>foo
9876 <ul><li><ul><li>bar</li></ul></li>
9877 <li>baz</li></ul></li>
9878 <li>boo</li></ul>
9879
9880 !! end
9881
9882 !! test
9883 Nested lists 9 (extension interaction)
9884 !! options
9885 parsoid
9886 !! wikitext
9887 *<references />
9888 !! html/parsoid
9889 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9890 !! end
9891
9892 !! test
9893 1. Lists with start-of-line-transparent tokens before bullets: Comments
9894 !! wikitext
9895 *foo
9896 *<!--cmt-->bar
9897 <!--cmt-->*baz
9898 !! html
9899 <ul><li>foo</li>
9900 <li>bar</li>
9901 <li>baz</li></ul>
9902
9903 !! end
9904
9905 !! test
9906 Nested lists 10 (list and span siblings: wt2wt regression)
9907 !! wikitext
9908 *a <span>x</span>
9909 **b <span>y</span>
9910 !! html/parsoid
9911 <ul><li>a <span>x</span>
9912 <ul><li>b <span>y</span></li></ul></li></ul>
9913 !! end
9914
9915 !! test
9916 2. Lists with start-of-line-transparent tokens before bullets: Template close
9917 !! wikitext
9918 *foo {{echo|bar
9919 }}*baz
9920 !! html
9921 <ul><li>foo bar</li>
9922 <li>baz</li></ul>
9923
9924 !! end
9925
9926 !! test
9927 List items are not parsed correctly following a <pre> block (T2785)
9928 !! wikitext
9929 *<pre>foo</pre>
9930 *<pre>bar</pre>
9931 *zar
9932 !! html/php
9933 <ul><li><pre>foo</pre></li>
9934 <li><pre>bar</pre></li>
9935 <li>zar</li></ul>
9936
9937 !! html/parsoid
9938 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9939 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9940 <li>zar</li></ul>
9941 !! end
9942
9943 # FIXME: Might benefit from a html/parsoid since this has a template
9944 !! test
9945 List items from template
9946 !! wikitext
9947
9948 {{inner list}}
9949 *item 2
9950
9951 *item 0
9952 {{inner list}}
9953 *item 2
9954
9955 *item 0
9956 *notSOL{{inner list}}
9957 *item 2
9958 !! html
9959 <ul><li>item 1</li>
9960 <li>item 2</li></ul>
9961 <ul><li>item 0</li>
9962 <li>item 1</li>
9963 <li>item 2</li></ul>
9964 <ul><li>item 0</li>
9965 <li>notSOL</li>
9966 <li>item 1</li>
9967 <li>item 2</li></ul>
9968
9969 !! end
9970
9971 !! test
9972 List interrupted by empty line or heading
9973 !! wikitext
9974 *foo
9975
9976 **bar
9977 ==A heading==
9978 *Another list item
9979 !! html
9980 <ul><li>foo</li></ul>
9981 <ul><li><ul><li>bar</li></ul></li></ul>
9982 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9983 <ul><li>Another list item</li></ul>
9984
9985 !!end
9986
9987 !! test
9988 Multiple list tags generated by templates
9989 !! wikitext
9990 {{echo|<li>}}a
9991 {{echo|<li>}}b
9992 {{echo|<li>}}c
9993 !! html
9994 <li>a
9995 <li>b
9996 <li>c</li>
9997 </li>
9998 </li>
9999
10000
10001 !! html+tidy
10002 <li>a
10003 </li><li>b
10004 </li><li>c
10005 </li>
10006 !! html/parsoid
10007 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a"]}'>a</li>
10008 <li about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"b"]}'>b</li>
10009 <li about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"c"]}'>c</li>
10010 !! end
10011
10012 !! test
10013 Multiple newlines in between HTML list items don't induce paragraph wrapping
10014 !! wikitext
10015 <ul>
10016 <li>hi</li>
10017
10018
10019
10020
10021 <li>ho</li>
10022 </ul>
10023
10024 <dl>
10025 <dt>hi</dt>
10026 <dd>ho<div>123</div>
10027 </dd>
10028
10029
10030 </dl>
10031 !! html/php+tidy
10032 <ul>
10033 <li>hi</li>
10034
10035
10036
10037
10038 <li>ho</li>
10039 </ul>
10040 <dl>
10041 <dt>hi</dt>
10042 <dd>ho<div>123</div>
10043 </dd>
10044
10045
10046 </dl>
10047 !! end
10048
10049 !!test
10050 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10051 !! wikitext
10052 *a
10053 <!--This line will NOT split the list-->
10054 *b
10055 <!--This line will NOT split the list either-->
10056 *c
10057 <!--foo--> <!----> <!--This line NOT split the list either-->
10058 *d
10059 !! html
10060 <ul><li>a</li>
10061 <li>b</li>
10062 <li>c</li>
10063 <li>d</li></ul>
10064
10065 !!end
10066
10067 !!test
10068 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10069 !! wikitext
10070 *a
10071 <!--This line will NOT split the list-->
10072 *b
10073 <!--This line will NOT split the list either-->
10074 *c
10075 <!--foo--> <!----> <!--This line NOT split the list
10076 either-->
10077 *d
10078 !! html
10079 <ul><li>a</li>
10080 <li>b</li>
10081 <li>c</li>
10082 <li>d</li></ul>
10083
10084 !!end
10085
10086 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10087 # That pass could possibly be removed.
10088 !!test
10089 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10090 !!options
10091 parsoid=wt2html,wt2wt
10092 !! wikitext
10093 *foo
10094 *<li>li-hack
10095 *{{echo|<li>templated li-hack}}
10096 *<!--foo--><li> unsupported li-hack with preceding comments
10097
10098 <ul>
10099 <li><li>not a li-hack
10100 </li>
10101 </ul>
10102 !! html+tidy
10103 <ul><li>foo</li>
10104 <li class="mw-empty-elt"></li><li>li-hack</li>
10105 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10106 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10107 <ul>
10108 <li class="mw-empty-elt"></li><li>not a li-hack
10109 </li>
10110 </ul>
10111 !! html/parsoid
10112 <ul><li> foo</li>
10113 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10114 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
10115 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10116
10117 <ul data-parsoid='{"stx":"html"}'>
10118 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10119 </li>
10120 </ul>
10121
10122 !!end
10123
10124 !! test
10125 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10126 !! options
10127 parsoid
10128 !! wikitext
10129 #foo
10130 ##bar
10131
10132 *foo
10133 **bar
10134
10135 :foo
10136 ::bar
10137 !! html
10138 <ol>
10139 <li>foo<ol>
10140 <li>bar</li>
10141 </ol></li>
10142 </ol><ul>
10143 <li>foo<ul>
10144 <li>bar</li>
10145 </ul></li>
10146 </ul><dl>
10147 <dd>foo<dl>
10148 <dd>bar</dd>
10149 </dl></dd>
10150 </dl>
10151 !! end
10152
10153 !! test
10154 Parsoid: Test of whitespace serialization with Templated bullets
10155 !! options
10156 parsoid=wt2html
10157 !! wikitext
10158 * {{bullet}}
10159 !! html/parsoid
10160 <ul>
10161 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
10162 </ul>
10163 !! end
10164
10165 # ------------------------------------------------------------------------
10166 # The next set of tests are about Parsoid's ability to handle badly nested
10167 # tags (parse, minimize scope of fixup, and roundtrip back)
10168 # ------------------------------------------------------------------------
10169
10170 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10171 # Parsoid's list handling is more aware of block structure.
10172 !! test
10173 Unbalanced closing block tags break a list
10174 !! wikitext
10175 <div>
10176 *a</div><div>
10177 *b</div>
10178 !! html+tidy
10179 <div>
10180 <ul><li>a</li></ul></div><div>
10181 <li>b</li></div>
10182 !! html/parsoid
10183 <div><ul>
10184 <li>a</li>
10185 </ul></div>
10186 <div><ul>
10187 <li>b</li>
10188 </ul></div>
10189 !! end
10190
10191 !! test
10192 Unbalanced closing non-block tags don't break a list
10193 !! options
10194 parsoid=wt2html,html2html
10195 !! wikitext
10196 <span>
10197 *a</span><span>
10198 *b</span>
10199 !! html/php+tidy
10200 <p><span>
10201 </span></p>
10202 <ul><li>a<span></span></li>
10203 <li>b</li></ul>
10204 !! html/parsoid
10205 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10206 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10207 <li>b</li></ul>
10208 !! end
10209
10210 # Parsoid does some post-dom-building cleanup
10211 # which is why its output differs from Remex.
10212 !! test
10213 Unclosed formatting tags that straddle lists are closed and reopened
10214 !! options
10215 parsoid=wt2html,wt2wt,html2html
10216 !! wikitext
10217 #<s> a
10218 #b </s>
10219 !! html/php+tidy
10220 <ol><li><s> a</s></li><s>
10221 </s><li><s>b </s></li></ol>
10222 !! html/parsoid
10223 <ol><li><s> a</s></li>
10224 <li><s>b </s></li></ol>
10225 !! end
10226
10227 # Output is ugly because of all the misnested tag fixups.
10228 !! test
10229 1. List embedded in a formatting tag
10230 !! wikitext
10231 <small>
10232 *foo
10233 </small>
10234 !! html/php+tidy
10235 <p><small>
10236 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10237 </p>
10238 !! html/parsoid
10239 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10240 <ul><li data-parsoid='{}'>foo</li></ul></small>
10241 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10242 !! end
10243
10244 # Output is ugly because of all the misnested tag fixups.
10245 !! test
10246 2. List embedded in a formatting tag in a misnested way
10247 !! wikitext
10248 <small>
10249 *a
10250 *b</small>
10251 !! html/php+tidy
10252 <p><small>
10253 </small></p><small></small><ul><small><li>a</li>
10254 </small><li><small>b</small></li></ul>
10255 !! html/parsoid
10256 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10257 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10258 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10259 !! end
10260
10261 # Output is ugly because of all the misnested tag fixups.
10262 !! test
10263 3. List embedded in a formatting tag in a misnested way
10264 !! wikitext
10265 <small>
10266
10267 ** 123</small>
10268 !! html/php+tidy
10269 <p><small>
10270 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10271 !! html/parsoid
10272 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10273
10274 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10275 !! end
10276
10277 ###
10278 ### Magic Words
10279 ###
10280
10281 # Note that the current date is hard-coded as
10282 # 1970-01-01T00:02:03Z (a Thursday)
10283 # when running parser tests. The timezone is also fixed to GMT, so
10284 # local date will be identical to current date.
10285
10286 !! test
10287 Magic Word: {{CURRENTDAY}}
10288 !! wikitext
10289 {{CURRENTDAY}}
10290 !! html
10291 <p>1
10292 </p>
10293 !! end
10294
10295 !! test
10296 Magic Word: {{CURRENTDAY2}}
10297 !! wikitext
10298 {{CURRENTDAY2}}
10299 !! html
10300 <p>01
10301 </p>
10302 !! end
10303
10304 !! test
10305 Magic Word: {{CURRENTDAYNAME}}
10306 !! wikitext
10307 {{CURRENTDAYNAME}}
10308 !! html
10309 <p>Thursday
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{CURRENTDOW}}
10315 !! wikitext
10316 {{CURRENTDOW}}
10317 !! html
10318 <p>4
10319 </p>
10320 !! end
10321
10322 !! test
10323 Magic Word: {{CURRENTMONTH}}
10324 !! wikitext
10325 {{CURRENTMONTH}}
10326 !! html
10327 <p>01
10328 </p>
10329 !! end
10330
10331 !! test
10332 Magic Word: {{CURRENTMONTH1}}
10333 !! wikitext
10334 {{CURRENTMONTH1}}
10335 !! html
10336 <p>1
10337 </p>
10338 !! end
10339
10340 !! test
10341 Magic Word: {{CURRENTMONTHABBREV}}
10342 !! wikitext
10343 {{CURRENTMONTHABBREV}}
10344 !! html
10345 <p>Jan
10346 </p>
10347 !! end
10348
10349 !! test
10350 Magic Word: {{CURRENTMONTHNAME}}
10351 !! wikitext
10352 {{CURRENTMONTHNAME}}
10353 !! html
10354 <p>January
10355 </p>
10356 !! end
10357
10358 !! test
10359 Magic Word: {{CURRENTMONTHNAMEGEN}}
10360 !! wikitext
10361 {{CURRENTMONTHNAMEGEN}}
10362 !! html
10363 <p>January
10364 </p>
10365 !! end
10366
10367 !! test
10368 Magic Word: {{CURRENTTIME}}
10369 !! wikitext
10370 {{CURRENTTIME}}
10371 !! html
10372 <p>00:02
10373 </p>
10374 !! end
10375
10376 !! test
10377 Magic Word: {{CURRENTHOUR}}
10378 !! wikitext
10379 {{CURRENTHOUR}}
10380 !! html
10381 <p>00
10382 </p>
10383 !! end
10384
10385 !! test
10386 Magic Word: {{CURRENTWEEK}} (T6594)
10387 !! wikitext
10388 {{CURRENTWEEK}}
10389 !! html
10390 <p>1
10391 </p>
10392 !! end
10393
10394 !! test
10395 Magic Word: {{CURRENTYEAR}}
10396 !! wikitext
10397 {{CURRENTYEAR}}
10398 !! html
10399 <p>1970
10400 </p>
10401 !! end
10402
10403 !! test
10404 Magic Word: {{CURRENTTIMESTAMP}}
10405 !! wikitext
10406 {{CURRENTTIMESTAMP}}
10407 !! html
10408 <p>19700101000203
10409 </p>
10410 !! end
10411
10412 !! test
10413 Magic Words LOCAL (UTC)
10414 !! wikitext
10415 *{{LOCALMONTH}}
10416 *{{LOCALMONTH1}}
10417 *{{LOCALMONTHNAME}}
10418 *{{LOCALMONTHNAMEGEN}}
10419 *{{LOCALMONTHABBREV}}
10420 *{{LOCALDAY}}
10421 *{{LOCALDAY2}}
10422 *{{LOCALDAYNAME}}
10423 *{{LOCALYEAR}}
10424 *{{LOCALTIME}}
10425 *{{LOCALHOUR}}
10426 *{{LOCALWEEK}}
10427 *{{LOCALDOW}}
10428 *{{LOCALTIMESTAMP}}
10429 !! html
10430 <ul><li>01</li>
10431 <li>1</li>
10432 <li>January</li>
10433 <li>January</li>
10434 <li>Jan</li>
10435 <li>1</li>
10436 <li>01</li>
10437 <li>Thursday</li>
10438 <li>1970</li>
10439 <li>00:02</li>
10440 <li>00</li>
10441 <li>1</li>
10442 <li>4</li>
10443 <li>19700101000203</li></ul>
10444
10445 !! end
10446
10447 !! test
10448 Magic Word: {{FULLPAGENAME}}
10449 !! options
10450 title=[[User:Ævar Arnfjörð Bjarmason]]
10451 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10452 !! wikitext
10453 {{FULLPAGENAME}}
10454 !! html/*
10455 <p>User:Ævar Arnfjörð Bjarmason
10456 </p>
10457 !! end
10458
10459 !! test
10460 Magic Word: {{FULLPAGENAMEE}}
10461 !! options
10462 title=[[User:Ævar Arnfjörð Bjarmason]]
10463 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10464 !! wikitext
10465 {{FULLPAGENAMEE}}
10466 !! html/*
10467 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10468 </p>
10469 !! end
10470
10471 !! test
10472 Magic Word: {{TALKSPACE}}
10473 !! options
10474 title=[[User:Ævar Arnfjörð Bjarmason]]
10475 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10476 !! wikitext
10477 {{TALKSPACE}}
10478 !! html/*
10479 <p>User talk
10480 </p>
10481 !! end
10482
10483 !! test
10484 Magic Word: {{TALKSPACE}}, same namespace
10485 !! options
10486 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10487 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10488 !! wikitext
10489 {{TALKSPACE}}
10490 !! html/*
10491 <p>User talk
10492 </p>
10493 !! end
10494
10495 !! test
10496 Magic Word: {{TALKSPACE}}, main namespace
10497 !! options
10498 title=[[Parser Test]]
10499 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10500 !! wikitext
10501 {{TALKSPACE}}
10502 !! html/*
10503 <p>Talk
10504 </p>
10505 !! end
10506
10507 !! test
10508 Magic Word: {{TALKSPACEE}}
10509 !! options
10510 title=[[User:Ævar Arnfjörð Bjarmason]]
10511 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10512 !! wikitext
10513 {{TALKSPACEE}}
10514 !! html/*
10515 <p>User_talk
10516 </p>
10517 !! end
10518
10519 !! test
10520 Magic Word: {{SUBJECTSPACE}}
10521 !! options
10522 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10523 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10524 !! wikitext
10525 {{SUBJECTSPACE}}
10526 !! html/*
10527 <p>User
10528 </p>
10529 !! end
10530
10531 !! test
10532 Magic Word: {{SUBJECTSPACE}}, same namespace
10533 !! options
10534 title=[[User:Ævar Arnfjörð Bjarmason]]
10535 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10536 !! wikitext
10537 {{SUBJECTSPACE}}
10538 !! html/*
10539 <p>User
10540 </p>
10541 !! end
10542
10543 !! test
10544 Magic Word: {{SUBJECTSPACE}}, main namespace
10545 !! options
10546 title=[[Parser Test]]
10547 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10548 !! wikitext
10549 {{SUBJECTSPACE}}
10550 !! html/*
10551
10552 !! end
10553
10554 !! test
10555 Magic Word: {{SUBJECTSPACEE}}
10556 !! options
10557 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SUBJECTSPACEE}}
10561 !! html/*
10562 <p>User
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{NAMESPACE}}
10568 !! options
10569 title=[[User:Ævar Arnfjörð Bjarmason]]
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{NAMESPACE}}
10573 !! html/*
10574 <p>User
10575 </p>
10576 !! end
10577
10578 !! test
10579 Magic Word: {{NAMESPACEE}}
10580 !! options
10581 title=[[User:Ævar Arnfjörð Bjarmason]]
10582 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10583 !! wikitext
10584 {{NAMESPACEE}}
10585 !! html/*
10586 <p>User
10587 </p>
10588 !! end
10589
10590 !! test
10591 Magic Word: {{NAMESPACENUMBER}}
10592 !! options
10593 title=[[User:Ævar Arnfjörð Bjarmason]]
10594 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10595 !! wikitext
10596 {{NAMESPACENUMBER}}
10597 !! html/*
10598 <p>2
10599 </p>
10600 !! end
10601
10602 !! test
10603 Magic Word: {{SUBPAGENAME}}
10604 !! options
10605 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10606 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10607 !! wikitext
10608 {{SUBPAGENAME}}
10609 !! html/*
10610 <p>sub ö
10611 </p>
10612 !! end
10613
10614 !! test
10615 Magic Word: {{SUBPAGENAMEE}}
10616 !! options
10617 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10618 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10619 !! wikitext
10620 {{SUBPAGENAMEE}}
10621 !! html/*
10622 <p>sub_%C3%B6
10623 </p>
10624 !! end
10625
10626 !! test
10627 Magic Word: {{ROOTPAGENAME}}
10628 !! options
10629 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10630 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10631 !! wikitext
10632 {{ROOTPAGENAME}}
10633 !! html/*
10634 <p>Ævar Arnfjörð Bjarmason
10635 </p>
10636 !! end
10637
10638 !! test
10639 Magic Word: {{ROOTPAGENAMEE}}
10640 !! options
10641 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10642 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10643 !! wikitext
10644 {{ROOTPAGENAMEE}}
10645 !! html/*
10646 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10647 </p>
10648 !! end
10649
10650 !! test
10651 Magic Word: {{BASEPAGENAME}}
10652 !! options
10653 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10654 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10655 !! wikitext
10656 {{BASEPAGENAME}}
10657 !! html/*
10658 <p>Ævar Arnfjörð Bjarmason
10659 </p>
10660 !! end
10661
10662 !! test
10663 Magic Word: {{BASEPAGENAMEE}}
10664 !! options
10665 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10666 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10667 !! wikitext
10668 {{BASEPAGENAMEE}}
10669 !! html/*
10670 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10671 </p>
10672 !! end
10673
10674 !! test
10675 Magic Word: {{TALKPAGENAME}}
10676 !! options
10677 title=[[User:Ævar Arnfjörð Bjarmason]]
10678 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10679 !! wikitext
10680 {{TALKPAGENAME}}
10681 !! html/*
10682 <p>User talk:Ævar Arnfjörð Bjarmason
10683 </p>
10684 !! end
10685
10686 !! test
10687 Magic Word: {{TALKPAGENAMEE}}
10688 !! options
10689 title=[[User:Ævar Arnfjörð Bjarmason]]
10690 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10691 !! wikitext
10692 {{TALKPAGENAMEE}}
10693 !! html/*
10694 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10695 </p>
10696 !! end
10697
10698 !! test
10699 Magic Word: {{SUBJECTPAGENAME}}
10700 !! options
10701 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10702 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10703 !! wikitext
10704 {{SUBJECTPAGENAME}}
10705 !! html/*
10706 <p>User:Ævar Arnfjörð Bjarmason
10707 </p>
10708 !! end
10709
10710 !! test
10711 Magic Word: {{SUBJECTPAGENAMEE}}
10712 !! options
10713 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10714 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10715 !! wikitext
10716 {{SUBJECTPAGENAMEE}}
10717 !! html/*
10718 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10719 </p>
10720 !! end
10721
10722 !! test
10723 Magic Word: {{NUMBEROFFILES}}
10724 !! options
10725 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10726 !! wikitext
10727 {{NUMBEROFFILES}}
10728 !! html/*
10729 <p>7
10730 </p>
10731 !! end
10732
10733 !! test
10734 Magic Word: {{PAGENAME}}
10735 !! options
10736 title=[[User:Ævar Arnfjörð Bjarmason]]
10737 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10738 !! wikitext
10739 {{PAGENAME}}
10740 !! html/*
10741 <p>Ævar Arnfjörð Bjarmason
10742 </p>
10743 !! end
10744
10745 !! test
10746 Magic Word: {{PAGENAME}} with metacharacters
10747 !! options
10748 title=[['foo & bar = baz']]
10749 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10750 !! wikitext
10751 ''{{PAGENAME}}''
10752 !! html+tidy
10753 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10754 </p>
10755 !! end
10756
10757 !! test
10758 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10759 !! options
10760 title=[[*RFC 1234 http://example.com/]]
10761 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10762 !! wikitext
10763 {{PAGENAME}}
10764 !! html+tidy
10765 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10766 </p>
10767 !! end
10768
10769 !! test
10770 Magic Word: {{PAGENAMEE}}
10771 !! options
10772 title=[[User:Ævar Arnfjörð Bjarmason]]
10773 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10774 !! wikitext
10775 {{PAGENAMEE}}
10776 !! html/*
10777 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10778 </p>
10779 !! end
10780
10781 !! test
10782 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10783 !! options
10784 title=[[*RFC 1234 http://example.com/]]
10785 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10786 !! wikitext
10787 {{PAGENAMEE}}
10788 !! html+tidy
10789 <p>&#42;RFC_1234_http&#58;//example.com/
10790 </p>
10791 !! end
10792
10793 !! test
10794 Magic Word: {{REVISIONID}}
10795 !! options
10796 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10797 showflags
10798 !! wikitext
10799 {{REVISIONID}}
10800 !! html/*
10801 <p>1337
10802 </p>
10803 flags=vary-revision-id
10804 !! end
10805
10806 !! test
10807 Magic Word: {{SCRIPTPATH}}
10808 !! options
10809 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10810 !! wikitext
10811 {{SCRIPTPATH}}
10812 !! html/*
10813
10814 !! end
10815
10816 !! test
10817 Magic Word: {{STYLEPATH}}
10818 !! options
10819 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10820 !! wikitext
10821 {{STYLEPATH}}
10822 !! html/*
10823 <p>/skins
10824 </p>
10825 !! end
10826
10827 !! test
10828 Magic Word: {{SERVER}}
10829 !! options
10830 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10831 !! wikitext
10832 {{SERVER}}
10833 !! html/*
10834 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10835 </p>
10836 !! end
10837
10838 !! test
10839 Magic Word: {{SERVERNAME}}
10840 !! options
10841 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10842 !! wikitext
10843 {{SERVERNAME}}
10844 !! html/*
10845 <p>example.org
10846 </p>
10847 !! end
10848
10849 !! test
10850 Magic Word: {{SITENAME}}
10851 !! options
10852 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10853 !! wikitext
10854 {{SITENAME}}
10855 !! html/*
10856 <p>MediaWiki
10857 </p>
10858 !! end
10859
10860 !! test
10861 Magic Word: {{PAGELANGUAGE}}
10862 !! options
10863 language=fr
10864 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10865 !! wikitext
10866 {{PAGELANGUAGE}}
10867 !! html/*
10868 <p>fr
10869 </p>
10870 !! end
10871
10872 !! test
10873 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10874 !! options
10875 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10876 !! wikitext
10877 {{PAGELANGUAGE}}
10878 !! html/*
10879 <p>en
10880 </p>
10881 !! end
10882
10883 !! test
10884 Case-sensitive magic words, when cased differently, should just be template transclusions
10885 !! wikitext
10886 {{CurrentMonth}}
10887 {{currentday}}
10888 {{cURreNTweEK}}
10889 {{currentHour}}
10890 !! html
10891 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
10892 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
10893 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
10894 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
10895 </p>
10896 !! end
10897
10898 !! test
10899 Case-insensitive magic words should still work with weird casing.
10900 !! wikitext
10901 {{sErVeRNaMe}}
10902 {{LCFirst:AOEU}}
10903 {{ucFIRST:aoeu}}
10904 {{SERver}}
10905 !! html
10906 <p>example.org
10907 aOEU
10908 Aoeu
10909 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10910 </p>
10911 !! end
10912
10913 # From plwiki:PLOS_ONE
10914 !! test
10915 Parsoid: Page property magic word with magic word contents
10916 !! wikitext
10917 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10918 !! html/parsoid
10919 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10920 !! end
10921
10922 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10923 # But, this is a limitation of our representation and is documented in
10924 # TemplateHandler.js in processSpecialMagicWord
10925 !! test
10926 Parsoid: Template-generated DISPLAYTITLE
10927 !! wikitext
10928 {{{{echo|DISPLAYTITLE}}:Foo}}
10929 !! options
10930 showtitle
10931 !! config
10932 wgAllowDisplayTitle=true
10933 wgRestrictDisplayTitle=false
10934 !! html/php
10935 Foo
10936
10937 !! html/parsoid
10938 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
10939 !! end
10940
10941 !! test
10942 Namespace 1 {{ns:1}}
10943 !! wikitext
10944 {{ns:1}}
10945 !! html
10946 <p>Talk
10947 </p>
10948 !! end
10949
10950 !! test
10951 Namespace 1 {{ns:01}}
10952 !! wikitext
10953 {{ns:01}}
10954 !! html
10955 <p>Talk
10956 </p>
10957 !! end
10958
10959 !! test
10960 Namespace 0 {{ns:0}} (T6783)
10961 !! wikitext
10962 {{ns:0}}
10963 !! html
10964
10965 !! end
10966
10967 !! test
10968 Namespace 0 {{ns:00}} (T6783)
10969 !! wikitext
10970 {{ns:00}}
10971 !! html
10972
10973 !! end
10974
10975 !! test
10976 Namespace -1 {{ns:-1}}
10977 !! wikitext
10978 {{ns:-1}}
10979 !! html
10980 <p>Special
10981 </p>
10982 !! end
10983
10984 !! test
10985 Namespace User {{ns:User}}
10986 !! wikitext
10987 {{ns:User}}
10988 !! html
10989 <p>User
10990 </p>
10991 !! end
10992
10993 !! test
10994 Namespace User talk {{ns:User_talk}}
10995 !! wikitext
10996 {{ns:User_talk}}
10997 !! html
10998 <p>User talk
10999 </p>
11000 !! end
11001
11002 !! test
11003 Namespace User talk {{ns:uSeR tAlK}}
11004 !! wikitext
11005 {{ns:uSeR tAlK}}
11006 !! html
11007 <p>User talk
11008 </p>
11009 !! end
11010
11011 !! test
11012 Namespace File {{ns:File}}
11013 !! wikitext
11014 {{ns:File}}
11015 !! html
11016 <p>File
11017 </p>
11018 !! end
11019
11020 !! test
11021 Namespace File {{ns:Image}}
11022 !! wikitext
11023 {{ns:Image}}
11024 !! html
11025 <p>File
11026 </p>
11027 !! end
11028
11029 !! test
11030 Namespace (lang=de) Benutzer {{ns:User}}
11031 !! options
11032 language=de
11033 !! wikitext
11034 {{ns:User}}
11035 !! html
11036 <p>Benutzer
11037 </p>
11038 !! end
11039
11040 !! test
11041 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11042 !! options
11043 language=de
11044 !! wikitext
11045 {{ns:3}}
11046 !! html
11047 <p>Benutzer Diskussion
11048 </p>
11049 !! end
11050
11051 !! test
11052 Urlencode
11053 !! wikitext
11054 {{urlencode:hi world?!}}
11055 {{urlencode:hi world?!|WIKI}}
11056 {{urlencode:hi world?!|PATH}}
11057 {{urlencode:hi world?!|QUERY}}
11058 !! html/php
11059 <p>hi+world%3F%21
11060 hi_world%3F!
11061 hi%20world%3F%21
11062 hi+world%3F%21
11063 </p>
11064 !! end
11065
11066 !! test
11067 Magic Word: prioritize type info over data-parsoid
11068 !! options
11069 parsoid=html2wt
11070 !! html/parsoid
11071 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11072 !! wikitext
11073 __FORCETOC__
11074 !! end
11075
11076 !! test
11077 Magic Word: serialize on separate line (parsoid)
11078 !! options
11079 parsoid=wt2wt,html2wt
11080 !! wikitext
11081 foo
11082 __NOTOC__
11083 bar
11084 !! html/parsoid
11085 foo<meta property="mw:PageProp/notoc"/>bar
11086 !! end
11087
11088 !! test
11089 Magic Word: rt non-english wikis
11090 !! options
11091 parsoid=wt2wt
11092 language=de
11093 !! wikitext
11094 __NOEDITSECTION__
11095 !! html/parsoid
11096 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11097 !! end
11098
11099 !!test
11100 __proto__ is treated as normal wikitext (T105997)
11101 !!wikitext
11102 __proto__
11103 !!html
11104 <p>__proto__
11105 </p>
11106 !!end
11107
11108 ###
11109 ### Magic links
11110 ###
11111 !! test
11112 Magic links: internal link to RFC (T2479)
11113 !! wikitext
11114 [[RFC 123]]
11115 !! html/php
11116 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
11117 </p>
11118 !! html/parsoid
11119 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11120 !! end
11121
11122 !! test
11123 Magic links: RFC (T2479)
11124 !! wikitext
11125 RFC 822
11126 !! html/php
11127 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11128 </p>
11129 !! html/parsoid
11130 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11131 !! end
11132
11133 !! test
11134 Magic links: RFC (T67278)
11135 !! wikitext
11136 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11137 !! html/php
11138 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
11139 </p>
11140 !! html/parsoid
11141 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
11142 !! end
11143
11144 !! test
11145 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11146 !! wikitext
11147 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11148 RFC
11149 822
11150 !! html/php
11151 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11152 RFC
11153 822
11154 </p>
11155 !! html/parsoid
11156 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
11157 RFC
11158 822</p>
11159 !! end
11160
11161 !! test
11162 Magic links: ISBN (T3937)
11163 !! wikitext
11164 ISBN 0-306-40615-2
11165 !! html/php
11166 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11167 </p>
11168 !! html/parsoid
11169 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11170 !! end
11171
11172 !! test
11173 Magic links: ISBN (T67278)
11174 !! wikitext
11175 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11176 !! html/php
11177 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11178 </p>
11179 !! html/parsoid
11180 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
11181 !! end
11182
11183 !! test
11184 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11185 !! wikitext
11186 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11187 ISBN
11188 9780316098113
11189 ISBN 978
11190 0316098113
11191 !! html/php
11192 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11193 ISBN
11194 9780316098113
11195 ISBN 978
11196 0316098113
11197 </p>
11198 !! html/parsoid
11199 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
11200 ISBN
11201 9780316098113
11202 ISBN 978
11203 0316098113</p>
11204 !! end
11205
11206 !! test
11207 Magic links: PMID incorrectly converts space to underscore
11208 !! wikitext
11209 PMID 1234
11210 !! html/php
11211 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11212 </p>
11213 !! html/parsoid
11214 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11215 !! end
11216
11217 !! test
11218 Magic links: PMID (T67278)
11219 !! wikitext
11220 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11221 !! html/php
11222 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
11223 </p>
11224 !! html/parsoid
11225 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11226 !! end
11227
11228 !! test
11229 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11230 !! wikitext
11231 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11232 PMID
11233 1234
11234 !! html/php
11235 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11236 PMID
11237 1234
11238 </p>
11239 !! html/parsoid
11240 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
11241 PMID
11242 1234</p>
11243 !! end
11244
11245 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11246 # since these are ExtLinkText, not MagicLinkText
11247 !! test
11248 Magic links: use appropriate serialization for "almost" magic links.
11249 !! wikitext
11250 X[[Special:BookSources/0978739256|foo]]
11251
11252 X[https://tools.ietf.org/html/rfc1234 foo]
11253 !! html/php
11254 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11255 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11256 </p>
11257 !! html/parsoid
11258 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11259 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11260 !! end
11261
11262 !! test
11263 Magic links: All disabled (T47942)
11264 !! options
11265 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11266 !! wikitext
11267 ISBN 0-306-40615-2
11268 PMID 1234
11269 RFC 4321
11270 !! html/php
11271 <p>ISBN 0-306-40615-2
11272 PMID 1234
11273 RFC 4321
11274 </p>
11275 !! end
11276
11277 ###
11278 ### Templates
11279 ####
11280
11281 !! test
11282 Nonexistent template
11283 !! wikitext
11284 {{thistemplatedoesnotexist}}
11285 !! html
11286 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
11287 </p>
11288 !! end
11289
11290 !! test
11291 Template with invalid target containing tags
11292 !! wikitext
11293 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11294 !! html
11295 <p>{{a<b>b</b>|foo|a=b|a = b}}
11296 </p>
11297 !! end
11298
11299 !! test
11300 Template with invalid target containing unclosed tag
11301 !! wikitext
11302 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11303 !! html
11304 <p>{{a<b>|foo|a=b|a = b}}</b>
11305 </p>
11306 !! end
11307
11308 !! test
11309 Template with invalid target containing wikilink
11310 !! wikitext
11311 {{[[Main Page]]}}
11312 !! html/php
11313 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11314 </p>
11315 !! html/parsoid
11316 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
11317 !! end
11318
11319 !! test
11320 Template with just whitespace in it, T70421
11321 !! wikitext
11322 {{echo|{{ }}}}
11323 !! html/parsoid
11324 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11325 !! end
11326
11327 !! article
11328 Template:test
11329 !! text
11330 This is a test template
11331 !! endarticle
11332
11333 !! test
11334 Simple template
11335 !! wikitext
11336 {{test}}
11337 !! html
11338 <p>This is a test template
11339 </p>
11340 !! end
11341
11342 !! test
11343 Template with explicit namespace
11344 !! wikitext
11345 {{Template:test}}
11346 !! html
11347 <p>This is a test template
11348 </p>
11349 !! end
11350
11351
11352 !! article
11353 Template:paramtest
11354 !! text
11355 This is a test template with parameter {{{param}}}
11356 !! endarticle
11357
11358 !! test
11359 Template parameter
11360 !! wikitext
11361 {{paramtest|param=foo}}
11362 !! html
11363 <p>This is a test template with parameter foo
11364 </p>
11365 !! end
11366
11367 !! article
11368 Template:paramtestnum
11369 !! text
11370 [[{{{1}}}|{{{2}}}]]
11371 !! endarticle
11372
11373 !! test
11374 Template unnamed parameter
11375 !! wikitext
11376 {{paramtestnum|Main Page|the main page}}
11377 !! html
11378 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11379 </p>
11380 !! end
11381
11382 !! article
11383 Template:templatesimple
11384 !! text
11385 (test)
11386 !! endarticle
11387
11388 !! article
11389 Template:templateredirect
11390 !! text
11391 #redirect [[Template:templatesimple]]
11392 !! endarticle
11393
11394 !! article
11395 Template:templateasargtestnum
11396 !! text
11397 {{{{{1}}}}}
11398 !! endarticle
11399
11400 !! article
11401 Template:templateasargtest
11402 !! text
11403 {{template{{{templ}}}}}
11404 !! endarticle
11405
11406 !! article
11407 Template:templateasargtest2
11408 !! text
11409 {{{{{templ}}}}}
11410 !! endarticle
11411
11412 !! test
11413 Template with template name as unnamed argument
11414 !! wikitext
11415 {{templateasargtestnum|templatesimple}}
11416 !! html
11417 <p>(test)
11418 </p>
11419 !! end
11420
11421 !! test
11422 Template with template name as argument
11423 !! wikitext
11424 {{templateasargtest|templ=simple}}
11425 !! html
11426 <p>(test)
11427 </p>
11428 !! end
11429
11430 !! test
11431 Template with template name as argument (2)
11432 !! wikitext
11433 {{templateasargtest2|templ=templatesimple}}
11434 !! html
11435 <p>(test)
11436 </p>
11437 !! end
11438
11439 !! article
11440 Template:templateasargtestdefault
11441 !! text
11442 {{{{{templ|templatesimple}}}}}
11443 !! endarticle
11444
11445 !! article
11446 Template:templa
11447 !! text
11448 '''templ'''
11449 !! endarticle
11450
11451 !! test
11452 Template with default value
11453 !! wikitext
11454 {{templateasargtestdefault}}
11455 !! html
11456 <p>(test)
11457 </p>
11458 !! end
11459
11460 !! test
11461 Template with default value (value set)
11462 !! wikitext
11463 {{templateasargtestdefault|templ=templa}}
11464 !! html
11465 <p><b>templ</b>
11466 </p>
11467 !! end
11468
11469 !! test
11470 Template redirect
11471 !! wikitext
11472 {{templateredirect}}
11473 !! html/php
11474 <p>(test)
11475 </p>
11476 !! html/parsoid
11477 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11478 !! end
11479
11480 !! test
11481 Template with argument in separate line
11482 !! wikitext
11483 {{ templateasargtest |
11484 templ = simple }}
11485 !! html
11486 <p>(test)
11487 </p>
11488 !! end
11489
11490 !! test
11491 Template with complex template as argument
11492 !! wikitext
11493 {{paramtest|
11494 param ={{ templateasargtest |
11495 templ = simple }}}}
11496 !! html
11497 <p>This is a test template with parameter (test)
11498 </p>
11499 !! end
11500
11501 !! test
11502 Templates with templated name
11503 !! wikitext
11504 {{{{echo|echo}}|foo}}
11505 {{{{echo|inner list}} }}
11506 !! html
11507 <p>foo
11508 </p>
11509 <ul><li>item 1</li></ul>
11510
11511 !! html/parsoid
11512 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11513 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
11514 !! end
11515
11516 ## Regression test; the output here isn't really that interesting.
11517 !! test
11518 Templates with templated name and top level template args
11519 !! wikitext
11520 {{1{{2{{{3}}}|4=5}}}}
11521 !! html/parsoid
11522 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11523 !! end
11524
11525 # Parsoid markup is deliberate "broken". This is an edge case.
11526 # See long comment in TemplateHandler.js:convertAttribsToString.
11527 !! test
11528 Templates with invalid templated targets
11529 !! wikitext
11530 {{echo
11531 {{echo|foo}}
11532 }}
11533 !! html/php
11534 <p>{{echo
11535 foo
11536 }}
11537 </p>
11538 !! html/parsoid
11539 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11540 foo }}</p>
11541 !! end
11542
11543 !! test
11544 Template with thumb image (with link in description)
11545 !! wikitext
11546 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11547 !! html/php
11548 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11549
11550 !! html+tidy
11551 <p>This is a test template with parameter </p><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
11552 !! html/parsoid
11553 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
11554 !! end
11555
11556 !! article
11557 Template:complextemplate
11558 !! text
11559 {{{1}}} {{paramtest|
11560 param ={{{param}}}}}
11561 !! endarticle
11562
11563 !! test
11564 Template with complex arguments
11565 !! wikitext
11566 {{complextemplate|
11567 param ={{ templateasargtest |
11568 templ = simple }}|[[Template:complextemplate|link]]}}
11569 !! html
11570 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11571 </p>
11572 !! end
11573
11574 !! test
11575 T2553: link with two variables in a piped link
11576 !! wikitext
11577 {|
11578 |[[{{{1}}}|{{{2}}}]]
11579 |}
11580 !! html/php
11581 <table>
11582 <tr>
11583 <td>[[{{{1}}}|{{{2}}}]]
11584 </td></tr></table>
11585
11586 !! html/parsoid
11587 <table>
11588 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11589 </tbody></table>
11590 !! end
11591
11592 # See: T2553
11593 !! test
11594 Abort table cell attribute parsing on wikilink
11595 !! wikitext
11596 {|
11597 |testing [[one|two]] |three||four
11598 |testing one two |three||four
11599 |testing="[[one|two]]" |three||four
11600 |}
11601 !! html/php
11602 <table>
11603 <tr>
11604 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
11605 <td>four
11606 </td>
11607 <td>three</td>
11608 <td>four
11609 </td>
11610 <td>testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
11611 <td>four
11612 </td></tr></table>
11613
11614 !! html/parsoid
11615 <table>
11616 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11617 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11618 <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td></tr>
11619 </tbody></table>
11620 !! end
11621
11622 !! test
11623 Don't abort table cell attribute parsing if wikilink is found in template arg
11624 !! wikitext
11625 {|
11626 |Test {{#tag:ref|One two "[[three]]" four}}
11627 |}
11628 !! html/parsoid
11629 <table>
11630 <tbody><tr><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11631 </tbody></table>
11632 !! end
11633
11634 !! test
11635 Magic variable as template parameter
11636 !! wikitext
11637 {{paramtest|param={{SITENAME}}}}
11638 !! html
11639 <p>This is a test template with parameter MediaWiki
11640 </p>
11641 !! end
11642
11643 !! article
11644 Template:linktest
11645 !! text
11646 [[{{{param}}}|link]]
11647 !! endarticle
11648
11649 !! test
11650 Template parameter as link source
11651 !! wikitext
11652 {{linktest|param=Main Page}}
11653 !! html
11654 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11655 </p>
11656 !! end
11657
11658 !!article
11659 Template:paramtest2
11660 !! text
11661 including another template, {{paramtest|param={{{arg}}}}}
11662 !! endarticle
11663
11664 !! test
11665 Template passing argument to another template
11666 !! wikitext
11667 {{paramtest2|arg='hmm'}}
11668 !! html
11669 <p>including another template, This is a test template with parameter 'hmm'
11670 </p>
11671 !! end
11672
11673 !! article
11674 Template:Linktest2
11675 !! text
11676 Main Page
11677 !! endarticle
11678
11679 !! test
11680 Template as link source
11681 !! wikitext
11682 [[{{linktest2}}]]
11683
11684 [[{{linktest2}}|Main Page]]
11685
11686 [[{{linktest2}}]]Page
11687 !! html
11688 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11689 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11690 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11691 </p>
11692 !! end
11693
11694
11695 !! article
11696 Template:loop1
11697 !! text
11698 {{loop2}}
11699 !! endarticle
11700
11701 !! article
11702 Template:loop2
11703 !! text
11704 {{loop1}}
11705 !! endarticle
11706
11707 !! test
11708 Template infinite loop
11709 !! wikitext
11710 {{loop1}}
11711 !! html
11712 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11713 </p>
11714 !! end
11715
11716 !! test
11717 Template from main namespace
11718 !! wikitext
11719 {{:Main Page}}
11720 !! html
11721 <p>blah blah
11722 </p>
11723 !! end
11724
11725 !! test
11726 Template from non-includable namespace
11727 !! options
11728 wgNonincludableNamespaces=10
11729 !! wikitext
11730 {{echo|uh oh!}}
11731 !! html
11732 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11733 </p>
11734 !! end
11735
11736 !! article
11737 Template:table
11738 !! text
11739 {|
11740 | 1 || 2
11741 |-
11742 | 3 || 4
11743 |}
11744 !! endarticle
11745
11746 !! test
11747 T2529: Template with table, not included at beginning of line
11748 !! wikitext
11749 foo {{table}}
11750 !! html
11751 <p>foo
11752 </p>
11753 <table>
11754 <tr>
11755 <td>1</td>
11756 <td>2
11757 </td></tr>
11758 <tr>
11759 <td>3</td>
11760 <td>4
11761 </td></tr></table>
11762
11763 !! end
11764
11765 !! test
11766 T2523: Template shouldn't eat newline (or add an extra one before table)
11767 !! wikitext
11768 foo
11769 {{table}}
11770 !! html
11771 <p>foo
11772 </p>
11773 <table>
11774 <tr>
11775 <td>1</td>
11776 <td>2
11777 </td></tr>
11778 <tr>
11779 <td>3</td>
11780 <td>4
11781 </td></tr></table>
11782
11783 !! end
11784
11785 !! test
11786 T2041: Template parameters shown as broken links
11787 !! wikitext
11788 {{{parameter}}}
11789 !! html
11790 <p>{{{parameter}}}
11791 </p>
11792 !! end
11793
11794 !! test
11795 Template with targets containing wikilinks
11796 !! options
11797 parsoid=wt2html
11798 !! wikitext
11799 {{[[foo]]}}
11800
11801 {{[[{{echo|foo}}]]}}
11802
11803 {{{{echo|[[foo}}]]}}
11804 !! html/php
11805 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11806 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11807 </p><p>{{[[foo}}]]
11808 </p>
11809 !! html/parsoid
11810 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11811 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
11812 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11813 !! end
11814
11815 !! article
11816 Template:''
11817 !! text
11818 bar
11819 !! endarticle
11820
11821 !! test
11822 Templates: Double quotes as template target
11823 !! wikitext
11824 foo {{''}} baz
11825 !! html/php
11826 <p>foo bar baz
11827 </p>
11828 !! html/parsoid
11829 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11830 </p>
11831 !! end
11832
11833 ## This test is about making sure Parsoid's data-mw is well formed in the
11834 ## face of multiple templates with intersecting and overlapping ranges. The
11835 ## wikitext itself is wretched.
11836 !! test
11837 Templates with intersecting and overlapping ranges
11838 !! wikitext
11839 {|{{echo|
11840 <p>ha</p>}}
11841 {|{{echo|
11842 <p>ho</p>}}
11843 {{echo|{{!}}hi}}
11844 |}
11845 !! html/php+tidy
11846 <p>ha</p><table>
11847
11848 </table><p>ho</p><table>
11849
11850 <tbody><tr>
11851 <td>hi
11852 </td></tr></tbody></table>
11853 !! html/parsoid
11854 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11855
11856 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11857
11858 <tbody><tr><td>hi</td></tr>
11859 </tbody></table>
11860 !! end
11861
11862 !! article
11863 Template:MSGNW test
11864 !! text
11865 ''None'' of '''this''' should be
11866 * interpreted
11867 but rather passed unmodified
11868 {{test}}
11869 <gallery>
11870 File:Foobar.jpg
11871 </gallery>
11872 <!-- comment -->
11873 !! endarticle
11874
11875 # hmm, fix this or just deprecate msgnw and document its behavior?
11876 !! test
11877 msgnw keyword
11878 !! wikitext
11879 {{msgnw:MSGNW test}}
11880 !! html/php
11881 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11882 &#42; interpreted
11883 &#32;but rather passed unmodified
11884 &#123;&#123;test&#125;&#125;
11885 &#60;gallery&#62;
11886 File:Foobar.jpg
11887 &#60;/gallery&#62;
11888 &#60;!-- comment --&#62;
11889 </p>
11890 !! end
11891
11892 !! test
11893 int keyword
11894 !! wikitext
11895 {{int:youhavenewmessages|lots of money|not!}}
11896 !! html
11897 <p>You have lots of money (not!).
11898 </p>
11899 !! end
11900
11901 !! test
11902 int keyword - non-existing message
11903 !! wikitext
11904 {{int:var}}
11905 !! html
11906 <p>⧼var⧽
11907 </p>
11908 !! end
11909
11910 !! article
11911 Template:Includes
11912 !! text
11913 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11914 !! endarticle
11915
11916 !! test
11917 <includeonly> and <noinclude> being included
11918 !! wikitext
11919 {{Includes}}
11920 !! html
11921 <p>Foobar
11922 </p>
11923 !! end
11924
11925 !! article
11926 Template:Includes2
11927 !! text
11928 <onlyinclude>Foo</onlyinclude>bar
11929 !! endarticle
11930
11931 !! test
11932 <onlyinclude> being included
11933 !! wikitext
11934 {{Includes2}}
11935 !! html
11936 <p>Foo
11937 </p>
11938 !! end
11939
11940
11941 !! article
11942 Template:Includes3
11943 !! text
11944 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11945 !! endarticle
11946
11947 !! test
11948 <onlyinclude> and <includeonly> being included
11949 !! wikitext
11950 {{Includes3}}
11951 !! html
11952 <p>Foo
11953 </p>
11954 !! end
11955
11956 !! test
11957 <includeonly> and <noinclude> on a page
11958 !! wikitext
11959 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11960 !! html
11961 <p>Foozar
11962 </p>
11963 !! end
11964
11965 !! test
11966 Un-closed <noinclude>
11967 !! wikitext
11968 <noinclude>
11969 !! html
11970 !! end
11971
11972 !! test
11973 <onlyinclude> on a page
11974 !! wikitext
11975 <onlyinclude>Foo</onlyinclude>bar
11976 !! html
11977 <p>Foobar
11978 </p>
11979 !! end
11980
11981 !! test
11982 Un-closed <onlyinclude>
11983 !! wikitext
11984 <onlyinclude>
11985 !! html
11986 !! end
11987
11988 !!test
11989 Self-closed noinclude, includeonly, onlyinclude tags
11990 !! wikitext
11991 <noinclude />
11992 <includeonly />
11993 <onlyinclude />
11994 !! html
11995 <p><br />
11996 </p>
11997 !!end
11998
11999 !!test
12000 Unbalanced includeonly and noinclude tags
12001 !! wikitext
12002 {|
12003 |a</noinclude>
12004 |b</noinclude></noinclude>
12005 |c</noinclude></includeonly>
12006 |d</includeonly></includeonly>
12007 |}
12008 !! html
12009 <table>
12010 <tr>
12011 <td>a
12012 </td>
12013 <td>b
12014 </td>
12015 <td>c&lt;/includeonly&gt;
12016 </td>
12017 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12018 </td></tr></table>
12019
12020 !!end
12021
12022 !! article
12023 Template:Includeonly section
12024 !! text
12025 <includeonly>
12026 ==Includeonly section==
12027 </includeonly>
12028 ==Section T-1==
12029 !!endarticle
12030
12031 !! test
12032 T8563: Edit link generation for section shown by <includeonly>
12033 !! wikitext
12034 {{includeonly section}}
12035 !! html
12036 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12037 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12038
12039 !! end
12040
12041 # Uses same input as the contents of [[Template:Includeonly section]]
12042 !! test
12043 T8563: Section extraction for section shown by <includeonly>
12044 !! options
12045 section=T-2
12046 !! wikitext
12047 <includeonly>
12048 ==Includeonly section==
12049 </includeonly>
12050 ==Section T-2==
12051 !! html
12052 ==Section T-2==
12053 !! end
12054
12055 !! test
12056 T8563: Edit link generation for section suppressed by <includeonly>
12057 !! wikitext
12058 <includeonly>
12059 ==Includeonly section==
12060 </includeonly>
12061 ==Section 1==
12062 !! html
12063 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12064
12065 !! end
12066
12067 !! test
12068 T8563: Section extraction for section suppressed by <includeonly>
12069 !! options
12070 section=1
12071 !! wikitext
12072 <includeonly>
12073 ==Includeonly section==
12074 </includeonly>
12075 ==Section 1==
12076 !! html
12077 ==Section 1==
12078 !! end
12079
12080 !! test
12081 Un-closed <includeonly>
12082 !! wikitext
12083 <includeonly>
12084 !! html/php
12085 !! html/parsoid
12086 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12087 !! end
12088
12089 ## We used to, but no longer wt2wt this test since the default serializer
12090 ## will normalize the include directives to serialize on their own line.
12091 ## Selser will take care of preserving formatting in scenarios where they
12092 ## intermingled with other wikitext.
12093 !! test
12094 Includes and comments at SOL
12095 !! options
12096 parsoid=wt2html,html2html
12097 !! wikitext
12098 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12099
12100 <noinclude>
12101 some
12102 </noinclude>*stuff
12103 *here
12104
12105 <noinclude>
12106 some</noinclude>* stuff
12107 * here
12108
12109 <includeonly>can have stuff</includeonly>===here===
12110
12111 !! html/php
12112 <h2><span class="mw-headline" id="hu">hu</span></h2>
12113 <p>some
12114 </p>
12115 <ul><li>stuff</li>
12116 <li>here</li></ul>
12117 <p><br />
12118 some* stuff
12119 </p>
12120 <ul><li>here</li></ul>
12121 <h3><span class="mw-headline" id="here">here</span></h3>
12122
12123 !! html/parsoid
12124 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2 id="hu">hu</h2>
12125
12126 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12127 <p>some</p>
12128 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12129 <li>here</li></ul>
12130
12131 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12132 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12133 <ul><li>here</li></ul>
12134
12135 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
12136
12137 !! end
12138
12139 # TODO: test with DOM fragment reuse!
12140 !! test
12141 Parsoid: DOM fragment reuse
12142 !! options
12143 parsoid=wt2wt,wt2html
12144 !! wikitext
12145 a{{echo|b<table></table>c}}d
12146
12147 a{{echo|b
12148 <table></table>
12149 c}}d
12150
12151 {{echo|a
12152
12153 <table></table>
12154
12155 b}}
12156 !! html
12157 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
12158
12159 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
12160 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12161 </span><p about="#mwt2">cd</p>
12162
12163 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
12164
12165 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12166
12167 </span><p about="#mwt3">b</p>
12168 !! end
12169
12170 !! test
12171 Parsoid: Merge double tds (T52603)
12172 !! options
12173 parsoid
12174 !! wikitext
12175 {|
12176 |{{echo|{{!}} foo}}
12177 |}
12178 !! html
12179 <table><tbody>
12180 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
12181 </tbody></table>
12182 !! end
12183
12184 !! test
12185 Parsoid: Merge double tds in nested transclusion content (T52603)
12186 !! options
12187 parsoid
12188 !! wikitext
12189 {{echo|<div>}}
12190 {|
12191 |{{echo|{{!}} foo}}
12192 |}
12193 {{echo|</div>}}
12194 !! html
12195 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
12196 <table><tbody>
12197 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12198 </tbody></table>
12199 </div>
12200 !! end
12201
12202 ###
12203 ### <includeonly> and <noinclude> in attributes
12204 ###
12205 !!test
12206 0. includeonly around the entire attribute
12207 !! wikitext
12208 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12209 !! html
12210 <p><span id="v2">bar</span>
12211 </p>
12212 !!end
12213
12214 !!test
12215 1. includeonly in html attr key
12216 !! wikitext
12217 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12218 !! html
12219 <p><span id="foo">bar</span>
12220 </p>
12221 !!end
12222
12223 !!test
12224 2. includeonly in html attr value
12225 !! wikitext
12226 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12227 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12228 !! html
12229 <p><span id="v1">bar</span>
12230 <span id="v1">bar</span>
12231 </p>
12232 !!end
12233
12234 !!test
12235 3. includeonly in part of an attr value
12236 !! wikitext
12237 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12238 !! html
12239 <p><span style="color:red;">bar</span>
12240 </p>
12241 !!end
12242
12243 !!test
12244 4. includeonly in table attributes
12245 !! wikitext
12246 {|
12247 |- <noinclude>
12248 |-
12249 |a
12250 </noinclude>
12251 |- <includeonly>
12252 |-
12253 |b
12254 </includeonly>
12255 |}
12256 !! html
12257 <table>
12258
12259
12260 <tr>
12261 <td>a
12262 </td></tr>
12263 </table>
12264
12265 !!end
12266
12267 ###
12268 ### Preprocessor precedence tests
12269 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12270 ###
12271 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12272 !! test
12273 Preprocessor precedence 1: link is rightmost opening
12274 !! options
12275 parsoid=wt2html
12276 !! wikitext
12277 {{[[Foo|bar}}]]
12278
12279 But close-brace is not a valid character in a link title:
12280 {{[[Foo}}|bar]]
12281
12282 However, we can still tell this was handled as a link in the preprocessor:
12283 {{echo|[[Foo}}|bar]]|bat}}
12284 !! html/php
12285 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12286 </p><p>But close-brace is not a valid character in a link title:
12287 {{[[Foo}}|bar]]
12288 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12289 [[Foo}}|bar]]
12290 </p>
12291 !! html/parsoid
12292 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12293 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12294 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12295 !! end
12296
12297 !! test
12298 Preprocessor precedence 2: template is rightmost opening
12299 !! options
12300 language=zh
12301 !! wikitext
12302 -{{echo|foo}-}}-
12303 !! html/php
12304 <p>-foo}--
12305 </p>
12306 !! html/parsoid
12307 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12308 !! end
12309
12310 !! test
12311 Preprocessor precedence 3: language converter is rightmost opening
12312 !! options
12313 language=zh
12314 parsoid=wt2html
12315 !! wikitext
12316 {{echo|hi}}
12317
12318 {{-{R|echo|hi}}}-
12319
12320 [[-{R|raw]]}-
12321 !! html/php
12322 <p>hi
12323 </p><p>{{echo|hi}}
12324 </p><p>[[raw]]
12325 </p>
12326 !! html/parsoid
12327 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12328 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12329 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12330 !! end
12331
12332 !! test
12333 Preprocessor precedence 4: left-most angle bracket
12334 !! options
12335 language=zh
12336 !! wikitext
12337 <!--{raw}-->
12338 !! html/php
12339 !! html/parsoid
12340 <!--{raw}-->
12341 !! end
12342
12343 !! article
12344 Template:Precedence5
12345 !! text
12346 {{{{{1}}}}}
12347 !! endarticle
12348
12349 !! test
12350 Preprocessor precedence 5: tplarg takes precedence over template
12351 !! wikitext
12352 {{Precedence5|Bullet}}
12353 !! html/php
12354 <ul><li>Bar</li></ul>
12355
12356 !! html/parsoid
12357 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12358 !! end
12359
12360 !! test
12361 Preprocessor precedence 6: broken link is rightmost opening
12362 !! options
12363 parsoid=wt2html
12364 !! wikitext
12365 {{echo|[[Foo}}
12366
12367 {{echo|[[Foo|bar|bat=baz}}
12368 !! html/php
12369 <p>{{echo|[[Foo}}
12370 </p><p>{{echo|[[Foo|bar|bat=baz}}
12371 </p>
12372 !! html/parsoid
12373 <p>{{echo|[[Foo}}</p>
12374 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12375 !! end
12376
12377 # This next test exposes a difference between PHP and Parsoid:
12378 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12379 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12380 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12381 # outer `[[Foo` extends until the `y]]`
12382 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12383 # intermediate result (after template expansion), and link processing
12384 # happens on this intermediate result, which moves the wikilink
12385 # boundary leftward to `[[Foo|Bar]]`
12386 # 2b) Parsoid works in a single step, so it's going to keep the
12387 # wikilink as extending to the `y]]`
12388 # 3a) Then PHP does linktrail processing which slurps up the trailing
12389 # `xy` inside the link.
12390 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12391 # `z` inside the link.
12392 # This is "correct" behavior. Parsoid's basic worldview is that the
12393 # `]]` inside the template shouldn't be allowed to leak out to affect
12394 # the surrounding wikilink. PHP may match Parsoid (in the future)
12395 # if you use {{#balance}} (T114445).
12396
12397 !! test
12398 Preprocessor precedence 7: broken template is rightmost opening
12399 !! options
12400 parsoid=wt2html
12401 !! wikitext
12402 [[Foo|{{echo|Bar]]
12403
12404 [[Foo|{{echo|Bar]]-x}}-y]]-z
12405
12406 Careful: linktrails can move the end of the wikilink:
12407 [[Foo|{{echo|y']]a}}l]]l
12408 !! html/php
12409 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12410 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12411 </p><p>Careful: linktrails can move the end of the wikilink:
12412 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12413 </p>
12414 !! html/parsoid
12415 <p>[[Foo|{{echo|Bar]]</p>
12416 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12417 <p>Careful: linktrails can move the end of the wikilink:
12418 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12419 !! end
12420
12421 !! test
12422 Preprocessor precedence 8: broken language converter is rightmost opening
12423 !! options
12424 language=zh
12425 !! wikitext
12426 [[Foo-{R|raw]]
12427 !! html
12428 <p>[[Foo-{R|raw]]
12429 </p>
12430 !! end
12431
12432 !! article
12433 Template:Preprocessor_precedence_9
12434 !! text
12435 ;4: {{{{1}}}}
12436 ;5: {{{{{2}}}}}
12437 ;6: {{{{{{3}}}}}}
12438 ;7: {{{{{{{4}}}}}}}
12439 !! endarticle
12440
12441 !! test
12442 Preprocessor precedence 9: groups of braces
12443 !! wikitext
12444 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12445 !! html/php
12446 <dl><dt>4</dt>
12447 <dd>{Four}</dd>
12448 <dt>5</dt>
12449 <dd></dd></dl>
12450 <ul><li>Bar</li></ul>
12451 <dl><dt>6</dt>
12452 <dd>Four</dd>
12453 <dt>7</dt>
12454 <dd>{Bullet}</dd></dl>
12455
12456 !! html/parsoid
12457 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12458 <dt>4</dt>
12459 <dd>{Four}</dd>
12460 <dt>5</dt>
12461 <dd></dd>
12462 </dl><ul about="#mwt1">
12463 <li>Bar</li>
12464 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12465 <dt>6</dt>
12466 <dd>Four</dd>
12467 <dt>7</dt>
12468 <dd>{Bullet}</dd>
12469 </dl>
12470 !! end
12471
12472 !! article
12473 Template:Preprocessor_precedence_10
12474 !! text
12475 ;1: -{R|raw}-
12476 ;2: -{{Bullet}}-
12477 ;3: -{{{1}}}-
12478 ;4: -{{{{2}}}}-
12479 ;5: -{{{{{3}}}}}-
12480 ;6: -{{{{{{4}}}}}}-
12481 ;7: -{{{{{{{5}}}}}}}-
12482 !! endarticle
12483
12484 !! test
12485 Preprocessor precedence 10: groups of braces with leading dash
12486 !! options
12487 language=zh
12488 !! wikitext
12489 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12490 !! html/php
12491 <dl><dt>1</dt>
12492 <dd>raw</dd>
12493 <dt>2</dt>
12494 <dd>-</dd></dl>
12495 <ul><li>Bar-</li></ul>
12496 <dl><dt>3</dt>
12497 <dd>-Three-</dd>
12498 <dt>4</dt>
12499 <dd>raw2</dd>
12500 <dt>5</dt>
12501 <dd>-</dd></dl>
12502 <ul><li>Bar-</li></ul>
12503 <dl><dt>6</dt>
12504 <dd>-Three-</dd>
12505 <dt>7</dt>
12506 <dd>raw2</dd></dl>
12507
12508 !! html/parsoid
12509 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12510 <dt>1</dt>
12511 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12512 <dt>2</dt>
12513 <dd>-</dd>
12514 </dl><ul about="#mwt1">
12515 <li>Bar-</li>
12516 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12517 <dt>3</dt>
12518 <dd>-Three-</dd>
12519 <dt>4</dt>
12520 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12521 <dt>5</dt>
12522 <dd>-</dd>
12523 </dl><ul about="#mwt1">
12524 <li>Bar-</li>
12525 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12526 <dt>6</dt>
12527 <dd>-Three-</dd>
12528 <dt>7</dt>
12529 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12530 </dl>
12531 !! end
12532
12533 !! test
12534 Preprocessor precedence 11: found during visual diff testing
12535 !! wikitext
12536 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12537
12538 {{echo|-{{echo|-{{echo|x}}}}}}
12539
12540 {{echo|-{{echo|x}}}}
12541 !! html/php
12542 <p><span>-<span>-x</span></span>
12543 </p><p>--x
12544 </p><p>-x
12545 </p>
12546 !! html/parsoid
12547 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12548
12549 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12550
12551 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12552 !! end
12553
12554 !! test
12555 Preprocessor precedence 12: broken language converter closed by brace.
12556 !! options
12557 parsoid=wt2html
12558 !! wikitext
12559 This form breaks the template, which is unfortunate:
12560 *{{echo|foo-{bar}bat}}
12561
12562 But if the broken language converter markup is inside an extension
12563 tag, nothing bad happens:
12564 *<nowiki>foo-{bar}bat</nowiki>
12565 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12566 *<pre>foo-{bar}bat</pre>
12567 *{{echo|<pre>foo-{bar}bat</pre>}}
12568
12569 <tag>foo-{bar}bat</tag>
12570 {{echo|<tag>foo-{bar}bat</tag>}}
12571
12572 !! html/php+tidy
12573 <p>This form breaks the template, which is unfortunate:
12574 </p>
12575 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12576 <p>But if the broken language converter markup is inside an extension
12577 tag, nothing bad happens:
12578 </p>
12579 <ul><li>foo-&#123;bar}bat</li>
12580 <li>foo-&#123;bar}bat</li>
12581 <li><pre>foo-{bar}bat</pre></li>
12582 <li><pre>foo-{bar}bat</pre></li></ul>
12583 <pre>'foo-{bar}bat'
12584 array (
12585 )
12586 </pre>
12587 <pre>'foo-{bar}bat'
12588 array (
12589 )
12590 </pre>
12591 !! html/parsoid
12592 <p>This form breaks the template, which is unfortunate:</p>
12593 <ul>
12594 <li>{{echo|foo-{bar}bat}}</li>
12595 </ul>
12596 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12597 <ul>
12598 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12599 <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12600 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12601 <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12602 </ul>
12603 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12604 !! end
12605
12606 !! test
12607 Preprocessor precedence 13: broken language converter in external link
12608 !! options
12609 parsoid=wt2html
12610 !! wikitext
12611 *[http://example.com/-{foo Example in URL]
12612 *[http://example.com Example in -{link} description]
12613 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12614 !! html/php+tidy
12615 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12616 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12617 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12618 !! html/parsoid
12619 <ul>
12620 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12621 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12622 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12623 </ul>
12624 !! end
12625
12626 !! test
12627 Preprocessor precedence 14: broken language converter in comment
12628 !! wikitext
12629 *<!--{{foo}}-->...should be ok
12630 *<!---{{foo}}-->...extra dashes
12631 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12632 !! html/php+tidy
12633 <ul><li>...should be ok</li>
12634 <li>...extra dashes</li>
12635 <li>foobat...should be ok</li></ul>
12636 !! html/parsoid
12637 <ul>
12638 <li><!--{{foo}}-->...should be ok</li>
12639 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12640 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
12641 </ul>
12642 !! end
12643
12644 !! test
12645 Preprocessor precedence 15: broken brace markup in headings
12646 !! config
12647 wgFragmentMode=[ 'html5', 'legacy' ]
12648 !! options
12649 parsoid=wt2html
12650 !! wikitext
12651 __NOTOC__ __NOEDITSECTION__
12652 ===1 foo[bar 1===
12653 1
12654 ===2 foo[[bar 2===
12655 2
12656 ===3 foo{bar 3===
12657 3
12658 ===4 foo{{bar 4===
12659 4
12660 ===5 foo{{{bar 5===
12661 5
12662 ===6 foo-{bar 6===
12663 6
12664 !! html/php+tidy
12665 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12666 <p>1
12667 </p>
12668 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12669 <p>2
12670 </p>
12671 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12672 <p>3
12673 </p>
12674 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12675 <p>4
12676 </p>
12677 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12678 <p>5
12679 </p>
12680 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12681 <p>6
12682 </p>
12683 !! html/parsoid
12684 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12685 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12686 <p>1</p>
12687 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12688 <p>2</p>
12689 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12690 <p>3</p>
12691 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12692 <p>4</p>
12693 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12694 <p>5</p>
12695 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12696 <p>6</p>
12697 !! end
12698
12699 !! test
12700 Preprocessor precedence 16: matching closing braces to opening braces
12701 !! options
12702 language=zh
12703 parsoid=wt2html
12704 !! wikitext
12705 -{{{echo|foo}}bar}-
12706 !! html/php
12707 <p>foobar
12708 </p>
12709 !! html/parsoid
12710 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
12711 !! end
12712
12713 !! test
12714 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12715 !! options
12716 parsoid=wt2html
12717 !! wikitext
12718 {{echo|hi {{}}}}
12719 !! html/php
12720 <p>hi {{}}
12721 </p>
12722 !! html/parsoid
12723 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12724 !! end
12725
12726 # Ensure we're using a language without variants for this test; even
12727 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12728 !! test
12729 Preprocessor precedence 18: another rightmost wins scenario
12730 !! options
12731 parsoid=wt2html
12732 language=de
12733 !! wikitext
12734 {{ -{{{{1|tplarg}}} }} }-
12735 !! html/php
12736 <p>{{ -{tplarg }} }-
12737 </p>
12738 !! html/parsoid
12739 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12740 !! end
12741
12742 !! test
12743 Preprocessor precedence 19: break syntax
12744 !! options
12745 parsoid=wt2html
12746 !! wikitext
12747 -{{
12748 !! html/php
12749 <p>-{{
12750 </p>
12751 !! html/parsoid
12752 <p>-{{</p>
12753 !! end
12754
12755 ###
12756 ### Token Stream Patcher tests
12757 ###
12758 ### These tests won't always pass wt2wt and other modes because
12759 ### on serialization, the table will be output on a new line.
12760 ### For now, we are blacklisting them, and using this to test selser.
12761 ###
12762
12763 !!test
12764 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12765 !!options
12766 parsoid=wt2html,wt2wt
12767 !!wikitext
12768 {{echo|}}{| width = '100%'
12769 |foo
12770 |}
12771 !!html/parsoid
12772 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12773 <tbody><tr><td>foo</td></tr>
12774 </tbody></table>
12775 !!end
12776
12777 ## We used to, but no longer wt2wt this test since the default serializer
12778 ## will normalize the include directives to serialize on their own line.
12779 ## Selser will take care of preserving formatting in scenarios where they
12780 ## intermingled with other wikitext.
12781 !!test
12782 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12783 !!options
12784 parsoid=wt2html
12785 !!wikitext
12786 <includeonly>a</includeonly>{| {{{b}}}
12787 |c
12788 |}
12789 !!html/parsoid
12790 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12791 <tbody><tr><td>c</td></tr>
12792 </tbody></table>
12793 !!end
12794
12795 !! test
12796 Table wikitext syntax outside wiki-tables
12797 !! wikitext
12798 a
12799 |+ not a caption
12800 ! not a table heading
12801 |- not a table row
12802 | not a table cell
12803 | class="foo bar" | baz
12804 b
12805 |}
12806 |-
12807 c
12808 !! html
12809 <p>a
12810 |+ not a caption
12811 ! not a table heading
12812 |- not a table row
12813 | not a table cell
12814 | class="foo bar" | baz
12815 b
12816 |}
12817 |-
12818 c
12819 </p>
12820 !! end
12821
12822 ###
12823 ### Testing parsing of templates where a template arg
12824 ### has the same name as the template itself.
12825 ###
12826
12827 !! article
12828 Template:quote
12829 !! text
12830 {{{quote|{{{1}}}}}}
12831 !! endarticle
12832
12833 !!test
12834 Templates: Template Name/Arg clash: 1. Use of positional param
12835 !! wikitext
12836 {{quote|foo}}
12837 !! html
12838 <p>foo
12839 </p>
12840 !!end
12841
12842 !!test
12843 Templates: Template Name/Arg clash: 2. Use of named param
12844 !! wikitext
12845 {{quote|quote=foo}}
12846 !! html
12847 <p>foo
12848 </p>
12849 !!end
12850
12851 !!test
12852 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12853 !! wikitext
12854 {{quote|quote}}
12855 !! html
12856 <p>quote
12857 </p>
12858 !!end
12859
12860 ###
12861 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12862 ###
12863
12864 !!test
12865 Templates: 1. Simple use
12866 !! wikitext
12867 {{echo|Foo}}
12868 !! html
12869 <p>Foo
12870 </p>
12871 !!end
12872
12873 !!test
12874 Templates: 2. Inside a block tag
12875 !! wikitext
12876 <div>{{echo|Foo}}</div>
12877 <blockquote>{{echo|Foo}}</blockquote>
12878 !! html
12879 <div>Foo</div>
12880 <blockquote>Foo</blockquote>
12881
12882 !! html+tidy
12883 <div>Foo</div>
12884 <blockquote><p>Foo</p></blockquote>
12885 !!end
12886
12887 !!test
12888 Templates: P-wrapping: 1a. Templates on consecutive lines
12889 !! wikitext
12890 {{echo|Foo}}
12891 {{echo|bar}}
12892 !! html
12893 <p>Foo
12894 bar
12895 </p>
12896 !!end
12897
12898 !!test
12899 Templates: P-wrapping: 1b. Templates on consecutive lines
12900 !! wikitext
12901 Foo
12902
12903 {{echo|bar}}
12904 {{echo|baz}}
12905 !! html
12906 <p>Foo
12907 </p><p>bar
12908 baz
12909 </p>
12910 !!end
12911
12912 !!test
12913 Templates: P-wrapping: 1c. Templates on consecutive lines
12914 !! wikitext
12915 {{echo|Foo}}
12916 {{echo|bar}} <div>baz</div>
12917 !! html
12918 <p>Foo
12919 </p>
12920 bar <div>baz</div>
12921
12922 !! html+tidy
12923 <p>Foo
12924 </p><p>
12925 bar </p><div>baz</div>
12926 !! end
12927
12928 !!test
12929 Templates: P-wrapping: 1d. Template preceded by comment-only line
12930 !!options
12931 parsoid
12932 !! wikitext
12933 <!-- foo -->
12934 {{echo|Bar}}
12935 !! html
12936 <!-- foo -->
12937
12938 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12939 !!end
12940
12941 !! test
12942 Templates: Scopes should not be expanded unnecessarily
12943 !! options
12944 parsoid=wt2html,wt2wt
12945 !! wikitext
12946 {{echo|<div>a</div>}}b{{echo|
12947 <div>c</div>}}
12948 !! html
12949 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>a&lt;/div>"}},"i":0}}]}'>a</div><p>b</p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;div>c&lt;/div>"}},"i":0}}]}'>
12950 </span><div about="#mwt2">c</div>
12951 !! end
12952
12953 !!test
12954 Templates: Inline Text: 1. Multiple template uses
12955 !! wikitext
12956 {{echo|Foo}}bar{{echo|baz}}
12957 !! html
12958 <p>Foobarbaz
12959 </p>
12960 !!end
12961
12962 !!test
12963 Templates: Inline Text: 2. Back-to-back template uses
12964 !! wikitext
12965 {{echo|Foo}}{{echo|bar}}
12966 !! html
12967 <p>Foobar
12968 </p>
12969 !!end
12970
12971 !!test
12972 Templates: Block Tags: 1. Multiple template uses
12973 !! wikitext
12974 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12975 !! html
12976 <div>Foo</div><div>bar</div><div>baz</div>
12977
12978 !!end
12979
12980 !!test
12981 Templates: Block Tags: 2. Back-to-back template uses
12982 !! wikitext
12983 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12984 !! html
12985 <div>Foo</div><div>bar</div>
12986
12987 !!end
12988
12989 ## Parsoid drops empty elements in templates.
12990 !! test
12991 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12992 !! wikitext
12993 {{echo|a
12994 b</p>}}
12995 !! html/php+tidy
12996 <p>a
12997 </p><p>
12998 b</p><p class="mw-empty-elt"></p>
12999 !! html/parsoid
13000 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a</p><span about="#mwt1">
13001 </span><p about="#mwt1">b</p>
13002 !! end
13003
13004 !!test
13005 Templates: Links: 1. Simple example
13006 !! wikitext
13007 {{echo|[[Foo|bar]]}}
13008 !! html
13009 <p><a href="/wiki/Foo" title="Foo">bar</a>
13010 </p>
13011 !!end
13012
13013 !!test
13014 Templates: Links: 2. Generation of link href
13015 !! wikitext
13016 [[{{echo|Foo}}|bar]]
13017 !! html
13018 <p><a href="/wiki/Foo" title="Foo">bar</a>
13019 </p>
13020 !!end
13021
13022 !!test
13023 Templates: Links: 3. Generation of part of a link href
13024 !! wikitext
13025 [[Fo{{echo|o}}|bar]]
13026
13027 [[Foo{{echo|bar}}]]
13028
13029 [[Foo{{echo|bar}}baz]]
13030
13031 [[Foo{{echo|bar}}|bar]]
13032
13033 [[:Foo{{echo|bar}}]]
13034
13035 [[:Foo{{echo|bar}}|bar]]
13036 !! html
13037 <p><a href="/wiki/Foo" title="Foo">bar</a>
13038 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13039 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13040 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13041 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13042 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13043 </p>
13044 !!end
13045
13046 !!test
13047 Templates: Links: 4. Multiple templates generating link href
13048 !! wikitext
13049 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13050 !! html
13051 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13052 </p>
13053 !!end
13054
13055 !!test
13056 Templates: Links: 5. Generation of link text
13057 !! wikitext
13058 [[Foo|{{echo|bar}}]]
13059 !! html
13060 <p><a href="/wiki/Foo" title="Foo">bar</a>
13061 </p>
13062 !!end
13063
13064 !!test
13065 Templates: Links: 5. Nested templates (only outermost template should be marked)
13066 !! wikitext
13067 {{echo|[[{{echo|Foo}}|bar]]}}
13068 !! html
13069 <p><a href="/wiki/Foo" title="Foo">bar</a>
13070 </p>
13071 !!end
13072
13073 !!test
13074 Templates: HTML Tag: 1. Generation of HTML attr. key
13075 !! wikitext
13076 <div {{echo|style}}="color:red;">foo</div>
13077 !! html
13078 <div style="color:red;">foo</div>
13079
13080 !!end
13081
13082 !!test
13083 Templates: HTML Tag: 2. Generation of HTML attr. value
13084 !! wikitext
13085 <div style={{echo|'color:red;'}}>foo</div>
13086 !! html
13087 <div style="color:red;">foo</div>
13088
13089 !!end
13090
13091 !!test
13092 Templates: HTML Tag: 3. Generation of HTML attr key and value
13093 !! wikitext
13094 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13095 !! html
13096 <div style="color:red;">foo</div>
13097
13098 !!end
13099
13100 !!test
13101 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13102 !! wikitext
13103 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13104 !! html
13105 <div title="This is a long title with just one piece templated">foo</div>
13106
13107 !!end
13108
13109 !!test
13110 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13111 !! wikitext
13112 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13113 !! html
13114 <div title="This is a long title with just one piece templated">foo</div>
13115
13116 !!end
13117
13118 !!test
13119 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13120 !! wikitext
13121 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13122 !! html
13123 <div title="This is a long title with just one piece templated">foo</div>
13124
13125 !!end
13126
13127 # SSS FIXME: While it is great we added support for all this,
13128 # do we want to make this part of the spec? Maybe we want to
13129 # deprecate this kind of usage in the future?
13130 !!test
13131 Templates: HTML Tag: 7. Generation of partial attribute key string
13132 !! wikitext
13133 <div st{{echo|yle}}="color:red;">foo</div>
13134 !! html
13135 <div style="color:red;">foo</div>
13136
13137 !!end
13138
13139 !! test
13140 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13141 !! wikitext
13142 <div {{echo|1=id="v1"}}>bar</div>
13143 !! html
13144 <div id="v1">bar</div>
13145
13146 !!end
13147
13148 !! test
13149 Templates: HTML Tag: 9. Multiple template-generated attributes
13150 !! wikitext
13151 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13152 !! html
13153 <div id="v1" title="foo">bar</div>
13154
13155 !!end
13156
13157 !! test
13158 Templates: Support for templates generating attributes and content
13159 !! wikitext
13160 {| {{mixed_attr_content_template}}
13161 |-
13162 |bar
13163 |}
13164 !! html/php
13165 <table style="color:red;" title="T48811">
13166
13167 <tr>
13168 <td>foo
13169 </td></tr>
13170 <tr>
13171 <td>bar
13172 </td></tr></table>
13173
13174 !! html/parsoid
13175 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
13176 <tbody><tr>
13177 <td>foo</td></tr>
13178 <tr>
13179 <td>bar</td></tr>
13180 </tbody></table>
13181 !!end
13182
13183 !! article
13184 Template:attribute_from_template
13185 !! text
13186 class="123"
13187 !! endarticle
13188
13189 !! test
13190 Table cell with attribute before expanded attribute
13191 !! wikitext
13192 {|
13193 | align="center" {{attribute_from_template}} |456
13194 |}
13195 !! html/parsoid
13196 <table>
13197 <tbody><tr><td align="center" class="123" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"class","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[]],\"dsr\":[20,47,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"attribute_from_template\",\"href\":\"./Template:Attribute_from_template\"},\"params\":{},\"i\":0}}]}&apos;>class=\"123\"&lt;/span>"},{"html":""}]]}'>456</td></tr>
13198 </tbody></table>
13199 !! end
13200
13201 !! test
13202 1. Entities and nowikis inside templated attributes should be handled correctly
13203 !! wikitext
13204 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13205 !! html/php
13206 <div style="background:#f9f9f9;">foo</div>
13207
13208 !! html/parsoid
13209 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
13210 !! end
13211
13212 !! test
13213 2. Entities and nowikis inside templated attributes should be handled correctly
13214 !! wikitext
13215 {|
13216 |{{table_attribs_3}}
13217 |}
13218 !! html/php
13219 <table>
13220 <tr>
13221 <td style="background:#f9f9f9;">Foo
13222 </td></tr></table>
13223
13224 !! html/parsoid
13225 <table>
13226 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
13227 </tbody></table>
13228 !! end
13229
13230 !! test
13231 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13232 !! wikitext
13233 {{tbl-start}}
13234 |{{table_attribs_3}}
13235 {{tbl-end}}
13236 !! html/php
13237 <table>
13238 <tr>
13239 <td style="background:#f9f9f9;">Foo
13240 </td></tr></table>
13241
13242 !! html/parsoid
13243 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
13244 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13245 </tbody></table>
13246 !! end
13247
13248 # T107622
13249 !! test
13250 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13251 !! wikitext
13252 {|
13253 |{{table_attribs_6}} hi
13254 |}
13255 !! html/php
13256 <table>
13257 <tr>
13258 <td style="background: red;">hi
13259 </td></tr></table>
13260
13261 !! html/parsoid
13262 <table>
13263 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
13264 </tbody></table>
13265 !! end
13266
13267 !!test
13268 Templates: HTML Tables: 1. Generating start of a HTML table
13269 !! wikitext
13270 {{echo|<table><tr><td>foo</td>}}</tr></table>
13271 !! html
13272 <table><tr><td>foo</td></tr></table>
13273
13274 !!end
13275
13276 !!test
13277 Templates: HTML Tables: 2a. Generating middle of a HTML table
13278 !! wikitext
13279 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13280 !! html
13281 <table><tr><td>foo</td></tr></table>
13282
13283 !!end
13284
13285 !!test
13286 Templates: HTML Tables: 2b. Generating middle of a HTML table
13287 !! wikitext
13288 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13289 !! html
13290 <table><tr><td>foo</td></tr></table>
13291
13292 !!end
13293
13294 !!test
13295 Templates: HTML Tables: 3. Generating end of a HTML table
13296 !! wikitext
13297 <table><tr>{{echo|<td>foo</td></tr></table>}}
13298 !! html
13299 <table><tr><td>foo</td></tr></table>
13300
13301 !!end
13302
13303 !!test
13304 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13305 !! wikitext
13306 {{echo|<table>}}<tr><td>foo</td></tr></table>
13307 !! html
13308 <table><tr><td>foo</td></tr></table>
13309
13310 !!end
13311
13312 !!test
13313 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13314 !! wikitext
13315 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13316 !! html
13317 <table><tr><td>foo</td></tr></table>
13318
13319 !!end
13320
13321 !!test
13322 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13323 !! wikitext
13324 <table><tr>{{echo|<td>}}foo</td></tr></table>
13325 !! html
13326 <table><tr><td>foo</td></tr></table>
13327
13328 !!end
13329
13330 !!test
13331 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13332 !! wikitext
13333 <table><tr><td>foo{{echo|</td>}}</tr></table>
13334 !! html
13335 <table><tr><td>foo</td></tr></table>
13336
13337 !!end
13338
13339 !!test
13340 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13341 !! wikitext
13342 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13343 !! html
13344 <table><tr><td>foo</td></tr></table>
13345
13346 !!end
13347
13348 !!test
13349 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13350 !! wikitext
13351 <table><tr><td>foo</td></tr>{{echo|</table>}}
13352 !! html
13353 <table><tr><td>foo</td></tr></table>
13354
13355 !!end
13356
13357 !!test
13358 Templates: HTML Tables: 5. Proper fostering of categories from inside
13359 !!options
13360 parsoid=wt2html,wt2wt
13361 !! wikitext
13362 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13363 <!--Two categories (T52330)-->
13364 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13365 !! html
13366 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13367 <!--Two categories (T52330)-->
13368 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
13369 !!end
13370
13371 ## Remex doesn't account for fostered content.
13372 !! test
13373 Templates: Wiki Tables: 1a. Fostering of entire template content
13374 !! wikitext
13375 {|
13376 {{echo|a}}
13377 |}
13378 !! html/php
13379 <table>
13380 a
13381 <tr><td></td></tr></table>
13382
13383 !! html/php+tidy
13384
13385 a
13386 <table><tbody><tr><td></td></tr></tbody></table>
13387 !! html/parsoid
13388 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13389
13390 </table>
13391 !! end
13392
13393 !!test
13394 Templates: Wiki Tables: 1b. Fostering of entire template content
13395 !! wikitext
13396 {|
13397 {{echo|<div>}}
13398 foo
13399 {{echo|</div>}}
13400 |}
13401 !! html
13402 <table>
13403 <div>
13404 <p>foo
13405 </p>
13406 </div>
13407 <tr><td></td></tr></table>
13408
13409 !! html/php+tidy
13410 <div>
13411 <p>foo
13412 </p>
13413 </div><table>
13414
13415 <tbody><tr><td></td></tr></tbody></table>
13416 !! html/parsoid
13417 <div about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":1}},"\n|}"]}'>
13418 <p>foo</p>
13419 </div><table about="#mwt3">
13420
13421 </table>
13422 !! end
13423
13424 ## Remex doesn't account for fostered content.
13425 !! test
13426 Templates: Wiki Tables: 2. Fostering of partial template content
13427 !! wikitext
13428 {|
13429 {{echo|a
13430 <div>b</div>}}
13431 |}
13432 !! html/php
13433 <table>
13434 a
13435 <div>b</div>
13436 <tr><td></td></tr></table>
13437
13438 !! html/php+tidy
13439
13440 a
13441 <div>b</div><table>
13442 <tbody><tr><td></td></tr></tbody></table>
13443 !! html/parsoid
13444 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
13445
13446
13447 </table>
13448 !! end
13449
13450 !!test
13451 Templates: Wiki Tables: 3. td-content via multiple templates
13452 !! wikitext
13453 {|
13454 {{echo|{{pipe}}a}}{{echo|b}}
13455 |}
13456 !! html
13457 <table>
13458 <tr>
13459 <td>ab
13460 </td></tr></table>
13461
13462 !!end
13463
13464 !!test
13465 Templates: Wiki Tables: 4. Templated tags, no content
13466 !! wikitext
13467 {{tbl-start}}
13468 {{tbl-end}}
13469 !! html
13470 <table>
13471 <tr><td></td></tr></table>
13472
13473 !!end
13474
13475 !!test
13476 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13477 !! wikitext
13478 {{tbl-start}}
13479 |foo
13480 {{tbl-end}}
13481 !! html
13482 <table>
13483 <tr>
13484 <td>foo
13485 </td></tr></table>
13486
13487 !!end
13488
13489 !!test
13490 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13491 !! wikitext
13492 {{tbl-start}}
13493 {{!}}foo
13494 {{tbl-end}}
13495 !! html
13496 <table>
13497 <tr>
13498 <td>foo
13499 </td></tr></table>
13500
13501 !!end
13502
13503 ## This test case is very specific to Parsoid's internals
13504 ## and is hence only tested for Parsoid's code. Parsoid uses
13505 ## a <meta> marker tag for <ref> tags and they are expanded
13506 ## much later. We are verifying that this <meta> tag usage
13507 ## doesn't prevent foster parenting.
13508 !! test
13509 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13510 !! wikitext
13511 {{PartialTable}}<ref>foo</ref>
13512 |}
13513
13514 <references />
13515 !! html/parsoid
13516 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
13517 <tbody>
13518 </tbody></table>
13519
13520 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
13521 !! end
13522
13523 !! test
13524 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13525 !! wikitext
13526 {{echo|
13527 {{{!}}
13528 {{!}}-}}
13529 <onlyinclude>
13530 |foo
13531 </onlyinclude>
13532 {{!}}}
13533 !! html/parsoid
13534 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
13535 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13536 <tbody><tr>
13537
13538 <td>foo
13539 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13540 </tbody></table>
13541 !! end
13542
13543 !!test
13544 Templates: Lists: Multi-line list-items via templates
13545 !! wikitext
13546 *{{echo|a {{nonexistent|
13547 unused}}}}
13548 *{{echo|b {{nonexistent|
13549 unused}}}}
13550 !! html
13551 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
13552 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
13553
13554 !!end
13555
13556 !!test
13557 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13558 !! wikitext
13559 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13560 !! html
13561 <p><i>ab</i>c<i>d</i>e
13562 </p>
13563 !!end
13564
13565 !!test
13566 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13567 (PHP parser generates misnested html)
13568 !! wikitext
13569 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13570 !! html/parsoid
13571 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
13572 !!end
13573
13574 !!test
13575 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13576 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13577 !! options
13578 parsoid=wt2html,wt2wt
13579 !! wikitext
13580 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13581 !! html
13582 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
13583 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
13584 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
13585 !!end
13586
13587 !!test
13588 Templates: Ugly nesting: 4. Divs opened/closed across templates
13589 !! wikitext
13590 a<div>b{{echo|c</div>d}}e
13591 !! html
13592 a<div>bc</div>de
13593
13594 !! html+tidy
13595 <p>a</p><div>bc</div><p>de
13596 </p>
13597 !! end
13598
13599 !! test
13600 Templates: Ugly templates: 3. newline-only template parameter
13601 !! wikitext
13602 foo {{echo|
13603 }}
13604 !! html
13605 <p>foo
13606 </p>
13607 !! end
13608
13609 # This looks like a bug: a single newline triggers p/br for some reason.
13610 !! test
13611 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13612 !! wikitext
13613 {{echo|
13614 }}
13615 !! html
13616 <p><br />
13617 </p>
13618 !! end
13619
13620 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13621 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13622 !! test
13623 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13624 !! wikitext
13625 {{echo|<table>}}
13626 {{echo|<div>foo}}
13627 {{echo|</table>}}
13628 !! html/parsoid
13629 <div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}'>foo</div><span about="#mwt1">
13630 </span><table about="#mwt1">
13631 </table>
13632 !! end
13633
13634 # T66017 -- ugly wikitext with fostered content generates two template ranges
13635 # that are "identical" and generate nesting cycles in the algorithm
13636 !! test
13637 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13638 !! wikitext
13639 {{echo|<table><tr><td><table>}}
13640 {{echo|<div>}}
13641 {{echo|</div>}}
13642 !! html/parsoid
13643 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
13644 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13645 </table></td></tr></tbody></table>
13646 !! end
13647
13648 !! test
13649 Templates: Parameters substituted at the top-level
13650 !! wikitext
13651 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13652
13653 {{{foo|bar|baz}}}
13654 !! html/php
13655 <p><i>who</i> me? <b>never!</b>
13656 </p><p>bar
13657 </p>
13658 !! html/parsoid
13659 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
13660
13661 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13662 !! end
13663
13664 !! test
13665 Templates: Param with empty arg in the final position
13666 !! wikitext
13667 {{{hi|}}}
13668 !! html/parsoid
13669 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13670 !! end
13671
13672 !!test
13673 Parser Functions: 1. Simple example
13674 !! wikitext
13675 {{uc:foo}}
13676 !! html
13677 <p>FOO
13678 </p>
13679 !!end
13680
13681 !!test
13682 Parser Functions: 2. Nested use (only outermost should be marked up)
13683 !! wikitext
13684 {{uc:{{lc:FOO}}}}
13685 !! html
13686 <p>FOO
13687 </p>
13688 !!end
13689
13690 ## Note that the templates inside the references are not wrapped
13691 !! test
13692 Template nested in extension tag in template
13693 !! options
13694 language=zh
13695 !! wikitext
13696 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13697 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13698 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13699 <references />
13700 !! html/parsoid
13701 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>[[ho|{{echo|hi}}]]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Wikipedia:首页#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13702 <span about="#mwt8" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>[http://test.com?q={{echo|ho}}]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt8" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Wikipedia:首页#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
13703 <span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>-{ho|{{echo|hi}}}-&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt13" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Wikipedia:首页#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
13704 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt17" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Wikipedia:首页#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Ho" title="Ho">hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Wikipedia:首页#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><a rel="mw:ExtLink" class="external autonumber" href="http://test.com?q=ho"></a></span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Wikipedia:首页#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["ho"],"t":"hi"}}'></span></span></li></ol>
13705 !! end
13706
13707 ###
13708 ### Pre-save transform tests
13709 ###
13710
13711 !! test
13712 pre-save transform: subst:
13713 !! options
13714 pst
13715 !! wikitext
13716 {{subst:test}}
13717 !! html/php
13718 This is a test template
13719 !! end
13720
13721 !! test
13722 pre-save transform: normal template
13723 !! options
13724 pst
13725 !! wikitext
13726 {{test}}
13727 !! html/php
13728 {{test}}
13729 !! end
13730
13731 !! test
13732 pre-save transform: nonexistent template
13733 !! options
13734 pst
13735 !! wikitext
13736 {{thistemplatedoesnotexist}}
13737 !! html/php
13738 {{thistemplatedoesnotexist}}
13739 !! end
13740
13741 !! test
13742 pre-save transform: subst magic variables
13743 !! options
13744 pst
13745 !! wikitext
13746 {{subst:SITENAME}}
13747 !! html/php
13748 MediaWiki
13749 !! end
13750
13751 # This is T2089, which I fixed. -- wtm
13752 !! test
13753 pre-save transform: subst: templates with parameters
13754 !! options
13755 pst
13756 !! wikitext
13757 {{subst:paramtest|param="something else"}}
13758 !! html/php
13759 This is a test template with parameter "something else"
13760 !! end
13761
13762 !! article
13763 Template:nowikitest
13764 !! text
13765 <nowiki>'''not wiki'''</nowiki>
13766 !! endarticle
13767
13768 !! test
13769 pre-save transform: nowiki in subst (T3188)
13770 !! options
13771 pst
13772 !! wikitext
13773 {{subst:nowikitest}}
13774 !! html/php
13775 <nowiki>'''not wiki'''</nowiki>
13776 !! end
13777
13778 !! article
13779 Template:commenttest
13780 !! text
13781 This template has <!-- a comment --> in it.
13782 !! endarticle
13783
13784 !! test
13785 pre-save transform: comment in subst (T3936)
13786 !! options
13787 pst
13788 !! wikitext
13789 {{subst:commenttest}}
13790 !! html/php
13791 This template has <!-- a comment --> in it.
13792 !! end
13793
13794 !! test
13795 pre-save transform: unclosed tag
13796 !! options
13797 pst
13798 !! wikitext
13799 <nowiki>'''not wiki'''
13800 !! html/php
13801 <nowiki>'''not wiki'''
13802 !! end
13803
13804 !! test
13805 pre-save transform: mixed tag case
13806 !! options
13807 pst
13808 !! wikitext
13809 <NOwiki>'''not wiki'''</noWIKI>
13810 !! html/php
13811 <NOwiki>'''not wiki'''</noWIKI>
13812 !! end
13813
13814 !! test
13815 pre-save transform: unclosed comment in <nowiki>
13816 !! options
13817 pst
13818 !! wikitext
13819 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13820 !! html/php
13821 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13822 !!end
13823
13824 # Leading @ in this template definition works around a limitation
13825 # in parsoid's parserTests which otherwise strips the <span> from the
13826 # result (confusing it for a template wrapper)
13827 !! article
13828 Template:dangerous
13829 !!text
13830 @<span onmouseover="alert('crap')">Oh no</span>
13831 !!endarticle
13832
13833 !!test
13834 (confirming safety of fix for subst T3936)
13835 !! wikitext
13836 {{Template:dangerous}}
13837 !! html
13838 <p>@<span>Oh no</span>
13839 </p>
13840 !! end
13841
13842 !! test
13843 pre-save transform: comment containing gallery (T7024)
13844 !! options
13845 pst
13846 !! wikitext
13847 <!-- <gallery>data</gallery> -->
13848 !! html/php
13849 <!-- <gallery>data</gallery> -->
13850 !!end
13851
13852 !! test
13853 pre-save transform: comment containing extension
13854 !! options
13855 pst
13856 !! wikitext
13857 <!-- <tag>data</tag> -->
13858 !! html/php
13859 <!-- <tag>data</tag> -->
13860 !!end
13861
13862 !! test
13863 pre-save transform: comment containing nowiki
13864 !! options
13865 pst
13866 !! wikitext
13867 <!-- <nowiki>data</nowiki> -->
13868 !! html/php
13869 <!-- <nowiki>data</nowiki> -->
13870 !!end
13871
13872 !! test
13873 pre-save transform: <noinclude> in subst (T5298)
13874 !! options
13875 pst
13876 !! wikitext
13877 {{subst:Includes}}
13878 !! html/php
13879 Foobar
13880 !! end
13881
13882 !! test
13883 pre-save transform: <onlyinclude> in subst (T5298)
13884 !! options
13885 pst
13886 !! wikitext
13887 {{subst:Includes2}}
13888 !! html/php
13889 Foo
13890 !! end
13891
13892 !! article
13893 Template:SubstTest
13894 !!text
13895 {{<includeonly>subst:</includeonly>Includes}}
13896 !! endarticle
13897
13898 !! article
13899 Template:SafeSubstTest
13900 !! text
13901 {{<includeonly>safesubst:</includeonly>Includes}}
13902 !! endarticle
13903
13904 !! test
13905 T24297: safesubst: works during PST
13906 !! options
13907 pst
13908 !! wikitext
13909 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13910 !! html/php
13911 FoobarFoobar
13912 !! end
13913
13914 !! test
13915 T24297: safesubst: works during normal parse
13916 !! wikitext
13917 {{SafeSubstTest}}
13918 !! html
13919 <p>Foobar
13920 </p>
13921 !! end
13922
13923 !! test
13924 subst: does not work during normal parse
13925 !! wikitext
13926 {{SubstTest}}
13927 !! html
13928 <p>{{subst:Includes}}
13929 </p>
13930 !! end
13931
13932 !! test
13933 pre-save transform: context links ("pipe trick")
13934 !! options
13935 pst
13936 !! wikitext
13937 [[Article (context)|]]
13938 [[Bar:Article|]]
13939 [[:Bar:Article|]]
13940 [[Bar:Article (context)|]]
13941 [[:Bar:Article (context)|]]
13942 [[|Article]]
13943 [[|Article (context)]]
13944 [[Bar:X (Y) Z|]]
13945 [[:Bar:X (Y) Z|]]
13946 !! html/php
13947 [[Article (context)|Article]]
13948 [[Bar:Article|Article]]
13949 [[:Bar:Article|Article]]
13950 [[Bar:Article (context)|Article]]
13951 [[:Bar:Article (context)|Article]]
13952 [[Article]]
13953 [[Article (context)]]
13954 [[Bar:X (Y) Z|X (Y) Z]]
13955 [[:Bar:X (Y) Z|X (Y) Z]]
13956 !! end
13957
13958 !! test
13959 pre-save transform: context links ("pipe trick") with interwiki prefix
13960 !! options
13961 pst
13962 !! wikitext
13963 [[interwiki:Article|]]
13964 [[:interwiki:Article|]]
13965 [[interwiki:Bar:Article|]]
13966 [[:interwiki:Bar:Article|]]
13967 !! html/php
13968 [[interwiki:Article|Article]]
13969 [[:interwiki:Article|Article]]
13970 [[interwiki:Bar:Article|Bar:Article]]
13971 [[:interwiki:Bar:Article|Bar:Article]]
13972 !! end
13973
13974 !! test
13975 pre-save transform: context links ("pipe trick") with parens in title
13976 !! options
13977 pst title=[[Somearticle (context)]]
13978 !! wikitext
13979 [[|Article]]
13980 !! html/php
13981 [[Article (context)|Article]]
13982 !! end
13983
13984 !! test
13985 pre-save transform: context links ("pipe trick") with comma in title
13986 !! options
13987 pst title=[[Someplace, Somewhere]]
13988 !! wikitext
13989 [[|Otherplace]]
13990 [[Otherplace, Elsewhere|]]
13991 [[Otherplace, Elsewhere, Anywhere|]]
13992 !! html/php
13993 [[Otherplace, Somewhere|Otherplace]]
13994 [[Otherplace, Elsewhere|Otherplace]]
13995 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13996 !! end
13997
13998 !! test
13999 pre-save transform: context links ("pipe trick") with parens and comma
14000 !! options
14001 pst title=[[Someplace (IGNORED), Somewhere]]
14002 !! wikitext
14003 [[|Otherplace]]
14004 [[Otherplace (place), Elsewhere|]]
14005 !! html/php
14006 [[Otherplace, Somewhere|Otherplace]]
14007 [[Otherplace (place), Elsewhere|Otherplace]]
14008 !! end
14009
14010 !! test
14011 pre-save transform: context links ("pipe trick") with comma and parens
14012 !! options
14013 pst title=[[Who, me? (context)]]
14014 !! wikitext
14015 [[|Yes, you.]]
14016 [[Me, Myself, and I (1937 song)|]]
14017 !! html/php
14018 [[Yes, you. (context)|Yes, you.]]
14019 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14020 !! end
14021
14022 !! test
14023 pre-save transform: context links ("pipe trick") with namespace
14024 !! options
14025 pst title=[[Ns:Somearticle]]
14026 !! wikitext
14027 [[|Article]]
14028 !! html/php
14029 [[Ns:Article|Article]]
14030 !! end
14031
14032 !! test
14033 pre-save transform: context links ("pipe trick") with namespace and parens
14034 !! options
14035 pst title=[[Ns:Somearticle (context)]]
14036 !! wikitext
14037 [[|Article]]
14038 !! html/php
14039 [[Ns:Article (context)|Article]]
14040 !! end
14041
14042 !! test
14043 pre-save transform: context links ("pipe trick") with namespace and comma
14044 !! options
14045 pst title=[[Ns:Somearticle, Context, Whatever]]
14046 !! wikitext
14047 [[|Article]]
14048 !! html/php
14049 [[Ns:Article, Context, Whatever|Article]]
14050 !! end
14051
14052 !! test
14053 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14054 !! options
14055 pst title=[[Ns:Somearticle, Context (context)]]
14056 !! wikitext
14057 [[|Article]]
14058 !! html/php
14059 [[Ns:Article (context)|Article]]
14060 !! end
14061
14062 !! test
14063 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14064 !! options
14065 pst title=[[Ns:Somearticle (IGNORED), Context]]
14066 !! wikitext
14067 [[|Article]]
14068 !! html/php
14069 [[Ns:Article, Context|Article]]
14070 !! end
14071
14072 !! test
14073 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14074 !! options
14075 pst
14076 !! wikitext
14077 [[Article(context)|]]
14078 [[Bar:Article(context)|]]
14079 [[:Bar:Article(context)|]]
14080 [[|Article(context)]]
14081 [[Bar:X(Y)Z|]]
14082 [[:Bar:X(Y)Z|]]
14083 !! html/php
14084 [[Article(context)|Article]]
14085 [[Bar:Article(context)|Article]]
14086 [[:Bar:Article(context)|Article]]
14087 [[Article(context)]]
14088 [[Bar:X(Y)Z|X(Y)Z]]
14089 [[:Bar:X(Y)Z|X(Y)Z]]
14090 !! end
14091
14092 !! test
14093 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14094 !! options
14095 pst
14096 !! wikitext
14097 [[Article (context)|]]
14098 [[Bar:Article (context)|]]
14099 [[:Bar:Article (context)|]]
14100 [[|Article (context)]]
14101 [[Bar:X (Y) Z|]]
14102 [[:Bar:X (Y) Z|]]
14103 !! html/php
14104 [[Article (context)|Article]]
14105 [[Bar:Article (context)|Article]]
14106 [[:Bar:Article (context)|Article]]
14107 [[Article (context)]]
14108 [[Bar:X (Y) Z|X (Y) Z]]
14109 [[:Bar:X (Y) Z|X (Y) Z]]
14110 !! end
14111
14112 !! test
14113 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14114 !! options
14115 pst
14116 !! wikitext
14117 [[Article(context)|]]
14118 [[Bar:Article(context)|]]
14119 [[:Bar:Article(context)|]]
14120 [[|Article(context)]]
14121 [[Bar:X(Y)Z|]]
14122 [[:Bar:X(Y)Z|]]
14123 !! html/php
14124 [[Article(context)|Article]]
14125 [[Bar:Article(context)|Article]]
14126 [[:Bar:Article(context)|Article]]
14127 [[Article(context)]]
14128 [[Bar:X(Y)Z|X(Y)Z]]
14129 [[:Bar:X(Y)Z|X(Y)Z]]
14130 !! end
14131
14132 !! test
14133 pre-save transform: context links ("pipe trick") with commas (T23660)
14134 !! options
14135 pst
14136 !! wikitext
14137 [[Article (context), context|]]
14138 [[Article (context),context|]]
14139 [[Bar:Article (context), context|]]
14140 [[Bar:Article (context),context|]]
14141 [[:Bar:Article (context), context|]]
14142 [[:Bar:Article (context),context|]]
14143 !! html/php
14144 [[Article (context), context|Article]]
14145 [[Article (context),context|Article]]
14146 [[Bar:Article (context), context|Article]]
14147 [[Bar:Article (context),context|Article]]
14148 [[:Bar:Article (context), context|Article]]
14149 [[:Bar:Article (context),context|Article]]
14150 !! end
14151
14152 !! test
14153 Parsoid: backwards pipe trick
14154 !! wikitext
14155 [[|'''bar''']]
14156 !! html/php
14157 <p>[[|<b>bar</b>]]
14158 </p>
14159 !! html/parsoid
14160 <p>[[|<b>bar</b>]]</p>
14161 !! end
14162
14163 !! test
14164 pre-save transform: trim trailing empty lines
14165 !! options
14166 pst
14167 !! wikitext
14168 Empty lines are trimmed
14169
14170
14171
14172
14173 !! html/php
14174 Empty lines are trimmed
14175 !! end
14176
14177 !! test
14178 pre-save transform: Signature expansion
14179 !! options
14180 pst
14181 !! wikitext
14182 * ~~~
14183 * ~~~~
14184 * ~~~~~
14185 * <noinclude>~~~</noinclude>
14186 * <includeonly>~~~</includeonly>
14187 * <onlyinclude>~~~</onlyinclude>
14188 !! html/php
14189 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14190 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14191 * 00:02, 1 January 1970 (UTC)
14192 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14193 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14194 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14195 !! end
14196
14197
14198 !! test
14199 ParserOutput flags from signature expansion (T84843)
14200 !! options
14201 pst
14202 showflags
14203 !! wikitext
14204 ~~~~
14205 !! html/php
14206 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14207 flags=user-signature
14208 !! end
14209
14210
14211 !! test
14212 pre-save transform: Signature expansion in nowiki tags (T2093)
14213 !! options
14214 pst disabled
14215 !! wikitext
14216 Shall not expand:
14217
14218 <nowiki>~~~~</nowiki>
14219
14220 <includeonly><nowiki>~~~~</nowiki></includeonly>
14221
14222 <noinclude><nowiki>~~~~</nowiki></noinclude>
14223
14224 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14225
14226 {{subst:Foo}} shall be converted to FOO
14227
14228 As well as inside noinclude/onlyinclude
14229 <noinclude>{{subst:Foo}}</noinclude>
14230 <onlyinclude>{{subst:Foo}}</onlyinclude>
14231
14232 But not inside includeonly
14233 <includeonly>{{subst:Foo}}</includeonly>
14234 !! html/php
14235 Shall not expand:
14236
14237 <nowiki>~~~~</nowiki>
14238
14239 <includeonly><nowiki>~~~~</nowiki></includeonly>
14240
14241 <noinclude><nowiki>~~~~</nowiki></noinclude>
14242
14243 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14244
14245 FOO shall be converted to FOO
14246
14247 As well as inside noinclude/onlyinclude
14248 <noinclude>FOO</noinclude>
14249 <onlyinclude>FOO</onlyinclude>
14250
14251 But not inside includeonly
14252 <includeonly>{{subst:Foo}}</includeonly>
14253 !! end
14254
14255 !! test
14256 Parsoid: Recognize nowiki with trailing space in tags
14257 !! options
14258 parsoid=wt2html
14259 !! wikitext
14260 <nowiki ><div>[[foo]]</nowiki >
14261
14262 a<nowiki / >b
14263
14264 c<nowiki />d
14265
14266 e<nowiki/ >f
14267 !! html/php+tidy
14268 <p>&lt;div&gt;[[foo]]
14269 </p><p>a&lt;nowiki / &gt;b
14270 </p><p>cd
14271 </p><p>e&lt;nowiki/ &gt;f
14272 </p>
14273 !! html/parsoid
14274 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14275
14276 <p>a&lt;nowiki / >b</p>
14277
14278 <p>c<span typeof="mw:Nowiki"></span>d</p>
14279
14280 <p>e&lt;nowiki/ >f</p>
14281 !! end
14282
14283 !! test
14284 Parsoid: Recognize nowiki with odd capitalization
14285 !! options
14286 parsoid=wt2html
14287 !! wikitext
14288 <noWikI ><div>[[foo]]</Nowiki >
14289 !! html
14290 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14291 !! end
14292
14293
14294 !! test
14295 Parsoid: Escape nowiki with trailing space in tags
14296 !! options
14297 parsoid=html2wt
14298 !! html/parsoid
14299 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14300 <p>a&lt;nowiki /&gt;b</p>
14301 <p>c&lt;nowiki/ &gt;d</p>
14302 !! wikitext
14303 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14304
14305 a&lt;nowiki /&gt;b
14306
14307 c&lt;nowiki/ &gt;d
14308 !! end
14309
14310 !! test
14311 Parsoid: Escape weird noWikI capitalizations
14312 !! options
14313 parsoid=html2wt
14314 !! html/parsoid
14315 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14316 !! wikitext
14317 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14318 !! end
14319
14320 ###
14321 ### Message transform tests
14322 ###
14323 !! test
14324 message transform: magic variables
14325 !! options
14326 msg
14327 !! wikitext
14328 {{SITENAME}}
14329 !! html
14330 MediaWiki
14331 !! end
14332
14333 !! test
14334 message transform: should not transform wiki markup
14335 !! options
14336 msg
14337 !! wikitext
14338 ''test''
14339 !! html
14340 ''test''
14341 !! end
14342
14343 !! test
14344 message transform: <noinclude> in transcluded template (T6926)
14345 !! options
14346 msg
14347 !! wikitext
14348 {{Includes}}
14349 !! html
14350 Foobar
14351 !! end
14352
14353 !! test
14354 message transform: <onlyinclude> in transcluded template (T6926)
14355 !! options
14356 msg
14357 !! wikitext
14358 {{Includes2}}
14359 !! html
14360 Foo
14361 !! end
14362
14363 !! test
14364 {{#special:}} page name, known
14365 !! options
14366 msg
14367 !! wikitext
14368 {{#special:Recentchanges}}
14369 !! html
14370 Special:RecentChanges
14371 !! end
14372
14373 !! test
14374 {{#special:}} page name with subpage, known
14375 !! options
14376 msg
14377 !! wikitext
14378 {{#special:Recentchanges/param}}
14379 !! html
14380 Special:RecentChanges/param
14381 !! end
14382
14383 !! test
14384 {{#special:}} page name, unknown
14385 !! options
14386 msg
14387 !! wikitext
14388 {{#special:foobar nonexistent}}
14389 !! html
14390 Special:Foobar nonexistent
14391 !! end
14392
14393 !! test
14394 {{#speciale:}} page name, known
14395 !! options
14396 msg
14397 !! wikitext
14398 {{#speciale:Recentchanges}}
14399 !! html
14400 Special:RecentChanges
14401 !! end
14402
14403 !! test
14404 {{#speciale:}} page name with subpage, known
14405 !! options
14406 msg
14407 !! wikitext
14408 {{#speciale:Recentchanges/param}}
14409 !! html
14410 Special:RecentChanges/param
14411 !! end
14412
14413 !! test
14414 {{#speciale:}} page name, unknown
14415 !! options
14416 msg
14417 !! wikitext
14418 {{#speciale:foobar nonexistent}}
14419 !! html
14420 Special:Foobar_nonexistent
14421 !! end
14422
14423 ###
14424 ### Images
14425 ###
14426 ### For Parsoid-specific tests, see
14427 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14428
14429 !! test
14430 Simple image
14431 !! options
14432 parsoid=wt2html,wt2wt,html2html
14433 !! wikitext
14434 [[Image:foobar.jpg]]
14435 !! html/php
14436 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14437 </p>
14438 !! html/parsoid
14439 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14440 !! end
14441
14442 !! test
14443 Serialize simple image with span wrapper
14444 !! options
14445 parsoid=html2wt
14446 !! html/parsoid
14447 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14448 !! wikitext
14449 [[File:Foobar.jpg]]
14450 !! end
14451
14452 !! test
14453 Simple image (using File: namespace, now canonical)
14454 !! wikitext
14455 [[File:Foobar.jpg]]
14456 !! html/php
14457 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14458 </p>
14459 !! html/parsoid
14460 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14461 !! end
14462
14463 !! test
14464 Right-aligned image
14465 !! wikitext
14466 [[File:Foobar.jpg|right]]
14467 !! html/php
14468 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14469
14470 !! html/parsoid
14471 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
14472 !! end
14473
14474 !! test
14475 Image with caption
14476 !! wikitext
14477 [[File:Foobar.jpg|right|Caption text]]
14478 !! html/php
14479 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14480
14481 !! html/parsoid
14482 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14483 !! end
14484
14485 !! test
14486 Image with caption, T55312 #1
14487 !! wikitext
14488 [[File:Foobar.jpg|right|Caption page stuff]]
14489 !! html/php
14490 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14491
14492 !! html/parsoid
14493 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
14494 !! end
14495
14496 !! test
14497 Image with caption, T55312 #2
14498 !! wikitext
14499 [[File:Foobar.jpg|right|Caption page=]]
14500 !! html/php
14501 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14502
14503 !! html/parsoid
14504 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
14505 !! end
14506
14507 !! test
14508 Image with caption, T55312 #3
14509 !! wikitext
14510 [[File:Foobar.jpg|right|Caption page=stuff]]
14511 !! html/php
14512 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14513
14514 !! html/parsoid
14515 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
14516 !! end
14517
14518 !! test
14519 Image caption with pipe entity
14520 !! wikitext
14521 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14522 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14523 !! html/php
14524 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one &#x7c; two</div></div></div>
14525 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
14526
14527 !! html/parsoid
14528 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
14529 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14530 !! end
14531
14532 !! test
14533 Allow empty links in image captions (T62753)
14534 !! options
14535 thumbsize=220
14536 !! wikitext
14537 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14538 [[]]
14539 [[Link2]]
14540 ]]
14541 !! html/php
14542 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
14543
14544 !! html/parsoid
14545 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
14546 [[]]
14547 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14548 </figcaption></figure>
14549 !! end
14550
14551 !! test
14552 Titles in unlinked images (T23454)
14553 !! wikitext
14554 [[File:Foobar.jpg|link=|stuff]]
14555 !! html/php
14556 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14557 </p>
14558 !! html/parsoid
14559 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"stuff"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
14560 !! end
14561
14562 !! test
14563 Link with empty target
14564 !! wikitext
14565 [[]]
14566 !! html
14567 <p>[[]]
14568 </p>
14569 !! end
14570
14571 !! test
14572 Image with link trail
14573 !! wikitext
14574 Linktrails should not work for images: [[File:Foobar.jpg]]s
14575 !! html/php
14576 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
14577 </p>
14578 !! html/parsoid
14579 <p>Linktrails should not work for images: <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline>s</p>
14580 !! end
14581
14582 !! test
14583 Image with empty attribute
14584 !! options
14585 parsoid=wt2html,wt2wt,html2html
14586 !! wikitext
14587 [[File:Foobar.jpg|right||Caption text]]
14588 !! html/php
14589 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14590
14591 !! html/parsoid
14592 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14593 !! end
14594
14595 !! test
14596 1. Block image with individual attributes from templates
14597 !! wikitext
14598 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14599 !! html/php
14600 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
14601
14602 !! html/parsoid
14603 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14604 !! end
14605
14606 !! test
14607 2. Block Image with individual attributes from templates
14608 !! wikitext
14609 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14610 !! html/php
14611 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
14612
14613 !! html/parsoid
14614 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14615 !! end
14616
14617 !! test
14618 3. Inline image with individual attributes from templates
14619 !! wikitext
14620 [[File:Foobar.jpg|{{echo|50px}}]]
14621 !! html/php
14622 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
14623 </p>
14624 !! html/parsoid
14625 <p><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
14626 !! end
14627
14628 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14629 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14630 !! test
14631 Image with multiple attributes from the same template
14632 !! wikitext
14633 [[File:Foobar.jpg|{{image_attribs}}]]
14634 !! html/php
14635 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14636
14637 !! html/parsoid
14638 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
14639 !! end
14640
14641 !! test
14642 Image with link tails
14643 !! options
14644 thumbsize=220
14645 !! wikitext
14646 123[[File:Foobar.jpg]]456
14647 123[[File:Foobar.jpg|right]]456
14648 123[[File:Foobar.jpg|thumb]]456
14649 !! html/php
14650 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14651 </p>
14652 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
14653 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
14654
14655 !! html/php+tidy
14656 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
14657 </p><p>
14658 123</p><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div><p>456
14659 123</p><div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div><p>456
14660 </p>
14661 !! html/parsoid
14662 <p>123<figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline>456</p>
14663 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456
14664 123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
14665 !! end
14666
14667 !! test
14668 Image with multiple captions -- only last one is accepted
14669 !! wikitext
14670 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14671 !! html/php
14672 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
14673
14674 !! html/parsoid
14675 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
14676 !! end
14677
14678 !! test
14679 Image with multiple widths -- use last
14680 !! wikitext
14681 [[File:Foobar.jpg|200px|300px|caption]]
14682 !! html/php
14683 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
14684 </p>
14685 !! html/parsoid
14686 <p><figure-inline typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure-inline></p>
14687 !! end
14688
14689 !! test
14690 Image with multiple alignments -- use first (T50664)
14691 !! options
14692 thumbsize=220
14693 !! wikitext
14694 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14695
14696 [[File:Foobar.jpg|middle|text-top|caption]]
14697 !! html/php
14698 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14699 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
14700 </p>
14701 !! html/parsoid
14702 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14703 <p><figure-inline class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14704 !! end
14705
14706 !! test
14707 Image with width attribute at different positions
14708 !! wikitext
14709 [[File:Foobar.jpg|200px|right|Caption]]
14710 [[File:Foobar.jpg|right|200px|Caption]]
14711 [[File:Foobar.jpg|right|Caption|200px]]
14712 !! html/php
14713 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14714 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14715 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
14716
14717 !! html/parsoid
14718 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14719 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14720 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
14721 !! end
14722
14723 # a sad bit of backward-compatibility
14724 !! test
14725 Image with size specified with pxpx (T15500, T53628)
14726 !! options
14727 parsoid=wt2html,wt2wt,html2html
14728 !! wikitext
14729 [[File:Foobar.jpg|20pxpx]]
14730 [[File:Foobar.jpg|200x20pxpx]]
14731 !! html/php
14732 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
14733 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
14734 </p>
14735 !! html/parsoid
14736 <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline> <figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></figure-inline></p>
14737 !! end
14738
14739 !! test
14740 Image with link parameter, wiki target
14741 !! wikitext
14742 [[File:Foobar.jpg|link=Main Page]]
14743 !! html/php
14744 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14745 </p>
14746 !! html/parsoid
14747 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14748 !! end
14749
14750 # parsoid T51293 (part 1)
14751 !! test
14752 Image with link parameter, URL target
14753 !! wikitext
14754 [[File:Foobar.jpg|link=http://example.com/]]
14755 !! html/php
14756 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14757 </p>
14758 !! html/parsoid
14759 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14760 !! end
14761
14762 # parsoid T51293 (part 2)
14763 !! test
14764 Image with link parameter, protocol-less URL target
14765 !! wikitext
14766 [[File:Foobar.jpg|link=//example.com/]]
14767 !! html/php
14768 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14769 </p>
14770 !! html/parsoid
14771 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14772 !! end
14773
14774 !! test
14775 Escaping non-block captions (T107435)
14776 !! options
14777 parsoid={
14778 "modes": ["wt2wt"],
14779 "changes": [
14780 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14781 ]
14782 }
14783 !! wikitext
14784 [[Image:Foobar.jpg|caption]]
14785 !! wikitext/edited
14786 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14787 !! end
14788
14789 # wgExternalLinkTarget not supported by Parsoid
14790 !! test
14791 Image with link parameter, wgExternalLinkTarget
14792 !! wikitext
14793 [[Image:foobar.jpg|link=http://example.com/]]
14794 !! config
14795 wgExternalLinkTarget='foobar'
14796 !! html/php
14797 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14798 </p>
14799 !! end
14800
14801 !! test
14802 Image with link parameter, wgNoFollowLinks set to false
14803 !! wikitext
14804 [[Image:foobar.jpg|link=http://example.com/]]
14805 !! config
14806 wgNoFollowLinks=false
14807 !! html/php
14808 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14809 </p>
14810 !! end
14811
14812 !! test
14813 Image with link parameter, wgNoFollowDomainExceptions
14814 !! wikitext
14815 [[Image:foobar.jpg|link=http://example.com/]]
14816 !! config
14817 wgNoFollowDomainExceptions='example.com'
14818 !! html/php
14819 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14820 </p>
14821 !! end
14822
14823 # wgExternalLinkTarget not supported by Parsoid
14824 !! test
14825 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14826 !! wikitext
14827 [[Image:foobar.jpg|link=http://example.com/|Title]]
14828 !! config
14829 wgExternalLinkTarget='foobar'
14830 !! html/php
14831 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14832 </p>
14833 !! end
14834
14835 !! test
14836 Image with empty link parameter
14837 !! wikitext
14838 [[File:Foobar.jpg|link=]]
14839 !! html/php
14840 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14841 </p>
14842 !! html/parsoid
14843 <p><figure-inline class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
14844 !! end
14845
14846 !! test
14847 Image with link parameter (wiki target) and unnamed parameter
14848 !! wikitext
14849 [[File:Foobar.jpg|link=Main_Page|Title]]
14850 !! html/php
14851 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14852 </p>
14853 !! html/parsoid
14854 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14855 !! end
14856
14857 !! test
14858 Image with link parameter (URL target) and unnamed parameter
14859 !! wikitext
14860 [[File:Foobar.jpg|link=http://example.com/|Title]]
14861 !! html/php
14862 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14863 </p>
14864 !! html/parsoid
14865 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
14866 !! end
14867
14868 !! test
14869 Thumbnail image with link parameter
14870 !! options
14871 thumbsize=220
14872 parsoid=wt2html,wt2wt,html2html
14873 !! wikitext
14874 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14875 !! html/php
14876 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14877
14878 !! html/parsoid
14879 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
14880 !! end
14881
14882 !! test
14883 Manually-specified thumbnail image
14884 !! options
14885 thumbsize=220
14886 !! wikitext
14887 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14888 !! html/php
14889 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14890
14891 !! html/parsoid
14892 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14893 !! end
14894
14895 !! test
14896 Manually-specified thumbnail image with explicit link to wiki page
14897 !! options
14898 thumbsize=220
14899 parsoid=wt2html,wt2wt,html2html
14900 !! wikitext
14901 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14902 !! html/php
14903 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14904
14905 !! html/parsoid
14906 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14907 !! end
14908
14909 !! test
14910 Manually-specified thumbnail image with explicit link to url
14911 !! options
14912 thumbsize=220
14913 parsoid=wt2html,wt2wt,html2html
14914 !! wikitext
14915 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14916 !! html/php
14917 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14918
14919 !! html/parsoid
14920 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14921 !! end
14922
14923 !! test
14924 Manually-specified thumbnail image with explicit no link
14925 !! options
14926 thumbsize=220
14927 parsoid=wt2html,wt2wt,html2html
14928 !! wikitext
14929 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14930 !! html/php
14931 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14932
14933 !! html/parsoid
14934 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
14935 !! end
14936
14937 !! test
14938 Manually-specified thumbnail image with explicit link and alt text
14939 !! options
14940 thumbsize=220
14941 parsoid=wt2html,wt2wt,html2html
14942 !! wikitext
14943 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14944 !! html/php
14945 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
14946
14947 !! html/parsoid
14948 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
14949 !! end
14950
14951 !! test
14952 Image with frame and link
14953 !! options
14954 parsoid=wt2html,wt2wt,html2html
14955 !! wikitext
14956 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14957 !! html/php
14958 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
14959
14960 !! html/parsoid
14961 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
14962 !! end
14963
14964 !! test
14965 Image with frame and link and explicit alt
14966 !! options
14967 parsoid=wt2html,wt2wt,html2html
14968 !! wikitext
14969 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14970 !! html/php
14971 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
14972
14973 !! html/parsoid
14974 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
14975 !! end
14976
14977 !! test
14978 Image with wiki markup in implicit alt
14979 !! wikitext
14980 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14981
14982 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14983 !! html/php
14984 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14985 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14986 </p>
14987 !! html/parsoid
14988 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14989
14990 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
14991 !! end
14992
14993 !! test
14994 Alt image option should handle most kinds of wikitext without barfing
14995 !! wikitext
14996 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14997 !! html/php
14998 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
14999
15000 !! html/parsoid
15001 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
15002 !! end
15003
15004 !! test
15005 Image with table with attributes in caption
15006 !! options
15007 parsoid=wt2html,html2html
15008 !! wikitext
15009 [[File:Foobar.jpg|thumb|
15010 {| class="123" |
15011 |- class="456" |
15012 | ha
15013 |}
15014 ]]
15015 !! html/parsoid
15016 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{| class=\"123\" |\n|- class=\"456\" |\n| ha\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
15017 <table class="123">
15018 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15019 <td> ha</td></tr>
15020 </tbody></table>
15021 </figcaption></figure>
15022 !! end
15023
15024 !! test
15025 Image with table with rows from templates in caption
15026 !! wikitext
15027 [[File:Foobar.jpg|thumb|
15028 {|
15029 {{echo|{{!}} hi}}
15030 |}
15031 ]]
15032 !! html/parsoid
15033 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{|\n{{echo|{{!}} hi}}\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
15034 <table>
15035 <tbody about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} hi"}},"i":0}},"\n"]}'><tr><td> hi</td></tr>
15036 </tbody></table>
15037 </figcaption></figure>
15038 !! end
15039
15040 !! test
15041 Image with nested tables in caption
15042 !! wikitext
15043 [[File:Foobar.jpg|thumb|Foo<br />
15044 {|
15045 |
15046 {|
15047 |z
15048 |}
15049 |}
15050 ]]
15051 !! html/parsoid
15052 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo&lt;br/>\n{|\n|\n{|\n|z\n|}\n|}\n"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,50,null,null]}'>Foo<br data-parsoid='{"stx":"html","selfClose":true}'/>
15053 <table>
15054 <tbody><tr><td>
15055 <table>
15056 <tbody><tr><td>z</td></tr>
15057 </tbody></table></td></tr>
15058 </tbody></table>
15059 </figcaption></figure>
15060 !! end
15061
15062 !! test
15063 Image with heading and horizontal rule in caption
15064 !! wikitext
15065 [[File:Foobar.jpg|thumb|
15066 ===Testing===
15067 123
15068 --------------
15069 ]]
15070 !! html/php
15071 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><h3><span class="mw-headline" id="Testing">Testing</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Testing">edit</a><span class="mw-editsection-bracket">]</span></span></h3> 123 <hr /></div></div></div>
15072
15073 !! html/parsoid
15074 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n=== Testing ===\n123\n--------------\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
15075 <h3 id="Testing">Testing</h3>
15076 123
15077 <hr data-parsoid='{"extra_dashes":10}'/>
15078 </figcaption></figure>
15079 !! end
15080
15081 ###################
15082 # Conflicting image format options.
15083 # First option specified should 'win'.
15084 # All three cases in each test should be identical.
15085
15086 !! test
15087 Image with 'frameless' first.
15088 !! options
15089 parsoid=wt2html,wt2wt,html2html
15090 !! wikitext
15091 [[File:Foobar.jpg|frameless|caption]]
15092
15093 [[File:Foobar.jpg|frameless|frame|caption]]
15094
15095 [[File:Foobar.jpg|frameless|thumb|caption]]
15096 !! html/php
15097 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
15098 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
15099 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
15100 </p>
15101 !! html/parsoid
15102 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15103 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15104 <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15105 !! end
15106
15107 !! test
15108 Image with 'frame' first.
15109 !! options
15110 parsoid=wt2html,wt2wt,html2html
15111 !! wikitext
15112 [[File:Foobar.jpg|frame|caption]]
15113 [[File:Foobar.jpg|frame|frameless|caption]]
15114 [[File:Foobar.jpg|frame|thumb|caption]]
15115 !! html/php
15116 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15117 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15118 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15119
15120 !! html/parsoid
15121 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15122 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15123 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15124 !! end
15125
15126 !! test
15127 Image with 'thumb' first.
15128 !! options
15129 parsoid=wt2html,wt2wt,html2html
15130 !! wikitext
15131 [[File:Foobar.jpg|thumb|caption]]
15132 [[File:Foobar.jpg|thumb|frameless|caption]]
15133 [[File:Foobar.jpg|thumb|frame|caption]]
15134 !! html/php
15135 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15136 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15137 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15138
15139 !! html/parsoid
15140 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15141 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15142 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15143 !! end
15144
15145 ###################
15146 # Image sizing.
15147 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15148 # and https://phabricator.wikimedia.org/T64258
15149 # Foobar has actual size of 1941x220
15150 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15151 # a scalable format.
15152 # 2. Framed images always ignore size options; always render at default size.
15153 # 3. "Unspecified format" and border are the only types which can be
15154 # enlarged.
15155
15156 !! test
15157 Image: unspecified format and border enlarge
15158 !! options
15159 parsoid=wt2html,wt2wt,html2html
15160 !! wikitext
15161 [[File:Foobar.jpg|2000px]]
15162
15163 [[File:Foobar.jpg|border|2000px]]
15164 !! html/php
15165 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
15166 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
15167 </p>
15168 !! html/parsoid
15169 <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
15170 <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
15171 !! end
15172
15173 !! test
15174 Image: "unspecified format" and border reduce
15175 !! options
15176 parsoid=wt2html,wt2wt,html2html
15177 !! wikitext
15178 [[File:Foobar.jpg|1000px]]
15179
15180 [[File:Foobar.jpg|border|1000px]]
15181 !! html/php
15182 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
15183 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
15184 </p>
15185 !! html/parsoid
15186 <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></figure-inline></p>
15187 <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></figure-inline></p>
15188 !! end
15189
15190 !! test
15191 Image: thumbs reduce
15192 !! options
15193 parsoid=wt2html,wt2wt,html2html
15194 !! wikitext
15195 [[File:Foobar.jpg|thumb|50px]]
15196 !! html/php
15197 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
15198
15199 !! html/parsoid
15200 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
15201 !! end
15202
15203 !! test
15204 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15205 !! options
15206 parsoid=wt2html,wt2wt,html2html
15207 !! wikitext
15208 [[File:Foobar.jpg|thumb|2000px]]
15209
15210 [[File:Foobar.svg|thumb|2000px]]
15211 !! html/php
15212 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
15213 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
15214
15215 !! html/parsoid
15216 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15217 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
15218 !! end
15219
15220 !! test
15221 Image: frameless can reduce in size
15222 !! options
15223 parsoid=wt2html,wt2wt,html2html
15224 !! wikitext
15225 [[File:Foobar.jpg|frameless|50px]]
15226 !! html/php
15227 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
15228 </p>
15229 !! html/parsoid
15230 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15231 !! end
15232
15233 !! test
15234 Image: bitmap frameless can't be enlarged past original size, but vector can
15235 !! options
15236 parsoid=wt2html,wt2wt,html2html
15237 !! wikitext
15238 [[File:Foobar.jpg|frameless|2000px]]
15239
15240 [[File:Foobar.svg|frameless|2000px]]
15241 !! html/php
15242 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15243 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
15244 </p>
15245 !! html/parsoid
15246 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15247 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure-inline></p>
15248 !! end
15249
15250 !! test
15251 Image: framed images are always unscaled.
15252 !! options
15253 parsoid=wt2html,wt2wt,html2html
15254 !! wikitext
15255 [[File:Foobar.jpg|frame]]
15256
15257 [[File:Foobar.jpg|frame|50px]]
15258
15259 [[File:Foobar.jpg|frame|50x50px]]
15260
15261 [[File:Foobar.jpg|frame|2000px]]
15262 !! html/php
15263 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15264 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15265 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15266 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15267
15268 !! html/parsoid
15269 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15270 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15271 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15272 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
15273 !! end
15274
15275 ###################
15276
15277 !! test
15278 Link to image page- image page normally doesn't exists, hence edit link
15279 Add test with existing image page
15280 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15281 !! wikitext
15282 [[:Image:test]]
15283 !! html
15284 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
15285 </p>
15286 !! end
15287
15288 !! test
15289 T20784 Link to non-existent image page with caption should use caption as link text
15290 !! wikitext
15291 [[:Image:test|caption]]
15292 !! html
15293 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
15294 </p>
15295 !! end
15296
15297 !! test
15298 Frameless image caption with a free URL
15299 !! wikitext
15300 [[File:Foobar.jpg|http://example.com]]
15301 !! html/php
15302 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15303 </p>
15304 !! html/parsoid
15305 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15306 !! end
15307
15308 !! test
15309 Thumbnail image caption with a free URL
15310 !! options
15311 thumbsize=220
15312 !! wikitext
15313 [[File:Foobar.jpg|thumb|http://example.com]]
15314 !! html/php
15315 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
15316
15317 !! html/parsoid
15318 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
15319 !! end
15320
15321 !! test
15322 Thumbnail image caption with a free URL and explicit alt
15323 !! options
15324 thumbsize=220
15325 parsoid=wt2html,wt2wt,html2html
15326 !! wikitext
15327 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15328 !! html/php
15329 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
15330
15331 !! html/parsoid
15332 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
15333 !! end
15334
15335 !! test
15336 SVG thumbnails with no language set
15337 !! options
15338 !! wikitext
15339 [[File:Foobar.svg|thumb|caption]]
15340 !! html/php
15341 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15342
15343 !! html/parsoid
15344 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
15345 !! end
15346
15347 !! test
15348 SVG thumbnails with language de
15349 !! options
15350 parsoid=wt2html,wt2wt,html2html
15351 !! wikitext
15352 [[File:Foobar.svg|thumb|caption|lang=de]]
15353 !! html/php
15354 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15355
15356 !! html/parsoid
15357 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
15358 !! end
15359
15360 !! test
15361 SVG thumbnails with invalid language code
15362 !! options
15363 parsoid=wt2html,wt2wt,html2html
15364 !! wikitext
15365 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15366 !! html/php
15367 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid:language:code</div></div></div>
15368
15369 !! html/parsoid
15370 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid:language:code</figcaption></figure>
15371 !! end
15372
15373 !! test
15374 T3887: A ISBN with a thumbnail
15375 !! wikitext
15376 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15377 !! html/php
15378 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
15379
15380 !! html/parsoid
15381 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
15382 !! end
15383
15384 !! test
15385 T3887: A RFC with a thumbnail
15386 !! wikitext
15387 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15388 !! html/php
15389 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
15390
15391 !! html/parsoid
15392 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink" class="external mw-magiclink">RFC 12354</a></figcaption></figure>
15393 !! end
15394
15395 !! test
15396 T3887: A mailto link with a thumbnail
15397 !! wikitext
15398 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15399 !! html/php
15400 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
15401
15402 !! html/parsoid
15403 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
15404 !! end
15405
15406 # Pending resolution to T2368
15407 !! test
15408 T2648: Frameless image caption with a link
15409 !! wikitext
15410 [[File:Foobar.jpg|text with a [[link]] in it]]
15411 !! html/php
15412 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15413 </p>
15414 !! html/parsoid
15415 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15416 !! end
15417
15418 !! test
15419 T2648: Frameless image caption with a link (suffix)
15420 !! wikitext
15421 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15422 !! html/php
15423 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15424 </p>
15425 !! html/parsoid
15426 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15427 !! end
15428
15429 !! test
15430 T2648: Frameless image caption with an interwiki link
15431 !! wikitext
15432 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15433 !! html/php
15434 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15435 </p>
15436 !! html/parsoid
15437 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15438 !! end
15439
15440 !! test
15441 T2648: Frameless image caption with a piped interwiki link
15442 !! wikitext
15443 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15444 !! html/php
15445 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15446 </p>
15447 !! html/parsoid
15448 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15449 !! end
15450
15451 !! test
15452 T107474: Frameless image caption with <nowiki>
15453 !! wikitext
15454 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15455 !! html/parsoid
15456 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15457 !! end
15458
15459 !! test
15460 Escape HTML special chars in image alt text
15461 !! wikitext
15462 [[File:Foobar.jpg|& < > "]]
15463 !! html/php
15464 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15465 </p>
15466 !! html/parsoid
15467 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15468 !! end
15469
15470 !! test
15471 Escape HTML special chars in image alt text with LanguageConverter
15472 !! options
15473 language=zh
15474 !! wikitext
15475 [[File:Foobar.jpg|& < > "]]
15476 !! html/php
15477 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15478 </p>
15479 !! html/parsoid
15480 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15481 !! end
15482
15483 !! test
15484 Entities in file name and attributes
15485 !! wikitext
15486 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15487 !! html/php
15488 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15489 </p>
15490 !! html/parsoid
15491 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></figure-inline></p>
15492 !! end
15493
15494 !! test
15495 T2499: Alt text should have &#1234;, not &amp;1234;
15496 !! wikitext
15497 [[File:Foobar.jpg|&#9792;]]
15498 !! html/php
15499 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15500 </p>
15501 !! html/parsoid
15502 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15503 !! end
15504
15505 !! test
15506 Broken image caption with link
15507 !! options
15508 parsoid=wt2html,wt2wt,html2html
15509 !! wikitext
15510 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15511 !! html/php
15512 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
15513 </p>
15514 !! html/parsoid
15515 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
15516 !! end
15517
15518 !! test
15519 Image caption containing another image
15520 !! wikitext
15521 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15522 !! html/php
15523 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
15524
15525 !! html/parsoid
15526 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></figure-inline> inside it!</figcaption></figure>
15527 !! end
15528
15529 !! test
15530 Image: caption containing a newline
15531 !! wikitext
15532 [[File:Foobar.jpg|This
15533 *is some text]]
15534 !! html/php
15535 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15536 </p>
15537 !! html/parsoid
15538 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15539 !!end
15540
15541 !!test
15542 Image: caption containing leading space
15543 (The leading space should not trigger nowiki escaping in wt2wt mode)
15544 !! wikitext
15545 [[File:Foobar.jpg|thumb| bar]]
15546 !! html/php
15547 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
15548
15549 !! html/parsoid
15550 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
15551 !!end
15552
15553 # html/php output not have newlines after table, td, th, etc. because
15554 # Linker::makeThumbLink2() replaces the newlines with spaces since
15555 # the table is inside a caption.
15556 # FIXME: Verify if that circa 2004 fix is still required.
15557 !! test
15558 Image: caption containing a table
15559 !! options
15560 parsoid=wt2html,wt2wt,html2html
15561 !! wikitext
15562 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15563 {|
15564 !Foo!!Bar
15565 |-
15566 |Foo1||Bar1
15567 |}
15568 and some more text.]]
15569 !! html/php
15570 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th>Foo</th> <th>Bar </th></tr> <tr> <td>Foo1</td> <td>Bar1 </td></tr></table> and some more text.</div></div></div>
15571
15572 !! html/parsoid
15573 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
15574 <table>
15575 <tbody>
15576 <tr><th>Foo</th><th>Bar</th></tr>
15577 <tr>
15578 <td>Foo1</td>
15579 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15580 !! end
15581
15582 !! test
15583 T5090: External links other than http: in image captions
15584 !! wikitext
15585 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15586 !! html/php
15587 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
15588
15589 !! html/parsoid
15590 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" class="external text" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" class="external text" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
15591 !! end
15592
15593 !! test
15594 Custom class
15595 !! options
15596 parsoid=wt2html,wt2wt,html2html
15597 !! wikitext
15598 [[Image:foobar.jpg|a|class=b]]
15599 !! html/php
15600 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
15601 </p>
15602 !! html/parsoid
15603 <p><figure-inline class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
15604 !! end
15605
15606 !! test
15607 Localized image handling (1).
15608 !! options
15609 parsoid=wt2html,wt2wt,html2html
15610 language=es
15611 !! wikitext
15612 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15613 !! html/php
15614 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
15615
15616 !! html/parsoid
15617 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15618 !! end
15619
15620 !! test
15621 Localized image handling (2).
15622 !! options
15623 thumbsize=220
15624 parsoid=wt2html,wt2wt,html2html
15625 language=es
15626 !! wikitext
15627 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15628 !! html/php
15629 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
15630
15631 !! html/parsoid
15632 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15633 !! end
15634
15635 !! test
15636 Localized image handling (3).
15637 !! options
15638 language=fa
15639 parsoid=html2wt
15640 !! html/parsoid
15641 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
15642 !! wikitext
15643 [[File:Foobar.jpg|بندانگشتی]]
15644 !! end
15645
15646 !! test
15647 "border", "frameless" and "class" attributes on an image.
15648 !! options
15649 thumbsize=220
15650 parsoid=wt2html,wt2wt,html2html
15651 !! wikitext
15652 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15653 !! html/php
15654 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
15655 </p>
15656 !! html/parsoid
15657 <p><figure-inline class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
15658 !! end
15659
15660 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15661 !! test
15662 Invalid image attributes (T64500)
15663 !! options
15664 thumbsize=220
15665 parsoid=wt2html,wt2wt,html2html
15666 !! wikitext
15667 [[File:Foobar.jpg|thumb|float|left|caption]]
15668
15669 [[File:Foobar.jpg|thumb|righ|caption]]
15670
15671 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15672 !! html/php
15673 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15674 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15675 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
15676
15677 !! html/parsoid
15678 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15679 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15680 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
15681 !! end
15682
15683 !! article
15684 File:Barfoo.jpg
15685 !! text
15686 #REDIRECT [[File:Barfoo.jpg]]
15687 !! endarticle
15688
15689 # FIXME: Parsoid should run this test -- but we'd need to teach the
15690 # mockAPI about the redirected Barfoo.jpg image.
15691 !! test
15692 Redirected image
15693 !! wikitext
15694 [[Image:Barfoo.jpg]]
15695 !! html/php
15696 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15697 </p>
15698 !! end
15699
15700 !! test
15701 Missing image with uploads disabled
15702 !! options
15703 wgEnableUploads=0
15704 !! wikitext
15705 [[File:Foobaz.jpg]]
15706 !! html/php
15707 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15708 </p>
15709 !! html/parsoid
15710 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></figure-inline></p>
15711 !! end
15712
15713 # Parsoid-specific testing for images
15714 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15715 # Currently imperfect due to a flaw in the Parsoid testrunner
15716 # Work in progress
15717 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15718 # image tests.
15719
15720 !! test
15721 Parsoid-specific image handling - simple image with size and middle alignment
15722 !! wikitext
15723 [[File:Foobar.jpg|middle|50px]]
15724 !! html/parsoid
15725 <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15726 !! end
15727
15728 !! test
15729 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15730 !! options
15731 parsoid=wt2wt,wt2html,html2html
15732 !! wikitext
15733 [[Image:Foobar.jpg|middle|50px]]
15734 !! html/parsoid
15735 <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15736 !! end
15737
15738 !! test
15739 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15740 !! wikitext
15741 [[File:Foobar.jpg|50px|middle]]
15742 !! html/parsoid
15743 <p><figure-inline class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15744 !! end
15745
15746 !! test
15747 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15748 !! options
15749 parsoid=wt2html,wt2wt,html2html
15750 !! wikitext
15751 [[Image:Foobar.jpg|50px|middle]]
15752 !! html/parsoid
15753 <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
15754 !! end
15755
15756 !! test
15757 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15758 !! wikitext
15759 [[File:Foobar.jpg|500x10px|baseline|caption]]
15760 !! html/parsoid
15761 <p><figure-inline class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15762 !! end
15763
15764 !! test
15765 Parsoid-specific image handling - simple image with border and size spec
15766 !! wikitext
15767 [[File:Foobar.jpg|50px|border|caption]]
15768 !! html/parsoid
15769 <p><figure-inline class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15770 !! end
15771
15772 !! test
15773 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15774 !! options
15775 parsoid=wt2html,html2html
15776 !! wikitext
15777 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15778 !! html/parsoid
15779 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
15780 !! end
15781
15782 !! test
15783 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15784 !! options
15785 parsoid=wt2html,html2html
15786 !! wikitext
15787 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15788 !! html/parsoid
15789 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
15790 !! end
15791
15792 !! test
15793 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15794 !! options
15795 parsoid=wt2html,html2html
15796 !! wikitext
15797 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15798 !! html/parsoid
15799 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
15800 !! end
15801
15802 !! test
15803 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15804 !! options
15805 parsoid=wt2html,html2html
15806 !! wikitext
15807 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15808 !! html/parsoid
15809 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
15810 !! end
15811
15812 !! test
15813 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15814 !! options
15815 parsoid=wt2html,wt2wt,html2html
15816 !! wikitext
15817 [[File:Foobar.jpg|frame|500x50px|caption]]
15818 !! html/parsoid
15819 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15820 !! end
15821
15822 !! test
15823 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15824 !! options
15825 parsoid=wt2html,html2html
15826 !! wikitext
15827 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15828 !! html/parsoid
15829 <figure class="mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
15830 !! end
15831
15832 !! test
15833 Parsoid-specific image handling - frameless image with specific size, border, and caption
15834 !! wikitext
15835 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15836 !! html/parsoid
15837 <p><figure-inline class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15838 !! end
15839
15840 !! test
15841 Parsoid-specific image handling - simple image with a formatted caption
15842 !! wikitext
15843 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15844 !! html/parsoid
15845 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15846 !! end
15847
15848 !! test
15849 Parsoid-specific image handling - caption with a template in it
15850 !! wikitext
15851 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15852 !! html/parsoid
15853 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
15854 !! end
15855
15856 !! test
15857 Parsoid-specific image handling - caption with unbalanced tags in it
15858 !! options
15859 parsoid=wt2html,wt2wt,html2html
15860 !! wikitext
15861 foo
15862 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15863 bar
15864 !! html/parsoid
15865 <p>foo</p>
15866 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
15867 <p>bar</p>
15868 !! end
15869
15870 !! test
15871 Parsoid-specific image handling - empty caption (1)
15872 !! options
15873 parsoid=wt2html,wt2wt
15874 !! wikitext
15875 [[File:Foobar.jpg|thumb|]]
15876 !! html/parsoid
15877 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
15878 !! end
15879
15880 # empty captions don't get serialized unless we're in the "round trip" case
15881 !! test
15882 Parsoid-specific image handling - empty caption (2)
15883 !! options
15884 parsoid=html2wt
15885 !! html/parsoid
15886 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15887 <a href="./File:Foobar.jpg">
15888 <img resource="./File:Foobar.jpg"
15889 src="//example.com/images/3/3a/Foobar.jpg"
15890 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15891 height="25" width="220"/>
15892 </a>
15893 <figcaption></figcaption>
15894 </figure>
15895 !! wikitext
15896 [[File:Foobar.jpg|thumb]]
15897 !! end
15898
15899 !! test
15900 Parsoid-specific image handling - whitespace caption
15901 !! wikitext
15902 [[File:Foobar.jpg|thumb| ]]
15903 !! html/parsoid
15904 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
15905 !! end
15906
15907 !! test
15908 Parsoid-specific image handling - lang option
15909 !! wikitext
15910 foo
15911 [[File:Foobar.svg|lang=de|caption]]
15912 bar
15913 !! html/parsoid
15914 <p>foo
15915 <figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></figure-inline>
15916 bar</p>
15917 !! end
15918
15919 ## Edge case bugs in Parsoid from T93580
15920 !! test
15921 T93580: 1. Templated <ref> inside block images
15922 !! wikitext
15923 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15924
15925 <references />
15926 !! html/parsoid
15927 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <sup about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
15928
15929 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
15930 !! end
15931
15932 !! test
15933 T93580: 2. <ref> inside inline images
15934 !! wikitext
15935 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15936
15937 <references />
15938 !! html/parsoid
15939 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15940
15941 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15942 !! end
15943
15944 !! test
15945 T93580: 3. Templated <ref> inside inline images
15946 !! wikitext
15947 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15948
15949 <references />
15950 !! html/parsoid
15951 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15952
15953 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
15954 !! end
15955
15956 ###
15957 ### Subpages
15958 ###
15959 !! article
15960 Subpage test/subpage
15961 !! text
15962 foo
15963 !! endarticle
15964
15965 !! test
15966 Subpage link
15967 !! options
15968 subpage title=[[Subpage test]]
15969 !! wikitext
15970 [[/subpage]]
15971 !! html
15972 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15973 </p>
15974 !! end
15975
15976 !! test
15977 Subpage noslash link
15978 !! options
15979 subpage title=[[Subpage test]]
15980 !! wikitext
15981 [[/subpage/]]
15982 !! html
15983 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15984 </p>
15985 !! end
15986
15987 !! article
15988 Subpage test/1/2/subpage
15989 !! text
15990 blah
15991 !! endarticle
15992
15993 !! test
15994 Relative subpage noslash link
15995 !! options
15996 parsoid=wt2wt,wt2html,html2html
15997 subpage title=[[Subpage test/1/2/3/4]]
15998 !! wikitext
15999 [[../../subpage/]]
16000
16001 [[../../subpage]]
16002 !! html/php
16003 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16004 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16005 </p>
16006 !! html/parsoid
16007 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16008 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16009 !! end
16010
16011 !! test
16012 Parsoid: dot-slash prefixed wikilinks
16013 !! wikitext
16014 [[./foo]]
16015
16016 [[././bar]]
16017
16018 [[././baz/]]
16019 !! html/php
16020 <p>[[./foo]]
16021 </p><p>[[././bar]]
16022 </p><p>[[././baz/]]
16023 </p>
16024 !! html/parsoid
16025 <p>[[./foo]]
16026 </p><p>[[././bar]]
16027 </p><p>[[././baz/]]
16028 </p>
16029 !! end
16030
16031 !! test
16032 Render invalid page names as plain text (T53090)
16033 !! wikitext
16034 [[./../foo|bar]]
16035 [[foo�|bar]]
16036 [[foo/.|bar]]
16037 [[foo/..|bar]]
16038 [[foo~~~bar]]
16039 [[foo>bar]]
16040 [[foo[bar]]
16041 [[.]]
16042 [[..]]
16043 [[foo././bar]]
16044 [[foo[http://example.com]xyz]]
16045
16046 [[{{echo|./../foo}}|bar]]
16047 [[{{echo|foo/.}}|bar]]
16048 [[{{echo|foo/..}}|bar]]
16049 [[{{echo|foo~~~~bar}}]]
16050 [[{{echo|foo>bar}}]]
16051 [[{{echo|foo././bar}}]]
16052 [[{{echo|foo{bar}}]]
16053 [[{{echo|foo}bar}}]]
16054 [[{{echo|foo[bar}}]]
16055 [[{{echo|foo]bar}}]]
16056 [[{{echo|foo<bar}}]]
16057 !!html/php
16058 <p>[[./../foo|bar]]
16059 [[foo�|bar]]
16060 [[foo/.|bar]]
16061 [[foo/..|bar]]
16062 [[foo~~~bar]]
16063 [[foo&gt;bar]]
16064 [[foo[bar]]
16065 [[.]]
16066 [[..]]
16067 [[foo././bar]]
16068 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16069 </p><p>[[./../foo|bar]]
16070 [[foo/.|bar]]
16071 [[foo/..|bar]]
16072 [[foo~~~~bar]]
16073 [[foo&gt;bar]]
16074 [[foo././bar]]
16075 [[foo{bar]]
16076 [[foo}bar]]
16077 [[foo[bar]]
16078 [[foo]bar]]
16079 [[foo&lt;bar]]
16080 </p>
16081 !!html/parsoid
16082 <p>[[./../foo|bar]]
16083 [[foo�|bar]]
16084 [[foo/.|bar]]
16085 [[foo/..|bar]]
16086 [[foo~~~bar]]
16087 [[foo>bar]]
16088 [[foo[bar]]
16089 [[.]]
16090 [[..]]
16091 [[foo././bar]]
16092 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16093
16094 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16095 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16096 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16097 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16098 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16099 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16100 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16101 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16102 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16103 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16104 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
16105 !!end
16106
16107 !! test
16108 Disabled subpages
16109 !! wikitext
16110 [[/subpage]]
16111 !! html
16112 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16113 </p>
16114 !! end
16115
16116 !! test
16117 T2561: {{/Subpage}}
16118 !! options
16119 subpage title=[[Page]]
16120 !! wikitext
16121 {{/Subpage}}
16122 !! html
16123 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
16124 </p>
16125 !! end
16126
16127 ###
16128 ### Categories
16129 ###
16130 !! article
16131 Category:MediaWiki User's Guide
16132 !! text
16133 blah
16134 !! endarticle
16135
16136 !! test
16137 Link to category
16138 !! wikitext
16139 [[:Category:MediaWiki User's Guide]]
16140 !! html
16141 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16142 </p>
16143 !! end
16144
16145 !! test
16146 Simple category
16147 !! options
16148 cat
16149 !! wikitext
16150 [[Category:MediaWiki User's Guide]]
16151 !! html/php
16152 cat=MediaWiki_User's_Guide sort=
16153 !! html/parsoid
16154 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
16155 !! end
16156
16157 !! test
16158 PAGESINCATEGORY invalid title fatal (r33546 fix)
16159 !! wikitext
16160 {{PAGESINCATEGORY:<bogus>}}
16161 !! html
16162 <p>0
16163 </p>
16164 !! end
16165
16166 !! test
16167 Category with different sort key
16168 !! options
16169 cat
16170 !! wikitext
16171 [[Category:MediaWiki User's Guide|Foo]]
16172 !! html/php
16173 cat=MediaWiki_User's_Guide sort=Foo
16174 !! html/parsoid
16175 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
16176 !! end
16177
16178 !! test
16179 Category with identical sort key
16180 !! options
16181 cat
16182 !! wikitext
16183 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16184 !! html/php
16185 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16186 !! html/parsoid
16187 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
16188 !! end
16189
16190 !! test
16191 Category with empty sort key
16192 !! options
16193 cat
16194 pst
16195 !! wikitext
16196 [[Category:MediaWiki User's Guide|]]
16197 !! html/php
16198 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16199 !! end
16200
16201 !! test
16202 Category with empty sort key and parentheses
16203 !! options
16204 cat
16205 pst
16206 !! wikitext
16207 [[Category:Foo (bar)|]]
16208 !! html/php
16209 [[Category:Foo (bar)|Foo]]
16210 !! end
16211
16212 !! test
16213 Category with link tail
16214 !! options
16215 cat
16216 pst
16217 !! wikitext
16218 123[[Category:Foo]]456
16219 !! html/php
16220 123[[Category:Foo]]456
16221 !! end
16222
16223 !! test
16224 Category with template
16225 !! options
16226 cat
16227 pst
16228 !! wikitext
16229 [[Category:{{echo|Foo}}]]
16230 !! html/php
16231 [[Category:{{echo|Foo}}]]
16232 !! end
16233
16234 !! test
16235 Category with template in sort key
16236 !! options
16237 cat
16238 pst
16239 !! wikitext
16240 [[Category:Foo|{{echo|Bar}}]]
16241 !! html/php
16242 [[Category:Foo|{{echo|Bar}}]]
16243 !! end
16244
16245 !! test
16246 Category with template in sort key and title
16247 !! options
16248 cat
16249 pst
16250 !! wikitext
16251 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16252 !! html/php
16253 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16254 !! end
16255
16256 ## We used to, but no longer wt2wt this test since the default serializer
16257 ## will normalize all categories to serialize on their own line.
16258 ## This wikitext usage is going to be fairly uncommon in production and
16259 ## selser will take care of preserving formatting in those scenarios.
16260 !! test
16261 Category / paragraph interactions
16262 !! options
16263 parsoid=wt2html
16264 !! wikitext
16265 Foo [[Category:Baz]] Bar
16266
16267 Foo [[Category:Baz]]
16268 Bar
16269
16270 Foo
16271 [[Category:Baz]]
16272 Bar
16273
16274 Foo
16275 [[Category:Baz]] Bar
16276
16277 Foo
16278 [[Category:Baz]]
16279 [[Category:Baz]]
16280 [[Category:Baz]]
16281 Bar
16282
16283 [[Category:Baz]]
16284 [[Category:Baz]]
16285 [[Category:Baz]]
16286
16287 [[Category:Baz]]
16288 {{echo|[[Category:Baz]]}}
16289 [[Category:Baz]]
16290 !! html/php
16291 <p>Foo Bar
16292 </p><p>Foo
16293 Bar
16294 </p><p>Foo
16295 Bar
16296 </p><p>Foo Bar
16297 </p><p>Foo
16298 Bar
16299 </p>
16300 !! html/parsoid
16301 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16302 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16303 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16304 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16305 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16306 <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/>
16307 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16308 !! end
16309
16310 ## We used to, but no longer wt2wt this test since the default serializer
16311 ## will normalize all categories to serialize on their own line.
16312 ## This wikitext usage is going to be fairly uncommon in production and
16313 ## selser will take care of preserving formatting in those scenarios.
16314 ##
16315 ## The whitespace on the empty line is part of the test. Please do not delete
16316 !! test
16317 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16318 !! options
16319 parsoid=wt2html
16320 !! wikitext
16321 This
16322
16323 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16324
16325 {{echo|[[Category:Foo]] and so should this!}}
16326 !! html/php
16327 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16328 </p>
16329 !! html/parsoid
16330 <p>This
16331
16332 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16333
16334 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
16335 !! end
16336
16337 ## Parsoid will not try to wt2wt this while preserving newlines because
16338 ## it suppresses excess newlines within list items -- and we don't want to
16339 ## introduce a special case just for categories, which is, in reality somewhat
16340 ## odd behavior -- categories are unlikely to be used in list items like this
16341 ## in top-level pages and are only likely to show up in template-generated
16342 ## list items where this RT-ing is a non-issue.
16343 ##
16344 ## The whitespace on the empty line is part of the test. Please do not delete
16345 !! test
16346 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16347 !! options
16348 parsoid=wt2html
16349 !! wikitext
16350 * This
16351
16352 [[Category:Foo]] and this should be part of the same list item
16353 * So should this
16354
16355 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16356 !! html
16357 <ul><li>This and this should be part of the same list item</li>
16358 <li>So should this and this should be part of the same list item</li></ul>
16359 !! html/parsoid
16360 <ul>
16361 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16362 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
16363 </ul>
16364 !! end
16365
16366 ## Newlines and categories that follow the last item of a list
16367 ## are treated differently because this (list followed by categories)
16368 ## is an extremely common pattern on wikis.
16369 !! test
16370 3. Categories and newlines: newline suppression for last list item should RT properly
16371 !! wikitext
16372 *a
16373 *b
16374
16375 [[Category:Foo]]
16376
16377 [[Category:Bar]]
16378 [[Category:Baz]]
16379
16380 :c
16381
16382 [[Category:C]]
16383
16384 ;d
16385
16386 [[Category:D]]
16387 !! html/parsoid
16388 <ul><li>a</li>
16389 <li>b</li></ul>
16390
16391 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16392
16393 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16394 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16395
16396 <dl><dd>c</dd></dl>
16397
16398 <link rel="mw:PageProp/Category" href="./Category:C"/>
16399
16400 <dl><dt>d</dt></dl>
16401
16402 <link rel="mw:PageProp/Category" href="./Category:D"/>
16403 !! end
16404
16405 !! test
16406 4. Categories and newlines: newline suppression for last list item should RT properly
16407 !! wikitext
16408 *a
16409 ****b
16410
16411 [[Category:Foo]]
16412 !! html/parsoid
16413 <ul><li>a
16414 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16415
16416 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16417 !! end
16418
16419 ## only wt2html for this to make sure the algo only applies to the rightmost path
16420 !! test
16421 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16422 !! options
16423 parsoid=wt2html
16424 !! wikitext
16425 *a
16426 **b
16427 [[Category:Foo]]
16428 *c
16429 **d
16430 [[Category:Foo]]
16431 !! html/parsoid
16432 <ul><li>a
16433 <ul><li>b
16434 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16435 <li>c
16436 <ul><li>d</li></ul></li></ul>
16437 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16438 !! end
16439
16440 ## We used to, but no longer wt2wt this test since the default serializer
16441 ## will normalize all categories to serialize on their own line.
16442 ## This wikitext usage is going to be fairly uncommon in production and
16443 ## selser will take care of preserving formatting in those scenarios.
16444 !! test
16445 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16446 !! options
16447 parsoid=wt2html
16448 !! wikitext
16449 *a [[Category:Foo]]
16450 !! html/parsoid
16451 <ul><li>a<link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
16452 !! end
16453
16454 # This test also demonstrates because of newline+category tunneling
16455 # through the list hander, template wrapping doesn't expand to the
16456 # containing list when the list item swallows the category.
16457 !! test
16458 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16459 !! wikitext
16460 *{{echo|a
16461 [[Category:Foo]]}}
16462 !! html/parsoid
16463 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
16464 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
16465 !! end
16466
16467 !! test
16468 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16469 !! wikitext
16470 *a
16471
16472 {{echo|[[Category:Foo]]
16473 [[Category:Bar]]}}
16474 [[Category:Baz]]
16475 !! html/parsoid
16476 <ul><li>a</li></ul>
16477
16478 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
16479 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16480 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16481 !! end
16482
16483 !! test
16484 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16485 !! wikitext
16486 *a
16487
16488 [[Category:Bar]]<!--boo1--> <!--boo2-->
16489 [[Category:Baz]]<!--boo3--> <!--boo4-->
16490 !! html/parsoid
16491 <ul><li>a</li></ul>
16492
16493 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16494 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16495 !! end
16496
16497 !! test
16498 Categories and newlines: should behave properly with linkprefix (T87753)
16499 !! options
16500 language=ar
16501 !! wikitext
16502 foo bar
16503 foo bar
16504 [[تصنيف:Foo]]
16505 [[تصنيف:Bar]]
16506 !! html/php
16507 <p>foo bar
16508 foo bar
16509 </p>
16510 !! html/parsoid
16511 <p>foo bar
16512 foo bar</p>
16513 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16514 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16515 !! end
16516
16517 !! test
16518 No regressions on internal links following category (T174639)
16519 !! options
16520 parsoid=wt2html,html2html
16521 !! wikitext
16522 [[Category:Foo]]<div>a
16523
16524 [[Foo]]</div>
16525 !! html/php
16526 <div>a
16527 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16528
16529 !! html/parsoid
16530 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16531
16532 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16533 !! end
16534
16535 # Note that Parsoid differs slightly from PHP due to T175421
16536 !! test
16537 11. Special case where only newlines separate links (T175416)
16538 !! options
16539 parsoid=wt2html,html2html
16540 !! wikitext
16541 [[Category:Foo]]
16542
16543 [[Foo]][[es:Alimento]]
16544
16545 [[Foo]]
16546 !! html/php
16547 <p><br />
16548 <a href="/wiki/Foo" title="Foo">Foo</a>
16549 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16550 </p>
16551 !! html/parsoid
16552 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16553
16554 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16555
16556 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16557 !! end
16558
16559 !! test
16560 Category links with multiple namespaces
16561 !! wikitext
16562 [[Category:Project:Foo]]
16563 !! html/parsoid
16564 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16565 !! end
16566
16567 !! test
16568 Parsoid: Serialize link to category page with colon escape
16569 !! options
16570 parsoid
16571 !! wikitext
16572
16573 [[:Category:Foo]]
16574 [[:Category:Foo|Bar]]
16575 !! html
16576 <p>
16577 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16578 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16579 </p>
16580 !! end
16581
16582 # We used to, but no longer wt2wt this test since the default serializer
16583 # will normalize all categories to serialize on their own line.
16584 # This wikitext usage is going to be fairly uncommon in production and
16585 # selser will take care of preventing whitespace insertion if this
16586 # occurs in an article.
16587 #
16588 # html2html disabled for the same reason (whitespace insertion between
16589 # x and y).
16590 #
16591 # html2wt disabled because it localizes the "Category" namespace.
16592 !! test
16593 Link prefix/suffixes aren't applied to category links
16594 !! options
16595 parsoid=wt2html
16596 language=is
16597 !! wikitext
16598 x[[Category:Foo]]y
16599 !! html/php
16600 <p>xy
16601 </p>
16602 !! html/parsoid
16603 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16604 !! end
16605
16606 !! test
16607 Link prefix/suffixes aren't applied to language links
16608 !! options
16609 parsoid=wt2html
16610 language=is
16611 !! wikitext
16612 x[[es:Foo]]y
16613 !! html/php
16614 <p>xy
16615 </p>
16616 !! html/parsoid
16617 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16618 !! end
16619
16620 !! test
16621 Parsoid: Serialize link to file page with colon escape
16622 !! options
16623 parsoid
16624 !! wikitext
16625
16626 [[:File:Foo.png]]
16627 [[:File:Foo.png|Bar]]
16628 !! html
16629 <p>
16630 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16631 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16632 </p>
16633 !! end
16634
16635 !! test
16636 Parsoid: Serialize a genuine category link without colon escape
16637 !! options
16638 parsoid
16639 !! wikitext
16640 [[Category:Foo]]
16641 [[Category:Foo|Bar]]
16642 !! html
16643 <link rel="mw:PageProp/Category" href="./Category:Foo">
16644 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16645 !! end
16646
16647 !! test
16648 Normalize hrefs properly before testing for invalid link targets (T72894)
16649 !! options
16650 parsoid=html2wt
16651 !! html/parsoid
16652 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16653 !! wikitext
16654 [[Category:Toxine bactérienne]]
16655 !! end
16656
16657 !! test
16658 Parsoid: Defaultsort
16659 !! wikitext
16660 {{DEFAULTSORT:Foo}}
16661 !! html/parsoid
16662 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16663 !! end
16664
16665 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16666 # But, this is a limitation of our representation and is documented in
16667 # TemplateHandler.js in processSpecialMagicWord
16668 !! test
16669 Parsoid: Defaultsort (template-generated)
16670 !! wikitext
16671 {{{{echo|DEFAULTSORT}}:Foo}}
16672 !! html/parsoid
16673 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
16674 !! end
16675
16676 ###
16677 ### Inter-language links
16678 ###
16679 !! test
16680 Interlanguage links
16681 !! options
16682 ill
16683 !! wikitext
16684 [[es:Alimento]]
16685 [[fr:Nourriture]]
16686 [[zh:食品]]
16687 !! html/php
16688 es:Alimento fr:Nourriture zh:食品
16689 !! html/parsoid
16690 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16691 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16692 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16693 !! end
16694
16695 !! test
16696 Duplicate interlanguage links (T26502)
16697 !! options
16698 ill
16699 !! wikitext
16700 [[es:1]]
16701 [[es:2]]
16702 [[fr:1]]
16703 [[fr:2]]
16704 !! html/php
16705 es:1 fr:1
16706 !! html/parsoid
16707 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16708 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16709 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16710 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16711 !! end
16712
16713 ###
16714 ### Sections
16715 ###
16716 !! test
16717 Basic section headings
16718 !! wikitext
16719 ==Headline 1==
16720 Some text
16721
16722 ==Headline 2==
16723 More
16724 ===Smaller headline===
16725 Blah blah
16726 !! html
16727 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16728 <p>Some text
16729 </p>
16730 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16731 <p>More
16732 </p>
16733 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16734 <p>Blah blah
16735 </p>
16736 !! end
16737
16738 !! test
16739 Section headings with TOC
16740 !! wikitext
16741 ==Headline 1==
16742 ===Subheadline 1===
16743 =====Skipping a level=====
16744 ======Skipping a level======
16745
16746 ==Headline 2==
16747 Some text
16748 ===Another headline===
16749 !! html
16750 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16751 <ul>
16752 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16753 <ul>
16754 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16755 <ul>
16756 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
16757 <ul>
16758 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
16759 </ul>
16760 </li>
16761 </ul>
16762 </li>
16763 </ul>
16764 </li>
16765 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16766 <ul>
16767 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16768 </ul>
16769 </li>
16770 </ul>
16771 </div>
16772
16773 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16774 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16775 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
16776 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16777 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16778 <p>Some text
16779 </p>
16780 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16781
16782 !! end
16783
16784 !! test
16785 TOC anchors don't collide
16786 !! wikitext
16787 __FORCETOC__
16788 ==Headline 2==
16789 ==Headline==
16790 ==Headline 2==
16791 ==Headline==
16792 !! html/php
16793 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16794 <ul>
16795 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16796 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16797 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16798 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16799 </ul>
16800 </div>
16801
16802 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16803 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16804 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16805 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16806
16807 !! end
16808
16809 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16810 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16811 !! test
16812 Handling of sections up to level 6 and beyond
16813 !! options
16814 parsoid=wt2html
16815 !! wikitext
16816 =Level 1 Heading=
16817 ==Level 2 Heading==
16818 ===Level 3 Heading===
16819 ====Level 4 Heading====
16820 =====Level 5 Heading=====
16821 ======Level 6 Heading======
16822 =======Level 7 Heading=======
16823 ========Level 8 Heading========
16824 =========Level 9 Heading=========
16825 ==========Level 10 Heading==========
16826 !! html/php
16827 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16828 <ul>
16829 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16830 <ul>
16831 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
16832 <ul>
16833 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
16834 <ul>
16835 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
16836 <ul>
16837 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
16838 <ul>
16839 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
16840 <li class="toclevel-6 tocsection-7"><a href="#.3DLevel_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">=Level 7 Heading=</span></a></li>
16841 <li class="toclevel-6 tocsection-8"><a href="#.3D.3DLevel_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">==Level 8 Heading==</span></a></li>
16842 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3DLevel_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">===Level 9 Heading===</span></a></li>
16843 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">====Level 10 Heading====</span></a></li>
16844 </ul>
16845 </li>
16846 </ul>
16847 </li>
16848 </ul>
16849 </li>
16850 </ul>
16851 </li>
16852 </ul>
16853 </li>
16854 </ul>
16855 </div>
16856
16857 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16858 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16859 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16860 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16861 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
16862 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16863 <h6><span class="mw-headline" id=".3DLevel_7_Heading.3D">=Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: =Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16864 <h6><span class="mw-headline" id=".3D.3DLevel_8_Heading.3D.3D">==Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: ==Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16865 <h6><span class="mw-headline" id=".3D.3D.3DLevel_9_Heading.3D.3D.3D">===Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: ===Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16866 <h6><span class="mw-headline" id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D">====Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ====Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16867
16868 !! html/parsoid
16869 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16870 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16871 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16872 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16873 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16874 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16875 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16876 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16877 <h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3DLevel_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
16878 <h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
16879 !! end
16880
16881 !! test
16882 TOC regression (T11764)
16883 !! wikitext
16884 ==title 1==
16885 ===title 1.1===
16886 ====title 1.1.1====
16887 ===title 1.2===
16888 ==title 2==
16889 ===title 2.1===
16890 !! html
16891 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16892 <ul>
16893 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16894 <ul>
16895 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
16896 <ul>
16897 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
16898 </ul>
16899 </li>
16900 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
16901 </ul>
16902 </li>
16903 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16904 <ul>
16905 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
16906 </ul>
16907 </li>
16908 </ul>
16909 </div>
16910
16911 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16912 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16913 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16914 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16915 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16916 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16917
16918 !! end
16919
16920 !! test
16921 TOC for heading containing <span id="..."></span> (T96153)
16922 !! wikitext
16923 __FORCETOC__
16924 ==<span id="old-anchor"></span>New title==
16925 !! html/php
16926 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16927 <ul>
16928 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16929 </ul>
16930 </div>
16931
16932 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16933
16934 !! end
16935
16936 !! test
16937 TOC with wgMaxTocLevel=3 (T8204)
16938 !! options
16939 wgMaxTocLevel=3
16940 !! wikitext
16941 ==title 1==
16942 ===title 1.1===
16943 ====title 1.1.1====
16944 ===title 1.2===
16945 ==title 2==
16946 ===title 2.1===
16947 !! html
16948 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16949 <ul>
16950 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16951 <ul>
16952 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
16953 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
16954 </ul>
16955 </li>
16956 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16957 <ul>
16958 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
16959 </ul>
16960 </li>
16961 </ul>
16962 </div>
16963
16964 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16965 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16966 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16967 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16968 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16969 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16970
16971 !! end
16972
16973 !! test
16974 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16975 !! options
16976 wgMaxTocLevel=3
16977 !! wikitext
16978 ==Section 1==
16979 ===Section 1.1===
16980 ====Section 1.1.1====
16981 ====Section 1.1.1.1====
16982 ==Section 2==
16983 !! html
16984 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
16985 <ul>
16986 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16987 <ul>
16988 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
16989 </ul>
16990 </li>
16991 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16992 </ul>
16993 </div>
16994
16995 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16996 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16997 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16998 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
16999 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17000
17001 !! end
17002
17003
17004 !! test
17005 Resolving duplicate section names
17006 !! wikitext
17007 ==Foo bar==
17008 ==Foo bar==
17009 !! html
17010 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17011 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17012
17013 !! end
17014
17015 !! test
17016 Resolving duplicate section names with differing case (T12721)
17017 !! wikitext
17018 ==Foo bar==
17019 ==Foo Bar==
17020 !! html
17021 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17022 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17023
17024 !! end
17025
17026 !! article
17027 Template:sections
17028 !! text
17029 ===Section 1===
17030 ==Section 2==
17031 !! endarticle
17032
17033 !! test
17034 Template with sections, __NOTOC__
17035 !! wikitext
17036 __NOTOC__
17037 ==Section 0==
17038 {{sections}}
17039 ==Section 4==
17040 !! html
17041 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17042 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
17043 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17044 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17045
17046 !! end
17047
17048 !! test
17049 __NOEDITSECTION__ keyword
17050 !! wikitext
17051 __NOEDITSECTION__
17052 ==Section 1==
17053 ==Section 2==
17054 !! html
17055 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17056 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17057
17058 !! end
17059
17060 !! test
17061 Link inside a section heading
17062 !! wikitext
17063 ==Section with a [[Main Page|link]] in it==
17064 !! html
17065 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17066
17067 !! end
17068
17069 !! test
17070 TOC regression (T14077)
17071 !! wikitext
17072 __TOC__
17073 ==title 1==
17074 ===title 1.1===
17075 ==title 2==
17076 !! html
17077 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17078 <ul>
17079 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17080 <ul>
17081 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
17082 </ul>
17083 </li>
17084 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17085 </ul>
17086 </div>
17087
17088 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17089 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
17090 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17091
17092 !! end
17093
17094 !! test
17095 T3219 URL next to image (good)
17096 !! wikitext
17097 http://example.com [[File:Foobar.jpg]]
17098 !! html/php
17099 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
17100 </p>
17101 !! html/parsoid
17102 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
17103 !!end
17104
17105 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17106 !! test
17107 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17108 !! options
17109 parsoid=wt2html,html2html
17110 !! wikitext
17111 ===
17112 The line above must have a trailing space!
17113 === <!--
17114 --> <!-- -->
17115 But just in case it doesn't...
17116 !! html/php
17117 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17118 <p>The line above must have a trailing space!
17119 </p>
17120 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17121 <p>But just in case it doesn't...
17122 </p>
17123 !! html/parsoid
17124 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17125 <p>The line above must have a trailing space!</p>
17126 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17127 --> <!-- -->
17128 <p>But just in case it doesn't...</p>
17129 !! end
17130
17131 !! test
17132 Header with special characters (T27462)
17133 !! wikitext
17134 The tooltips shall not show entities to the user (ie. be double escaped)
17135
17136 ==text > text==
17137 section 1
17138
17139 ==text < text==
17140 section 2
17141
17142 ==text & text==
17143 section 3
17144
17145 ==text ' text==
17146 section 4
17147
17148 ==text " text==
17149 section 5
17150 !! html/php
17151 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17152 </p>
17153 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17154 <ul>
17155 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
17156 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
17157 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
17158 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17159 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17160 </ul>
17161 </div>
17162
17163 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17164 <p>section 1
17165 </p>
17166 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17167 <p>section 2
17168 </p>
17169 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17170 <p>section 3
17171 </p>
17172 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text &#039; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17173 <p>section 4
17174 </p>
17175 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17176 <p>section 5
17177 </p>
17178 !! html/parsoid
17179 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17180
17181 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17182 <p>section 1</p>
17183
17184 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17185 <p>section 2</p>
17186
17187 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17188 <p>section 3</p>
17189
17190 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17191 <p>section 4</p>
17192
17193 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17194 <p>section 5</p>
17195 !! end
17196
17197 !! test
17198 Header with space, plus and underscore as entity
17199 !! wikitext
17200 Id should not contain + for spaces
17201
17202 ==Space between Text==
17203 section 1
17204
17205 ==Space-Entity&#32;between&#32;Text==
17206 section 2
17207
17208 ==Plus+between+Text==
17209 section 3
17210
17211 ==Plus-Entity&#43;between&#43;Text==
17212 section 4
17213
17214 ==Underscore_between_Text==
17215 section 5
17216
17217 ==Underscore-Entity&#95;between&#95;Text==
17218 section 6
17219
17220 [[#Space between Text]]
17221 [[#Space-Entity&#32;between&#32;Text]]
17222 [[#Plus+between+Text]]
17223 [[#Plus-Entity&#43;between&#43;Text]]
17224 [[#Underscore_between_Text]]
17225 [[#Underscore-Entity&#95;between&#95;Text]]
17226 !! html/php
17227 <p>Id should not contain + for spaces
17228 </p>
17229 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17230 <ul>
17231 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
17232 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
17233 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
17234 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
17235 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
17236 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
17237 </ul>
17238 </div>
17239
17240 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17241 <p>section 1
17242 </p>
17243 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17244 <p>section 2
17245 </p>
17246 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17247 <p>section 3
17248 </p>
17249 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17250 <p>section 4
17251 </p>
17252 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17253 <p>section 5
17254 </p>
17255 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17256 <p>section 6
17257 </p><p><a href="#Space_between_Text">#Space between Text</a>
17258 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17259 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17260 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17261 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17262 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17263 </p>
17264 !! html/parsoid
17265 <p>Id should not contain + for spaces</p>
17266
17267 <h2 id="Space_between_Text">Space between Text</h2>
17268 <p>section 1</p>
17269
17270 <h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>Text</h2>
17271 <p>section 2</p>
17272
17273 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17274 <p>section 3</p>
17275
17276 <h2 id="Plus-Entity+between+Text"><span id="Plus-Entity.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>Text</h2>
17277 <p>section 4</p>
17278
17279 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17280 <p>section 5</p>
17281
17282 <h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>Text</h2>
17283 <p>section 6</p>
17284
17285 <p><a rel="mw:WikiLink" href="./Main_Page#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
17286 <a rel="mw:WikiLink" href="./Main_Page#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
17287 <a rel="mw:WikiLink" href="./Main_Page#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
17288 <a rel="mw:WikiLink" href="./Main_Page#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
17289 <a rel="mw:WikiLink" href="./Main_Page#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
17290 <a rel="mw:WikiLink" href="./Main_Page#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
17291 !! end
17292
17293 # Parsoid html2wt disabled because it adds padding spaces around =
17294 !! test
17295 Headers with excess '=' characters
17296 (Are similar tests necessary beyond the 1st level?)
17297 !! options
17298 parsoid=wt2html,wt2wt,html2html
17299 !! wikitext
17300 =foo==
17301 ==foo=
17302 =''italic'' heading==
17303 ==''italic'' heading=
17304 !! html/php
17305 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17306 <ul>
17307 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17308 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17309 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
17310 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
17311 </ul>
17312 </div>
17313
17314 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17315 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17316 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17317 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17318
17319 !! html/parsoid
17320 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17321 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17322 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17323 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17324 !! end
17325
17326 !! test
17327 HTML headers vs TOC (T25393)
17328 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17329 !! wikitext
17330 <h1>Header 1</h1>
17331 ==Header 1.1==
17332 ==Header 1.2==
17333
17334 <h1>Header 2
17335 </h1>
17336 ==Header 2.1==
17337 ==Header 2.2==
17338 __NOEDITSECTION__
17339 !! html/php
17340 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17341 <ul>
17342 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17343 <ul>
17344 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
17345 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
17346 </ul>
17347 </li>
17348 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17349 <ul>
17350 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
17351 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
17352 </ul>
17353 </li>
17354 </ul>
17355 </div>
17356
17357 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17358 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17359 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17360 <h1><span class="mw-headline" id="Header_2">Header 2
17361 </span></h1>
17362 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17363 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17364
17365 !! html/parsoid
17366 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17367 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17368 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17369
17370 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17371 </h1>
17372 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17373 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17374 <meta property="mw:PageProp/noeditsection"/>
17375 !! end
17376
17377 !! test
17378 Single-line or multiline-comments can follow headings
17379 !! options
17380 parsoid=wt2html,wt2wt
17381 !! wikitext
17382 ==foo==<!---->
17383 ==bar==<!--c1-->
17384 ==baz==<!--
17385 c2
17386 c3-->
17387 !! html/php
17388 <h2><span class="mw-headline" id="foo">foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17389 <h2><span class="mw-headline" id="bar">bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17390 <h2><span class="mw-headline" id="baz">baz</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: baz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17391
17392 !! html/parsoid
17393 <h2 id="foo">foo</h2><!---->
17394 <h2 id="bar">bar</h2><!--c1-->
17395 <h2 id="baz">baz</h2><!--
17396 c2
17397 c3-->
17398 !! end
17399
17400 !! test
17401 T3219 URL next to image (broken)
17402 !! wikitext
17403 http://example.com[[File:Foobar.jpg]]
17404 !! html/php
17405 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
17406 </p>
17407 !! html/parsoid
17408 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
17409 !!end
17410
17411 !! test
17412 T3186 news: in the middle of text
17413 !! wikitext
17414 http://en.wikinews.org/wiki/Wikinews:Workplace
17415 !! html
17416 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17417 </p>
17418 !!end
17419
17420
17421 !! test
17422 Namespaced link must have a title
17423 !! wikitext
17424 [[Project:]]
17425 !! html
17426 <p>[[Project:]]
17427 </p>
17428 !!end
17429
17430 !! test
17431 Namespaced link must have a title (bad fragment version)
17432 !! wikitext
17433 [[Project:#fragment]]
17434 !! html
17435 <p>[[Project:#fragment]]
17436 </p>
17437 !!end
17438
17439
17440 ###
17441 ### HTML tags and HTML attributes
17442 ###
17443
17444 !! test
17445 div with no attributes
17446 !! wikitext
17447 <div>HTML rocks</div>
17448 !! html
17449 <div>HTML rocks</div>
17450
17451 !! end
17452
17453 !! test
17454 div with double-quoted attribute
17455 !! wikitext
17456 <div id="rock">HTML rocks</div>
17457 !! html
17458 <div id="rock">HTML rocks</div>
17459
17460 !! end
17461
17462 !! test
17463 div with single-quoted attribute
17464 !! wikitext
17465 <div id='rock'>HTML rocks</div>
17466 !! html
17467 <div id="rock">HTML rocks</div>
17468
17469 !! end
17470
17471 !! test
17472 div with unquoted attribute
17473 !! wikitext
17474 <div id=rock>HTML rocks</div>
17475 !! html
17476 <div id="rock">HTML rocks</div>
17477
17478 !! end
17479
17480 !! test
17481 div with illegal double attributes
17482 !! wikitext
17483 <div id="a" id="b">HTML rocks</div>
17484 !! html
17485 <div id="b">HTML rocks</div>
17486
17487 !!end
17488
17489 !! test
17490 div with empty attribute value, space before equals
17491 !! options
17492 parsoid=wt2html,html2html
17493 !! wikitext
17494 <div class =>HTML rocks</div>
17495 !! html/php
17496 <div class="">HTML rocks</div>
17497
17498 !! html/parsoid
17499 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17500 !! end
17501
17502 !! test
17503 div with multiple empty attribute values
17504 !! config
17505 wgFragmentMode=[ 'html5', 'legacy' ]
17506 !! options
17507 parsoid=wt2html,html2html
17508 !! wikitext
17509 <div id= title=>HTML rocks</div>
17510 !! html/php
17511 <div id="title=">HTML rocks</div>
17512
17513 !! html/parsoid
17514 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17515 !! end
17516
17517 # FIXME Parsoid doesn't actually match PHP here.
17518 # Probably we should use the synthetic <foo /> or <indicator>
17519 # extensions for this test, which are enabled when running parser tests.
17520 !! test
17521 Extension tag in attribute value
17522 !! wikitext
17523 <span title="<translate>123</translate>">ok</span>
17524 !! html/php+disabled
17525 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17526 </p>
17527 !! html/parsoid
17528 <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"&lt;translate>123&lt;/translate>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;translate typeof=\"mw:Extension/translate\" about=\"#mwt3\" data-parsoid=&apos;{\"dsr\":[13,39,2,2]}&apos; data-mw=&apos;{\"name\":\"translate\",\"attrs\":{},\"body\":{\"extsrc\":\"123\"}}&apos;>123&lt;/translate>"}]]}'>ok</span></p>
17529 !! end
17530
17531 !! test
17532 table with multiple empty attribute values
17533 !! options
17534 parsoid=wt2html,html2html
17535 !! wikitext
17536 {| title= id=
17537 |hi
17538 |}
17539 !! html/php
17540 <table title="id=">
17541 <tr>
17542 <td>hi
17543 </td></tr></table>
17544
17545 !! html/parsoid
17546 <table title="id=">
17547 <tbody><tr><td>hi</td></tr>
17548 </tbody></table>
17549 !! end
17550
17551 !! test
17552 div with braces in attribute value
17553 !! wikitext
17554 <div title="{}">Foo</div>
17555 !! html/php
17556 <div title="&#123;&#125;">Foo</div>
17557
17558 !! html/parsoid
17559 <div title="{}">Foo</div>
17560 !! end
17561
17562 !! test
17563 div with empty attribute value, no space before equals
17564 !! options
17565 parsoid=wt2html,html2html
17566 !! wikitext
17567 <div class=>HTML rocks</div>
17568 !! html/php
17569 <div class="">HTML rocks</div>
17570
17571 !! html/parsoid
17572 <div class="">HTML rocks</div>
17573 !! end
17574
17575 !! test
17576 HTML multiple attributes correction
17577 !! wikitext
17578 <p class="error" class="awesome">Awesome!</p>
17579 !! html
17580 <p class="awesome">Awesome!</p>
17581
17582 !!end
17583
17584 !! test
17585 Table multiple attributes correction
17586 !! wikitext
17587 {|
17588 !+ class="error" class="awesome"|status
17589 |}
17590 !! html
17591 <table>
17592 <tr>
17593 <th class="awesome">status
17594 </th></tr></table>
17595
17596 !!end
17597
17598 !! test
17599 DIV IN UPPERCASE
17600 !! wikitext
17601 <DIV ID="x">HTML ROCKS</DIV>
17602 !! html
17603 <div id="x">HTML ROCKS</div>
17604
17605 !!end
17606
17607 !! test
17608 Non-ASCII pseudo-tags are rendered as text
17609 !! wikitext
17610 <khyô>
17611 !! html
17612 <p>&lt;khyô&gt;
17613 </p>
17614 !! end
17615
17616 !! test
17617 Pseudo-tag with URL 'name' renders as url link
17618 !! wikitext
17619 <http://example.com/>
17620 !! html
17621 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17622 </p>
17623 !! end
17624
17625 !! test
17626 text with amp in the middle of nowhere
17627 !! wikitext
17628 Remember AT&T?
17629 !! html
17630 <p>Remember AT&amp;T?
17631 </p>
17632 !! end
17633
17634 !! test
17635 text with character entity: eacute
17636 !! wikitext
17637 I always thought &eacute; was a cute letter.
17638 !! html+tidy
17639 <p>I always thought &#233; was a cute letter.
17640 </p>
17641 !! end
17642
17643 !! test
17644 text with entity-escaped character entity-like string: eacute
17645 !! wikitext
17646 I always thought &amp;eacute; was a cute letter.
17647 !! html
17648 <p>I always thought &amp;eacute; was a cute letter.
17649 </p>
17650 !! end
17651
17652 !! test
17653 text with undefined character entity: xacute
17654 !! wikitext
17655 I always thought &xacute; was a cute letter.
17656 !! html
17657 <p>I always thought &amp;xacute; was a cute letter.
17658 </p>
17659 !! end
17660
17661 !! test
17662 HTML5 tags
17663 !! wikitext
17664 <data value="5">five</data>
17665 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17666 <mark>This highlighted text</mark>
17667 !! html
17668 <p><data value="5">five</data>
17669 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17670 <mark>This highlighted text</mark>
17671 </p>
17672 !! end
17673
17674 !! test
17675 HTML tag with leading space is parsed as text
17676 !! wikitext
17677 < div>foo< /div>
17678 !! html
17679 <p>&lt; div&gt;foo&lt; /div&gt;
17680 </p>
17681 !! end
17682
17683 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17684 ## the HTML5 parsing spec.
17685 !! test
17686 Element with broken attribute syntax
17687 !! options
17688 parsoid=wt2html
17689 !! wikitext
17690 <div style=" style="123">hi</div>
17691 <div =>ho</div>
17692 !! html/php
17693 <div style="123">hi</div>
17694 <div>ho</div>
17695
17696 !! html/parsoid
17697 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17698 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17699 !! end
17700
17701 ###
17702 ### Nesting tests (see T43545, T52604, T53081)
17703 ###
17704
17705 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17706 # Note that html2wt is considerably more difficult if we use <b> in
17707 # the test case, instead of <small>
17708 !! test
17709 Ensure that HTML adoption agency algorithm is properly implemented.
17710 !! wikitext
17711 <small>X<small>Y</small>Z</small>
17712 !! html
17713 <p><small>X<small>Y</small>Z</small>
17714 </p>
17715 !! end
17716
17717 # This was T43545 in the PHP parser.
17718 !! test
17719 Nesting of <kbd>
17720 !! wikitext
17721 <kbd>X<kbd>Y</kbd>Z</kbd>
17722 !! html+tidy
17723 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17724 </p>
17725 !! end
17726
17727 # The following cases were T53081 in the PHP parser.
17728 # Note that there are some other nestable tags (b, i, etc) which are
17729 # not covered; see T53081 for discussion.
17730
17731 !! test
17732 Nesting of <em>
17733 !! wikitext
17734 <em>X<em>Y</em>Z</em>
17735 !! html+tidy
17736 <p><em>X<em>Y</em>Z</em>
17737 </p>
17738 !! end
17739
17740 !! test
17741 Nesting of <strong>
17742 !! wikitext
17743 <strong>X<strong>Y</strong>Z</strong>
17744 !! html+tidy
17745 <p><strong>X<strong>Y</strong>Z</strong>
17746 </p>
17747 !! end
17748
17749 !! test
17750 Nesting of <q>
17751 !! wikitext
17752 <q>X<q>Y</q>Z</q>
17753 !! html+tidy
17754 <p><q>X<q>Y</q>Z</q>
17755 </p>
17756 !! end
17757
17758 !! test
17759 Nesting of <ruby>
17760 !! wikitext
17761 <ruby>X<ruby>Y</ruby>Z</ruby>
17762 !! html
17763 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17764 </p>
17765 !! end
17766
17767 !! test
17768 Nesting of <bdo>
17769 !! wikitext
17770 <bdo>X<bdo>Y</bdo>Z</bdo>
17771 !! html
17772 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17773 </p>
17774 !! end
17775
17776
17777 ###
17778 ### Media links
17779 ###
17780
17781 !! test
17782 Media link
17783 !! wikitext
17784 [[Media:Foobar.jpg]]
17785 [[Media:Video.ogv]]
17786 [[:Media:Video.ogv]]
17787 !! html/php
17788 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17789 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17790 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17791 </p>
17792 !! html/parsoid
17793 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17794 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17795 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv" data-parsoid='{"a":{"resource":"./Media:Video.ogv"},"sa":{"resource":":Media:Video.ogv"}}'>Media:Video.ogv</a></p>
17796 !! end
17797
17798 !! test
17799 Media link with text
17800 !! wikitext
17801 [[Media:Foobar.jpg|A neat file to look at]]
17802 !! html/php
17803 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17804 </p>
17805 !! html/parsoid
17806 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17807 !! end
17808
17809 !! test
17810 Localized media link
17811 !! options
17812 language=is
17813 !! wikitext
17814 [[Miðill:Foobar.jpg]]
17815
17816 [[Miðill:Foobar.jpg|Icelandic]]
17817 !! html/php
17818 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
17819 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
17820 </p>
17821 !! html/parsoid
17822 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Miðill:Foobar.jpg</a></p>
17823 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
17824 !! end
17825
17826 # FIXME: this is still bad HTML tag nesting
17827 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17828 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17829 !! test
17830 Media link with nasty text
17831 !! options
17832 parsoid=wt2html,html2html
17833 !! wikitext
17834 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17835 !! html/php
17836 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
17837
17838 !! html/php+tidy
17839 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
17840 !! html/parsoid
17841 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Safe Link</a></p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg"><div style="display:none" data-parsoid='{"stx":"html"}'>" onmouseover="alert(document.cookie)" onfoo="</div></a>
17842 !! end
17843
17844 !! test
17845 Media link from missing resource (parsoid-only)
17846 !! options
17847 parsoid=html2wt
17848 !! html/parsoid
17849 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
17850 !! wikitext
17851 [[Media:Foobar.jpg|Bat!]]
17852 !! end
17853
17854 !! test
17855 Media link from missing resource, localized (parsoid-only)
17856 !! options
17857 parsoid=html2wt
17858 language=is
17859 !! html/parsoid
17860 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
17861 !! wikitext
17862 [[Miðill:Foobar.jpg|Bat!]]
17863 !! end
17864
17865 # This is a sanity test to ensure we don't crash or choke when given
17866 # old cached 1.7.0 HTML for media links; we don't require that the
17867 # result be "valid" because wt2wt was completely broken in 1.7.0
17868 !! test
17869 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
17870 !! options
17871 parsoid=html2wt
17872 !! html/parsoid
17873 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
17874 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17875 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
17876 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17877 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
17878 !! wikitext
17879 This is what Parsoid would emit (and we still handle this HTML fine):
17880
17881 [[Media:Foobar.jpg|A neat file to look at]]
17882
17883 But VisualEditor would mangle the rel attribute, and give us back this:
17884
17885 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
17886
17887 But at least we don't crash when trying to handle the mangled HTML!
17888 !! end
17889
17890 !! test
17891 Media link to nonexistent file (T3702)
17892 !! wikitext
17893 [[Media:No such.jpg]]
17894 [[Media:No_such file.jpg]]
17895 !! html/php
17896 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17897 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
17898 </p>
17899 !! html/parsoid
17900 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" resource="./Media:No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"resource":"./Media:No_such.jpg"},"sa":{"resource":"Media:No such.jpg"}}'>Media:No such.jpg</a>
17901 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" resource="./Media:No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"resource":"./Media:No_such_file.jpg"},"sa":{"resource":"Media:No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17902 !! end
17903
17904 !! test
17905 Image link to nonexistent file (T3850 - good)
17906 !! wikitext
17907 [[File:No_such.jpg]]
17908 !! html/php
17909 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
17910 </p>
17911 !! html/parsoid
17912 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></figure-inline></p>
17913 !! end
17914
17915 !! test
17916 :Image link to nonexistent file (T3850 - bad)
17917 !! wikitext
17918 [[:Image:No such.jpg]]
17919 !! html/php
17920 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
17921 </p>
17922 !! html/parsoid
17923 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17924 !! end
17925
17926 !! test
17927 Character reference normalization in link text (T3938)
17928 !! wikitext
17929 [[Main Page|this&that]]
17930 !! html
17931 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17932 </p>
17933 !!end
17934
17935 !! article
17936 אַ
17937 !! text
17938 Test for unicode normalization
17939
17940 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17941 !! endarticle
17942
17943 !! test
17944 (T21451) Links should refer to the normalized form.
17945 !! wikitext
17946 [[&#xFB2E;]]
17947 [[&#x5d0;&#x5b7;]]
17948 [[&#x5d0;ַ]]
17949 [[א&#x5b7;]]
17950 [[אַ]]
17951 !! html
17952 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17953 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17954 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17955 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17956 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17957 </p>
17958 !! end
17959
17960 !! test
17961 Empty attribute crash test (T4067)
17962 !! wikitext
17963 <font color="">foo</font>
17964 !! html
17965 <p><font color="">foo</font>
17966 </p>
17967 !! end
17968
17969 !! test
17970 Empty attribute crash test single-quotes (T4067)
17971 !! wikitext
17972 <font color=''>foo</font>
17973 !! html
17974 <p><font color="">foo</font>
17975 </p>
17976 !! end
17977
17978 !! test
17979 Attribute test: equals, then nothing
17980 !! options
17981 parsoid=wt2html,html2html
17982 !! wikitext
17983 <font color=>foo</font>
17984 !! html/php
17985 <p><font color="">foo</font>
17986 </p>
17987 !! html/parsoid
17988 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17989 !! end
17990
17991 !! test
17992 Attribute test: unquoted value
17993 !! options
17994 parsoid=wt2html,html2html
17995 !! wikitext
17996 <font color=x>foo</font>
17997 !! html/php
17998 <p><font color="x">foo</font>
17999 </p>
18000 !! html/parsoid
18001 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18002 !! end
18003
18004 !! test
18005 Attribute test: unquoted but illegal value (hash)
18006 !! wikitext
18007 <font color=#x>foo</font>
18008 !! html
18009 <p><font color="#x">foo</font>
18010 </p>
18011 !! end
18012
18013 # Parsoid does not serialize to empty attribute syntax,
18014 # so wt2wt and html2wt cases are skipped
18015 !! test
18016 Attribute test: no value (T54330)
18017 !! options
18018 parsoid=wt2html,html2html
18019 !! wikitext
18020 <font color>foo</font>
18021 !! html/php
18022 <p><font color="">foo</font>
18023 </p>
18024 !! html/parsoid
18025 <p><font color="">foo</font></p>
18026 !! end
18027
18028 !! test
18029 T4095: link with three closing brackets
18030 !! wikitext
18031 [[Main Page]]]
18032 !! html/php
18033 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18034 </p>
18035 !! html/parsoid
18036 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18037 !! end
18038
18039 !! test
18040 T4095: link with pipe and three closing brackets
18041 !! wikitext
18042 [[Main Page|link]]]
18043 !! html/php
18044 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18045 </p>
18046 !! html/parsoid
18047 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18048 !! end
18049
18050 !! test
18051 T4095: link with pipe and three closing brackets, version 2
18052 !! wikitext
18053 [[Main Page|[http://example.com/]]]
18054 !! html/php
18055 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18056 </p>
18057 !! html/parsoid
18058 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18059 !! end
18060
18061
18062 ###
18063 ### Safety
18064 ###
18065
18066 !! article
18067 Template:Dangerous attribute
18068 !! text
18069 " onmouseover="alert(document.cookie)
18070 !! endarticle
18071
18072 !! article
18073 Template:Dangerous style attribute
18074 !! text
18075 border-size: expression(alert(document.cookie))
18076 !! endarticle
18077
18078 !! article
18079 Template:Div style
18080 !! text
18081 <div style="float: right; {{{1}}}">Magic div</div>
18082 !! endarticle
18083
18084 !! test
18085 T4304: HTML attribute safety (safe template; regression T4309)
18086 !! wikitext
18087 <div title="{{test}}"></div>
18088 !! html/php
18089 <div title="This is a test template"></div>
18090
18091 !! html/parsoid
18092 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
18093 !! end
18094
18095 # Parsoid has enough context to handle this case
18096 !! test
18097 T4304: HTML attribute safety (dangerous template; 2309)
18098 !! wikitext
18099 <div title="{{dangerous attribute}}"></div>
18100 !! html/php
18101 <div title=""></div>
18102
18103 !! html/parsoid
18104 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
18105 !! end
18106
18107 !! test
18108 T4304: HTML attribute safety (dangerous style template; 2309)
18109 !! wikitext
18110 <div style="{{dangerous style attribute}}"></div>
18111 !! html/php
18112 <div style="/* insecure input */"></div>
18113
18114 !! html/parsoid
18115 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
18116 !! end
18117
18118 !! test
18119 T4304: HTML attribute safety (safe parameter; 2309)
18120 !! wikitext
18121 {{div style|width: 200px}}
18122 !! html/php
18123 <div style="float: right; width: 200px">Magic div</div>
18124
18125 !! html/parsoid
18126 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
18127 !! end
18128
18129 !! test
18130 T4304: HTML attribute safety (unsafe parameter; 2309)
18131 !! wikitext
18132 {{div style|width: expression(alert(document.cookie))}}
18133 !! html/php
18134 <div style="/* insecure input */">Magic div</div>
18135
18136 !! html/parsoid
18137 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
18138 !! end
18139
18140 ## Parsoid output here differs; needs investigation.
18141 !! test
18142 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18143 !! wikitext
18144 {{div style|"><script>alert(document.cookie)</script>}}
18145 !! html
18146 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18147
18148 !! end
18149
18150 ## Parsoid output here differs; needs investigation.
18151 !! test
18152 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18153 !! wikitext
18154 {{div style|" ><script>alert(document.cookie)</script>}}
18155 !! html
18156 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18157
18158 !! end
18159
18160 !! test
18161 T4304: HTML attribute safety (link)
18162 !! wikitext
18163 <div title="[[Main Page]]"></div>
18164 !! html/php
18165 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18166
18167 !! html/parsoid
18168 <div title="[[Main Page]]"></div>
18169 !! end
18170
18171 !! test
18172 T4304: HTML attribute safety (italics)
18173 !! wikitext
18174 <div title="''foobar''"></div>
18175 !! html
18176 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18177
18178 !! end
18179
18180 !! test
18181 T4304: HTML attribute safety (bold)
18182 !! wikitext
18183 <div title="'''foobar'''"></div>
18184 !! html
18185 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18186
18187 !! end
18188
18189 !! test
18190 T4304: HTML attribute safety (ISBN)
18191 !! wikitext
18192 <div title="ISBN 1234567890"></div>
18193 !! html
18194 <div title="&#73;SBN 1234567890"></div>
18195
18196 !! end
18197
18198 !! test
18199 T4304: HTML attribute safety (RFC)
18200 !! wikitext
18201 <div title="RFC 1234"></div>
18202 !! html
18203 <div title="&#82;FC 1234"></div>
18204
18205 !! end
18206
18207 !! test
18208 T4304: HTML attribute safety (PMID)
18209 !! wikitext
18210 <div title="PMID 1234567890"></div>
18211 !! html
18212 <div title="&#80;MID 1234567890"></div>
18213
18214 !! end
18215
18216 !! test
18217 T4304: HTML attribute safety (web link)
18218 !! wikitext
18219 <div title="http://example.com/"></div>
18220 !! html
18221 <div title="http&#58;//example.com/"></div>
18222
18223 !! end
18224
18225 !! test
18226 T4304: HTML attribute safety (named web link)
18227 !! wikitext
18228 <div title="[http://example.com/ link]"></div>
18229 !! html/php
18230 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18231
18232 !! html/parsoid
18233 <div title="[http://example.com/ link]"></div>
18234 !! end
18235
18236 !! test
18237 T5244: HTML attribute safety (extension; safe)
18238 !! wikitext
18239 <div style="<nowiki>background:blue</nowiki>"></div>
18240 !! html/php
18241 <div style="background:blue"></div>
18242
18243 !! html/parsoid
18244 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18245 !! end
18246
18247 !! test
18248 T5244: HTML attribute safety (extension; unsafe)
18249 !! wikitext
18250 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18251 !! html/php
18252 <div style="/* insecure input */"></div>
18253
18254 !! html/parsoid
18255 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
18256 !! end
18257
18258 # More MSIE fun discovered by Tom Gilder
18259
18260 !! test
18261 MSIE CSS safety test: spurious slash
18262 !! wikitext
18263 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18264 !! html/php
18265 <div style="/* insecure input */">evil</div>
18266
18267 !! html/parsoid
18268 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18269 !! end
18270
18271 !! test
18272 MSIE CSS safety test: hex code
18273 !! wikitext
18274 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18275 !! html/php
18276 <div style="/* insecure input */">evil</div>
18277
18278 !! html/parsoid
18279 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18280 !! end
18281
18282 !! test
18283 MSIE CSS safety test: comment in url
18284 !! wikitext
18285 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18286 !! html/php
18287 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18288
18289 !! html/parsoid
18290 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18291 !! end
18292
18293 !! test
18294 MSIE CSS safety test: comment in expression
18295 !! wikitext
18296 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18297 !! html/php
18298 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18299
18300 !! html/parsoid
18301 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
18302 !! end
18303
18304 !! test
18305 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18306 !! wikitext
18307 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18308 !! html/php
18309 <p style="/* invalid control char */">A</p>
18310
18311 !! html/parsoid
18312 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
18313 !! end
18314
18315 !! test
18316 MSIE 6 CSS safety test: Fullwidth (T57332)
18317 !! wikitext
18318 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18319 <div style="top:EXPRESSION(alert())">B</div>
18320 !! html/php
18321 <p style="/* insecure input */">A</p>
18322 <div style="/* insecure input */">B</div>
18323
18324 !! html/parsoid
18325 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
18326 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18327 !! end
18328
18329 !! test
18330 MSIE 6 CSS safety test: IPA extensions (T57332)
18331 !! wikitext
18332 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18333 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18334 !! html/php
18335 <div style="/* insecure input */">A</div>
18336 <p style="/* insecure input */">B</p>
18337
18338 !! html/parsoid
18339 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18340 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18341 !! end
18342
18343 !! test
18344 MSIE 6 CSS safety test: sup/sub script (T57332)
18345 !! wikitext
18346 <div style="background-image:url⁽javascript:alert())">A</div>
18347 <div style="background-image:url₍javascript:alert())">B</div>
18348 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18349 !! html/php
18350 <div style="/* insecure input */">A</div>
18351 <div style="/* insecure input */">B</div>
18352 <p style="/* insecure input */">C</p>
18353
18354 !! html/parsoid
18355 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18356 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18357 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18358 !! end
18359
18360 !! test
18361 Opera -o-link CSS
18362 !! options
18363 parsoid=wt2html,html2html
18364 !! wikitext
18365 <div
18366 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
18367 style="-o-link:attr(title);-o-link-source:current">X</div>
18368 !! html/php
18369 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18370
18371 !! html/parsoid
18372 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
18373 !! end
18374
18375 !! test
18376 MSIE 6 CSS safety test: Repetition markers (T57332)
18377 !! wikitext
18378 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18379 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18380 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18381 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18382 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18383 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18384 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18385 !! html/php
18386 <p style="/* insecure input */">A</p>
18387 <p style="/* insecure input */">B</p>
18388 <p style="/* insecure input */">C</p>
18389 <p style="/* insecure input */">D</p>
18390 <p style="/* insecure input */">E</p>
18391 <p style="/* insecure input */">F</p>
18392 <p style="/* insecure input */">G</p>
18393
18394 !! html/parsoid
18395 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
18396 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18397 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18398 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
18399 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
18400 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
18401 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
18402 !! end
18403
18404 !! test
18405 Table attribute legitimate extension
18406 !! wikitext
18407 {|
18408 !+ style="<nowiki>color:blue</nowiki>"|status
18409 |}
18410 !! html
18411 <table>
18412 <tr>
18413 <th style="color:blue">status
18414 </th></tr></table>
18415
18416 !!end
18417
18418 !! test
18419 Table attribute safety
18420 !! wikitext
18421 {|
18422 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18423 |}
18424 !! html
18425 <table>
18426 <tr>
18427 <th style="/* insecure input */">status
18428 </th></tr></table>
18429
18430 !! end
18431
18432 !! test
18433 CSS line continuation 1
18434 !! wikitext
18435 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18436 !! html
18437 <div style="/* insecure input */"></div>
18438
18439 !! end
18440
18441 !! test
18442 CSS line continuation 2
18443 !! wikitext
18444 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18445 !! html
18446 <div style="/* invalid control char */"></div>
18447
18448 !! end
18449
18450 !! article
18451 Template:Identity
18452 !! text
18453 {{{1}}}
18454 !! endarticle
18455
18456 !! test
18457 Expansion of multi-line templates in attribute values (T8255)
18458 !! wikitext
18459 <div style="background: {{identity|#00FF00}}">-</div>
18460 !! html
18461 <div style="background: #00FF00">-</div>
18462
18463 !! end
18464
18465 !! test
18466 Expansion of multi-line templates in attribute values (T8255 sanity check)
18467 !! wikitext
18468 <div style="background:
18469 #00FF00">-</div>
18470 !! html/php
18471 <div style="background: #00FF00">-</div>
18472
18473 !! html/parsoid
18474 <div style="background:
18475 #00FF00">-</div>
18476 !! end
18477
18478 !! test
18479 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18480 !! wikitext
18481 <div style="background: &#10;#00FF00">-</div>
18482 !! html
18483 <div style="background: &#10;#00FF00">-</div>
18484
18485 !! end
18486
18487 !! test
18488 Tags which are hidden from tidiers cannot pass through the Sanitizer
18489 !! wikitext
18490 <mw:toc><script>alert();</script></mw:toc>
18491 !! html+tidy
18492 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18493 </p>
18494 !! end
18495
18496 ###
18497 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18498 ###
18499
18500 !! test
18501 Parser hook: empty input
18502 !! wikitext
18503 <tag></tag>
18504 !! html/php
18505 <pre>
18506 ''
18507 array (
18508 )
18509 </pre>
18510
18511 !! html/parsoid
18512 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18513 !! end
18514
18515 ## Don't expect parsoid to rt this form.
18516 !! test
18517 Parser hook: empty input using terminated empty elements
18518 !! options
18519 parsoid=wt2html,html2html
18520 !! wikitext
18521 <tag/>
18522 !! html/php
18523 <pre>
18524 NULL
18525 array (
18526 )
18527 </pre>
18528
18529 !! html/parsoid
18530 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18531 !! end
18532
18533 !! test
18534 Parser hook: empty input using terminated empty elements (space before)
18535 !! wikitext
18536 <tag />
18537 !! html/php
18538 <pre>
18539 NULL
18540 array (
18541 )
18542 </pre>
18543
18544 !! html/parsoid
18545 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18546 !! end
18547
18548 !! test
18549 Parser hook: basic input
18550 !! wikitext
18551 <tag>input</tag>
18552 !! html/php
18553 <pre>
18554 'input'
18555 array (
18556 )
18557 </pre>
18558
18559 !! html/parsoid
18560 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18561 !! end
18562
18563 ## Don't expect parsoid to rt this form.
18564 !! test
18565 Parser hook: case insensitive
18566 !! options
18567 parsoid=wt2html,html2html
18568 !! wikitext
18569 <TAG>input</TAG>
18570 !! html/php
18571 <pre>
18572 'input'
18573 array (
18574 )
18575 </pre>
18576
18577 !! html/parsoid
18578 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18579 !! end
18580
18581 ## Don't expect parsoid to rt this form.
18582 !! test
18583 Parser hook: case insensitive, redux
18584 !! options
18585 parsoid=wt2html,html2html
18586 !! wikitext
18587 <TaG>input</TAg>
18588 !! html/php
18589 <pre>
18590 'input'
18591 array (
18592 )
18593 </pre>
18594
18595 !! html/parsoid
18596 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18597 !! end
18598
18599 !! test
18600 Parser hook: nested tags
18601 !! options
18602 parsoid=wt2html
18603 !! wikitext
18604 <tag><tag></tag></tag>
18605 !! html/php
18606 <pre>
18607 '<tag>'
18608 array (
18609 )
18610 </pre>&lt;/tag&gt;
18611
18612 !! html/php+tidy
18613 <pre>'<tag>'
18614 array (
18615 )
18616 </tag></pre><p>&lt;/tag&gt;
18617 </p>
18618 !! html/parsoid
18619 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18620 !! end
18621
18622 !! test
18623 Parser hook: basic arguments
18624 !! wikitext
18625 <tag width="200" height="100" depth="50" square=""></tag>
18626 !! html/php
18627 <pre>
18628 ''
18629 array (
18630 'width' => '200',
18631 'height' => '100',
18632 'depth' => '50',
18633 'square' => '',
18634 )
18635 </pre>
18636
18637 !! html/parsoid
18638 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18639 !! end
18640
18641 ## Don't expect parsoid to rt this form.
18642 !! test
18643 Parser hook: basic arguments, variations
18644 !! options
18645 parsoid=wt2html,html2html
18646 !! wikitext
18647 <tag width=200 height = "100" depth = '50' square></tag>
18648 !! html/php
18649 <pre>
18650 ''
18651 array (
18652 'width' => '200',
18653 'height' => '100',
18654 'depth' => '50',
18655 'square' => '',
18656 )
18657 </pre>
18658
18659 !! html/parsoid
18660 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18661 !! end
18662
18663 !! test
18664 Parser hook: argument containing a forward slash (T7344)
18665 !! wikitext
18666 <tag filename="/tmp/bla"></tag>
18667 !! html/php
18668 <pre>
18669 ''
18670 array (
18671 'filename' => '/tmp/bla',
18672 )
18673 </pre>
18674
18675 !! html/parsoid
18676 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18677 !! end
18678
18679 ## Don't expect parsoid to rt this form.
18680 !! test
18681 Parser hook: empty input using terminated empty elements (T4374)
18682 !! options
18683 parsoid=wt2html,html2html
18684 !! wikitext
18685 <tag foo=bar/>text
18686 !! html/php
18687 <pre>
18688 NULL
18689 array (
18690 'foo' => 'bar',
18691 )
18692 </pre>text
18693
18694 !! html/parsoid
18695 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
18696 !! end
18697
18698 ## </tag> should be output literally since there is no matching tag that begins it
18699 ## Don't expect parsoid to rt this form.
18700 !! test
18701 Parser hook: basic arguments using terminated empty elements (T4374)
18702 !! options
18703 parsoid=wt2html
18704 !! wikitext
18705 <tag width=200 height = "100" depth = '50' square/>
18706 other stuff
18707 </tag>
18708 !! html/php
18709 <pre>
18710 NULL
18711 array (
18712 'width' => '200',
18713 'height' => '100',
18714 'depth' => '50',
18715 'square' => '',
18716 )
18717 </pre>
18718 <p>other stuff
18719 &lt;/tag&gt;
18720 </p>
18721 !! html/parsoid
18722 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
18723 &lt;/tag></p>
18724 !! end
18725
18726 ## Don't expect parsoid to rt this form.
18727 !! test
18728 Parser hook: Don't allow unclosed extension tags
18729 !! options
18730 parsoid=wt2html
18731 !! wikitext
18732 test <tag>123
18733
18734 this is a '''test'''
18735 !! html/php
18736 <p>test &lt;tag&gt;123
18737 </p><p>this is a <b>test</b>
18738 </p>
18739 !! html/parsoid
18740 <p>test &lt;tag>123</p>
18741
18742 <p>this is a <b>test</b></p>
18743 !! end
18744
18745 !! test
18746 Parser hook: horizontal rule inside extension tag that outputs <pre>
18747 !! wikitext
18748 <tag>
18749 Hello
18750 <hr/>
18751 Goodbye
18752 </tag>
18753 !! html/php
18754 <pre>
18755 '
18756 Hello
18757 <hr/>
18758 Goodbye
18759 '
18760 array (
18761 )
18762 </pre>
18763
18764 !! end
18765
18766 ###
18767 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18768 ###
18769
18770 !! test
18771 Parser hook: static parser hook not inside a comment
18772 !! wikitext
18773 <statictag>hello, world</statictag>
18774
18775 <statictag action="flush" />
18776 !! html/php
18777 <p><br />
18778 hello, world
18779 </p>
18780 !! html/parsoid
18781 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18782 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about="#mwt4">hello, world</p>
18783 !! end
18784
18785 !! test
18786 Parser hook: static parser hook inside a comment
18787 !! wikitext
18788 <!-- <statictag>hello, world</statictag> -->
18789 <statictag action="flush" />
18790 !! html/php
18791 <p><br />
18792 </p>
18793 !! html/parsoid
18794 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18795 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></p>
18796 !! end
18797
18798 # Nested template calls; this case was broken by Parser.php rev 1.506,
18799 # since reverted.
18800
18801 !! article
18802 Template:One-parameter
18803 !! text
18804 (My parameter is: {{{1}}})
18805 !! endarticle
18806
18807 !! article
18808 Template:Map-one-parameter
18809 !! text
18810 {{{{{1}}}|{{{2}}}}}
18811 !! endarticle
18812
18813 !! test
18814 Nested template calls
18815 !! wikitext
18816 {{Map-one-parameter|One-parameter|param}}
18817 !! html
18818 <p>(My parameter is: param)
18819 </p>
18820 !! end
18821
18822
18823 ###
18824 ### Sanitizer
18825 ###
18826
18827 !! test
18828 Sanitizer: Closing of open tags
18829 !! wikitext
18830 <s></s><table></table>
18831 !! html/php+tidy
18832 <p><s></s></p><table></table>
18833 !! html/parsoid
18834 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
18835 !! end
18836
18837 !! test
18838 Sanitizer: Closing of open but not closed tags
18839 !! wikitext
18840 <s>foo
18841 !! html
18842 <p><s>foo</s>
18843 </p>
18844 !! end
18845
18846 !! test
18847 Sanitizer: Closing of closed but not open tags
18848 !! options
18849 parsoid=wt2html
18850 !! wikitext
18851 </s>
18852 !! html+tidy
18853 <p class="mw-empty-elt">
18854 </p>
18855 !! end
18856
18857 !! test
18858 Sanitizer: Closing of closed but not open table tags
18859 !! options
18860 parsoid=wt2html
18861 !! wikitext
18862 Table not started</td></tr></table>
18863 !! html+tidy
18864 <p>Table not started
18865 </p>
18866 !! end
18867
18868 !! test
18869 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18870 !! config
18871 wgFragmentMode=[ 'html5', 'legacy' ]
18872 !! wikitext
18873 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18874 !! html/php
18875 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18876 </p>
18877 !! html/parsoid
18878 <p><span id="æ:_v" data-parsoid='{"stx":"html","a":{"id":"æ:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#æ:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#æ:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
18879 !! end
18880
18881 !! test
18882 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18883 !! config
18884 wgFragmentMode=[ 'legacy' ]
18885 !! wikitext
18886 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18887 !! html/php
18888 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18889 </p>
18890 !! end
18891
18892 # In HTML5, the restrictions are that id must contain at least one character,
18893 # and must not contain any space characters.
18894 !! test
18895 Sanitizer: Validating the contents of the id attribute (T6515)
18896 !! options
18897 disabled
18898 !! wikitext
18899 <br id="" /><br id="a space" />
18900 !! html
18901 Something ...
18902 !! end
18903
18904 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18905 !! test
18906 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18907 !! options
18908 disabled
18909 !! wikitext
18910 <br id="foo" /><br id="foo" />
18911 !! html
18912 Something need to be done. foo-2 ?
18913 !! end
18914
18915 !! test
18916 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18917 !! wikitext
18918 <div itemscope>
18919 <meta itemprop="hello" content="world">
18920 <meta http-equiv="refresh" content="5">
18921 <meta itemprop="hello" http-equiv="refresh" content="5">
18922 <link itemprop="hello" href="{{SERVER}}">
18923 <link rel="stylesheet" href="{{SERVER}}">
18924 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18925 </div>
18926 !! html
18927 <div itemscope="">
18928 <p> <meta itemprop="hello" content="world" />
18929 &lt;meta http-equiv="refresh" content="5"&gt;
18930 <meta itemprop="hello" content="5" />
18931 <link itemprop="hello" href="http&#58;//example.org" />
18932 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18933 <link itemprop="hello" href="http&#58;//example.org" />
18934 </p>
18935 </div>
18936
18937 !! end
18938
18939 !! test
18940 Sanitizer: Strip comments from CSS attributes
18941 !! options
18942 parsoid=wt2html,wt2wt
18943 !! wikitext
18944 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18945 !! html/php
18946 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18947 </p>
18948 !! html/parsoid
18949 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18950 !! end
18951
18952 !! test
18953 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18954 !! wikitext
18955 [[meatball:Soft"Security]]
18956 !! html/php
18957 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18958 </p>
18959 !! html/parsoid
18960 <p><a rel="mw:WikiLink/Interwiki" href='http://www.usemod.com/cgi-bin/mb.pl?Soft"Security' title='meatball:Soft"Security'>meatball:Soft"Security</a></p>
18961 !! end
18962
18963 !! test
18964 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18965 !! wikitext
18966 [[meatball:Foo<Bar]]
18967 [[meatball:Foo>Bar]]
18968 [[meatball:Foo&lt;bar]]
18969 [[meatball:Foo&gt;bar]]
18970 !! html/php
18971 <p>[[meatball:Foo&lt;Bar]]
18972 [[meatball:Foo&gt;Bar]]
18973 [[meatball:Foo&lt;bar]]
18974 [[meatball:Foo&gt;bar]]
18975 </p>
18976 !! html/parsoid
18977 <p>[[meatball:Foo&lt;Bar]]
18978 [[meatball:Foo>Bar]]
18979 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18980 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18981 !! end
18982
18983 !! test
18984 Language converter: output gets cut off unexpectedly (T7757)
18985 !! options
18986 language=zh
18987 !! wikitext
18988 this bit is safe: }-
18989
18990 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18991
18992 then we get cut off here: }-
18993
18994 all additional text is vanished
18995 !! html/php
18996 <p>this bit is safe: }-
18997 </p><p>but if we add a conversion instance: xxx
18998 </p><p>then we get cut off here: }-
18999 </p><p>all additional text is vanished
19000 </p>
19001 !! html/parsoid
19002 <p>this bit is safe: }-</p>
19003 <p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p>
19004 <p>then we get cut off here: }-</p>
19005 <p>all additional text is vanished</p>
19006 !! end
19007
19008 !! test
19009 Language converter glossary rules inside attributes (T119158)
19010 !! options
19011 language=sr variant=sr-el
19012 !! wikitext
19013 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19014
19015 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19016 !! html/php
19017 <p>
19018 </p><p><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="&quot; onload=&quot;alert(1)&quot; data-foo=&quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
19019 </p>
19020 !! html/parsoid
19021 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19022
19023 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Датотека:Foobar.jpg"><img alt="foAjrjvi" resource="./Датотека:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"foAjrjvi","resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=-{}-foAjrjvi-{}-","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
19024 !! end
19025
19026 !! test
19027 Self closed html pairs (T7487)
19028 !! wikitext
19029 <center><font id="bug" />Centered text</center>
19030 <div><font id="bug2" />In div text</div>
19031 !! html+tidy
19032 <center><font id="bug"></font>Centered text</center>
19033 <div><font id="bug2"></font>In div text</div>
19034 !! end
19035
19036 !! test
19037 Punctuation: nbsp before exclamation
19038 !! wikitext
19039 C'est grave !
19040 !! html
19041 <p>C'est grave&#160;!
19042 </p>
19043 !! end
19044
19045 !! test
19046 Punctuation: CSS !important (T13874)
19047 !! wikitext
19048 <div style="width:50% !important">important</div>
19049 !! html
19050 <div style="width:50% !important">important</div>
19051
19052 !!end
19053
19054 !! test
19055 Punctuation: CSS ! important (T13874; with space after)
19056 !! wikitext
19057 <div style="width:50% ! important">important</div>
19058 !! html
19059 <div style="width:50%&#32;! important">important</div>
19060
19061 !!end
19062
19063 !! test
19064 HTML bullet list, closed tags (T7497)
19065 !! wikitext
19066 <ul>
19067 <li>One</li>
19068 <li>Two</li>
19069 </ul>
19070 !! html/php
19071 <ul>
19072 <li>One</li>
19073 <li>Two</li>
19074 </ul>
19075
19076 !! html/parsoid
19077 <ul data-parsoid='{"stx":"html"}'>
19078 <li data-parsoid='{"stx":"html"}'>One</li>
19079 <li data-parsoid='{"stx":"html"}'>Two</li>
19080 </ul>
19081
19082 !! end
19083
19084 !! test
19085 HTML bullet list, unclosed tags (T7497)
19086 !! wikitext
19087 <ul>
19088 <li>One
19089 <li>Two
19090 </ul>
19091 !! html/php+tidy
19092 <ul>
19093 <li>One
19094 </li><li>Two
19095 </li></ul>
19096 !! html/parsoid
19097 <ul data-parsoid='{"stx":"html"}'>
19098 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19099 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19100 </ul>
19101
19102 !! end
19103
19104 !! test
19105 HTML ordered list, closed tags (T7497)
19106 !! wikitext
19107 <ol>
19108 <li>One</li>
19109 <li>Two</li>
19110 </ol>
19111 !! html/php
19112 <ol>
19113 <li>One</li>
19114 <li>Two</li>
19115 </ol>
19116
19117 !! html/parsoid
19118 <ol data-parsoid='{"stx":"html"}'>
19119 <li data-parsoid='{"stx":"html"}'>One</li>
19120 <li data-parsoid='{"stx":"html"}'>Two</li>
19121 </ol>
19122
19123 !! end
19124
19125 !! test
19126 HTML ordered list, unclosed tags (T7497)
19127 !! options
19128 !! wikitext
19129 <ol>
19130 <li>One
19131 <li>Two
19132 </ol>
19133 !! html/php+tidy
19134 <ol>
19135 <li>One
19136 </li><li>Two
19137 </li></ol>
19138 !! html/parsoid
19139 <ol data-parsoid='{"stx":"html"}'>
19140 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19141 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19142 </ol>
19143
19144 !! end
19145
19146 !! test
19147 HTML nested bullet list, closed tags (T7497)
19148 !! wikitext
19149 <ul>
19150 <li>One</li>
19151 <li>Two:
19152 <ul>
19153 <li>Sub-one</li>
19154 <li>Sub-two</li>
19155 </ul>
19156 </li>
19157 </ul>
19158 !! html/php
19159 <ul>
19160 <li>One</li>
19161 <li>Two:
19162 <ul>
19163 <li>Sub-one</li>
19164 <li>Sub-two</li>
19165 </ul>
19166 </li>
19167 </ul>
19168
19169 !! html/parsoid
19170 <ul data-parsoid='{"stx":"html"}'>
19171 <li data-parsoid='{"stx":"html"}'>One</li>
19172 <li data-parsoid='{"stx":"html"}'>Two:
19173 <ul data-parsoid='{"stx":"html"}'>
19174 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19175 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19176 </ul>
19177 </li>
19178 </ul>
19179 !! end
19180
19181 !! test
19182 HTML nested bullet list, open tags (T7497)
19183 !! wikitext
19184 <ul>
19185 <li>One
19186 <li>Two:
19187 <ul>
19188 <li>Sub-one
19189 <li>Sub-two
19190 </ul>
19191 </ul>
19192 !! html+tidy
19193 <ul>
19194 <li>One
19195 </li><li>Two:
19196 <ul>
19197 <li>Sub-one
19198 </li><li>Sub-two
19199 </li></ul>
19200 </li></ul>
19201 !! end
19202
19203 !! test
19204 HTML nested ordered list, closed tags (T7497)
19205 !! wikitext
19206 <ol>
19207 <li>One</li>
19208 <li>Two:
19209 <ol>
19210 <li>Sub-one</li>
19211 <li>Sub-two</li>
19212 </ol>
19213 </li>
19214 </ol>
19215 !! html
19216 <ol>
19217 <li>One</li>
19218 <li>Two:
19219 <ol>
19220 <li>Sub-one</li>
19221 <li>Sub-two</li>
19222 </ol>
19223 </li>
19224 </ol>
19225
19226 !! end
19227
19228 !! test
19229 HTML nested ordered list, open tags (T7497)
19230 !! wikitext
19231 <ol>
19232 <li>One
19233 <li>Two:
19234 <ol>
19235 <li>Sub-one
19236 <li>Sub-two
19237 </ol>
19238 </ol>
19239 !! html/php
19240 <ol>
19241 <li>One
19242 <li>Two:
19243 <ol>
19244 <li>Sub-one
19245 <li>Sub-two
19246 </ol>
19247 </ol>
19248
19249 !! html/parsoid
19250 <ol>
19251 <li>One
19252 </li>
19253 <li>Two:
19254 <ol>
19255 <li>Sub-one
19256 </li>
19257 <li>Sub-two
19258 </li>
19259 </ol>
19260 </li>
19261 </ol>
19262
19263 !! end
19264
19265 !! test
19266 HTML ordered list item with parameters oddity
19267 !! wikitext
19268 <ol><li id="fragment">One</li>
19269 </ol>
19270 !! html
19271 <ol><li id="fragment">One</li>
19272 </ol>
19273
19274 !! end
19275
19276 # parsoid doesn't explicitly mark autonumbered links, see T55505
19277 !!test
19278 T7918: autonumbering
19279 !! wikitext
19280 [http://first/] [http://second] [ftp://ftp]
19281
19282 ftp://inlineftp
19283
19284 [mailto:enclosed@mail.tld With target]
19285
19286 [mailto:enclosed@mail.tld]
19287
19288 mailto:inline@mail.tld
19289 !! html/php
19290 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
19291 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19292 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19293 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19294 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19295 </p>
19296 !! html/parsoid
19297 <p><a rel="mw:ExtLink" class="external autonumber" href="http://first/"></a> <a rel="mw:ExtLink" class="external autonumber" href="http://second"></a> <a rel="mw:ExtLink" class="external autonumber" href="ftp://ftp"></a></p>
19298 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19299 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19300 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19301 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19302 !! end
19303
19304
19305 #
19306 # Security and HTML correctness
19307 # From Nick Jenkins' fuzz testing
19308 #
19309
19310 !! test
19311 Fuzz testing: Parser13
19312 !! wikitext
19313 {|
19314 | http://a|
19315 !! html
19316 <table>
19317 <tr>
19318 <td>
19319 </td>
19320 </tr>
19321 </table>
19322
19323 !! end
19324
19325 # Note that Parsoid output differs from the PHP parser here: the PHP
19326 # parser breaks the URL for the magic word, while in Parsoid the URL
19327 # production takes precedence.
19328 !! test
19329 Fuzz testing: Parser14
19330 !! wikitext
19331 ==onmouseover===
19332 http://__TOC__
19333 !! html/php
19334 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19335 http://<div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
19336 <ul>
19337 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19338 </ul>
19339 </div>
19340
19341
19342 !! html/php+tidy
19343 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2><p>
19344 http://</p><div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
19345 <ul>
19346 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19347 </ul>
19348 </div>
19349 !! html/parsoid
19350 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19351 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19352 !! end
19353
19354 !! test
19355 Fuzz testing: Parser14-table
19356 !! options
19357 parsoid=wt2html,html2html
19358 !! wikitext
19359 ==a==
19360 {| STYLE=__TOC__
19361 !! html
19362 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19363 <table style="&#95;_TOC&#95;_">
19364 <tr><td></td></tr>
19365 </table>
19366
19367 !! html+tidy
19368 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19369 <table style="__TOC__">
19370 <tr>
19371 <td></td>
19372 </tr>
19373 </table>
19374 !! html/parsoid
19375 <h2 id="a">a</h2>
19376 <table style="__TOC__"></table>
19377 !! end
19378
19379 # Known to produce bogus xml (extra </td>)
19380 # Don't add the html/php section since it generates broken HTML
19381 !! test
19382 Fuzz testing: Parser16
19383 !! wikitext
19384 {|
19385 !https://||||||
19386 !! html+tidy
19387 <table>
19388 <tbody><tr>
19389 <th>https://</th>
19390 <th></th>
19391 <th></th>
19392 <th>
19393
19394 </th></tr>
19395 </tbody></table>
19396 !! end
19397
19398 !! test
19399 Fuzz testing: Parser21
19400 !! wikitext
19401 {|
19402 !irc://{{ftp://a" onmouseover="alert('hello world');"
19403 |
19404 !! html
19405 <table>
19406 <tr>
19407 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19408 </th>
19409 <td>
19410 </td>
19411 </tr>
19412 </table>
19413
19414 !! end
19415
19416 !! test
19417 Fuzz testing: Parser22
19418 !! wikitext
19419 http://===r:::https://b
19420
19421 {|
19422 !! html
19423 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19424 </p>
19425 <table>
19426 <tr><td></td></tr>
19427 </table>
19428
19429 !! end
19430
19431 ## Remex doesn't account for fostered content.
19432 ## Known to produce bad XML for now
19433 !! test
19434 Fuzz testing: Parser24
19435 !! options
19436 parsoid=wt2html
19437 !! wikitext
19438 {|
19439 {{{|
19440 <u CLASS=
19441 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19442 <br style="onmouseover='alert(document.cookie);' " />
19443
19444 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19445 |
19446 !! html/php
19447 <table>
19448 {{{|
19449 <u class="&#124;">}}}} &gt;
19450 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19451
19452 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19453 <tr>
19454 <td></u>
19455 </td>
19456 </tr>
19457 </table>
19458
19459 !! html/php+tidy
19460
19461 {{{|
19462 <u class="&#124;">}}}} &gt;
19463 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19464
19465 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19466 </u><table><tbody><tr>
19467 <td>
19468 </td>
19469 </tr>
19470 </tbody></table><p><u class="&#124;">
19471 </u></p>
19472 !! html/parsoid
19473 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19474 {{{|
19475 <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
19476 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19477
19478 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19479 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19480 !! end
19481
19482 # Note: the current result listed for this is not what the original one was,
19483 # but the original bug was JavaScript injection, which is fixed in any case.
19484 # It's not clear that the original result listed was any more correct than the
19485 # current one. Original result:
19486 # <p>{{{|
19487 # </p>
19488 # <li class="&#124;&#124;">
19489 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19490 !!test
19491 Fuzz testing: Parser25 (T8055)
19492 !! wikitext
19493 {{{
19494 |
19495 <LI CLASS=||
19496 >
19497 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19498 !! html/php
19499 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19500 </p>
19501 !! html/parsoid
19502 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
19503 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19504 !! end
19505
19506 !!test
19507 Fuzz testing: URL adjacent extension (with space, clean)
19508 !! wikitext
19509 http://example.com <nowiki>junk</nowiki>
19510 !! html/php
19511 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19512 </p>
19513 !! html/parsoid
19514 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
19515 !! end
19516
19517 !!test
19518 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19519 !! wikitext
19520 http://example.com<nowiki>junk</nowiki>
19521 !! html/php
19522 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19523 </p>
19524 !! html/parsoid
19525 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
19526 !! end
19527
19528 !! test
19529 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19530 !! wikitext
19531 http://example.com<pre>junk</pre>
19532 !! html/php
19533 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19534
19535 !! html/php+tidy
19536 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19537 !! html/parsoid
19538 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
19539 !! end
19540
19541 !! test
19542 Fuzz testing: image with bogus manual thumbnail
19543 !! wikitext
19544 [[Image:foobar.jpg|thumbnail= ]]
19545 !! html/php
19546 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19547
19548 !! html/parsoid
19549 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
19550 !! end
19551
19552 # Parsoid will emit the newline literally in wt2wt; see next test case.
19553 !! test
19554 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19555 !! options
19556 parsoid=wt2html
19557 !! wikitext
19558 <pre dir="&#10;"></pre>
19559 !! html/php
19560 <pre dir="&#10;"></pre>
19561
19562 !! html/parsoid
19563 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19564 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19565 !! end
19566
19567 !! test
19568 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19569 !! options
19570 parsoid=html2wt
19571 !! html/parsoid
19572 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19573 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19574 !! wikitext
19575 <pre dir="
19576 "></pre>
19577 !! html/php
19578 <pre dir=""></pre>
19579
19580 !! end
19581
19582 !! test
19583 Templates in extension attributes are not expanded
19584 !! wikitext
19585 <pre dir="{{echo|ltr}}"></pre>
19586 !! html/php
19587 <pre dir="{{echo|ltr}}"></pre>
19588
19589 !! html/parsoid
19590 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19591 !! end
19592
19593 !! test
19594 Parsing optional HTML elements (T8171)
19595 !! options
19596 !! wikitext
19597 <table>
19598 <tr>
19599 <td> Some tabular data</td>
19600 <td> More tabular data ...
19601 <td> And yet som tabular data</td>
19602 </tr>
19603 </table>
19604 !! html
19605 <table>
19606 <tr>
19607 <td> Some tabular data</td>
19608 <td> More tabular data ...
19609 </td><td> And yet som tabular data</td>
19610 </tr>
19611 </table>
19612
19613 !! end
19614
19615 !! test
19616 Correct handling of <td>, <tr> (T8171)
19617 !! options
19618 !! wikitext
19619 <table>
19620 <tr>
19621 <td> Some tabular data</td>
19622 <td> More tabular data ...</td>
19623 <td> And yet som tabular data</td>
19624 </tr>
19625 </table>
19626 !! html
19627 <table>
19628 <tr>
19629 <td> Some tabular data</td>
19630 <td> More tabular data ...</td>
19631 <td> And yet som tabular data</td>
19632 </tr>
19633 </table>
19634
19635 !! end
19636
19637
19638 !! test
19639 Parsing crashing regression (fr:JavaScript)
19640 !! wikitext
19641 </body></x>
19642 !! html
19643 <p>&lt;/body&gt;&lt;/x&gt;
19644 </p>
19645 !! end
19646
19647 !! test
19648 Inline wiki vs wiki block nesting
19649 !! wikitext
19650 '''Bold paragraph
19651
19652 New wiki paragraph
19653 !! html
19654 <p><b>Bold paragraph</b>
19655 </p><p>New wiki paragraph
19656 </p>
19657 !! end
19658
19659 # FIXME: The current php output is documented
19660 # and desired output is the parsoid target.
19661 !! test
19662 Inline HTML vs wiki block nesting
19663 !! wikitext
19664 <b>Bold paragraph
19665
19666 New wiki paragraph
19667 !! html/php
19668 <p><b>Bold paragraph
19669 </p><p>New wiki paragraph</b>
19670 </p>
19671 !! html/php+tidy
19672 <p><b>Bold paragraph
19673 </b></p><p><b>New wiki paragraph
19674 </b></p>
19675 !! html/parsoid
19676 <p><b>Bold paragraph</b>
19677 </p><p>New wiki paragraph
19678 </p>
19679 !! end
19680
19681 # Original result was this:
19682 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19683 # </p>
19684 # While that might be marginally more intuitive, maybe, the six-apostrophe
19685 # construct is clearly pathological and the result stated here (which is what
19686 # the parser actually does) is about as reasonable as anything.
19687 !!test
19688 Mixing markup for italics and bold
19689 !! options
19690 !! wikitext
19691 '''bold''''''bold''bolditalics'''''
19692 !! html
19693 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19694 </p>
19695 !! end
19696
19697
19698 !! article
19699 Xyzzyx
19700 !! text
19701 Article for special page transclusion test
19702 !! endarticle
19703
19704 !! test
19705 Special page transclusion
19706 !! options
19707 !! wikitext
19708 {{Special:Prefixindex/Xyzzyx}}
19709 !! html
19710 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19711 </ul>
19712
19713 !! end
19714
19715 !! test
19716 Special page transclusion twice (T7021)
19717 !! options
19718 !! wikitext
19719 {{Special:Prefixindex/Xyzzyx}}
19720 {{Special:Prefixindex/Xyzzyx}}
19721 !! html
19722 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19723 </ul>
19724 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19725 </ul>
19726
19727 !! end
19728
19729 !! test
19730 Transclusion of default MediaWiki message
19731 !! wikitext
19732 {{MediaWiki:Mainpage}}
19733 !! html
19734 <p>Main Page
19735 </p>
19736 !! end
19737
19738 !! test
19739 Transclusion of nonexistent MediaWiki message
19740 !! wikitext
19741 {{MediaWiki:Mainpagexxx}}
19742 !! html
19743 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
19744 </p>
19745 !! end
19746
19747 !! test
19748 Transclusion of MediaWiki message with underscore
19749 !! wikitext
19750 {{MediaWiki:history_short}}
19751 !! html
19752 <p>History
19753 </p>
19754 !! end
19755
19756 !! test
19757 Transclusion of MediaWiki message with space
19758 !! wikitext
19759 {{MediaWiki:history short}}
19760 !! html
19761 <p>History
19762 </p>
19763 !! end
19764
19765 !! test
19766 Invalid header with following text
19767 !! wikitext
19768 = x = y
19769 !! html
19770 <p>= x = y
19771 </p>
19772 !! end
19773
19774
19775 !! test
19776 Section extraction test (section 0)
19777 !! options
19778 section=0
19779 !! wikitext
19780 start
19781 ==a==
19782 ===aa===
19783 ====aaa====
19784 ==b==
19785 ===ba===
19786 ===bb===
19787 ====bba====
19788 ===bc===
19789 ==c==
19790 ===ca===
19791 !! html/php
19792 start
19793 !! end
19794
19795 !! test
19796 Section extraction test (section 1)
19797 !! options
19798 section=1
19799 !! wikitext
19800 start
19801 ==a==
19802 ===aa===
19803 ====aaa====
19804 ==b==
19805 ===ba===
19806 ===bb===
19807 ====bba====
19808 ===bc===
19809 ==c==
19810 ===ca===
19811 !! html/php
19812 ==a==
19813 ===aa===
19814 ====aaa====
19815 !! end
19816
19817 !! test
19818 Section extraction test (section 2)
19819 !! options
19820 section=2
19821 !! wikitext
19822 start
19823 ==a==
19824 ===aa===
19825 ====aaa====
19826 ==b==
19827 ===ba===
19828 ===bb===
19829 ====bba====
19830 ===bc===
19831 ==c==
19832 ===ca===
19833 !! html/php
19834 ===aa===
19835 ====aaa====
19836 !! end
19837
19838 !! test
19839 Section extraction test (section 3)
19840 !! options
19841 section=3
19842 !! wikitext
19843 start
19844 ==a==
19845 ===aa===
19846 ====aaa====
19847 ==b==
19848 ===ba===
19849 ===bb===
19850 ====bba====
19851 ===bc===
19852 ==c==
19853 ===ca===
19854 !! html/php
19855 ====aaa====
19856 !! end
19857
19858 !! test
19859 Section extraction test (section 4)
19860 !! options
19861 section=4
19862 !! wikitext
19863 start
19864 ==a==
19865 ===aa===
19866 ====aaa====
19867 ==b==
19868 ===ba===
19869 ===bb===
19870 ====bba====
19871 ===bc===
19872 ==c==
19873 ===ca===
19874 !! html/php
19875 ==b==
19876 ===ba===
19877 ===bb===
19878 ====bba====
19879 ===bc===
19880 !! end
19881
19882 !! test
19883 Section extraction test (section 5)
19884 !! options
19885 section=5
19886 !! wikitext
19887 start
19888 ==a==
19889 ===aa===
19890 ====aaa====
19891 ==b==
19892 ===ba===
19893 ===bb===
19894 ====bba====
19895 ===bc===
19896 ==c==
19897 ===ca===
19898 !! html/php
19899 ===ba===
19900 !! end
19901
19902 !! test
19903 Section extraction test (section 6)
19904 !! options
19905 section=6
19906 !! wikitext
19907 start
19908 ==a==
19909 ===aa===
19910 ====aaa====
19911 ==b==
19912 ===ba===
19913 ===bb===
19914 ====bba====
19915 ===bc===
19916 ==c==
19917 ===ca===
19918 !! html/php
19919 ===bb===
19920 ====bba====
19921 !! end
19922
19923 !! test
19924 Section extraction test (section 7)
19925 !! options
19926 section=7
19927 !! wikitext
19928 start
19929 ==a==
19930 ===aa===
19931 ====aaa====
19932 ==b==
19933 ===ba===
19934 ===bb===
19935 ====bba====
19936 ===bc===
19937 ==c==
19938 ===ca===
19939 !! html/php
19940 ====bba====
19941 !! end
19942
19943 !! test
19944 Section extraction test (section 8)
19945 !! options
19946 section=8
19947 !! wikitext
19948 start
19949 ==a==
19950 ===aa===
19951 ====aaa====
19952 ==b==
19953 ===ba===
19954 ===bb===
19955 ====bba====
19956 ===bc===
19957 ==c==
19958 ===ca===
19959 !! html/php
19960 ===bc===
19961 !! end
19962
19963 !! test
19964 Section extraction test (section 9)
19965 !! options
19966 section=9
19967 !! wikitext
19968 start
19969 ==a==
19970 ===aa===
19971 ====aaa====
19972 ==b==
19973 ===ba===
19974 ===bb===
19975 ====bba====
19976 ===bc===
19977 ==c==
19978 ===ca===
19979 !! html/php
19980 ==c==
19981 ===ca===
19982 !! end
19983
19984 !! test
19985 Section extraction test (section 10)
19986 !! options
19987 section=10
19988 !! wikitext
19989 start
19990 ==a==
19991 ===aa===
19992 ====aaa====
19993 ==b==
19994 ===ba===
19995 ===bb===
19996 ====bba====
19997 ===bc===
19998 ==c==
19999 ===ca===
20000 !! html/php
20001 ===ca===
20002 !! end
20003
20004 !! test
20005 Section extraction test (nonexistent section 11)
20006 !! options
20007 section=11
20008 !! wikitext
20009 start
20010 ==a==
20011 ===aa===
20012 ====aaa====
20013 ==b==
20014 ===ba===
20015 ===bb===
20016 ====bba====
20017 ===bc===
20018 ==c==
20019 ===ca===
20020 !! html/php
20021 !! end
20022
20023 !! test
20024 Section extraction test with bogus heading (section 1)
20025 !! options
20026 section=1
20027 !! wikitext
20028 ==a==
20029 ==bogus== not a legal section
20030 ==b==
20031 !! html/php
20032 ==a==
20033 ==bogus== not a legal section
20034 !! end
20035
20036 !! test
20037 Section extraction test with bogus heading (section 2)
20038 !! options
20039 section=2
20040 !! wikitext
20041 ==a==
20042 ==bogus== not a legal section
20043 ==b==
20044 !! html/php
20045 ==b==
20046 !! end
20047
20048 !! test
20049 Section extraction test with comment after heading (section 1)
20050 !! options
20051 section=1
20052 !! wikitext
20053 ==a==
20054 ==b== <!-- -->
20055 ==c==
20056 !! html/php
20057 ==a==
20058 !! end
20059
20060 !! test
20061 Section extraction test with comment after heading (section 2)
20062 !! options
20063 section=2
20064 !! wikitext
20065 ==a==
20066 ==b== <!-- -->
20067 ==c==
20068 !! html/php
20069 ==b== <!-- -->
20070 !! end
20071
20072 !! test
20073 Section extraction test with bogus <nowiki> heading (section 1)
20074 !! options
20075 section=1
20076 !! wikitext
20077 ==a==
20078 ==bogus== <nowiki>not a legal section</nowiki>
20079 ==b==
20080 !! html/php
20081 ==a==
20082 ==bogus== <nowiki>not a legal section</nowiki>
20083 !! end
20084
20085 !! test
20086 Section extraction test with bogus <nowiki> heading (section 2)
20087 !! options
20088 section=2
20089 !! wikitext
20090 ==a==
20091 ==bogus== <nowiki>not a legal section</nowiki>
20092 ==b==
20093 !! html/php
20094 ==b==
20095 !! end
20096
20097 # Formerly testing for T4587, now resolved by the use of unmarked sections
20098 # instead of respecting commented sections
20099 !! test
20100 Section extraction prefixed by comment (section 1)
20101 !! options
20102 section=1
20103 !! wikitext
20104 <!-- -->==sec1==
20105 ==sec2==
20106 !! html/php
20107 ==sec2==
20108 !!end
20109
20110 !! test
20111 Section extraction prefixed by comment (section 2)
20112 !! options
20113 section=2
20114 !! wikitext
20115 <!-- -->==sec1==
20116 ==sec2==
20117 !! html/php
20118
20119 !!end
20120
20121 # Formerly testing for T4607, now resolved by the use of unmarked sections
20122 # instead of respecting HTML-style headings
20123 !! test
20124 Section extraction, mixed wiki and html (section 1)
20125 !! options
20126 section=1
20127 !! wikitext
20128 <h2>unmarked</h2>
20129 unmarked
20130 ==1==
20131 one
20132 ==2==
20133 two
20134 !! html/php
20135 ==1==
20136 one
20137 !! end
20138
20139 !! test
20140 Section extraction, mixed wiki and html (section 2)
20141 !! options
20142 section=2
20143 !! wikitext
20144 <h2>unmarked</h2>
20145 unmarked
20146 ==1==
20147 one
20148 ==2==
20149 two
20150 !! html/php
20151 ==2==
20152 two
20153 !! end
20154
20155
20156 # Formerly testing for T5342
20157 !! test
20158 Section extraction, heading surrounded by <noinclude>
20159 !! options
20160 section=1
20161 !! wikitext
20162 <noinclude>==unmarked==</noinclude>
20163 ==marked==
20164 !! html/php
20165 ==marked==
20166 !!end
20167
20168 # Test behavior of T21910
20169 !! test
20170 Sectiion with all-equals
20171 !! options
20172 section=2
20173 !! wikitext
20174 ===
20175 The line above must have a trailing space
20176 === <!--
20177 --> <!-- -->
20178 But just in case it doesn't...
20179 !! html/php
20180 === <!--
20181 --> <!-- -->
20182 But just in case it doesn't...
20183 !! end
20184
20185 !! test
20186 Section replacement test (section 0)
20187 !! options
20188 replace=0,"xxx"
20189 !! wikitext
20190 start
20191 ==a==
20192 ===aa===
20193 ====aaa====
20194 ==b==
20195 ===ba===
20196 ===bb===
20197 ====bba====
20198 ===bc===
20199 ==c==
20200 ===ca===
20201 !! html/php
20202 xxx
20203
20204 ==a==
20205 ===aa===
20206 ====aaa====
20207 ==b==
20208 ===ba===
20209 ===bb===
20210 ====bba====
20211 ===bc===
20212 ==c==
20213 ===ca===
20214 !! end
20215
20216 !! test
20217 Section replacement test (section 1)
20218 !! options
20219 replace=1,"xxx"
20220 !! wikitext
20221 start
20222 ==a==
20223 ===aa===
20224 ====aaa====
20225 ==b==
20226 ===ba===
20227 ===bb===
20228 ====bba====
20229 ===bc===
20230 ==c==
20231 ===ca===
20232 !! html/php
20233 start
20234 xxx
20235
20236 ==b==
20237 ===ba===
20238 ===bb===
20239 ====bba====
20240 ===bc===
20241 ==c==
20242 ===ca===
20243 !! end
20244
20245 !! test
20246 Section replacement test (section 2)
20247 !! options
20248 replace=2,"xxx"
20249 !! wikitext
20250 start
20251 ==a==
20252 ===aa===
20253 ====aaa====
20254 ==b==
20255 ===ba===
20256 ===bb===
20257 ====bba====
20258 ===bc===
20259 ==c==
20260 ===ca===
20261 !! html/php
20262 start
20263 ==a==
20264 xxx
20265
20266 ==b==
20267 ===ba===
20268 ===bb===
20269 ====bba====
20270 ===bc===
20271 ==c==
20272 ===ca===
20273 !! end
20274
20275 !! test
20276 Section replacement test (section 3)
20277 !! options
20278 replace=3,"xxx"
20279 !! wikitext
20280 start
20281 ==a==
20282 ===aa===
20283 ====aaa====
20284 ==b==
20285 ===ba===
20286 ===bb===
20287 ====bba====
20288 ===bc===
20289 ==c==
20290 ===ca===
20291 !! html/php
20292 start
20293 ==a==
20294 ===aa===
20295 xxx
20296
20297 ==b==
20298 ===ba===
20299 ===bb===
20300 ====bba====
20301 ===bc===
20302 ==c==
20303 ===ca===
20304 !! end
20305
20306 !! test
20307 Section replacement test (section 4)
20308 !! options
20309 replace=4,"xxx"
20310 !! wikitext
20311 start
20312 ==a==
20313 ===aa===
20314 ====aaa====
20315 ==b==
20316 ===ba===
20317 ===bb===
20318 ====bba====
20319 ===bc===
20320 ==c==
20321 ===ca===
20322 !! html/php
20323 start
20324 ==a==
20325 ===aa===
20326 ====aaa====
20327 xxx
20328
20329 ==c==
20330 ===ca===
20331 !! end
20332
20333 !! test
20334 Section replacement test (section 5)
20335 !! options
20336 replace=5,"xxx"
20337 !! wikitext
20338 start
20339 ==a==
20340 ===aa===
20341 ====aaa====
20342 ==b==
20343 ===ba===
20344 ===bb===
20345 ====bba====
20346 ===bc===
20347 ==c==
20348 ===ca===
20349 !! html/php
20350 start
20351 ==a==
20352 ===aa===
20353 ====aaa====
20354 ==b==
20355 xxx
20356
20357 ===bb===
20358 ====bba====
20359 ===bc===
20360 ==c==
20361 ===ca===
20362 !! end
20363
20364 !! test
20365 Section replacement test (section 6)
20366 !! options
20367 replace=6,"xxx"
20368 !! wikitext
20369 start
20370 ==a==
20371 ===aa===
20372 ====aaa====
20373 ==b==
20374 ===ba===
20375 ===bb===
20376 ====bba====
20377 ===bc===
20378 ==c==
20379 ===ca===
20380 !! html/php
20381 start
20382 ==a==
20383 ===aa===
20384 ====aaa====
20385 ==b==
20386 ===ba===
20387 xxx
20388
20389 ===bc===
20390 ==c==
20391 ===ca===
20392 !! end
20393
20394 !! test
20395 Section replacement test (section 7)
20396 !! options
20397 replace=7,"xxx"
20398 !! wikitext
20399 start
20400 ==a==
20401 ===aa===
20402 ====aaa====
20403 ==b==
20404 ===ba===
20405 ===bb===
20406 ====bba====
20407 ===bc===
20408 ==c==
20409 ===ca===
20410 !! html/php
20411 start
20412 ==a==
20413 ===aa===
20414 ====aaa====
20415 ==b==
20416 ===ba===
20417 ===bb===
20418 xxx
20419
20420 ===bc===
20421 ==c==
20422 ===ca===
20423 !! end
20424
20425 !! test
20426 Section replacement test (section 8)
20427 !! options
20428 replace=8,"xxx"
20429 !! wikitext
20430 start
20431 ==a==
20432 ===aa===
20433 ====aaa====
20434 ==b==
20435 ===ba===
20436 ===bb===
20437 ====bba====
20438 ===bc===
20439 ==c==
20440 ===ca===
20441 !! html/php
20442 start
20443 ==a==
20444 ===aa===
20445 ====aaa====
20446 ==b==
20447 ===ba===
20448 ===bb===
20449 ====bba====
20450 xxx
20451
20452 ==c==
20453 ===ca===
20454 !!end
20455
20456 !! test
20457 Section replacement test (section 9)
20458 !! options
20459 replace=9,"xxx"
20460 !! wikitext
20461 start
20462 ==a==
20463 ===aa===
20464 ====aaa====
20465 ==b==
20466 ===ba===
20467 ===bb===
20468 ====bba====
20469 ===bc===
20470 ==c==
20471 ===ca===
20472 !! html/php
20473 start
20474 ==a==
20475 ===aa===
20476 ====aaa====
20477 ==b==
20478 ===ba===
20479 ===bb===
20480 ====bba====
20481 ===bc===
20482 xxx
20483 !! end
20484
20485 !! test
20486 Section replacement test (section 10)
20487 !! options
20488 replace=10,"xxx"
20489 !! wikitext
20490 start
20491 ==a==
20492 ===aa===
20493 ====aaa====
20494 ==b==
20495 ===ba===
20496 ===bb===
20497 ====bba====
20498 ===bc===
20499 ==c==
20500 ===ca===
20501 !! html/php
20502 start
20503 ==a==
20504 ===aa===
20505 ====aaa====
20506 ==b==
20507 ===ba===
20508 ===bb===
20509 ====bba====
20510 ===bc===
20511 ==c==
20512 xxx
20513 !! end
20514
20515 !! test
20516 Section replacement test with initial whitespace (T15728)
20517 !! options
20518 replace=2,"xxx"
20519 !! wikitext
20520 Preformatted initial line
20521 ==a==
20522 ===a===
20523 !! html/php
20524 Preformatted initial line
20525 ==a==
20526 xxx
20527 !! end
20528
20529
20530 !! test
20531 Section extraction, heading followed by pre with 20 spaces (T8398)
20532 !! options
20533 section=1
20534 !! wikitext
20535 ==a==
20536 a
20537 !! html/php
20538 ==a==
20539 a
20540 !! end
20541
20542 !! test
20543 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20544 !! options
20545 section=1
20546 !! wikitext
20547 ==a==
20548 a
20549 !! html/php
20550 ==a==
20551 a
20552 !! end
20553
20554
20555 !! test
20556 Section extraction, <pre> around bogus header (T12309)
20557 !! options
20558 section=2
20559 !! wikitext
20560 == Section One ==
20561 <pre>
20562 =======
20563 </pre>
20564
20565 == Section Two ==
20566 stuff
20567 !! html/php
20568 == Section Two ==
20569 stuff
20570 !! end
20571
20572 !! test
20573 Section replacement, <pre> around bogus header (T12309)
20574 !! options
20575 replace=2,"xxx"
20576 !! wikitext
20577 == Section One ==
20578 <pre>
20579 =======
20580 </pre>
20581
20582 == Section Two ==
20583 stuff
20584 !! html/php
20585 == Section One ==
20586 <pre>
20587 =======
20588 </pre>
20589
20590 xxx
20591 !! end
20592
20593 !! test
20594 Handling of &#x0A; in URLs
20595 !! wikitext
20596 *irc://&#x0A;a
20597 !! html/php
20598 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20599
20600 !! html/parsoid
20601 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul>
20602 !! end
20603
20604 !! test
20605 Handling of %0A in URLs
20606 !! wikitext
20607 *irc://%0Aa
20608 !! html/php
20609 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20610
20611 !! html/parsoid
20612 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20613 !! end
20614
20615 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20616 !! test
20617 5 quotes, code coverage +1 line
20618 !! options
20619 parsoid=wt2html
20620 !! wikitext
20621 '''''
20622 !! html/php
20623 !! html/parsoid
20624 <p><b><i></i></b></p>
20625 !! end
20626
20627 # same html as previous, but wikitext adjusted to match parsoid html2wt
20628 # note that wt2html and html2html will put the <i> before the <b>
20629 !! test
20630 5 quotes, code coverage +1 line w/ nowiki (1)
20631 !! options
20632 parsoid=wt2wt,html2wt
20633 !! wikitext
20634 '''''<nowiki/>'''''
20635 !! html/php
20636 <p><i></i>
20637 </p>
20638 !! html/parsoid
20639 <p><b><i></i></b></p>
20640 !! end
20641
20642 # same as previous, just swapping the <i> and <b>
20643 !! test
20644 5 quotes, code coverage +1 line w/ nowiki (2)
20645 !! wikitext
20646 '''''<nowiki/>'''''
20647 !! html/php
20648 <p><i></i>
20649 </p>
20650 !! html/parsoid
20651 <p><i><b></b></i></p>
20652 !! end
20653
20654 !! test
20655 Special:Search page linking.
20656 !! wikitext
20657 {{Special:search}}
20658 !! html
20659 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20660 </p>
20661 !! end
20662
20663 !! test
20664 {{!}} is a magic word
20665 !! wikitext
20666 {{!}} is a magic word there and {{!}} is still a magic word here
20667 | is not a magic word here but {{!}} is still a magic word here
20668 !! html/php
20669 <p>| is a magic word there and | is still a magic word here
20670 | is not a magic word here but | is still a magic word here
20671 </p>
20672 !! html/parsoid
20673 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
20674 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
20675 !! end
20676
20677 !! test
20678 Say the magic word
20679 !! options
20680 title=[[Parser test]]
20681 !! wikitext
20682 *{{PAGENAME}}
20683 *{{PAGENAMEE}}
20684 *{{FULLPAGENAME}}
20685 *{{FULLPAGENAMEE}}
20686 *{{BASEPAGENAME}}
20687 *{{BASEPAGENAMEE}}
20688 *{{SUBPAGENAME}}
20689 *{{SUBPAGENAMEE}}
20690 *{{ROOTPAGENAME}}
20691 *{{ROOTPAGENAMEE}}
20692 *{{TALKPAGENAME}}
20693 *{{TALKPAGENAMEE}}
20694 *{{SUBJECTPAGENAME}}
20695 *{{SUBJECTPAGENAMEE}}
20696 *{{NAMESPACEE}}
20697 *{{NAMESPACE}}
20698 *{{NAMESPACENUMBER}}
20699 *{{TALKSPACE}}
20700 *{{TALKSPACEE}}
20701 *{{SUBJECTSPACE}}
20702 *{{SUBJECTSPACEE}}
20703 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20704 !! html
20705 <ul><li>Parser test</li>
20706 <li>Parser_test</li>
20707 <li>Parser test</li>
20708 <li>Parser_test</li>
20709 <li>Parser test</li>
20710 <li>Parser_test</li>
20711 <li>Parser test</li>
20712 <li>Parser_test</li>
20713 <li>Parser test</li>
20714 <li>Parser_test</li>
20715 <li>Talk:Parser test</li>
20716 <li>Talk:Parser_test</li>
20717 <li>Parser test</li>
20718 <li>Parser_test</li>
20719 <li></li>
20720 <li></li>
20721 <li>0</li>
20722 <li>Talk</li>
20723 <li>Talk</li>
20724 <li></li>
20725 <li></li>
20726 <li><a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
20727
20728 !! end
20729 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20730
20731 !! test
20732 Gallery with valid attributes
20733 !! wikitext
20734 <gallery type="123" summary="345">
20735 File:File:Foobar.jpg
20736 </gallery>
20737 !! html/php
20738 <ul class="gallery mw-gallery-traditional" type="123">
20739 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20740 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20741 <div class="gallerytext">
20742 </div>
20743 </div></li>
20744 </ul>
20745
20746 !! html/parsoid
20747 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{"extsrc":"\nFile:File:Foobar.jpg\n"}}'>
20748 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:File:Foobar.jpg"><img resource="./File:File:Foobar.jpg" src="./Special:FilePath/File:Foobar.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20749 </ul>
20750 !! end
20751
20752 ## Parsoid thinks the "centre" here is a property, not a caption.
20753 !! test
20754 Gallery
20755 !! options
20756 parsoid={
20757 "modes": ["wt2html"],
20758 "nativeGallery": true
20759 }
20760 !! wikitext
20761 <gallery>
20762 image1.png |
20763 image2.gif|||||
20764
20765 image3|
20766 image4 |300px| centre
20767 image5.svg| http://///////
20768 [[x|xx]]]]
20769 * image6
20770 </gallery>
20771 !! html/php
20772 <ul class="gallery mw-gallery-traditional">
20773 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20774 <div class="thumb" style="height: 150px;">Image1.png</div>
20775 <div class="gallerytext">
20776 </div>
20777 </div></li>
20778 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20779 <div class="thumb" style="height: 150px;">Image2.gif</div>
20780 <div class="gallerytext">
20781 </div>
20782 </div></li>
20783 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20784 <div class="thumb" style="height: 150px;">Image3</div>
20785 <div class="gallerytext">
20786 </div>
20787 </div></li>
20788 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20789 <div class="thumb" style="height: 150px;">Image4</div>
20790 <div class="gallerytext">
20791 <pre>centre
20792 </pre>
20793 </div>
20794 </div></li>
20795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20796 <div class="thumb" style="height: 150px;">Image5.svg</div>
20797 <div class="gallerytext">
20798 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20799 </p>
20800 </div>
20801 </div></li>
20802 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20803 <div class="thumb" style="height: 150px;">* image6</div>
20804 <div class="gallerytext">
20805 </div>
20806 </div></li>
20807 </ul>
20808
20809 !! html/parsoid
20810 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20811 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image1.png"><img resource="./File:Image1.png" src="./Special:FilePath/Image1.png" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20812 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image2.gif"><img resource="./File:Image2.gif" src="./Special:FilePath/Image2.gif" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20813 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20814 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></figure-inline></div><div class="gallerytext"></div></li>
20815 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image5.svg"><img resource="./File:Image5.svg" src="./Special:FilePath/Image5.svg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" class="external free" href="http://///////">http://///////</a></div></li>
20816 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20817 </ul>
20818 !! end
20819
20820 !! test
20821 Gallery (with options, html)
20822 !! options
20823 parsoid={
20824 "modes": ["wt2html", "html2html"],
20825 "nativeGallery": true
20826 }
20827 !! wikitext
20828 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20829 File:Nonexistent.jpg|caption
20830 File:Nonexistent.jpg
20831 image:foobar.jpg|some '''caption''' [[Main Page]]
20832 image:foobar.jpg
20833 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20834 </gallery>
20835 !! html/php
20836 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20837 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20838 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20839 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20840 <div class="gallerytext">
20841 <p>caption
20842 </p>
20843 </div>
20844 </div></li>
20845 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20846 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20847 <div class="gallerytext">
20848 </div>
20849 </div></li>
20850 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20851 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20852 <div class="gallerytext">
20853 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20854 </p>
20855 </div>
20856 </div></li>
20857 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20858 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20859 <div class="gallerytext">
20860 </div>
20861 </div></li>
20862 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20863 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20864 <div class="gallerytext">
20865 <p>blabla.
20866 </p>
20867 </div>
20868 </div></li>
20869 </ul>
20870
20871 !! html/parsoid
20872 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2"},"body":{}}'>
20873 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20874 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20875 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20876 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20877 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20878 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
20879 </ul>
20880 !! end
20881
20882 !! test
20883 Gallery (with options, extsrc)
20884 !! options
20885 parsoid={
20886 "nativeGallery": false
20887 }
20888 !! wikitext
20889 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20890 File:Nonexistent.jpg|caption
20891 File:Nonexistent.jpg
20892 image:foobar.jpg|some '''caption''' [[Main Page]]
20893 image:foobar.jpg
20894 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20895 </gallery>
20896 !! html/php
20897 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20898 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20899 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20900 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20901 <div class="gallerytext">
20902 <p>caption
20903 </p>
20904 </div>
20905 </div></li>
20906 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20907 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20908 <div class="gallerytext">
20909 </div>
20910 </div></li>
20911 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20912 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20913 <div class="gallerytext">
20914 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20915 </p>
20916 </div>
20917 </div></li>
20918 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20919 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20920 <div class="gallerytext">
20921 </div>
20922 </div></li>
20923 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20924 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20925 <div class="gallerytext">
20926 <p>blabla.
20927 </p>
20928 </div>
20929 </div></li>
20930 </ul>
20931
20932 !! html/parsoid
20933 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
20934 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20935 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
20936 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20937 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
20938 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20939 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
20940 </ul>
20941 !! end
20942
20943 !! test
20944 Gallery (without px units)
20945 !! wikitext
20946 <gallery widths="70" heights="40">
20947 File:Foobar.jpg
20948 </gallery>
20949 !! html/php
20950 <ul class="gallery mw-gallery-traditional">
20951 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20952 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
20953 <div class="gallerytext">
20954 </div>
20955 </div></li>
20956 </ul>
20957
20958 !! html/parsoid
20959 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
20960 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
20961 </ul>
20962 !! end
20963
20964 !! test
20965 Gallery (with invalid units)
20966 !! wikitext
20967 <gallery widths="70em" heights="40em">
20968 File:Foobar.jpg
20969 </gallery>
20970 !! html/php
20971 <ul class="gallery mw-gallery-traditional">
20972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20973 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20974 <div class="gallerytext">
20975 </div>
20976 </div></li>
20977 </ul>
20978
20979 !! html/parsoid
20980 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
20981 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
20982 </ul>
20983 !! end
20984
20985 !! test
20986 Gallery with link that has fragment
20987 !! options
20988 parsoid={
20989 "modes": ["wt2html", "html2html"],
20990 "nativeGallery": true
20991 }
20992 !! wikitext
20993 <gallery>
20994 image:foobar.jpg|link=Main_Page
20995 image:foobar.jpg|link=Main_Page#section
20996 image:foobar.jpg|link=Main Page#section|caption
20997 </gallery>
20998 !! html/php
20999 <ul class="gallery mw-gallery-traditional">
21000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21001 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21002 <div class="gallerytext">
21003 </div>
21004 </div></li>
21005 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21006 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21007 <div class="gallerytext">
21008 </div>
21009 </div></li>
21010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21011 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21012 <div class="gallerytext">
21013 <p>caption
21014 </p>
21015 </div>
21016 </div></li>
21017 </ul>
21018
21019 !! html/parsoid
21020 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21021 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21022 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21023 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21024 </ul>
21025 !! end
21026
21027 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
21028 !! test
21029 Gallery with template inside caption
21030 !! options
21031 parsoid={
21032 "nativeGallery": true
21033 }
21034 !! wikitext
21035 <gallery caption="{{echo|hi}}">
21036 File:Foobar.jpg|{{echo|ho}}
21037 </gallery>
21038 !! html/php
21039 <ul class="gallery mw-gallery-traditional">
21040 <li class='gallerycaption'>{{echo|hi}}</li>
21041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21042 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21043 <div class="gallerytext">
21044 <p>ho
21045 </p>
21046 </div>
21047 </div></li>
21048 </ul>
21049
21050 !! html/parsoid
21051 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21052 <li class="gallerycaption"><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></li>
21053 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho"}},"i":0}}]}'>ho</span></div></li>
21054 </ul>
21055 !! end
21056
21057 !! test
21058 Gallery with wikitext inside caption
21059 !! options
21060 parsoid={
21061 "nativeGallery": true
21062 }
21063 !! wikitext
21064 <gallery>
21065 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21066 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21067 </gallery>
21068 !! html/php
21069 <ul class="gallery mw-gallery-traditional">
21070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21071 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21072 <div class="gallerytext">
21073 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
21074 </p>
21075 </div>
21076 </div></li>
21077 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21078 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21079 <div class="gallerytext">
21080 <p>This is a test template
21081 </p>
21082 </div>
21083 </div></li>
21084 </ul>
21085
21086 !! html/parsoid
21087 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21088 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"desc"}'><a href="./File:Foobar.jpg"><img alt="inneralt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline></div></li>
21089 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"param"}},"i":0}}]}'>This is a test template</span></div></li>
21090 </ul>
21091 !! end
21092
21093 !! test
21094 Gallery (with showfilename option)
21095 !! options
21096 parsoid={
21097 "nativeGallery": true
21098 }
21099 !! wikitext
21100 <gallery showfilename="">
21101 File:Nonexistent.jpg|caption
21102 File:Nonexistent.jpg
21103 File:Foobar.jpg|some '''caption''' [[Main Page]]
21104 File:Foobar.jpg
21105 </gallery>
21106 !! html/php
21107 <ul class="gallery mw-gallery-traditional">
21108 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21109 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21110 <div class="gallerytext">
21111 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21112 caption
21113 </p>
21114 </div>
21115 </div></li>
21116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21117 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21118 <div class="gallerytext">
21119 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21120 </p>
21121 </div>
21122 </div></li>
21123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21124 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21125 <div class="gallerytext">
21126 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21127 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21128 </p>
21129 </div>
21130 </div></li>
21131 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21132 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21133 <div class="gallerytext">
21134 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21135 </p>
21136 </div>
21137 </div></li>
21138 </ul>
21139
21140 !! html/parsoid
21141 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21142 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
21143 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
21144 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
21145 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
21146 </ul>
21147 !! end
21148
21149 ## Should Parsoid be preserving these variations? See T151367
21150 !! test
21151 Gallery (with namespace-less filenames)
21152 !! options
21153 parsoid={
21154 "modes": ["wt2html", "html2html"],
21155 "nativeGallery": true
21156 }
21157 !! wikitext
21158 <gallery>
21159 File:Nonexistent.jpg
21160 Nonexistent.jpg
21161 image:foobar.jpg
21162 foobar.jpg
21163 </gallery>
21164 !! html/php
21165 <ul class="gallery mw-gallery-traditional">
21166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21167 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21168 <div class="gallerytext">
21169 </div>
21170 </div></li>
21171 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21172 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21173 <div class="gallerytext">
21174 </div>
21175 </div></li>
21176 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21177 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21178 <div class="gallerytext">
21179 </div>
21180 </div></li>
21181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21182 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21183 <div class="gallerytext">
21184 </div>
21185 </div></li>
21186 </ul>
21187
21188 !! html/parsoid
21189 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21190 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21191 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21192 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21193 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21194 </ul>
21195 !! end
21196
21197 !! test
21198 Gallery override link with wikilink (T36852)
21199 !! options
21200 parsoid={
21201 "nativeGallery": true
21202 }
21203 !! wikitext
21204 <gallery>
21205 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21206 </gallery>
21207 !! html/php
21208 <ul class="gallery mw-gallery-traditional">
21209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21210 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Wikilink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21211 <div class="gallerytext">
21212 </div>
21213 </div></li>
21214 </ul>
21215
21216 !! html/parsoid
21217 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21218 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Wikilink"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21219 </ul>
21220 !! end
21221
21222 !! test
21223 Gallery override link with absolute external link (T36852)
21224 !! options
21225 parsoid={
21226 "nativeGallery": true
21227 }
21228 !! wikitext
21229 <gallery>
21230 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21231 </gallery>
21232 !! html/php
21233 <ul class="gallery mw-gallery-traditional">
21234 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21235 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21236 <div class="gallerytext">
21237 </div>
21238 </div></li>
21239 </ul>
21240
21241 !! html/parsoid
21242 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21243 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21244 </ul>
21245 !! end
21246
21247 !! test
21248 Gallery override link with absolute external link with LanguageConverter
21249 !! options
21250 language=zh
21251 !! wikitext
21252 <gallery>
21253 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21254 </gallery>
21255 !! html/php
21256 <ul class="gallery mw-gallery-traditional">
21257 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21258 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21259 <div class="gallerytext">
21260 <p>caption
21261 </p>
21262 </div>
21263 </div></li>
21264 </ul>
21265
21266 !! html/parsoid
21267 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\n"}}'>
21268 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21269 </ul>
21270 !! end
21271
21272 !! test
21273 Gallery override link with malicious javascript (T36852)
21274 !! options
21275 parsoid={
21276 "modes": ["wt2html", "html2html"],
21277 "nativeGallery": true
21278 }
21279 !! wikitext
21280 <gallery>
21281 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21282 </gallery>
21283 !! html/php
21284 <ul class="gallery mw-gallery-traditional">
21285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21286 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21287 <div class="gallerytext">
21288 </div>
21289 </div></li>
21290 </ul>
21291
21292 !! html/parsoid
21293 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21294 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21295 </ul>
21296 !! end
21297
21298 # Note that parsoid uses the invalid link as a caption, PHP does not.
21299 !! test
21300 Gallery with invalid title as link (T45964)
21301 !! options
21302 parsoid={
21303 "modes": ["wt2html", "html2html"],
21304 "nativeGallery": true
21305 }
21306 !! wikitext
21307 <gallery>
21308 File:Foobar.jpg|link=<
21309 </gallery>
21310 !! html/php
21311 <ul class="gallery mw-gallery-traditional">
21312 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21313 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21314 <div class="gallerytext">
21315 </div>
21316 </div></li>
21317 </ul>
21318
21319 !! html/parsoid
21320 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21321 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">link=&lt;</div></li>
21322 </ul>
21323 !! end
21324
21325 !! test
21326 Serialize gallery without attrs in data-mw
21327 !! options
21328 parsoid={
21329 "modes": ["html2wt"],
21330 "nativeGallery": true
21331 }
21332 !! html/parsoid
21333 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21334 <li class="gallerycaption">123</li>
21335 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span>File:Test.png</span></div><div class="gallerytext"></div></li>
21336 </ul>
21337 !! wikitext
21338 <gallery caption="123">
21339 File:Test.png
21340 </gallery>
21341 !! end
21342
21343 !! test
21344 Gallery with class and style attributes
21345 !! options
21346 parsoid={
21347 "nativeGallery": true
21348 }
21349 !! wikitext
21350 <gallery class="center" style="text-align: center;">
21351 File:Foobar.jpg
21352 </gallery>
21353 !! html/php
21354 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21355 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21356 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21357 <div class="gallerytext">
21358 </div>
21359 </div></li>
21360 </ul>
21361
21362 !! html/parsoid
21363 <ul class="gallery mw-gallery-traditional center" style="text-align: center;" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center","style":"text-align: center;"},"body":{}}'>
21364 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21365 </ul>
21366 !! end
21367
21368 !! test
21369 Gallery in slideshow mode
21370 !! options
21371 parsoid={
21372 "nativeGallery": true
21373 }
21374 !! wikitext
21375 <gallery mode="slideshow" showthumbnails="">
21376 File:Foobar.jpg
21377 </gallery>
21378 !! html/php
21379 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21381 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21382 <div class="gallerytext">
21383 </div>
21384 </div></li>
21385 </ul>
21386
21387 !! html/parsoid
21388 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21389 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21390 </ul>
21391 !! end
21392
21393 !! test
21394 Serialize gallery image captions on a line
21395 !! options
21396 parsoid={
21397 "modes": ["html2wt"],
21398 "nativeGallery": true
21399 }
21400 !! html/parsoid
21401 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21402 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><p>hi</p><p>ho</p></div></li>
21403 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">hi<br />ho</div></li>
21404 </ul>
21405 !! wikitext
21406 <gallery>
21407 File:Foobar.jpg| hi ho
21408 File:Foobar.jpg|hi<br />ho
21409 </gallery>
21410 !! end
21411
21412 !! test
21413 HTML Hex character encoding (spells the word "JavaScript")
21414 !! options
21415 parsoid=wt2html,wt2wt,html2html
21416 !! wikitext
21417 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21418 !! html/php
21419 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21420 </p>
21421 !! html/parsoid
21422 <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
21423 !! end
21424
21425 !! test
21426 HTML Hex character encoding bogus encoding (T28437 regression check)
21427 !! wikitext
21428 &#xsee;&#XSEE;
21429 !! html
21430 <p>&amp;#xsee;&amp;#XSEE;
21431 </p>
21432 !! end
21433
21434 !! test
21435 HTML Hex character encoding mixed case
21436 !! options
21437 parsoid=wt2html,wt2wt,html2html
21438 !! wikitext
21439 &#xEE;&#Xee;
21440 !! html/php
21441 <p>&#xee;&#xee;
21442 </p>
21443 !! html/parsoid
21444 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21445 !! end
21446
21447 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21448 # Note that U+000C (form feed) is not a valid XML character, so
21449 # it is banned even though allowed in HTML5.
21450 !! test
21451 Illegal character references (T106578)
21452 !! wikitext
21453 ; Null: &#00;
21454 ; FF: &#xC;
21455 ; CR: &#xD;
21456 ; Control (low): &#8;
21457 ; Control (high): &#x7F; &#x9F;
21458 ; Surrogate: &#xD83D;&#xDCA9;
21459 ; This is an okay astral character: &#x1F4A9;
21460 !! html+tidy
21461 <dl><dt>Null</dt>
21462 <dd>&amp;#00;</dd>
21463 <dt>FF</dt>
21464 <dd>&amp;#xC;</dd>
21465 <dt>CR</dt>
21466 <dd>&amp;#xD;</dd>
21467 <dt>Control (low)</dt>
21468 <dd>&amp;#8;</dd>
21469 <dt>Control (high)</dt>
21470 <dd>&amp;#x7F; &amp;#x9F;</dd>
21471 <dt>Surrogate</dt>
21472 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21473 <dt>This is an okay astral character</dt>
21474 <dd>&#x1f4a9;</dd></dl>
21475 !! end
21476
21477 !! test
21478 __FORCETOC__ override
21479 !! wikitext
21480 __NEWSECTIONLINK__
21481 __FORCETOC__
21482 !! html/php
21483 <p><br />
21484 </p>
21485 !! end
21486
21487 !! test
21488 ISBN code coverage
21489 !! wikitext
21490 ISBN 978-0-1234-56&#x20;789
21491 !! html/php
21492 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21493 </p>
21494 !! html/parsoid
21495 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
21496 !! end
21497
21498 !! test
21499 ISBN followed by 5 spaces
21500 !! wikitext
21501 ISBN
21502 !! html
21503 <p>ISBN
21504 </p>
21505 !! end
21506
21507 !! test
21508 Double ISBN
21509 !! wikitext
21510 ISBN ISBN 1234567890
21511 !! html/php
21512 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21513 </p>
21514 !! html/parsoid
21515 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21516 !! end
21517
21518 # Uppercase X and lowercase x as well
21519 !! test
21520 ISBN with an X
21521 !! wikitext
21522 ISBN 3-462-04561-X
21523 ISBN 3-462-04561-x
21524 ISBN 080442957X
21525 ISBN 080442957x
21526 ISBN 978080442957X
21527 ISBN 978080442957x
21528 !! html/php
21529 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21530 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21531 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21532 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21533 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21534 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21535 </p>
21536 !! html/parsoid
21537 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21538 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21539 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21540 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21541 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21542 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21543 !! end
21544
21545 !! test
21546 ISBN with empty prefix (parsoid test)
21547 !! wikitext
21548 ISBN 1234567890
21549 !! html/php
21550 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21551 </p>
21552 !! html/parsoid
21553 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21554 !! end
21555
21556 !! test
21557 T24905: <abbr> followed by ISBN followed by </a>
21558 !! wikitext
21559 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21560 !! html/php
21561 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
21562 </p>
21563 !! html/parsoid
21564 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" class="external text" href="http://www.example.com">example.com</a></p>
21565 !! end
21566
21567 !! test
21568 Double RFC
21569 !! wikitext
21570 RFC RFC 1234
21571 !! html/php
21572 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21573 </p>
21574 !! html/parsoid
21575 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21576 !! end
21577
21578 !! test
21579 Double RFC with a wiki link
21580 !! wikitext
21581 RFC [[RFC 1234]]
21582 !! html/php
21583 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
21584 </p>
21585 !! html/parsoid
21586 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21587 !! end
21588
21589 !! test
21590 RFC code coverage
21591 !! wikitext
21592 RFC 983&#x20;987
21593 !! html/php
21594 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21595 </p>
21596 !! html/parsoid
21597 <p><a href="https://tools.ietf.org/html/rfc983" rel="mw:ExtLink" class="external mw-magiclink" data-parsoid='{"stx":"magiclink"}'>RFC 983</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>987</p>
21598 !! end
21599
21600 !! test
21601 Centre-aligned image
21602 !! wikitext
21603 [[Image:foobar.jpg|centre]]
21604 !! html/php
21605 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
21606
21607 !! html/parsoid
21608 <figure class="mw-default-size mw-halign-center" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"center","ak":"centre"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
21609 !! end
21610
21611 !! test
21612 None-aligned image
21613 !! wikitext
21614 [[Image:foobar.jpg|none]]
21615 !! html/php
21616 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
21617
21618 !! html/parsoid
21619 <figure class="mw-default-size mw-halign-none" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
21620 !! end
21621
21622 !! test
21623 Width + Height sized image (using px) (height is ignored)
21624 !! wikitext
21625 [[Image:foobar.jpg|640x480px]]
21626 !! html/php
21627 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
21628 </p>
21629 !! html/parsoid
21630 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640x480px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21631 !! end
21632
21633 !! test
21634 Width-sized image (using px, no following whitespace)
21635 !! wikitext
21636 [[Image:foobar.jpg|640px]]
21637 !! html/php
21638 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
21639 </p>
21640 !! html/parsoid
21641 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21642 !! end
21643
21644 !! test
21645 Width-sized image (using px, with following whitespace - test regression from r39467)
21646 !! wikitext
21647 [[Image:foobar.jpg|640px ]]
21648 !! html/php
21649 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
21650 </p>
21651 !! html/parsoid
21652 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px "}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21653 !!end
21654
21655 !! test
21656 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21657 !! wikitext
21658 [[Image:foobar.jpg| 640px]]
21659 !! html/php
21660 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
21661 </p>
21662 !! html/parsoid
21663 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":" 640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
21664 !! end
21665
21666 !! test
21667 Image with page parameter
21668 !! options
21669 djvu
21670 !! wikitext
21671 [[File:LoremIpsum.djvu|page=2]]
21672 !! html/php
21673 <p><a href="/index.php?title=File:LoremIpsum.djvu&amp;page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a>
21674 </p>
21675 !! html/parsoid
21676 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"2"}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></figure-inline></p>
21677 !! end
21678
21679 !! test
21680 Another italics / bold test
21681 !! wikitext
21682 ''' ''x'
21683 !! html
21684 <pre>'<i> </i>x'
21685 </pre>
21686 !!end
21687
21688 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21689 !! test
21690 dt/dd/dl test
21691 !! wikitext
21692 :;;;::
21693 !! html/php
21694 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21695
21696 !! html/parsoid
21697 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21698
21699 !!end
21700
21701 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21702 !! test
21703 Images with the "|" character in the comment
21704 !! wikitext
21705 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21706 !! html/php
21707 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
21708
21709 !! html/parsoid
21710 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
21711 !! end
21712
21713 !! test
21714 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21715 !! wikitext
21716 <html><script>alert(1);</script></html>
21717 !! html
21718 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21719 </p>
21720 !! end
21721
21722 !! test
21723 HTML with raw HTML ($wgRawHtml==true)
21724 !! options
21725 wgRawHtml=1
21726 !! wikitext
21727 <html><script>alert(1);</script></html>
21728 !! html/php
21729 <p><script>alert(1);</script>
21730 </p>
21731 !! end
21732
21733 !! test
21734 Parents of subpages, one level up
21735 !! options
21736 subpage title=[[Subpage test/L1/L2/L3]]
21737 !! wikitext
21738 [[../|L2]]
21739 !! html
21740 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
21741 </p>
21742 !! end
21743
21744
21745 !! test
21746 Parents of subpages, one level up, not named
21747 !! options
21748 subpage title=[[Subpage test/L1/L2/L3]]
21749 !! wikitext
21750 [[../]]
21751 !! html
21752 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
21753 </p>
21754 !! end
21755
21756
21757
21758 !! test
21759 Parents of subpages, two levels up
21760 !! options
21761 subpage title=[[Subpage test/L1/L2/L3]]
21762 !! wikitext
21763 [[../../|L1]]2
21764
21765 [[../../|L1]]l
21766 !! html
21767 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
21768 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
21769 </p>
21770 !! end
21771
21772 !! test
21773 Parents of subpages, two levels up, without trailing slash or name.
21774 !! options
21775 subpage title=[[Subpage test/L1/L2/L3]]
21776 !! wikitext
21777 [[../..]]
21778 !! html
21779 <p>[[../..]]
21780 </p>
21781 !! end
21782
21783 !! test
21784 Parents of subpages, two levels up, with lots of extra trailing slashes.
21785 !! options
21786 subpage title=[[Subpage test/L1/L2/L3]]
21787 !! wikitext
21788 [[../../////]]
21789 !! html
21790 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
21791 </p>
21792 !! end
21793
21794 !! article
21795 Subpage test/L1/L2/L3Sibling
21796 !! text
21797 Sibling article
21798 !! endarticle
21799
21800 !! test
21801 Transclusion of a sibling page (one level up)
21802 !! options
21803 subpage title=[[Subpage test/L1/L2/L3]]
21804 !! wikitext
21805 {{../L3Sibling}}
21806 !! html
21807 <p>Sibling article
21808 </p>
21809 !! end
21810
21811 !! test
21812 Transclusion of a child page
21813 !! options
21814 subpage title=[[Subpage test/L1/L2]]
21815 !! wikitext
21816 {{/L3Sibling}}
21817 !! html
21818 <p>Sibling article
21819 </p>
21820 !! end
21821
21822 # This is wt2html only in Parsoid because we add <nowiki>
21823 # because of {{..}} and we don't expect to fix that to
21824 # eliminate the nowikis selective for {{..}} markup.
21825 !! test
21826 Non-transclusion because of too many up levels
21827 !! options
21828 subpage title=[[Subpage test/L1/L2/L3]]
21829 parsoid=wt2html
21830 !! wikitext
21831 {{../../../../More than parent}}
21832 !! html/php
21833 <p>{{../../../../More than parent}}
21834 </p>
21835 !! html/parsoid
21836 <p>{{../../../../More than parent}}</p>
21837 !! end
21838
21839 !! test
21840 Definition list code coverage
21841 !! wikitext
21842 ;title :def
21843 ;title :def
21844 ;title:def
21845 !! html/php
21846 <dl><dt>title</dt>
21847 <dd>def</dd>
21848 <dt>title</dt>
21849 <dd>def</dd>
21850 <dt>title</dt>
21851 <dd>def</dd></dl>
21852
21853 !! html/parsoid
21854 <dl><dt>title </dt><dd>def</dd>
21855 <dt>title </dt><dd>def</dd>
21856 <dt>title</dt><dd>def</dd></dl>
21857 !! end
21858
21859 !! test
21860 Don't fall for the self-closing div
21861 !! wikitext
21862 <div>hello world</div/>
21863 !! html
21864 <div>hello world</div>
21865
21866 !! end
21867
21868 !! test
21869 MSGNW magic word
21870 !! wikitext
21871 {{MSGNW:msg}}
21872 !! html/php
21873 <p>&#91;&#91;:Template:Msg&#93;&#93;
21874 </p>
21875 !! end
21876
21877 !! test
21878 RAW magic word
21879 !! wikitext
21880 {{RAW:QUERTY}}
21881 !! html
21882 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
21883 </p>
21884 !! end
21885
21886 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21887 !! test
21888 Always escape literal '>' in output, not just after '<'
21889 !! wikitext
21890 ><>
21891 !! html
21892 <p>&gt;&lt;&gt;
21893 </p>
21894 !! end
21895
21896 !! test
21897 Template caching
21898 !! wikitext
21899 {{Test}}
21900 {{Test}}
21901 !! html
21902 <p>This is a test template
21903 This is a test template
21904 </p>
21905 !! end
21906
21907
21908 !! article
21909 MediaWiki:Fake
21910 !! text
21911 ==header==
21912 !! endarticle
21913
21914 !! test
21915 Inclusion of !userCanEdit() content
21916 !! wikitext
21917 {{MediaWiki:Fake}}
21918 !! html
21919 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21920
21921 !! end
21922
21923
21924 !! test
21925 Out-of-order TOC heading levels
21926 !! wikitext
21927 ==2==
21928 ======6======
21929 ===3===
21930 =1=
21931 =====5=====
21932 ==2==
21933 !! html
21934 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
21935 <ul>
21936 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21937 <ul>
21938 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21939 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21940 </ul>
21941 </li>
21942 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21943 <ul>
21944 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21945 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21946 </ul>
21947 </li>
21948 </ul>
21949 </div>
21950
21951 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21952 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
21953 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
21954 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
21955 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
21956 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21957
21958 !! end
21959
21960
21961 !! test
21962 ISBN with a dummy number
21963 !! wikitext
21964 ISBN ---
21965 !! html
21966 <p>ISBN ---
21967 </p>
21968 !! end
21969
21970
21971 !! test
21972 ISBN with space-delimited number
21973 !! wikitext
21974 ISBN 92 9017 032 8
21975 !! html/php
21976 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21977 </p>
21978 !! html/parsoid
21979 <p data-parsoid='{"dsr":[0,18,0,0]}'><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink","dsr":[0,18,2,2]}'>ISBN 92 9017 032 8</a></p>
21980 !! end
21981
21982
21983 !! test
21984 ISBN with multiple spaces, no number
21985 !! wikitext
21986 ISBN foo
21987 !! html
21988 <p>ISBN foo
21989 </p>
21990 !! end
21991
21992
21993 !! test
21994 ISBN length
21995 !! wikitext
21996 ISBN 123456789
21997
21998 ISBN 1234567890
21999
22000 ISBN 12345678901
22001 !! html/php
22002 <p>ISBN 123456789
22003 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22004 </p><p>ISBN 12345678901
22005 </p>
22006 !! html/parsoid
22007 <p>ISBN 123456789</p>
22008
22009 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22010
22011 <p>ISBN 12345678901</p>
22012 !! end
22013
22014
22015 !! test
22016 ISBN with trailing year (T9110)
22017 !! wikitext
22018 ISBN 1-234-56789-0 - 2006
22019
22020 ISBN 1 234 56789 0 - 2006
22021 !! html/php
22022 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22023 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22024 </p>
22025 !! html/parsoid
22026 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22027
22028 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22029 !! end
22030
22031
22032 !! test
22033 anchorencode
22034 !! config
22035 wgFragmentMode=[ 'html5', 'legacy' ]
22036 !! wikitext
22037 {{anchorencode:foo bar©#%n}}
22038 !! html/php
22039 <p>foo_bar©#%n
22040 </p>
22041 !! html/parsoid
22042 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:foo bar©#%n","function":"anchorencode"},"params":{},"i":0}}]}'>foo_bar©#%n</p>
22043 !! end
22044
22045 !! test
22046 anchorencode (legacy)
22047 !! config
22048 wgFragmentMode=[ 'legacy' ]
22049 !! wikitext
22050 {{anchorencode:foo bar©#%n}}
22051 !! html/php
22052 <p>foo_bar.C2.A9.23.25n
22053 </p>
22054 !! end
22055
22056 !! test
22057 anchorencode trims spaces
22058 !! config
22059 wgFragmentMode=[ 'html5', 'legacy' ]
22060 !! wikitext
22061 {{anchorencode: __pretty__please__}}
22062 !! html/php
22063 <p>pretty_please
22064 </p>
22065 !! html/parsoid
22066 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22067 !! end
22068
22069 !! test
22070 anchorencode deals with links
22071 !! config
22072 wgFragmentMode=[ 'html5', 'legacy' ]
22073 !! wikitext
22074 {{anchorencode: [[hello|world]] [[hi]]}}
22075 !! html/php
22076 <p>world_hi
22077 </p>
22078 !! html/parsoid
22079 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22080 !! end
22081
22082 !! test
22083 anchorencode deals with templates
22084 !! config
22085 wgFragmentMode=[ 'html5', 'legacy' ]
22086 !! wikitext
22087 {{anchorencode: {{Foo}} x}}
22088 !! html/php
22089 <p>FOO_x
22090 </p>
22091 !! html/parsoid
22092 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22093 !! end
22094
22095 !! test
22096 anchorencode encodes like the TOC generator: (T20431)
22097 !! config
22098 wgFragmentMode=[ 'html5', 'legacy' ]
22099 !! wikitext
22100 ===_ +:.3A%3A _ &&amp;]] x===
22101 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22102 __NOEDITSECTION__
22103 !! html/php
22104 <h3><span id=".2B:.3A.253A_.26.26.5D.5D_x"></span><span class="mw-headline" id="+:.3A%3A_&amp;&amp;]]_x">_ +:.3A%3A _ &amp;&amp;]] x</span></h3>
22105 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22106 </p>
22107 !! html/parsoid
22108 <h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &amp;<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;","dsr":[18,23,null,null]}'>&amp;</span>]] x</h3>
22109 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &amp;&amp;amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%3A_&amp;&amp;<span typeof="mw:Entity">]</span><span typeof="mw:Entity">]</span>_x</p>
22110 <meta property="mw:PageProp/noeditsection"/>
22111 !! end
22112
22113 !! test
22114 anchorencode encodes like the TOC generator: (T20431) (legacy)
22115 !! config
22116 wgFragmentMode=[ 'legacy' ]
22117 !! wikitext
22118 ===_ +:.3A%3A&&amp;]]===
22119 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22120 __NOEDITSECTION__
22121 !! html/php
22122 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22123 <p>.2B:.3A.253A.26.26.5D.5D
22124 </p>
22125 !! end
22126
22127 !! test
22128 T8200: blockquotes and paragraph formatting
22129 !! wikitext
22130 <blockquote>
22131 foo
22132 </blockquote>
22133
22134 bar
22135
22136 baz
22137 !! html
22138 <blockquote>
22139 <p>foo
22140 </p>
22141 </blockquote>
22142 <p>bar
22143 </p>
22144 <pre>baz
22145 </pre>
22146 !! end
22147
22148 !! test
22149 T10293: Use of center tag ruins paragraph formatting
22150 !! wikitext
22151 <center>
22152 foo
22153 </center>
22154
22155 bar
22156
22157 baz
22158 !! html
22159 <center>
22160 <p>foo
22161 </p>
22162 </center>
22163 <p>bar
22164 </p>
22165 <pre>baz
22166 </pre>
22167 !! end
22168
22169 !!test
22170 Parsing of overlapping (improperly nested) inline html tags
22171 !! wikitext
22172 <span><s>x</span></s>
22173 !! html/php
22174 <p><span><s>x&lt;/span&gt;</s></span>
22175 </p>
22176 !! html/parsoid
22177 <p><span><s>x</s></span>
22178 </p>
22179 !!end
22180
22181 ###
22182 ### Language variants related tests
22183 ###
22184
22185 # Parsoid does not mark self-links.
22186 # Parsoid does not convert links; PHP will do any necessary redirects.
22187
22188 !! test
22189 Self-link in language variants
22190 !! options
22191 title=[[Dunav]] language=sr
22192 !! wikitext
22193 Both [[Dunav]] and [[Дунав]] are names for this river.
22194 !! html/php
22195 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22196 </p>
22197 !! html/parsoid
22198 <p>Both <a rel="mw:WikiLink" href="./Dunav" title="Dunav">Dunav</a> and <a rel="mw:WikiLink" href="./Дунав" title="Дунав">Дунав</a> are names for this river.</p>
22199 !! end
22200
22201 !! article
22202 Дуна
22203 !! text
22204 content
22205 !! endarticle
22206
22207 !! test
22208 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22209 !! options
22210 title=[[Duna]] language=sr
22211 !! wikitext
22212 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22213 !! html/php
22214 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links.
22215 </p>
22216 !! html/parsoid
22217 <p><a rel="mw:WikiLink" href="./Дуна" title="Дуна">Дуна</a> is not a self-link while <a rel="mw:WikiLink" href="./Duna" title="Duna">Duna</a> and <a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> are still self-links.</p>
22218 !! end
22219
22220 !! test
22221 Link to a section of a variant of this title shouldn't be parsed as self-link
22222 !! options
22223 title=[[Duna]] language=sr
22224 !! wikitext
22225 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22226 !! html/php
22227 <p><a class="mw-selflink selflink">Dуна</a> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
22228 </p>
22229 !! html/parsoid
22230 <p><a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> is a self-link while <a rel="mw:WikiLink" href="./Dunа#Foo" title="Dunа">Dunа#Foo</a> and <a rel="mw:WikiLink" href="./Dуна#Foo" title="Dуна">Dуна#Foo</a> are not self-links.</p>
22231 !! end
22232
22233 !! test
22234 Link to pages in language variants
22235 !! options
22236 language=sr
22237 !! wikitext
22238 Main Page can be written as [[Маин Паге]]
22239 !! html/php
22240 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22241 </p>
22242 !! html/parsoid
22243 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22244 !! end
22245
22246
22247 !! test
22248 Multiple links to pages in language variants
22249 !! options
22250 language=sr
22251 !! wikitext
22252 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22253 !! html/php
22254 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
22255 </p>
22256 !! html/parsoid
22257 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a> can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a> same as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a>.</p>
22258 !! end
22259
22260
22261 !! test
22262 Simple template in language variants
22263 !! options
22264 language=sr
22265 !! wikitext
22266 {{тест}}
22267 !! html/php
22268 <p>This is a test template
22269 </p>
22270 !! end
22271
22272
22273 !! test
22274 Template with explicit namespace in language variants
22275 !! options
22276 language=sr
22277 !! wikitext
22278 {{Template:тест}}
22279 !! html/php
22280 <p>This is a test template
22281 </p>
22282 !! end
22283
22284
22285 !! test
22286 Basic test for template parameter in language variants
22287 !! options
22288 language=sr
22289 !! wikitext
22290 {{парамтест|param=foo}}
22291 !! html/php
22292 <p>This is a test template with parameter foo
22293 </p>
22294 !! end
22295
22296 !! test
22297 Simple category in language variants
22298 !! options
22299 language=sr cat
22300 !! wikitext
22301 [[Category:МедиаWики Усер'с Гуиде]]
22302 !! html/php
22303 cat=МедиаWики_Усер'с_Гуиде sort=
22304 !! html/parsoid
22305 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22306 !! end
22307
22308 !! article
22309 Category:分类
22310 !! text
22311 blah
22312 !! endarticle
22313
22314 !! article
22315 Category:分類
22316 !! text
22317 blah
22318 !! endarticle
22319
22320 ## We used to, but no longer wt2wt this test since the default serializer
22321 ## will normalize all categories to serialize on their own line.
22322 ## This wikitext usage is going to be fairly uncommon in production and
22323 ## selser will take care of preserving formatting in those scenarios.
22324 !! test
22325 Don't convert blue categorylinks to another variant (T35210)
22326 !! options
22327 cat
22328 language=zh
22329 parsoid=wt2html
22330 !! wikitext
22331 [[A]][[Category:分类]]
22332 !! html/php
22333 cat=分类 sort=
22334 !! html/parsoid
22335 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22336 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22337 !! end
22338
22339 !! test
22340 Stripping -{}- tags (language variants)
22341 !! options
22342 language=sr
22343 !! wikitext
22344 Latin proverb: -{Ne nuntium necare}-
22345 !! html/php
22346 <p>Latin proverb: Ne nuntium necare
22347 </p>
22348 !! html/parsoid
22349 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22350 !! end
22351
22352
22353 !! test
22354 Prevent conversion with -{}- tags (language variants)
22355 !! options
22356 language=sr variant=sr-ec
22357 !! wikitext
22358 Latinski: -{Ne nuntium necare}-
22359 !! html/php
22360 <p>Латински: Ne nuntium necare
22361 </p>
22362 !! html/parsoid
22363 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22364 !! end
22365
22366
22367 !! test
22368 Prevent conversion of text with -{}- tags (language variants)
22369 !! options
22370 language=sr variant=sr-ec
22371 !! wikitext
22372 Latinski: -{Ne nuntium necare}-
22373 !! html/php
22374 <p>Латински: Ne nuntium necare
22375 </p>
22376 !! html/parsoid
22377 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22378 !! end
22379
22380
22381 !! test
22382 Prevent conversion of links with -{}- tags (language variants)
22383 !! options
22384 language=sr variant=sr-ec
22385 !! wikitext
22386 -{[[Main Page]]}-
22387 !! html/php
22388 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22389 </p>
22390 !! html/parsoid
22391 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}&#39;>Main Page&lt;/a>"}}'></span></p>
22392 !! end
22393
22394
22395 !! test
22396 -{}- tags within headlines (within html for parserConvert())
22397 !! config
22398 wgFragmentMode=[ 'html5', 'legacy' ]
22399 !! options
22400 language=sr variant=sr-ec
22401 !! wikitext
22402 ==-{Naslov}-==
22403
22404 Note that even an unprotected headline ID is not affected by language
22405 conversion:
22406
22407 ==Latinski==
22408 !! html/php
22409 <h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov”">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
22410 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22411 цонверсион:
22412 </p>
22413 <h2><span class="mw-headline" id="Latinski">Латински</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Уредите одељак „Латински”">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
22414
22415 !! html/parsoid
22416 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22417
22418 <p>Note that even an unprotected headline ID is not affected by language
22419 conversion:</p>
22420
22421 <h2 id="Latinski">Latinski</h2>
22422 !! end
22423
22424 !! test
22425 Explicit definition of language variant alternatives
22426 !! options
22427 language=zh variant=zh-tw
22428 !! wikitext
22429 -{zh:China;zh-tw:Taiwan}-, not China
22430 !! html/php
22431 <p>Taiwan, not China
22432 </p>
22433 !! html/parsoid
22434 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, not China</p>
22435 !! end
22436
22437 !! test
22438 Explicit definition of language variant alternatives (BCP 47 codes)
22439 !! options
22440 language=zh variant=zh-tw
22441 !! wikitext
22442 -{zh:China;zh-Hant-TW:Taiwan}-, not China
22443 !! html/php
22444 <p>Taiwan, not China
22445 </p>
22446 !! html/parsoid
22447 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-Hant-TW","t":"Taiwan"}]}'></span>, not China</p>
22448 !! end
22449
22450 !! test
22451 Filter syntax for language variants
22452 !! options
22453 language=zh variant=zh-tw
22454 !! wikitext
22455 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22456 !! html/php
22457 <p>fooblog, WEBJOURNAL, WEBLOGquux
22458 </p>
22459 !! html/parsoid
22460 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22461 !! end
22462
22463 # Note that Parsoid post-processing for language variants needs to
22464 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22465 !! test
22466 Conversion around HTML tags
22467 !! options
22468 language=sr variant=sr-ec
22469 !! wikitext
22470 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22471 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22472 !! html/php
22473 <p>
22474 <span title="ЛаCтин">ски</span>
22475 </p>
22476 !! html/parsoid
22477 <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"}]}'/>
22478 <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>
22479 !! end
22480
22481 !! test
22482 Explicit session-wise two-way language variant mapping (A flag and - flag)
22483 !! options
22484 language=zh variant=zh-tw
22485 !! wikitext
22486 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22487
22488 Taiwan is not China.
22489
22490 But -{A|zh:China; zh-tw:Taiwan}- is China,
22491
22492 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22493
22494 and -{China}- is China.
22495 !! html/php
22496 <p>This is Taiwan, but we'll forget that now.
22497 </p><p>Taiwan is not China.
22498 </p><p>But Taiwan is Taiwan,
22499 </p><p>(This should be stripped!)
22500 </p><p>and China is China.
22501 </p>
22502 !! html/parsoid
22503 <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>
22504 <p>Taiwan is not China.</p>
22505 <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>
22506 <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>
22507 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22508 !! end
22509
22510 !! test
22511 Explicit session-wise one-way language variant mapping (A flag and - flag)
22512 !! options
22513 language=zh variant=zh-tw
22514 !! wikitext
22515 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22516
22517 COUNTRY is China or Taiwan.
22518
22519 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22520
22521 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22522
22523 and -{COUNTRY}- is COUNTRY.
22524 !! html/php
22525 <p>This is Taiwan, but we'll forget that now.
22526 </p><p>COUNTRY is China or Taiwan.
22527 </p><p>But Taiwan is Taiwan,
22528 </p><p>(This should be stripped!)
22529 </p><p>and COUNTRY is COUNTRY.
22530 </p>
22531 !! html/parsoid
22532 <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>
22533 <p>COUNTRY is China or Taiwan.</p>
22534 <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>
22535 <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>
22536 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22537 !! end
22538
22539 !! test
22540 Explicit session-wise two-way language variant mapping (H flag for hide)
22541 !! options
22542 language=zh variant=zh-tw
22543 !! wikitext
22544 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22545
22546 Taiwan is China.
22547 !! html/php
22548 <p>(This should be stripped!)
22549 </p><p>Taiwan is Taiwan.
22550 </p>
22551 !! html/parsoid
22552 <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>
22553 <p>Taiwan is China.</p>
22554 !! end
22555
22556 !! test
22557 Explicit session-wise one-way language variant mapping (H flag for hide)
22558 !! options
22559 language=zh variant=zh-tw
22560 !! wikitext
22561 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22562
22563 COUNTRY is Taiwan or China.
22564 !! html/php
22565 <p>(This should be stripped!)
22566 </p><p>Taiwan is Taiwan or China.
22567 </p>
22568 !! html/parsoid
22569 <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>
22570 <p>COUNTRY is Taiwan or China.</p>
22571 !! end
22572
22573 ## Note that parsoid test runner does not support 'showtitle' option.
22574 !! test
22575 Adding explicit conversion rule for title (T flag)
22576 !! options
22577 language=zh variant=zh-tw showtitle
22578 !! wikitext
22579 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22580
22581 Taiwan is China.
22582 !! html/php
22583 Taiwan
22584 <p>Should be stripped!
22585 </p><p>Taiwan is China.
22586 </p>
22587 !! html/parsoid
22588 <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>
22589 <p>Taiwan is China.</p>
22590 !! end
22591
22592 !! test
22593 Code coverage: T combined with H flag
22594 !! options
22595 language=zh variant=zh-tw showtitle
22596 !! wikitext
22597 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22598
22599 Taiwan is China.
22600 !! html/php
22601 Taiwan
22602 <p>Should be stripped!
22603 </p><p>Taiwan is Taiwan.
22604 </p>
22605 !! html/parsoid
22606 <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>
22607 <p>Taiwan is China.</p>
22608 !! end
22609
22610 !! test
22611 Code coverage: T with no variants
22612 !! options
22613 language=zh variant=zh-tw showtitle
22614 !! wikitext
22615 -{H|zh:China; zh-tw:Taiwan}-
22616 Taiwan is China.-{T|Taiwan is China}-
22617 !! html/php
22618 Taiwan is China
22619 <p>
22620 Taiwan is Taiwan.
22621 </p>
22622 !! html/parsoid
22623 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22624 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22625 !! end
22626
22627 !! test
22628 Code coverage: rules with no variants
22629 !! options
22630 language=zh variant=zh-tw
22631 !! wikitext
22632 -{H|zh:China; zh-tw:Taiwan}-
22633 Taiwan is China.
22634 -{H|China}-
22635 Taiwan is China.
22636 !! html/php
22637 <p>
22638 Taiwan is Taiwan.
22639
22640 Taiwan is China.
22641 </p>
22642 !! html/parsoid
22643 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22644 Taiwan is China.
22645 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22646 Taiwan is China.</p>
22647 !! end
22648
22649
22650 !! test
22651 Code coverage: D flag for conversion rule
22652 !! options
22653 language=zh variant=zh-tw
22654 !! wikitext
22655 -{D|zh-cn:XA; zh-tw:YA}-
22656 -{A;D|zh-cn:XB; zh-tw:YB}-
22657 -{D;H|zh-cn:XC; zh-tw:YC}-
22658
22659 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22660
22661 -{D|0=>zh-tw:1}-
22662 -{A;D|2=>zh-tw:3}-
22663 -{D;H|4=>zh-tw:5}-
22664
22665 XA XB XC YA YB YC FOO BAR BAT 012345
22666 !! html/php
22667 <p>大陆:XA;台灣:YA;
22668
22669 大陆:XC;台灣:YC;
22670 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22671 </p><p>0⇒台灣:1;
22672
22673 4⇒台灣:5;
22674 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22675 </p>
22676 !! html/parsoid
22677 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22678 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22679 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22680 <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>
22681 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22682 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22683 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22684 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22685 !! end
22686
22687 !! test
22688 Code coverage: N flag for conversion rule
22689 !! options
22690 language=zh variant=zh-cn
22691 !! wikitext
22692 -{N|zh-cn}-
22693
22694 -{N|zh-tw}-
22695
22696 -{N|sr-ec}-
22697 !! html/php
22698 <p>大陆
22699 </p><p>台灣
22700 </p><p>српски (ћирилица)‎
22701 </p>
22702 !! html/parsoid
22703 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22704 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22705 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22706 !! end
22707
22708 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22709 !! test
22710 Code coverage: N flag for conversion rule (wt2html only)
22711 !! options
22712 language=zh variant=zh-cn
22713 parsoid=wt2html,html2html
22714 !! wikitext
22715 -{D;N|en}-
22716 !! html/php
22717 <p>English
22718 </p>
22719 !! html/parsoid
22720 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22721 !! end
22722
22723 !! test
22724 Testing that changing the language variant here in the tests actually works
22725 !! options
22726 language=zh variant=zh showtitle
22727 !! wikitext
22728 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22729 !! html/php
22730 China
22731 <p>Should be stripped!
22732 </p>
22733 !! html/parsoid
22734 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22735 !! end
22736
22737 !! test
22738 Recursive conversion of alt and title attrs shouldn't clear converter state
22739 !! options
22740 language=zh variant=zh-cn
22741 showtitle
22742 !! wikitext
22743 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22744 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22745 !! html/php
22746 China
22747 <p>
22748 Should be stripped<span title="Exclamation">!</span>
22749 </p>
22750 !! html/parsoid
22751 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22752 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>
22753 !! end
22754
22755 !! test
22756 T26072: more test on conversion rule for title
22757 !! options
22758 language=zh variant=zh-tw showtitle
22759 !! wikitext
22760 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22761
22762 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22763 !! html/php
22764 Taiwan
22765 <p>This should be stripped!
22766 </p><p>This won't take interferes with the title rule.
22767 </p>
22768 !! html/parsoid
22769 <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>
22770 <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>
22771 !! end
22772
22773 !! test
22774 Partly disable title conversion if variant == main language code
22775 !! options
22776 language=zh variant=zh title=[[ZH]] showtitle
22777 !! wikitext
22778 -{T|zh-cn:CN;zh-tw:TW}-
22779 !! html/php
22780 ZH
22781 <p>
22782 </p>
22783 !! html/parsoid
22784 <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>
22785 !! end
22786
22787 !! test
22788 Partly disable title conversion if variant == main language code, more
22789 !! options
22790 language=zh variant=zh title=[[ZH]] showtitle
22791 !! wikitext
22792 -{T|TW}-
22793 !! html/php
22794 ZH
22795 <p>
22796 </p>
22797 !! html/parsoid
22798 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22799 !! end
22800
22801 !! test
22802 Raw output of variant escape tags (R flag)
22803 !! options
22804 language=zh variant=zh-tw
22805 !! wikitext
22806 Raw: -{R|zh:China;zh-tw:Taiwan}-
22807 !! html/php
22808 <p>Raw: zh:China;zh-tw:Taiwan
22809 </p>
22810 !! html/parsoid
22811 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22812 !! end
22813
22814 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22815 !! test
22816 Raw output of variant escape tags (R flag) (wt2html only)
22817 !! options
22818 language=zh variant=zh-tw
22819 parsoid=wt2html,html2html
22820 !! wikitext
22821 -{Variant}- -{D|syntax}- -{D;R|options}-
22822 !! html/php
22823 <p>Variant syntax options
22824 </p>
22825 !! html/parsoid
22826 <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>
22827 !! end
22828
22829 !! test
22830 Nested markup inside raw output of variant escape tags (R flag)
22831 !! options
22832 language=zh variant=zh-tw
22833 !! wikitext
22834 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22835 !! html/php
22836 <p>Nested raw: nested Taiwan nested
22837 </p>
22838 !! html/parsoid
22839 <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>
22840 !! end
22841
22842 !! test
22843 Nested markup and spaces inside raw output of variant escape tags (R flag)
22844 !! options
22845 language=zh variant=zh-tw
22846 !! wikitext
22847 X-{ outer -{ inner }- outer }-X
22848 !! html/php
22849 <p>X outer inner outer X
22850 </p>
22851 !! html/parsoid
22852 <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>
22853 !! end
22854
22855 !! test
22856 Templates inside raw output of variant escape tags (R flag)
22857 !! options
22858 language=zh variant=zh-tw
22859 !! wikitext
22860 Nested raw: -{R|nested {{echo|hi}} templates}-
22861 !! html/php
22862 <p>Nested raw: nested hi templates
22863 </p>
22864 !! html/parsoid
22865 <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>
22866 !! end
22867
22868 !! test
22869 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22870 !! options
22871 language=zh variant=zh-cn
22872 !! wikitext
22873 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22874 !! html/php
22875 <p>0
22876 </p>
22877 !! html/parsoid
22878 <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>
22879 !! end
22880
22881 !! test
22882 Conversion rules from [numeric-only string] to [something else] (T48634)
22883 !! options
22884 language=zh variant=zh-cn
22885 !! wikitext
22886 -{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
22887 !! html/php
22888 <p>D12345EE12345
22889 </p>
22890 !! html/parsoid
22891 <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>
22892 !! end
22893
22894 !! test
22895 Two-way converter rule entries with an empty value should be ignored (T53551)
22896 !! options
22897 language=zh variant=zh-cn
22898 !! wikitext
22899 -{H|zh-cn:foo;zh-tw:;}-foobar
22900 !! html/php
22901 <p>foobar
22902 </p>
22903 !! html/parsoid
22904 <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>
22905 !! end
22906
22907 !! test
22908 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22909 !! options
22910 language=zh variant=zh-cn
22911 !! wikitext
22912 -{H|=>zh-cn:foo;}-foobar
22913 !! html/php
22914 <p>foobar
22915 </p>
22916 !! html/parsoid
22917 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22918 !! end
22919
22920 !! test
22921 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22922 !! options
22923 language=zh variant=zh-cn
22924 !! wikitext
22925 -{H|}-foobar
22926 !! html/php
22927 <p>foobar
22928 </p>
22929 !! html/parsoid
22930 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22931 !! end
22932
22933 !! test
22934 Nested using of manual convert syntax
22935 !! options
22936 language=zh variant=zh-hk
22937 !! wikitext
22938 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22939 !! html/php
22940 <p>Nested: Hello Hong Kong!
22941 </p>
22942 !! html/parsoid
22943 <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>
22944 !! end
22945
22946 !! test
22947 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22948 !! options
22949 language=zh variant=zh-cn
22950 !! wikitext
22951 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22952 !! html/php
22953 <p><span title="X">A</span>
22954 </p>
22955 !! html/parsoid
22956 <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>
22957 !! end
22958
22959 !! test
22960 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22961 !! options
22962 language=zh variant=zh-cn
22963 !! wikitext
22964 -{<span title="-{X}-">A</span>}-
22965 !! html/php+disabled
22966 <p><span title="X">A</span>
22967 </p>
22968 !! html/parsoid
22969 <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>
22970 !! end
22971
22972 # Parsoid and PHP disagree on how to parse this example: Parsoid
22973 # insists that the content of a language converter element be a valid
22974 # DOM fragment or attribute string
22975 !! test
22976 Language converter markup with block content
22977 !! options
22978 language=zh variant=zh-cn
22979 !! wikitext
22980 <span>a-{b<div>c}-d
22981
22982 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22983
22984 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22985 !! html/php+tidy
22986 <span>ab<div>cd
22987 <span>ab<div>cd
22988 <span>ad
22989 </span></div></span></div></span>
22990 !! html/parsoid
22991 <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
22992
22993 <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
22994
22995 <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>
22996 !! end
22997
22998 !! test
22999 LanguageConverter selser (1)
23000 !! options
23001 language=zh variant=zh-cn
23002 parsoid={
23003 "modes": ["wt2wt", "selser"],
23004 "changes": [
23005 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23006 ]
23007 }
23008 !! wikitext
23009 -{raw}-
23010 !! wikitext/edited
23011 -{edited}-
23012 !! end
23013
23014 !! test
23015 LanguageConverter selser (2)
23016 !! options
23017 language=zh variant=zh-cn
23018 parsoid={
23019 "modes": ["wt2wt", "selser"],
23020 "changes": [
23021 ["span[class='x']", "contents", "text", "-{foo}-"],
23022 ["a", "contents", "text", "-{"],
23023 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23024 ]
23025 }
23026 !! wikitext
23027 <span class="x">TEXT1</span>
23028 [http://example.com TEXT2]
23029 [[Foo|TEXT3]]
23030 {{echo|TEXT4}}
23031 !! wikitext/edited
23032 <span class="x"><nowiki>-{foo}-</nowiki></span>
23033 [http://example.com -{]
23034 [[Foo|<nowiki>-{</nowiki>]]
23035 {{1x|<nowiki>-{</nowiki>}}
23036 !! end
23037
23038 # Tests LanguageVariantText in ConstrainedText
23039 !! test
23040 LanguageConverter selser (3)
23041 !! options
23042 language=zh variant=zh-cn
23043 parsoid={
23044 "modes": ["wt2wt", "selser"],
23045 "changes": [
23046 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23047 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23048 ]
23049 }
23050 !! wikitext
23051 {|
23052 |-
23053 |<span>Foo</span>
23054 |}
23055 !! wikitext/edited
23056 {|
23057 |-
23058 |<nowiki/>-{edited}-
23059 |}
23060 !! end
23061
23062 # Tests LanguageVariantText._fromSelSer
23063 !! test
23064 LanguageConverter selser (4)
23065 !! options
23066 language=zh variant=zh-cn
23067 parsoid={
23068 "modes": ["wt2wt", "selser"],
23069 "changes": [
23070 ["td > span.x", "remove"]
23071 ]
23072 }
23073 !! wikitext
23074 {|
23075 |-
23076 |<span class="x">Foo</span>-{Bar}-
23077 ||<span class="x">Foo</span>-{Bar}-
23078 |}
23079 !! wikitext/edited
23080 {|
23081 |-
23082 |<nowiki/>-{Bar}-
23083 ||-{Bar}-
23084 |}
23085 !! end
23086
23087 # Since Parsoid is starting to emit canonical wikitext for links,
23088 # [http://example.com http://example.com] will not RT back to that
23089 # form anymore.
23090 # Parsoid does not language-convert links (it is done in a
23091 # post-processing step)
23092 !! test
23093 Proper conversion of text in external links
23094 !! options
23095 language=sr variant=sr-ec
23096 parsoid=wt2html
23097 !! wikitext
23098 http://www.google.com
23099 gopher://www.google.com
23100 [http://www.google.com http://www.google.com]
23101 [gopher://www.google.com gopher://www.google.com]
23102 [https://www.google.com irc://www.google.com]
23103 [ftp://www.google.com www.google.com/ftp://dir]
23104 [//www.google.com www.google.com]
23105 !! html/php
23106 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23107 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23108 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23109 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23110 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23111 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23112 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23113 </p>
23114 !! html/parsoid
23115 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23116 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23117 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23118 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23119 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23120 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23121 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23122 !! end
23123
23124 !! test
23125 Do not convert roman numbers to language variants
23126 !! options
23127 language=sr variant=sr-ec
23128 !! wikitext
23129 Fridrih IV je car.
23130 !! html/php
23131 <p>Фридрих IV је цар.
23132 </p>
23133 !! html/parsoid
23134 <p>Fridrih IV je car.</p>
23135 !! end
23136
23137 !! test
23138 Unclosed language converter markup "-{"
23139 !! options
23140 language=sr
23141 !! wikitext
23142 -{T|hello
23143 !! html
23144 <p>-{T|hello
23145 </p>
23146 !! end
23147
23148 !! test
23149 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23150 !! options
23151 language=sr
23152 !! wikitext
23153 -{R|=&gt;}-
23154 !! html/php
23155 <p>=&gt;
23156 </p>
23157 !! html/parsoid
23158 <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>
23159 !!end
23160
23161 !! test
23162 Don't break link parsing if language converter markup is in the caption.
23163 !! options
23164 language=sr variant=sr-ec
23165 !! wikitext
23166 [[Main Page|-{R|main page}-]]
23167 !! html/php
23168 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23169 </p>
23170 !! html/parsoid
23171 <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>
23172 !! end
23173
23174 !! test
23175 T146304: Don't break template parsing if language converter markup is in the parameter.
23176 !! options
23177 language=sr variant=sr-ec
23178 !! wikitext
23179 {{echo|-{R|foo}-}}
23180 !! html/php
23181 <p>foo
23182 </p>
23183 !! html/parsoid
23184 <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>
23185 !! end
23186
23187 !! test
23188 T146305: Don't break image parsing if language converter markup is in the caption.
23189 !! options
23190 language=sr
23191 !! wikitext
23192 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23193 !! html/php
23194 <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>
23195
23196 !! html/parsoid
23197 <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>
23198 !! end
23199
23200 !! test
23201 T146305: Don't break image parsing if nested language converter markup is in the caption.
23202 !! options
23203 language=zh variant=zh-cn
23204 !! wikitext
23205 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23206 !! html/php
23207 <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>
23208
23209 !! html/parsoid
23210 <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>
23211 !! end
23212
23213 # XXX html2wt disabled because rich markup in alt is not preserved.
23214 !! test
23215 Don't break gallery if language converter markup is inside.
23216 !! options
23217 language=zh
23218 !! wikitext
23219 <gallery>
23220 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23221 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23222 </gallery>
23223 !! html/php
23224 <ul class="gallery mw-gallery-traditional">
23225 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23226 <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>
23227 <div class="gallerytext">
23228 <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>
23229 </p>
23230 </div>
23231 </div></li>
23232 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23233 <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>
23234 <div class="gallerytext">
23235 <p>This is a test template
23236 </p>
23237 </div>
23238 </div></li>
23239 </ul>
23240
23241 !! html/parsoid
23242 <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"}}'>
23243 <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>
23244 <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>
23245 </ul>
23246 !! end
23247
23248 !! test
23249 T153135: Don't break list handling if language converter markup is in the item.
23250 !! options
23251 language=zh variant=zh-cn
23252 !! wikitext
23253 ;-{zh-cn:AAA;zh-tw:BBB}-
23254 ;-{R|foo:bar}-
23255 !! html/php
23256 <dl><dt>AAA</dt>
23257 <dt>foo:bar</dt></dl>
23258
23259 !! html/parsoid
23260 <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>
23261 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23262 </dl>
23263 !! end
23264
23265 // Note that parsoid does not protect colons unless language converter
23266 // markup is properly nested, because it is a backtracking parser.
23267 !! test
23268 T153135: Unclosed markup in definition list (code coverage)
23269 !! options
23270 language=zh variant=zh-cn
23271 !! wikitext
23272 ;<b>foo:bar
23273 ;-{zh-cn:AAA
23274 !! html/php+tidy
23275 <dl><dt><b>foo:bar</b></dt><b>
23276 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23277 </b></p>
23278 !! html/parsoid
23279 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23280 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23281 !! end
23282
23283 !! test
23284 T153135: Nested language converter markup in definition list (code coverage)
23285 !! options
23286 language=zh variant=zh-cn
23287 !! wikitext
23288 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23289 !! html/php
23290 <dl><dt>AAA foo:bar bat:baz</dt>
23291 <dd>def</dd></dl>
23292
23293 !! html/parsoid
23294 <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>
23295 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23296 </dl>
23297 !! end
23298
23299 # html2wt mode disabled due to <nowiki> insertion.
23300 !! test
23301 T153140: Don't break table handling if language converter markup is in the cell.
23302 !! options
23303 language=sr variant=sr-ec
23304 parsoid=wt2html,wt2wt,html2html
23305 !! wikitext
23306 {|
23307 |-
23308 | -{R|B}-
23309 |}
23310 !! html/php
23311 <table>
23312
23313 <tr>
23314 <td>B
23315 </td></tr></table>
23316
23317 !! html/parsoid
23318 <table>
23319 <tbody>
23320 <tr>
23321 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23322 </tr>
23323 </tbody>
23324 </table>
23325 !! end
23326
23327 !! test
23328 Language converter tricky html2wt cases (1)
23329 !! options
23330 language=sr
23331 parsoid=html2wt,wt2wt
23332 !! html/parsoid
23333 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23334 !! wikitext
23335 -{<nowiki>}-</nowiki>}-
23336 !! html/php
23337 <p>&#125;-
23338 </p>
23339 !! end
23340
23341 !! test
23342 Language converter tricky html2wt cases (2)
23343 !! options
23344 language=sr
23345 parsoid=html2wt,wt2wt
23346 !! html/parsoid
23347 <p>-{foo}-</p>
23348 !! wikitext
23349 <nowiki>-{foo}-</nowiki>
23350 !! html/php
23351 <p>-&#123;foo&#125;-
23352 </p>
23353 !! end
23354
23355 !! test
23356 Language converter tricky html2wt cases (3)
23357 !! options
23358 language=sr
23359 parsoid=html2wt,wt2wt
23360 !! html/parsoid
23361 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23362 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23363 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23364 !! wikitext
23365 -{R||}-
23366
23367 -{R|R|raw}-
23368
23369 -{<nowiki>-{foo}-</nowiki>}-
23370 !! html/php
23371 <p>|
23372 </p><p>R|raw
23373 </p><p>-&#123;foo&#125;-
23374 </p>
23375 !! end
23376
23377 !! test
23378 Language converter tricky html2wt cases (4)
23379 !! options
23380 language=sr
23381 parsoid=html2wt,wt2wt
23382 !! html/parsoid
23383 <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>
23384 !! wikitext
23385 -{R|{{echo|hey}}}-
23386 !! html/php
23387 <p>hey
23388 </p>
23389 !! end
23390
23391 # Note that the <nowiki> escaping added by parsoid for source text,
23392 # destination text, and language names only works on the PHP side
23393 # for *destination text*. (HTML entity escaping wouldn't work
23394 # any better.) This is probably a bug, at least for source texts.
23395 # (For language names PHP uses a precise regexp based on the languages
23396 # it currently knows have variants, which is fragile since this set
23397 # can grow/shrink over time.)
23398 !! test
23399 Language converter tricky html2wt cases (5)
23400 !! options
23401 language=zh variant=zh-cn
23402 !! html/parsoid
23403 <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>
23404 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23405 <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>
23406 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23407 <p>a:b=>c xyz</p>
23408 !! wikitext
23409 -{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
23410
23411 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23412
23413 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23414
23415 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23416
23417 a:b=>c xyz
23418 !! html/php+disabled
23419 <p>foobat;xyz=&gt;zh-cn:abc
23420 </p><p>A
23421 </p><p>0;zh-tw:bar
23422 </p><p>abc
23423 </p><p>a:b=&gt;c 0;zh-tw:bar
23424 </p>
23425 !! end
23426
23427 !! test
23428 T179579: Nowiki and lc interaction
23429 !! options
23430 parsoid=wt2html
23431 language=sr
23432 !! wikitext
23433 -{</nowiki>123}-
23434
23435 -{123<nowiki>|</nowiki>456}-
23436 !! html/parsoid
23437 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23438
23439 <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>
23440 !! end
23441
23442 !! test
23443 T2529: Uncovered bullet
23444 !! wikitext
23445 *Foo {{bullet}}
23446 !! html
23447 <ul><li>Foo</li>
23448 <li>Bar</li></ul>
23449
23450 !! end
23451
23452 !! test
23453 T2529: Uncovered bullet in a deeply nested list
23454 !! wikitext
23455 *******Foo {{bullet}}
23456 !! html
23457 <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>
23458 <li>Bar</li></ul>
23459
23460 !! end
23461
23462 !! test
23463 T2529: Uncovered table already at line-start
23464 !! wikitext
23465 x
23466
23467 {{table}}
23468 y
23469 !! html
23470 <p>x
23471 </p>
23472 <table>
23473 <tr>
23474 <td>1</td>
23475 <td>2
23476 </td></tr>
23477 <tr>
23478 <td>3</td>
23479 <td>4
23480 </td></tr></table>
23481 <p>y
23482 </p>
23483 !! end
23484
23485 !! test
23486 T2529: Uncovered bullet in parser function result
23487 !! wikitext
23488 *Foo {{lc:{{bullet}} }}
23489 !! html
23490 <ul><li>Foo</li>
23491 <li>bar</li></ul>
23492
23493 !! end
23494
23495 !! test
23496 T7678: Double-parsed template argument
23497 !! wikitext
23498 {{lc:{{{1}}}|hello}}
23499 !! html
23500 <p>{{{1}}}
23501 </p>
23502 !! end
23503
23504 !! test
23505 T7678: Double-parsed template invocation
23506 !! wikitext
23507 {{lc:{{paramtest {{!}} param = hello }} }}
23508 !! html
23509 <p>{{paramtest | param = hello }}
23510 </p>
23511 !! end
23512
23513 !! test
23514 Case insensitivity of parser functions for non-ASCII characters (T10143)
23515 !! options
23516 language=cs
23517 title=[[Main Page]]
23518 !! wikitext
23519 {{PRVNÍVELKÉ:ěščř}}
23520 {{prvnívelké:ěščř}}
23521 {{PRVNÍMALÉ:ěščř}}
23522 {{prvnímalé:ěščř}}
23523 {{MALÁ:ěščř}}
23524 {{malá:ěščř}}
23525 {{VELKÁ:ěščř}}
23526 {{velká:ěščř}}
23527 !! html
23528 <p>Ěščř
23529 Ěščř
23530 ěščř
23531 ěščř
23532 ěščř
23533 ěščř
23534 ĚŠČŘ
23535 ĚŠČŘ
23536 </p>
23537 !! end
23538
23539 !! test
23540 Morwen/13: Unclosed link followed by heading
23541 !! wikitext
23542 [[link
23543 ==heading==
23544 !! html
23545 <p>[[link
23546 </p>
23547 <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>
23548
23549 !! end
23550
23551 !! test
23552 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23553 !! wikitext
23554 {{foo|
23555 =heading=
23556 !! html
23557 <p>{{foo|
23558 </p>
23559 <h1><span class="mw-headline" id="heading">heading</span></h1>
23560
23561 !! end
23562
23563 !! test
23564 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23565 !! wikitext
23566 {{foo|
23567 ==heading==
23568 !! html
23569 <p>{{foo|
23570 </p>
23571 <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>
23572
23573 !! end
23574
23575 !! test
23576 Tildes in comments
23577 !! options
23578 pst
23579 !! wikitext
23580 <!-- ~~~~ -->
23581 !! html/php
23582 <!-- ~~~~ -->
23583 !! end
23584
23585 !! test
23586 Paragraphs inside divs (no extra line breaks)
23587 !! wikitext
23588 <div>Line one
23589
23590 Line two</div>
23591 !! html
23592 <div>Line one
23593 Line two</div>
23594
23595 !! end
23596
23597 !! test
23598 Paragraphs inside divs (extra line break on open)
23599 !! wikitext
23600 <div>
23601 Line one
23602
23603 Line two</div>
23604 !! html
23605 <div>
23606 <p>Line one
23607 </p>
23608 Line two</div>
23609
23610 !! end
23611
23612 !! test
23613 Paragraphs inside divs (extra line break on close)
23614 !! wikitext
23615 <div>Line one
23616
23617 Line two
23618 </div>
23619 !! html
23620 <div>Line one
23621 <p>Line two
23622 </p>
23623 </div>
23624
23625 !! end
23626
23627 !! test
23628 Paragraphs inside divs (extra line break on open and close)
23629 !! wikitext
23630 <div>
23631 Line one
23632
23633 Line two
23634 </div>
23635 !! html
23636 <div>
23637 <p>Line one
23638 </p><p>Line two
23639 </p>
23640 </div>
23641
23642 !! end
23643
23644 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23645 !! test
23646 Nesting tags, paragraphs on lines which begin with <div>
23647 !! wikitext
23648 <div></div><strong>A
23649 B</strong>
23650 !! html/php+tidy
23651 <div></div><p><strong>A
23652 </strong></p><strong></strong><p><strong>B</strong>
23653 </p>
23654 !! html/parsoid
23655 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23656 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23657 !! end
23658
23659 # T8200: <blockquote> should behave like <div> with respect to line breaks
23660 !! test
23661 T8200: paragraphs inside blockquotes (no extra line breaks)
23662 !! wikitext
23663 <blockquote>Line one
23664
23665 Line two</blockquote>
23666 !! html
23667 <blockquote>Line one
23668 Line two</blockquote>
23669
23670 !! html+tidy
23671 <blockquote><p>Line one
23672 Line two</p></blockquote>
23673 !! end
23674
23675 !! test
23676 T8200: paragraphs inside blockquotes (extra line break on open)
23677 !! wikitext
23678 <blockquote>
23679 Line one
23680
23681 Line two</blockquote>
23682 !! html
23683 <blockquote>
23684 <p>Line one
23685 </p>
23686 Line two</blockquote>
23687
23688 !! html+tidy
23689 <blockquote>
23690 <p>Line one
23691 </p><p>
23692 Line two</p></blockquote>
23693 !! end
23694
23695 !! test
23696 T8200: paragraphs inside blockquotes (extra line break on close)
23697 !! wikitext
23698 <blockquote>Line one
23699
23700 Line two
23701 </blockquote>
23702 !! html
23703 <blockquote>Line one
23704 <p>Line two
23705 </p>
23706 </blockquote>
23707
23708 !! html+tidy
23709 <blockquote><p>Line one
23710 </p><p>Line two
23711 </p>
23712 </blockquote>
23713 !! end
23714
23715 !! test
23716 T8200: paragraphs inside blockquotes (extra line break on open and close)
23717 !! wikitext
23718 <blockquote>
23719 Line one
23720
23721 Line two
23722 </blockquote>
23723 !! html
23724 <blockquote>
23725 <p>Line one
23726 </p><p>Line two
23727 </p>
23728 </blockquote>
23729
23730 !! end
23731
23732 ## This is a corner case interaction between the paragraph wrapping in the
23733 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23734 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23735 ## of which "div" is one, but do p-wrapping inside them. These are referred
23736 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23737 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23738 !! test
23739 Paragraphs inside blockquotes/divs (no extra line breaks)
23740 !! wikitext
23741 <blockquote><div>Line one
23742
23743 Line two</div></blockquote>
23744 !! html
23745 <blockquote><div>Line one
23746 Line two</div></blockquote>
23747
23748 !! end
23749
23750 !! test
23751 Paragraphs inside blockquotes/divs (extra line break on open)
23752 !! wikitext
23753 <blockquote><div>
23754 Line one
23755
23756 Line two</div></blockquote>
23757 !! html
23758 <blockquote><div>
23759 <p>Line one
23760 </p>
23761 Line two</div></blockquote>
23762
23763 !! end
23764
23765 !! test
23766 Paragraphs inside blockquotes/divs (extra line break on close)
23767 !! wikitext
23768 <blockquote><div>Line one
23769
23770 Line two
23771 </div></blockquote>
23772 !! html
23773 <blockquote><div>Line one
23774 <p>Line two
23775 </p>
23776 </div></blockquote>
23777
23778 !! end
23779
23780 !! test
23781 Paragraphs inside blockquotes/divs (extra line break on open and close)
23782 !! wikitext
23783 <blockquote><div>
23784 Line one
23785
23786 Line two
23787 </div></blockquote>
23788 !! html
23789 <blockquote><div>
23790 <p>Line one
23791 </p><p>Line two
23792 </p>
23793 </div></blockquote>
23794
23795 !! end
23796
23797 !! test
23798 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23799 !! options
23800 wgLinkHolderBatchSize=0
23801 !! wikitext
23802 [[meatball:1]]
23803 [[meatball:2]]
23804 [[meatball:3]]
23805 !! html
23806 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23807 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23808 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23809 </p>
23810 !! end
23811
23812 !! test
23813 Free external link invading image caption
23814 !! wikitext
23815 [[Image:Foobar.jpg|thumb|http://x|hello]]
23816 !! html/php
23817 <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>
23818
23819 !! html/parsoid
23820 <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>
23821 !! end
23822
23823 !! test
23824 T17196: localised external link numbers
23825 !! options
23826 language=fa
23827 !! wikitext
23828 [http://en.wikipedia.org/]
23829 !! html/php
23830 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23831 </p>
23832 !! html/parsoid
23833 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23834 !! end
23835
23836 !! test
23837 Multibyte character in padleft
23838 !! wikitext
23839 {{padleft:-Hello|7|Æ}}
23840 !! html/php
23841 <p>Æ-Hello
23842 </p>
23843 !! html/parsoid
23844 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23845 !! end
23846
23847 !! test
23848 Multibyte character in padright
23849 !! wikitext
23850 {{padright:Hello-|7|Æ}}
23851 !! html/php
23852 <p>Hello-Æ
23853 </p>
23854 !! html/parsoid
23855 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23856 !! end
23857
23858 !!test
23859 formatdate parser function
23860 !! wikitext
23861 {{#formatdate:2009-03-24}}
23862 !! html
23863 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23864 </p>
23865 !! end
23866
23867 !!test
23868 formatdate parser function, with default format
23869 !! wikitext
23870 {{#formatdate:2009-03-24|mdy}}
23871 !! html
23872 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23873 </p>
23874 !! end
23875
23876 !! test
23877 Spacing of numbers in formatted dates
23878 !! wikitext
23879 {{#formatdate:January 15}}
23880 !! html
23881 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23882 </p>
23883 !! end
23884
23885 !! test
23886 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
23887 !! options
23888 language=nl title=[[MediaWiki:Common.css]]
23889 !! wikitext
23890 {{#formatdate:2009-03-24|dmy}}
23891 !! html
23892 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23893 </p>
23894 !! end
23895
23896 #
23897 #
23898 #
23899
23900 #
23901 # Edit comments
23902 #
23903
23904 !! test
23905 Edit comment with link
23906 !! options
23907 comment
23908 !! wikitext
23909 I like the [[Main Page]] a lot
23910 !! html/php
23911 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23912 !!end
23913
23914 !! test
23915 Edit comment with link and link text
23916 !! options
23917 comment
23918 !! wikitext
23919 I like the [[Main Page|best pages]] a lot
23920 !! html/php
23921 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23922 !!end
23923
23924 !! test
23925 Edit comment with link and link text with suffix
23926 !! options
23927 comment
23928 !! wikitext
23929 I like the [[Main Page|best page]]s a lot
23930 !! html/php
23931 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23932 !!end
23933
23934 !! test
23935 Edit comment with section link (non-local, eg in history list)
23936 !! options
23937 comment title=[[Main Page]]
23938 !! wikitext
23939 /* External links */ removed bogus entries
23940 !! html/php
23941 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23942 !!end
23943
23944 !! test
23945 Edit comment with section link and text before it (non-local, eg in history list)
23946 !! options
23947 comment title=[[Main Page]]
23948 !! wikitext
23949 pre-comment text /* External links */ removed bogus entries
23950 !! html/php
23951 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>
23952 !!end
23953
23954 !! test
23955 Edit comment with section link (local, eg in diff view)
23956 !! options
23957 comment local title=[[Main Page]]
23958 !! wikitext
23959 /* External links */ removed bogus entries
23960 !! html/php
23961 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23962 !!end
23963
23964 !! test
23965 Edit comment with subpage link (T16080)
23966 !! options
23967 comment
23968 subpage
23969 title=[[Subpage test]]
23970 !! wikitext
23971 Poked at a [[/subpage]] here...
23972 !! html/php
23973 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23974 !!end
23975
23976 !! test
23977 Edit comment with subpage link and link text (T16080)
23978 !! options
23979 comment
23980 subpage
23981 title=[[Subpage test]]
23982 !! wikitext
23983 Poked at a [[/subpage|neat little page]] here...
23984 !! html/php
23985 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23986 !!end
23987
23988 !! test
23989 Edit comment with bogus subpage link in non-subpage NS (T16080)
23990 !! options
23991 comment
23992 title=[[Subpage test]]
23993 !! wikitext
23994 Poked at a [[/subpage]] here...
23995 !! html/php
23996 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...
23997 !!end
23998
23999 !! test
24000 Edit comment with bare anchor link (local, as on diff)
24001 !! options
24002 comment
24003 local
24004 title=[[Main Page]]
24005 !! wikitext
24006 [[#section]]
24007 !! html/php
24008 <a href="#section">#section</a>
24009 !! end
24010
24011 !! test
24012 Edit comment with bare anchor link (non-local, as on history)
24013 !! options
24014 comment
24015 title=[[Main Page]]
24016 !! wikitext
24017 [[#section]]
24018 !! html/php
24019 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24020 !! end
24021
24022 !! test
24023 Anchor starting with underscore
24024 !! options
24025 title=[[Foo]]
24026 !! wikitext
24027 [[#_ref|One]]
24028 !! html/php
24029 <p><a href="#_ref">One</a>
24030 </p>
24031 !! html/parsoid
24032 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24033 !! end
24034
24035 !! test
24036 Id starting with underscore
24037 !! wikitext
24038 <div id="_ref"></div>
24039 !! html/*
24040 <div id="_ref"></div>
24041
24042 !! end
24043
24044 !! test
24045 Edit comment with link with more than one pipe (T99346)
24046 !! options
24047 comment
24048 !! wikitext
24049 [[Main Page|Many|pipes]]
24050 !! html/php
24051 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24052 !! end
24053
24054 !! test
24055 Complex edit comment with link with more than one pipe (T99346)
24056 !! options
24057 comment
24058 !! wikitext
24059 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24060 !! html/php
24061 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;
24062 !! end
24063
24064 !! test
24065 Space normalisation on autocomment (T24784)
24066 !! options
24067 comment
24068 title=[[Main Page]]
24069 !! wikitext
24070 /* __hello__world__ */
24071 !! html/php
24072 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
24073 !! end
24074
24075 !! test
24076 percent-encoding and + signs in comments (T28410)
24077 !! options
24078 comment
24079 !! wikitext
24080 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24081 !! html/php
24082 <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>
24083 !! end
24084
24085 # Parsoid doesn't support this yet: see T75581
24086 # but it *should* omit the 'src' attribute if the image is bad.
24087 # PHP side of tests was disabled in
24088 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24089 # because of issues in the PHP parserTests infrastructure
24090 # (but the output below is indeed what the PHP side emits)
24091 !! test
24092 Bad images - basic functionality
24093 !! wikitext
24094 [[File:Bad.jpg]]
24095 !! html/php+disabled
24096 !! html/parsoid
24097 <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>
24098 !! end
24099
24100 !! test
24101 Bad images - T18039: text after bad image disappears
24102 !! wikitext
24103 Foo bar
24104 [[File:Bad.jpg]]
24105 Bar foo
24106 !! html/php+disabled
24107 <p>Foo bar
24108 </p><p>Bar foo
24109 </p>
24110 !! html/parsoid
24111 <p>Foo bar
24112 <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>
24113 Bar foo</p>
24114 !! end
24115
24116 !! test
24117 Verify that displaytitle works (T24501) no displaytitle
24118 !! options
24119 showtitle
24120 !! config
24121 wgAllowDisplayTitle=true
24122 wgRestrictDisplayTitle=false
24123 !! wikitext
24124 this is not the the title
24125 !! html/php
24126 Parser test
24127 <p>this is not the the title
24128 </p>
24129 !! end
24130
24131 !! test
24132 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24133 !! options
24134 showtitle
24135 title=[[Screen]]
24136 !! config
24137 wgAllowDisplayTitle=true
24138 wgRestrictDisplayTitle=false
24139 !! wikitext
24140 this is not the the title
24141 {{DISPLAYTITLE:whatever}}
24142 !! html/php
24143 whatever
24144 <p>this is not the the title
24145 </p>
24146 !! end
24147
24148 !! test
24149 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24150 !! options
24151 showtitle
24152 title=[[Screen]]
24153 !! config
24154 wgAllowDisplayTitle=true
24155 wgRestrictDisplayTitle=true
24156 !! wikitext
24157 this is not the the title
24158 {{DISPLAYTITLE:whatever}}
24159 !! html/php
24160 Screen
24161 <p>this is not the the title
24162 </p>
24163 !! end
24164
24165 !! test
24166 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24167 !! options
24168 showtitle
24169 title=[[Screen]]
24170 !! config
24171 wgAllowDisplayTitle=true
24172 wgRestrictDisplayTitle=true
24173 !! wikitext
24174 this is not the the title
24175 {{DISPLAYTITLE:screen}}
24176 !! html/php
24177 screen
24178 <p>this is not the the title
24179 </p>
24180 !! end
24181
24182 !! test
24183 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24184 !! options
24185 showtitle
24186 title=[[Screen]]
24187 !! config
24188 wgAllowDisplayTitle=false
24189 !! wikitext
24190 this is not the the title
24191 {{DISPLAYTITLE:screen}}
24192 !! html/php
24193 Screen
24194 <p>this is not the the title
24195 <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>
24196 </p>
24197 !! end
24198
24199 !! test
24200 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24201 !! options
24202 showtitle
24203 title=[[Screen]]
24204 !! config
24205 wgAllowDisplayTitle=false
24206 !! wikitext
24207 this is not the the title
24208 !! html/php
24209 Screen
24210 <p>this is not the the title
24211 </p>
24212 !! end
24213
24214 !! test
24215 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24216 !! options
24217 showtitle
24218 title=[[Screen]]
24219 !! config
24220 wgAllowDisplayTitle=true
24221 wgRestrictDisplayTitle=true
24222 !! wikitext
24223 this is not the the title
24224 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24225 !! html/php
24226 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24227 <p>this is not the the title
24228 </p>
24229 !! end
24230
24231 !! test
24232 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24233 !! options
24234 showtitle
24235 title=[[Screen]]
24236 !! config
24237 wgAllowDisplayTitle=true
24238 wgRestrictDisplayTitle=true
24239 !! wikitext
24240 this is not the the title
24241 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24242 !! html/php
24243 <span style="color: red;">s</span>creen
24244 <p>this is not the the title
24245 </p>
24246 !! end
24247
24248 !! test
24249 Page status indicators: Empty name is invalid
24250 !! options
24251 showindicators
24252 !! wikitext
24253 <indicator name=" "></indicator>
24254 <indicator></indicator>
24255 !! html/php
24256 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24257 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24258 </p>
24259 !! end
24260
24261 !! test
24262 Page status indicators: Weird syntaxes that are okay
24263 !! options
24264 showindicators
24265 !! wikitext
24266 <indicator name="empty" />
24267 <indicator name="name"></indicator>
24268 !! html/php
24269 empty=
24270 name=
24271 <p><br />
24272 </p>
24273 !! end
24274
24275 !! test
24276 Page status indicators: Torture test
24277 !! options
24278 showindicators
24279 !! wikitext
24280 <indicator name="01">hello world</indicator>
24281 <indicator name="02">[[Main Page]]</indicator>
24282 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24283 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24284 <indicator name="05">*foo
24285 *bar</indicator>
24286 <indicator name="06"><nowiki>foo</nowiki></indicator>
24287 <indicator name="07"> Preformatted</indicator>
24288 <indicator name="08"><div>Broken tag</indicator>
24289 <indicator name="09">{| class=wikitable
24290 |cell
24291 |}</indicator>
24292 <indicator name="10">Two
24293
24294 paragraphs</indicator>
24295 !! html/php
24296 01=hello world
24297 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24298 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" />
24299 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>
24300 05=<ul><li>foo</li>
24301 <li>bar</li></ul>
24302
24303 06=foo
24304 07=<pre>Preformatted
24305 </pre>
24306 08=<div>Broken tag</div>
24307
24308 09=<table class="wikitable">
24309 <tr>
24310 <td>cell
24311 </td></tr></table>
24312
24313 10=<p>Two
24314 </p><p>paragraphs
24315 </p>
24316 <p><br />
24317 </p><p><br />
24318 </p><p><br />
24319 </p><p><br />
24320 </p><p><br />
24321 </p>
24322 !! end
24323
24324 !! test
24325 preload: check <noinclude> and <includeonly>
24326 !! options
24327 preload
24328 !! wikitext
24329 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24330 !! html/php
24331 Hello kind world.
24332 !! end
24333
24334 !! test
24335 preload: check <onlyinclude>
24336 !! options
24337 preload
24338 !! wikitext
24339 Goodbye <onlyinclude>Hello world</onlyinclude>
24340 !! html/php
24341 Hello world
24342 !! end
24343
24344 !! test
24345 preload: can pass tags through if we want to
24346 !! options
24347 preload
24348 !! wikitext
24349 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24350 !! html/php
24351 <includeonly>Hello world</includeonly>
24352 !! end
24353
24354 !! test
24355 preload: check that it doesn't try to do tricks
24356 !! options
24357 preload
24358 !! wikitext
24359 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24360 !! html/php
24361 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24362 !! end
24363
24364 !! test
24365 Play a bit with r67090 and T5158
24366 !! wikitext
24367 <div style="width:50% !important">&nbsp;</div>
24368 <div style="width:50%&nbsp;!important">&nbsp;</div>
24369 <div style="width:50%&#160;!important">&nbsp;</div>
24370 <div style="border : solid;">&nbsp;</div>
24371 !! html/php
24372 <div style="width:50% !important">&#160;</div>
24373 <div style="width:50% !important">&#160;</div>
24374 <div style="width:50% !important">&#160;</div>
24375 <div style="border&#32;: solid;">&#160;</div>
24376
24377 !! html/parsoid
24378 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24379 <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>
24380 <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>
24381 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24382
24383 !! end
24384
24385 !! test
24386 French spaces in wikitext
24387 !! wikitext
24388 foo ! bar ? bat 50 % is less than 75 %.
24389
24390 Hello : this ; is « something ‹ else › again »
24391 !! html
24392 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24393 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24394 </p>
24395 !! end
24396
24397 # It would be reasonable for Parsoid and PHP to differ here.
24398 # The PHP behavior is arguably a bug.
24399 !! test
24400 Corner case: french spaces in definition list
24401 !! wikitext
24402 ;foo : bar
24403 !! html+tidy
24404 <dl><dt>foo&#160;</dt>
24405 <dd>bar</dd></dl>
24406 !! end
24407
24408 !! test
24409 T5158: Test for French spaces in attributes
24410 !! wikitext
24411 <br style=" clear : both ; " />
24412 !! html/php
24413 <p><br style="clear&#32;: both&#32;;" />
24414 </p>
24415 !! end
24416
24417 !! test
24418 HTML5 data attributes
24419 !! wikitext
24420 <span data-foo="bar">Baz</span>
24421 <p data-abc-def_hij="">Quuz</p>
24422 !! html/php
24423 <p><span data-foo="bar">Baz</span>
24424 </p>
24425 <p data-abc-def_hij="">Quuz</p>
24426
24427 !! html/parsoid
24428 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24429 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24430 !! end
24431
24432 !! test
24433 Strip reserved data attributes
24434 !! wikitext
24435 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24436 !! html/php
24437 <div data-ok="fred">d</div>
24438
24439 !! html/parsoid
24440 <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>
24441 !! end
24442
24443 !! test
24444 percent-encoding and + signs in internal links (T28410)
24445 !! wikitext
24446 [[User:+%]] [[Page+title%]]
24447 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24448 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24449 [[%33%45]] [[%33%45+]]
24450 !! html/php
24451 <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>
24452 <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>
24453 <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>
24454 <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>
24455 </p>
24456 !! html/parsoid
24457 <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>
24458 <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>
24459 <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>
24460 <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>
24461 !! end
24462
24463 !! test
24464 Special characters in embedded file links (T29679)
24465 !! wikitext
24466 [[File:Contains & ampersand.jpg]]
24467 [[File:Does not exist.jpg|Title with & ampersand]]
24468 !! html/php
24469 <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>
24470 <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>
24471 </p>
24472 !! html/parsoid
24473 <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>
24474 <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>
24475 !! end
24476
24477 !! test
24478 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24479 !! wikitext
24480 Text&apos;s been normalized?
24481 !! html
24482 <p>Text&#39;s been normalized?
24483 </p>
24484 !! end
24485
24486 !! test
24487 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24488 !! wikitext
24489 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24490 !! html
24491 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24492 </p>
24493 !! end
24494
24495 !! test
24496 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24497 !! wikitext
24498 [http://www.example.org/ ideograms]
24499 !! html
24500 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24501 </p>
24502 !! end
24503
24504 !! test
24505 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24506 !! wikitext
24507 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24508 !! html
24509 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24510 </p>
24511 !! end
24512
24513 !! article
24514 Mediawiki:loop1
24515 !! text
24516 {{Identical|A}}
24517 !! endarticle
24518
24519 !! article
24520 Mediawiki:loop2
24521 !! text
24522 {{Identical|B}}
24523 !! endarticle
24524
24525 !! article
24526 Template:Identical
24527 !! text
24528 {{int:loop1}}
24529 {{int:loop2}}
24530 !! endarticle
24531
24532 !! test
24533 T33098 Template which includes system messages which includes the template
24534 !! wikitext
24535 {{Identical}}
24536 !! html
24537 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24538 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24539 </p>
24540 !! end
24541
24542 !! test
24543 T33490 Turkish: ucfirst 'blah'
24544 !! options
24545 language=tr
24546 !! wikitext
24547 {{ucfirst:blah}}
24548 !! html
24549 <p>Blah
24550 </p>
24551 !! end
24552
24553 !! test
24554 T33490 Turkish: ucfirst 'ix'
24555 !! options
24556 language=tr
24557 !! wikitext
24558 {{ucfirst:ix}}
24559 !! html
24560 <p>İx
24561 </p>
24562 !! end
24563
24564 !! test
24565 T33490 Turkish: lcfirst 'BLAH'
24566 !! options
24567 language=tr
24568 !! wikitext
24569 {{lcfirst:BLAH}}
24570 !! html
24571 <p>bLAH
24572 </p>
24573 !! end
24574
24575 !! test
24576 T33490 Turkish: ucfırst (with a dotless i)
24577 !! options
24578 language=tr
24579 !! wikitext
24580 {{ucfırst:blah}}
24581 !! html
24582 <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>
24583 </p>
24584 !! end
24585
24586 !! test
24587 T33490 ucfırst (with a dotless i) with English language
24588 !! options
24589 language=en
24590 !! wikitext
24591 {{ucfırst:blah}}
24592 !! html
24593 <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>
24594 </p>
24595 !! end
24596
24597 # Note that Parsoid doesn't emit an explicit TOC.
24598 # Note also that the html2wt direction tends to emit an extra newline
24599 # between the __TOC__ magicword and the first heading unless *both*
24600 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24601 # it's "{}").
24602
24603 !! test
24604 T28375: TOC with italics
24605 !! options
24606 title=[[Main Page]]
24607 !! wikitext
24608 __TOC__
24609 ==''Lost'' episodes==
24610 !! html/php
24611 <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>
24612 <ul>
24613 <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>
24614 </ul>
24615 </div>
24616
24617 <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>
24618
24619 !! html/parsoid
24620 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24621 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24622 !! end
24623
24624 !! test
24625 T28375: TOC with bold
24626 !! options
24627 title=[[Main Page]]
24628 !! wikitext
24629 __TOC__
24630 =='''should be bold''' then normal text==
24631 !! html/php
24632 <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>
24633 <ul>
24634 <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>
24635 </ul>
24636 </div>
24637
24638 <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>
24639
24640 !! html/parsoid
24641 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24642 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24643 !! end
24644
24645 !! test
24646 T35845: Headings become cursive in TOC when they contain an image
24647 !! options
24648 title=[[Main Page]]
24649 !! wikitext
24650 __TOC__
24651 ==Image [[Image:foobar.jpg]]==
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="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24656 </ul>
24657 </div>
24658
24659 <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>
24660
24661 !! html/parsoid
24662 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24663 <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>
24664 !! end
24665
24666 !! test
24667 T35845 (2): Headings become bold in TOC when they contain a blockquote
24668 !! options
24669 title=[[Main Page]]
24670 !! wikitext
24671 __TOC__
24672 ==<blockquote>Quote</blockquote>==
24673 !! html/php
24674 <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>
24675 <ul>
24676 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24677 </ul>
24678 </div>
24679
24680 <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>
24681
24682 !! html/php+tidy
24683 <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>
24684 <ul>
24685 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24686 </ul>
24687 </div>
24688
24689 <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>
24690 !! html/parsoid
24691 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24692 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24693 !! end
24694
24695 !! test
24696 Unclosed tags in TOC
24697 !! config
24698 wgFragmentMode=[ 'html5', 'legacy' ]
24699 !! options
24700 title=[[Main Page]]
24701 !! wikitext
24702 __TOC__
24703 ==Proof: 2 < 3==
24704 <small>Hanc marginis exiguitas non caperet.</small>
24705 QED
24706 !! html/php
24707 <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>
24708 <ul>
24709 <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>
24710 </ul>
24711 </div>
24712
24713 <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>
24714 <p><small>Hanc marginis exiguitas non caperet.</small>
24715 QED
24716 </p>
24717 !! html/parsoid
24718 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24719 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24720 <p><small>Hanc marginis exiguitas non caperet.</small>
24721 QED</p>
24722 !! end
24723
24724 !! test
24725 Multiple tags in TOC
24726 !! wikitext
24727 __TOC__
24728 ==<i>Foo</i> <b>Bar</b>==
24729
24730 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24731 !! html/php
24732 <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>
24733 <ul>
24734 <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>
24735 <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>
24736 </ul>
24737 </div>
24738
24739 <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>
24740 <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>
24741
24742 !! html/php+tidy
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="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
24746 <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>
24747 </ul>
24748 </div>
24749
24750 <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>
24751 <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>
24752 !! html/parsoid
24753 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24754 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24755
24756 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
24757 !! end
24758
24759 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24760 # html5 tag parsing.
24761 !! test
24762 Tags with parameters in TOC
24763 !! options
24764 parsoid=wt2html
24765 !! wikitext
24766 __TOC__
24767 ==<sup class="in-h2">Hello</sup>==
24768
24769 ==<sup class="a > b">Evilbye</sup>==
24770 !! html/php
24771 <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>
24772 <ul>
24773 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24774 <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>
24775 </ul>
24776 </div>
24777
24778 <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>
24779 <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>
24780
24781 !! html/parsoid
24782 <meta property="mw:PageProp/toc" />
24783 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24784
24785 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24786 !! end
24787
24788 !! test
24789 span tags with directionality in TOC
24790 !! wikitext
24791 __TOC__
24792 ==<span dir="ltr">C++</span>==
24793
24794 ==<span dir="rtl">זבנג!</span>==
24795
24796 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24797
24798 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24799
24800 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24801 !! html/php
24802 <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>
24803 <ul>
24804 <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>
24805 <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>
24806 <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>
24807 <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>
24808 <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>
24809 </ul>
24810 </div>
24811
24812 <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>
24813 <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>
24814 <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>
24815 <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>
24816 <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>
24817
24818 !! html/parsoid
24819 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24820 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24821 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24822 <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>
24823 <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>
24824 <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>
24825 !! end
24826
24827 !! test
24828 T74884: bdi element in ToC
24829 !! wikitext
24830 __TOC__
24831 ==<bdi>test</bdi>==
24832 !! html/php
24833 <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>
24834 <ul>
24835 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24836 </ul>
24837 </div>
24838
24839 <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>
24840
24841 !! html/parsoid
24842 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24843 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24844 !! end
24845
24846 !! test
24847 T35715: s/strike element in ToC
24848 !! wikitext
24849 __TOC__
24850 ==<s>test</s> test <strike>test</strike>==
24851 !! html/php
24852 <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>
24853 <ul>
24854 <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>
24855 </ul>
24856 </div>
24857
24858 <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>
24859
24860 !! html/parsoid
24861 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24862 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24863 !! end
24864
24865 !! test
24866 T198618: style element in ToC
24867 !! options
24868 styletag=1
24869 !! wikitext
24870 __TOC__
24871 ==<style>.foo {}</style>Style<style>.bar {}</style>==
24872 !! html/php
24873 <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>
24874 <ul>
24875 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
24876 </ul>
24877 </div>
24878
24879 <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>
24880
24881 !! html/parsoid
24882 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24883 <h2 id="Style" data-parsoid='{}'><style>.foo {}</style>Style<style>.bar {}</style></h2>
24884 !! end
24885
24886 !! test
24887 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24888 !! wikitext
24889 __TOC__
24890 ==x==
24891 !! html/php
24892 <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>
24893 <ul>
24894 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24895 </ul>
24896 </div>
24897
24898 <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>
24899
24900 !! html/parsoid
24901 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24902 <h2 id="x" data-parsoid='{}'>x</h2>
24903 !! end
24904
24905 !! article
24906 MediaWiki:T34057
24907 !! text
24908 == {{int:headline_sample}} ==
24909 !! endarticle
24910
24911 !! test
24912 T34057: Title needed when expanding <h> nodes.
24913 !! options
24914 title=[[Main Page]]
24915 !! wikitext
24916 {{int:T34057}}
24917 !! html
24918 <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>
24919
24920 !! end
24921
24922 !! test
24923 Strip marker in urlencode
24924 !! wikitext
24925 {{urlencode:x<nowiki/>y}}
24926 {{urlencode:x<nowiki/>y|wiki}}
24927 {{urlencode:x<nowiki/>y|path}}
24928 {{urlencode:x<pre id="one">two</pre>y}}
24929 !! html/php
24930 <p>xy
24931 xy
24932 xy
24933 xy
24934 </p>
24935 !! end
24936
24937 !! test
24938 Strip marker in lc
24939 !! wikitext
24940 {{lc:x<nowiki/>y}}
24941 !! html
24942 <p>xy
24943 </p>
24944 !! end
24945
24946 !! test
24947 Strip marker in uc
24948 !! wikitext
24949 {{uc:x<nowiki/>y}}
24950 !! html
24951 <p>XY
24952 </p>
24953 !! end
24954
24955 !! test
24956 Strip marker in formatNum
24957 !! wikitext
24958 {{formatnum:1<nowiki/>2}}
24959 {{formatnum:1<nowiki/>2|R}}
24960 !! html
24961 <p>12
24962 12
24963 </p>
24964 !! end
24965
24966 !! test
24967 Check noCommafy in formatNum
24968 !! options
24969 language=be-tarask
24970 !! wikitext
24971 {{formatnum:123456.78}}
24972 {{formatnum:123456.78|NOSEP}}
24973 !! html
24974 <p>123 456,78
24975 123456.78
24976 </p>
24977 !! end
24978
24979 !! test
24980 Wrong option for formatNum (T58199)
24981 !! wikitext
24982 {{formatnum:1,234.56|Random}}
24983 {{formatnum:1,234.56|EVERYTHING}}
24984 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24985 !! html
24986 <p>1,234.56
24987 1,234.56
24988 1,234.56
24989 </p>
24990 !! end
24991
24992 !! test
24993 Strip marker in grammar
24994 !! options
24995 language=fi
24996 !! wikitext
24997 {{grammar:elative|foo<nowiki/>bar}}
24998 !! html
24999 <p>foobarista
25000 </p>
25001 !! end
25002
25003 !! test
25004 Strip marker in padleft
25005 !! wikitext
25006 {{padleft:|2|x<nowiki/>y}}
25007 !! html
25008 <p>xy
25009 </p>
25010 !! end
25011
25012 !! test
25013 Strip marker in padright
25014 !! wikitext
25015 {{padright:|2|x<nowiki/>y}}
25016 !! html
25017 <p>xy
25018 </p>
25019 !! end
25020
25021 !! test
25022 Strip marker in anchorencode
25023 !! wikitext
25024 {{anchorencode:x<nowiki/>y}}
25025 !! html/php
25026 <p>xy
25027 </p>
25028 !! html/parsoid
25029 <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>
25030 !! end
25031
25032 !! test
25033 nowiki inside link inside heading (T20295)
25034 !! wikitext
25035 ==[[foo|x<nowiki>y</nowiki>z]]==
25036 !! html
25037 <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>
25038
25039 !! end
25040
25041 !! test
25042 new support for bdi element (T33817)
25043 !! wikitext
25044 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25045 !! html
25046 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25047
25048 !!end
25049
25050 !! test
25051 Ignore pipe between table row attributes
25052 !! wikitext
25053 {|
25054 |quux
25055 |- id=foo | style='color: red'
25056 |bar
25057 |}
25058 !! html
25059 <table>
25060 <tr>
25061 <td>quux
25062 </td></tr>
25063 <tr id="foo" style="color: red">
25064 <td>bar
25065 </td></tr></table>
25066
25067 !! end
25068
25069 !!test
25070 Language parser function
25071 !! wikitext
25072 {{#language:ar}}
25073 !! html
25074 <p>العربية
25075 </p>
25076 !! end
25077
25078 !!test
25079 Padleft and padright (default 0-padding)
25080 !! wikitext
25081 {{padleft:xyz|5}}
25082 {{padright:xyz|5}}
25083 !! html/php
25084 <p>00xyz
25085 xyz00
25086 </p>
25087 !! html/parsoid
25088 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25089 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25090 !! end
25091
25092 !!test
25093 Padleft and padright (partial fill)
25094 !! wikitext
25095 {{padleft:xyz|6|ab}}
25096 {{padright:xyz|6|ab}}
25097 !! html/php
25098 <p>abaxyz
25099 xyzaba
25100 </p>
25101 !! html/parsoid
25102 <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>
25103 <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>
25104 !! end
25105
25106 !!test
25107 Padleft and padright as substr
25108 !! wikitext
25109 {{padleft:|3|abcde}}
25110 {{padright:|3|abcde}}
25111 !! html/php
25112 <p>abc
25113 abc
25114 </p>
25115 !! html/parsoid
25116 <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>
25117 <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>
25118 !! end
25119
25120 !! test
25121 Padleft and padright with non-numerical length (T180403)
25122 !! wikitext
25123 {{padleft:abcdef|junk}}
25124 {{padright:abcdef|junk}}
25125 !! html/php
25126 <p>abcdef
25127 abcdef
25128 </p>
25129 !! end
25130
25131 !!test
25132 Special parser function
25133 !! wikitext
25134 {{#special:RandomPage}}
25135 {{#special:BaDtItLe}}
25136 {{#special:Foobar}}
25137 !! html
25138 <p>Special:Random
25139 Special:Badtitle
25140 Special:Foobar
25141 </p>
25142 !! end
25143
25144 !!test
25145 T36939 - Case insensitive link parsing ([HttP://])
25146 !! wikitext
25147 [HttP://MediaWiki.Org/]
25148 !! html/php
25149 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25150 </p>
25151 !! html/parsoid
25152 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25153 !! end
25154
25155 !!test
25156 T36939 - Case insensitive link parsing ([HttP:// title])
25157 !! wikitext
25158 [HttP://MediaWiki.Org/ MediaWiki]
25159 !! html
25160 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25161 </p>
25162 !! end
25163
25164 !!test
25165 T36939 - Case insensitive link parsing (HttP://)
25166 !! wikitext
25167 HttP://MediaWiki.Org/
25168 !! html/php
25169 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25170 </p>
25171 !! html/parsoid
25172 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25173 !! end
25174
25175 !!test
25176 Disable TOC
25177 !! options
25178 notoc
25179 !! wikitext
25180 Lead
25181 ==Section 1==
25182 ==Section 2==
25183 ==Section 3==
25184 ==Section 4==
25185 ==Section 5==
25186 !! html
25187 <p>Lead
25188 </p>
25189
25190 <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>
25191 <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>
25192 <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>
25193 <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>
25194 <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>
25195
25196 !! end
25197
25198
25199 ###
25200 ### Parsoid-specific tests
25201 ### Parsoid-PHP parser incompatibilities
25202 ###
25203 !!test
25204 1. SOL-sensitive wikitext tokens as template-args
25205 !!options
25206 parsoid=wt2html,wt2wt
25207 !! wikitext
25208 {{echo|*a}}
25209 {{echo|#a}}
25210 {{echo|:a}}
25211 !! html
25212 <span about="#mwt1" typeof="mw:Transclusion">
25213 </span><ul about="#mwt1"><li>a</li>
25214 </ul>
25215 <span about="#mwt2" typeof="mw:Transclusion">
25216 </span><ol about="#mwt2"><li>a</li>
25217 </ol>
25218 <span about="#mwt3" typeof="mw:Transclusion">
25219 </span><dl about="#mwt3"><dd>a</dd>
25220 </dl>
25221 !!end
25222
25223 #### -----------------------------------------------------------------
25224 #### Parsoid-specific functionality tests
25225 #### -----------------------------------------------------------------
25226
25227 # T65642/T68749: Formatting elt fixup around images.
25228 # We know wt2wt will fail, but we expect selser to pass.
25229 # Due to the nature of our testing, wt2wt and selser tests will enter the
25230 # blacklist and we'll catch selser regressions based on changes to the
25231 # blacklist entries for selser tests.
25232 !! test
25233 1. Treebuilder fixup of formatting elt
25234 !! options
25235 parsoid=wt2html,wt2wt
25236 !! wikitext
25237 {|
25238 |
25239 <small>
25240 [[Image:Foobar.jpg|right|Test]]
25241 </small>
25242 |}
25243 !! html/php+tidy
25244 <table>
25245 <tbody><tr>
25246 <td>
25247 <p><small>
25248 </small></p><small>
25249 <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>
25250 </small><p><small></small>
25251 </p>
25252 </td></tr></tbody></table>
25253 !! html/parsoid
25254 <table>
25255 <tbody><tr><td>
25256 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25257 <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>
25258 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25259 </tbody></table>
25260 !! end
25261
25262 !! test
25263 2. Treebuilder fixup of formatting elt
25264 !! options
25265 parsoid=wt2html,wt2wt
25266 !! wikitext
25267 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25268
25269 <small>[[Image:Foobar.jpg|right|300px]]</small>
25270 !! html/php+tidy
25271 <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>
25272 </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>
25273 !! html/parsoid
25274 <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>
25275
25276 <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>
25277 !! end
25278
25279 !! test
25280 3. Treebuilder fixup of formatting elt
25281 !! options
25282 parsoid=wt2html,wt2wt
25283 !! wikitext
25284 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25285 !! html/php+tidy
25286 <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>
25287 </p>
25288 !! html/parsoid
25289 <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>
25290 !! end
25291
25292 !! test
25293 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25294 !! options
25295 parsoid=wt2html,wt2wt
25296 !! wikitext
25297 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25298 !! html/php+tidy
25299 <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>
25300 !! html/parsoid
25301 <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>
25302 !! end
25303
25304 #### ----------------------------------------------------------------
25305 #### Parsoid-only testing of Parsoid's impl of LST
25306 #### Not implemented yet, see
25307 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25308 #### ----------------------------------------------------------------
25309
25310 ## We still need to support serializing the older format while content is stored.
25311 !! test
25312 LST Sections: Backwards compatibility
25313 !! options
25314 parsoid={
25315 "suppressErrors": true,
25316 "modes": ["html2wt"]
25317 }
25318 !! wikitext
25319 <section begin="2011-05-16" />
25320 <section end="2014-04-10 (MW 1.23wmf22)" />
25321 !! html/parsoid
25322 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25323 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25324 !! end
25325
25326 !! test
25327 LST Sections: Newfangled approach
25328 !! wikitext
25329 <section begin="2011-05-16" />
25330 <section end="2014-04-10 (MW 1.23wmf22)" />
25331 !! html/parsoid
25332 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25333 </span>
25334 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25335 </span></p>
25336 !! end
25337
25338 #--------- Test stripping of empty nodes in template content ----------
25339
25340 !! test
25341 Empty LI and TR nodes should be stripped from template content
25342 !! wikitext
25343 {{EmptyLITest}}
25344 {{EmptyTRTest}}
25345 !! html/parsoid
25346 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25347 <li>a</li>
25348 <li>b</li>
25349 </ul>
25350 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25351 <tbody>
25352 <tr>
25353 <td>foo</td>
25354 </tr>
25355 <tr>
25356 <td>bar</td>
25357 </tr>
25358 </tbody>
25359 </table>
25360 !! end
25361
25362 !! test
25363 Empty LI and TR nodes should not be stripped from top-level content
25364 !! wikitext
25365 *a
25366 *
25367 *b
25368
25369 {|
25370 |-
25371 |-
25372 |foo
25373 |}
25374 !! html/parsoid
25375 <ul>
25376 <li>a</li>
25377 <li class='mw-empty-elt'></li>
25378 <li>b</li>
25379 </ul>
25380 <table>
25381 <tbody>
25382 <tr class='mw-empty-elt'></tr>
25383 <tr>
25384 <td>foo</td>
25385 </tr>
25386 </tbody>
25387 </table>
25388 !! end
25389
25390 !! test
25391 Empty TR nodes should not be stripped if they have any attributes set
25392 !! wikitext
25393 {{EmptyTRWithHTMLAttrTest}}
25394 !! html/parsoid
25395 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25396 <tr align='center'></tr>
25397 <tr><td>foo</td></tr>
25398 <tr align='center'></tr>
25399 <tr><td>bar</td></tr>
25400 </table>
25401 !! end
25402
25403 #### ----------------------------------------------------------------
25404 #### The following section of tests are primarily to test
25405 #### wikitext escaping capabilities of Parsoid. Given that
25406 #### escaping can be done any number of ways, the wikitext (input)
25407 #### is always adjusted to reflect how Parsoid adds nowiki
25408 #### escape tags.
25409 ####
25410 #### We are marking several tests as parsoid-only since the
25411 #### HTML in the result section is different from what the
25412 #### PHP parser generates for it.
25413 #### ----------------------------------------------------------------
25414
25415
25416 #### --------------- Headings ---------------
25417 #### 0. Unnested
25418 #### 1. Nested inside html <h1>=foo=</h1>
25419 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25420 #### 3. Nested inside html with wikitext split by html tags
25421 #### 4. No escape needed
25422 #### 5. Empty headings <h1></h1>
25423 #### 6. Heading chars in SOL context
25424 #### ----------------------------------------
25425 !! test
25426 Headings: 0. Unnested
25427 !! options
25428 parsoid=html2wt
25429 !! html/parsoid
25430 <p>=foo=</p>
25431
25432 <p> =foo=
25433 <!--cmt-->
25434 =foo=</p>
25435
25436 <p>=foo<i>a</i>=</p>
25437 !! wikitext
25438 <nowiki>=foo=</nowiki>
25439
25440 <nowiki> </nowiki>=foo=
25441 <!--cmt-->
25442 <nowiki>=foo=</nowiki>
25443
25444 =foo''a''<nowiki>=</nowiki>
25445 !!end
25446
25447 # New headings and existing headings are handled differently
25448 !! test
25449 Headings: 1. Nested inside html
25450 !! options
25451 parsoid=html2wt
25452 !! html/parsoid
25453 <h1>=foo=</h1>
25454 <h2>=foo=</h2>
25455 <h3>=foo=</h3>
25456
25457 <h1 data-parsoid=''>=foo=</h1>
25458 <h2 data-parsoid=''>=foo=</h2>
25459 <h3 data-parsoid=''>=foo=</h3>
25460 <h4 data-parsoid=''>=foo=</h4>
25461 <h5 data-parsoid=''>=foo=</h5>
25462 <h6 data-parsoid=''>=foo=</h6>
25463 !! wikitext
25464 = =foo= =
25465
25466 == =foo= ==
25467
25468 === =foo= ===
25469
25470 =<nowiki>=foo=</nowiki>=
25471 ==<nowiki>=foo=</nowiki>==
25472 ===<nowiki>=foo=</nowiki>===
25473 ====<nowiki>=foo=</nowiki>====
25474 =====<nowiki>=foo=</nowiki>=====
25475 ======<nowiki>=foo=</nowiki>======
25476
25477 !!end
25478
25479 !! test
25480 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25481 !! options
25482 parsoid=html2wt
25483 !! html/parsoid
25484 <h1>foo</h1>*bar
25485 <h1>foo</h1>=bar
25486 <h1>foo</h1>=bar=
25487 !! wikitext
25488 = foo =
25489 <nowiki>*</nowiki>bar
25490
25491 = foo =
25492 =bar
25493
25494 = foo =
25495 <nowiki>=bar=</nowiki>
25496 !!end
25497
25498 !! test
25499 Headings: 3. Nested inside html with wikitext split by html tags
25500 !! options
25501 parsoid=html2wt
25502 !! html/parsoid
25503 <h1>=<b>bold</b>foo=</h1>
25504 !! wikitext
25505 = ='''bold'''foo= =
25506 !!end
25507
25508 !! test
25509 Headings: 4a. No escaping needed (testing just h1 and h2)
25510 !! options
25511 parsoid=html2wt
25512 !! html/parsoid
25513 <h1>=foo</h1>
25514 <h1>foo=</h1>
25515 <h1> =foo= </h1>
25516 <h1>=foo= bar</h1>
25517 <h2>=foo</h2>
25518 <h2>foo=</h2>
25519 <h1>=</h1>
25520 <h1><i>=</i>foo=</h1>
25521 !! wikitext
25522 = =foo =
25523
25524 = foo= =
25525
25526 = =foo= =
25527
25528 = =foo= bar =
25529
25530 == =foo ==
25531
25532 == foo= ==
25533
25534 = = =
25535
25536 = ''=''foo= =
25537 !!end
25538
25539 !! test
25540 Headings: 4b. No escaping needed (inside p-tags)
25541 !! options
25542 parsoid=html2wt
25543 !! html/parsoid
25544 <p>=foo= x
25545 =foo= <s></s>
25546 </p>
25547 !! wikitext
25548 =foo= x
25549 =foo= <s></s>
25550 !! html/php
25551 <p>=foo= x
25552 =foo= <s></s>
25553 </p>
25554 !!end
25555
25556 !! test
25557 Headings: 4c. Short headings (1)
25558 !! options
25559 parsoid=html2wt
25560 !! html/parsoid
25561 <p>===
25562 </p>
25563 !! wikitext
25564 <nowiki>===</nowiki>
25565 !! html/php
25566 <p>===
25567 </p>
25568 !! end
25569
25570 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25571 !! test
25572 Headings: 4d. Short headings (2)
25573 !! options
25574 parsoid=wt2html,html2html
25575 !! wikitext
25576 =
25577 ==
25578 ===
25579 ====
25580 =====
25581 !! html/php
25582 <p>=
25583 ==
25584 </p>
25585 <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>
25586 <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>
25587 <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>
25588
25589 !! html/parsoid
25590 <p>=
25591 ==</p>
25592 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25593 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25594 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25595 !! end
25596
25597 !! test
25598 Headings: 5. Empty headings
25599 !! options
25600 parsoid=html2wt
25601 !! html/parsoid
25602 <h1 data-parsoid='{}'></h1>
25603
25604 <h2 data-parsoid='{}'></h2>
25605
25606 <h3 data-parsoid='{}'></h3>
25607
25608 <h4 data-parsoid='{}'></h4>
25609
25610 <h5 data-parsoid='{}'></h5>
25611
25612 <h6 data-parsoid='{}'></h6>
25613 !! wikitext
25614 =<nowiki/>=
25615
25616 ==<nowiki/>==
25617
25618 ===<nowiki/>===
25619
25620 ====<nowiki/>====
25621
25622 =====<nowiki/>=====
25623
25624 ======<nowiki/>======
25625 !!end
25626
25627 !! test
25628 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25629 !! options
25630 parsoid=html2wt
25631 !! html/parsoid
25632 <p>=a=</p>
25633
25634 <p>=a=</p>
25635
25636 <p>=a=</p>
25637 !! wikitext
25638 <nowiki>=a=</nowiki>
25639
25640 <nowiki>=a=</nowiki>
25641
25642 <nowiki>=a=</nowiki>
25643 !!end
25644
25645 !! test
25646 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25647 !! options
25648 parsoid=html2wt
25649 !! html/parsoid
25650 <p>=a=
25651 b</p>
25652
25653 <p>=a=
25654 b</p>
25655
25656 <p>=a=
25657 b</p>
25658 !! wikitext
25659 <nowiki>=a=</nowiki>
25660 b
25661
25662 <nowiki>=a=</nowiki>
25663 b
25664
25665 <nowiki>=a=</nowiki>
25666 b
25667 !!end
25668
25669 !! test
25670 Headings: 6c. Heading chars in SOL context (leading newline break)
25671 !! options
25672 parsoid=html2wt
25673 !! html/parsoid
25674 <p>a
25675 =b=</p>
25676 !! wikitext
25677 a
25678 <nowiki>=b=</nowiki>
25679 !!end
25680
25681 !! test
25682 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25683 !! options
25684 parsoid=html2wt
25685 !! html/parsoid
25686 <!--c0--><p>=a=</p>
25687
25688 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25689 !! wikitext
25690 <!--c0--><nowiki>=a=</nowiki>
25691
25692 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25693 !!end
25694
25695 !! test
25696 Headings: 6d. Heading chars in SOL context (No escaping needed)
25697 !! options
25698 parsoid=html2wt
25699 !! html/parsoid
25700 =a=<div>b</div>
25701 !! wikitext
25702 =a=<div>b</div>
25703 !!end
25704
25705 !! test
25706 Headings: 7. Insert a newline between new content and headings
25707 !! options
25708 parsoid=html2wt
25709 !! html/parsoid
25710 <h2>NEW</h2>
25711 <p>new</p>
25712 <h2 data-parsoid='{}'>A</h2>
25713 <p data-parsoid='{}'>a</p>
25714 !! wikitext
25715 == NEW ==
25716 new
25717
25718 ==A==
25719 a
25720
25721 !! end
25722
25723 !! test
25724 Headings: Used as horizontal rule
25725 !! config
25726 wgFragmentMode=[ 'html5', 'legacy' ]
25727 !! options
25728 parsoid=wt2html
25729 !! wikitext
25730 ===============
25731 !! html/php
25732 <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>
25733
25734 !! html/parsoid
25735 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25736 !! end
25737
25738 #### --------------- Lists ---------------
25739 #### 0. Outside nests (*foo, etc.)
25740 #### 1. Nested inside html <ul><li>*foo</li></ul>
25741 #### 2. Inside definition lists
25742 #### 3. Only bullets at start should be escaped
25743 #### 4. No escapes needed
25744 #### 5. No unnecessary escapes
25745 #### 6. Escape bullets in SOL position
25746 #### 7. Escape bullets in a multi-line context
25747 #### ----------------------------------------
25748
25749 !! test
25750 Lists: 0. Outside nests
25751 !! options
25752 parsoid=html2wt
25753 !! html/parsoid
25754 <p>*foo</p>
25755
25756 <p>#foo</p>
25757
25758 <p>;Foo:bar</p>
25759 !! wikitext
25760 <nowiki>*</nowiki>foo
25761
25762 <nowiki>#</nowiki>foo
25763
25764 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25765 !!end
25766
25767 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25768 ## to test wikitext escaping, and insignificant whitespace diffs
25769 ## cause PHP parser tests to barf
25770 !! test
25771 Lists: 1. Nested inside html (No unnecessary escapes)
25772 !! options
25773 parsoid=html2wt
25774 !! html/parsoid
25775 <ul>
25776 <li>*foo</li>
25777 <li>#foo</li>
25778 <li>:foo</li>
25779 <li>;foo</li>
25780 <li data-parsoid='{}'>*foo</li>
25781 <li data-parsoid='{}'>#foo</li>
25782 <li data-parsoid='{}'>:foo</li>
25783 <li data-parsoid='{}'>;foo</li>
25784 </ul>
25785
25786 <ol>
25787 <li>*foo</li>
25788 <li>#foo</li>
25789 <li>:foo</li>
25790 <li>;foo</li>
25791 <li data-parsoid='{}'>*foo</li>
25792 <li data-parsoid='{}'>#foo</li>
25793 <li data-parsoid='{}'>:foo</li>
25794 <li data-parsoid='{}'>;foo</li>
25795 </ol>
25796 !! wikitext
25797 * *foo
25798 * #foo
25799 * :foo
25800 * ;foo
25801 *<nowiki>*foo</nowiki>
25802 *<nowiki>#foo</nowiki>
25803 *<nowiki>:foo</nowiki>
25804 *<nowiki>;foo</nowiki>
25805
25806 # *foo
25807 # #foo
25808 # :foo
25809 # ;foo
25810 #<nowiki>*foo</nowiki>
25811 #<nowiki>#foo</nowiki>
25812 #<nowiki>:foo</nowiki>
25813 #<nowiki>;foo</nowiki>
25814 !!end
25815
25816 !! test
25817 Lists: 2. Inside definition lists
25818 !! options
25819 parsoid=html2wt
25820 !! html/parsoid
25821 <dl><dt>;foo</dt></dl>
25822 <dl><dt>:foo</dt></dl>
25823 <dl><dt>:foo</dt>
25824 <dd>bar</dd></dl>
25825 <dl><dd>:foo</dd></dl>
25826 !! wikitext
25827 ; ;foo
25828
25829 ; <nowiki>:foo</nowiki>
25830
25831 ; <nowiki>:foo</nowiki>
25832 : bar
25833
25834 : :foo
25835 !!end
25836
25837 !! test
25838 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25839 !! options
25840 parsoid=html2wt
25841 !! html/parsoid
25842 <ul>
25843 <li>*foo*bar</li>
25844 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25845 </ul>
25846 !! wikitext
25847 * *foo*bar
25848 *<nowiki>*foo</nowiki>''it''*bar
25849 !!end
25850
25851 !! test
25852 Lists: 4. No escapes needed
25853 !! options
25854 parsoid=html2wt
25855 !! html/parsoid
25856 <ul>
25857 <li>foo*bar
25858 </li>
25859 </ul>
25860 <ul>
25861 <li><i>foo</i>*bar
25862 </li>
25863 </ul>
25864 <ul>
25865 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25866 </li>
25867 </ul>
25868 <ul>
25869 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25870 </li>
25871 </ul>
25872 !! wikitext
25873 *foo*bar
25874
25875 *''foo''*bar
25876
25877 *[[Foo]]: bar
25878
25879 *[[Foo]]*bar
25880 !!end
25881
25882 !! test
25883 Lists: 5. No unnecessary escapes
25884 !! options
25885 parsoid=html2wt
25886 !! html/parsoid
25887 <ul><li> bar <span>[[foo]]</span></li></ul>
25888 <ul><li> =bar <span>[[foo]]</span></li></ul>
25889 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25890 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25891 <ul><li> =bar <span>foo]]</span>=</li></ul>
25892 <ul><li> <s></s>: a</li></ul>
25893 <ul><li> <i>* foo</i></li></ul>
25894
25895 !! wikitext
25896 * bar <span><nowiki>[[foo]]</nowiki></span>
25897
25898 * =bar <span><nowiki>[[foo]]</nowiki></span>
25899
25900 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25901
25902 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25903
25904 * =bar <span>foo]]</span>=
25905
25906 * <s></s>: a
25907
25908 * ''* foo''
25909 !!end
25910
25911 !! test
25912 Lists: 6. Escape bullets in SOL position
25913 !! options
25914 parsoid=html2wt
25915 !! html/parsoid
25916 <p><!--cmt-->*foo</p>
25917 !! wikitext
25918 <!--cmt--><nowiki>*</nowiki>foo
25919 !!end
25920
25921 !! test
25922 Lists: 7. Escape bullets in a multi-line context
25923 !! options
25924 parsoid=html2wt
25925 !! html/parsoid
25926 <p>a
25927 *b
25928 </p>
25929 !! wikitext
25930 a
25931 <nowiki>*</nowiki>b
25932 !!end
25933
25934 !! test
25935 Lists: 8. Escape colons only if not present in tags
25936 !! options
25937 parsoid=html2wt
25938 !! html/parsoid
25939 <dl><dt>a:b<i>c:d</i></dt></dl>
25940 !! wikitext
25941 ; <nowiki>a:b</nowiki>''c:d''
25942 !! end
25943
25944 #### --------------- HRs ---------------
25945 #### 1. Single line
25946 #### -----------------------------------
25947
25948 !! test
25949 HRs: 1. Single line
25950 !! options
25951 parsoid=html2wt
25952 !! html/parsoid
25953 <hr />----
25954 <hr />=foo=
25955 <hr />*foo
25956 !! wikitext
25957 ----<nowiki>----</nowiki>
25958 ----=foo=
25959 ----*foo
25960 !! end
25961
25962 #### --------------- Tables ---------------
25963 #### 1a. Simple example
25964 #### 1b. No escaping needed (!foo)
25965 #### 1c. No escaping needed (|foo)
25966 #### 1d. No escaping needed (|}foo)
25967 ####
25968 #### 2a. Nested in td (<td>foo|bar</td>)
25969 #### 2b. Nested in td (<td>foo||bar</td>)
25970 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25971 ####
25972 #### 3a. Nested in th (<th>foo!bar</th>)
25973 #### 3b. Nested in th (<th>foo!!bar</th>)
25974 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25975 ####
25976 #### 4a. Escape -
25977 #### 4b. Escape +
25978 #### 4c. No escaping needed
25979 #### --------------------------------------
25980
25981 !! test
25982 Tables: 1a. Simple example
25983 !! options
25984 parsoid=html2wt
25985 !! html/parsoid
25986 <p>{|
25987 |}
25988 </p>
25989 !! wikitext
25990 <nowiki>{|</nowiki>
25991 |}
25992 !! end
25993
25994 !! test
25995 Tables: 1b. No escaping needed
25996 !! options
25997 parsoid=html2wt
25998 !! html/parsoid
25999 <p>!foo
26000 </p>
26001 !! wikitext
26002 !foo
26003 !! end
26004
26005 !! test
26006 Tables: 1c. No escaping needed
26007 !! options
26008 parsoid=html2wt
26009 !! html/parsoid
26010 <p>|foo
26011 </p>
26012 !! wikitext
26013 |foo
26014 !! end
26015
26016 !! test
26017 Tables: 1d. No escaping needed
26018 !! options
26019 parsoid=html2wt
26020 !! html/parsoid
26021 <p>|}foo
26022 </p>
26023 !! wikitext
26024 |}foo
26025 !! end
26026
26027 !! test
26028 Tables: 2a. Nested in td
26029 !! options
26030 parsoid=html2wt
26031 !! html/parsoid
26032 <table><tbody><tr>
26033 <td>foo|bar</td></tr>
26034 <tr><td>x<div>a|b</div></td>
26035 </tbody></table>
26036 !! wikitext
26037 {|
26038 |<nowiki>foo|bar</nowiki>
26039 |-
26040 |x<div><nowiki>a|b</nowiki></div>
26041 |}
26042 !! html/php+tidy
26043 <table>
26044 <tbody><tr>
26045 <td>foo|bar
26046 </td></tr>
26047 <tr>
26048 <td>x<div>a|b</div>
26049 </td></tr></tbody></table>
26050 !! end
26051
26052 !! test
26053 Tables: 2b. Nested in td
26054 !! options
26055 parsoid=html2wt
26056 !! html/parsoid
26057 <table><tbody><tr>
26058 <td>foo||bar</td>
26059 <td>a<i>b||c</i></td>
26060 <td>a<i><div>b||c</div></i></td>
26061 </tr></tbody></table>
26062 !! wikitext
26063 {|
26064 |<nowiki>foo||bar</nowiki>
26065 |a''<nowiki>b||c</nowiki>''
26066 |a''<div><nowiki>b||c</nowiki></div>''
26067 |}
26068 !! html/php
26069 <table>
26070 <tr>
26071 <td>foo||bar
26072 </td>
26073 <td>a<i>b||c</i>
26074 </td>
26075 <td>a<i><div>b||c</div></i>
26076 </td></tr></table>
26077
26078 !! end
26079
26080 !! test
26081 Tables: 2c. Nested in td -- no escaping needed
26082 !! options
26083 parsoid=html2wt
26084 !! html/*
26085 <table>
26086 <tr>
26087 <td>foo!!bar
26088 </td></tr></table>
26089
26090 !! wikitext
26091 {|
26092 |foo!!bar
26093 |}
26094 !! end
26095
26096 !! test
26097 Tables: 3a. Nested in th
26098 !! options
26099 parsoid=html2wt
26100 !! html/*
26101 <table>
26102 <tr>
26103 <th>foo!bar
26104 </th></tr></table>
26105
26106 !! wikitext
26107 {|
26108 !foo!bar
26109 |}
26110 !! end
26111
26112 !! test
26113 Tables: 3b. Nested in th
26114 !! options
26115 parsoid=html2wt
26116 !! html/parsoid
26117 <table><tbody>
26118 <tr><th>foo!!bar</th>
26119 <th><i>foo|bar</i></th>
26120 <th><i>foo!!bar</i></th>
26121 <th><i><span>foo!!bar</span></i></th>
26122 </tr></tbody></table>
26123 !! wikitext
26124 {|
26125 !<nowiki>foo!!bar</nowiki>
26126 !''<nowiki>foo|bar</nowiki>''
26127 !''<nowiki>foo!!bar</nowiki>''
26128 !''<span><nowiki>foo!!bar</nowiki></span>''
26129 |}
26130 !! html/php
26131 <table>
26132 <tr>
26133 <th>foo!!bar
26134 </th>
26135 <th><i>foo|bar</i>
26136 </th>
26137 <th><i>foo!!bar</i>
26138 </th>
26139 <th><i><span>foo!!bar</span></i>
26140 </th></tr></table>
26141
26142 !! end
26143
26144 !! test
26145 Tables: 3c. Nested in th
26146 !! options
26147 parsoid=html2wt
26148 !! html/parsoid
26149 <table><tbody>
26150 <tr><th>foo||bar</th>
26151 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26152 </tr></tbody></table>
26153 !! wikitext
26154 {|
26155 !<nowiki>foo||bar</nowiki>
26156 !<nowiki>foo||bar</nowiki>
26157 |}
26158 !! html/php
26159 <table>
26160 <tr>
26161 <th>foo||bar
26162 </th>
26163 <th>foo||bar
26164 </th></tr></table>
26165
26166 !! end
26167
26168 !! test
26169 Tables: 4a. Escape -
26170 !! options
26171 parsoid=html2wt
26172 !! html/*
26173 <table>
26174 <tr>
26175 <th>-bar
26176 </th></tr>
26177 <tr>
26178 <td>-bar
26179 </td></tr></table>
26180
26181 !! wikitext
26182 {|
26183 !-bar
26184 |-
26185 |<nowiki>-bar</nowiki>
26186 |}
26187 !! end
26188
26189 !! test
26190 Tables: 4b. Escape +
26191 !! options
26192 parsoid=html2wt
26193 !! html/*
26194 <table>
26195 <tr>
26196 <th>+bar
26197 </th></tr>
26198 <tr>
26199 <td>+bar
26200 </td></tr></table>
26201
26202 !! wikitext
26203 {|
26204 !+bar
26205 |-
26206 |<nowiki>+bar</nowiki>
26207 |}
26208 !! end
26209
26210 !! test
26211 Tables: 4c. No escaping needed
26212 !! options
26213 parsoid=html2wt
26214 !! html/parsoid
26215 <table><tbody>
26216 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26217 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26218 <tr><td>foo
26219 <p>bar|baz
26220 +bar
26221 -bar</p></td></tr>
26222 <tr><td>x
26223 <div>a|b</div></td>
26224 </tbody></table>
26225 !! wikitext
26226 {|
26227 |foo-bar
26228 |foo+bar
26229 |-
26230 |''foo''-bar
26231 |''foo''+bar
26232 |-
26233 |foo
26234 bar|baz
26235 +bar
26236 -bar
26237 |-
26238 |x
26239 <div>a|b</div>
26240 |}
26241 !! html/php
26242 <table>
26243 <tr>
26244 <td>foo-bar
26245 </td>
26246 <td>foo+bar
26247 </td></tr>
26248 <tr>
26249 <td><i>foo</i>-bar
26250 </td>
26251 <td><i>foo</i>+bar
26252 </td></tr>
26253 <tr>
26254 <td>foo
26255 <p>bar|baz
26256 +bar
26257 -bar
26258 </p>
26259 </td></tr>
26260 <tr>
26261 <td>x
26262 <div>a|b</div>
26263 </td></tr></table>
26264
26265 !! end
26266
26267 !! test
26268 Tables: 4d. No escaping needed
26269 !! options
26270 parsoid=html2wt
26271 !! html/parsoid
26272 <table>
26273 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26274 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26275 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26276 </tbody></table>
26277 !! wikitext
26278 {|
26279 |[[Foo]]-bar
26280 ||+1
26281 ||-2
26282 |}
26283 !! html/php
26284 <table>
26285 <tr>
26286 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26287 </td>
26288 <td>+1
26289 </td>
26290 <td>-2
26291 </td></tr></table>
26292
26293 !! end
26294
26295 !! test
26296 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26297 !! options
26298 parsoid=html2wt
26299 !! html/parsoid
26300 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26301
26302 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26303
26304 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26305
26306 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26307 !! wikitext
26308 {|
26309 | || align="center" | ||
26310 |}
26311
26312 {|
26313 |
26314 | align="center" |
26315 |
26316 |}
26317
26318 {|
26319 | {{!}}{{!}} align="center" | ||
26320 |}
26321
26322 {|
26323 ! !! align="center" | !!
26324 |}
26325 !! html/php+tidy
26326 <table>
26327 <tbody><tr>
26328 <td></td>
26329 <td align="center"></td>
26330 <td>
26331 </td></tr></tbody></table>
26332 <table>
26333 <tbody><tr>
26334 <td>
26335 </td>
26336 <td align="center">
26337 </td>
26338 <td>
26339 </td></tr></tbody></table>
26340 <table>
26341 <tbody><tr>
26342 <td></td>
26343 <td align="center"></td>
26344 <td>
26345 </td></tr></tbody></table>
26346 <table>
26347 <tbody><tr>
26348 <th></th>
26349 <th align="center"></th>
26350 <th>
26351 </th></tr></tbody></table>
26352 !! end
26353
26354 !! test
26355 T97430: Don't emit empty nowiki pairs around marker meta tags
26356 !! options
26357 parsoid=html2wt
26358 !! html/parsoid
26359 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26360 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26361 !! wikitext
26362 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26363 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26364 !! end
26365
26366 !! test
26367 Unclosed xmlish element in table line shouldn't eat end delimiters
26368 !! options
26369 parsoid=html2wt
26370 !! html/parsoid
26371 <table>
26372 <tbody><tr><td> &lt;foo</td>
26373 <td> bar></td></tr>
26374 </tbody></table>
26375 !! wikitext
26376 {|
26377 | <foo
26378 | bar>
26379 |}
26380 !! html/php
26381 <table>
26382 <tr>
26383 <td>&lt;foo
26384 </td>
26385 <td>bar&gt;
26386 </td></tr></table>
26387
26388 !! end
26389
26390 #### --------------- Links ----------------
26391 #### 1. Quote marks in link text
26392 #### 2. Wikilinks: Escapes needed
26393 #### 3. Wikilinks: No escapes needed
26394 #### 4. Extlinks: Escapes needed
26395 #### 5. Extlinks: No escapes needed
26396 #### --------------------------------------
26397 !! test
26398 Links 1. WikiLinks: No escapes needed
26399 !! options
26400 parsoid=html2wt
26401 !! html/parsoid
26402 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26403 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26404 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26405 !! wikitext
26406 [[Foo|Foo''boo'']]
26407 [[Foo|[Foobar]]]
26408 [[Foo|x [Foobar] x]]
26409 !! html/php
26410 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26411 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26412 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26413 </p>
26414 !! end
26415
26416 !! test
26417 Links 2. WikiLinks: Escapes needed
26418 !! options
26419 parsoid=html2wt
26420 !! html/parsoid
26421 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26422 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26423 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26424 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26425 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26426 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26427 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26428 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26429 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26430 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26431 !! wikitext
26432 [[Foo|<nowiki>Foobar]</nowiki>]]
26433 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26434 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26435 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26436 [[Foo|<nowiki>|Bar</nowiki>]]
26437 [[Foo|<nowiki>]]bar</nowiki>]]
26438 [[Foo|<nowiki>[[bar</nowiki>]]
26439 [[Foo|<nowiki>x [[ y</nowiki>]]
26440 [[Foo|<nowiki>x ]] y</nowiki>]]
26441 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26442 !! html/php
26443 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26444 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26445 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26446 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26447 <a href="/wiki/Foo" title="Foo">|Bar</a>
26448 <a href="/wiki/Foo" title="Foo">]]bar</a>
26449 <a href="/wiki/Foo" title="Foo">[[bar</a>
26450 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26451 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26452 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26453 </p>
26454 !! end
26455
26456 !! test
26457 Links 3. WikiLinks: No escapes needed
26458 !! options
26459 parsoid=html2wt
26460 !! html/parsoid
26461 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26462 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26463 !! wikitext
26464 [[Foo|[Foobar]]
26465 [[Foo|foo|bar]]
26466 !! html/php
26467 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26468 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26469 </p>
26470 !! end
26471
26472 !! test
26473 Links 4. ExtLinks: Escapes needed
26474 !! options
26475 parsoid=html2wt
26476 !! html/parsoid
26477 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26478 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26479 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26480 <p>[http://google.com]</p>
26481 <p>[http://google.com google]</p>
26482 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26483 <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>
26484 !! wikitext
26485 [http://google.com <nowiki>[google]</nowiki>]
26486 [http://google.com <nowiki>google]</nowiki>]
26487 [http://google.com <nowiki>goog] le</nowiki>]
26488
26489 <nowiki>[http://google.com]</nowiki>
26490
26491 <nowiki>[http://google.com google]</nowiki>
26492
26493 [http://google.com<nowiki>]</nowiki>
26494
26495 [{{echo|http://google.com}}<nowiki>]</nowiki>
26496 !! html/php
26497 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26498 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26499 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26500 </p><p>[http://google.com]
26501 </p><p>[http://google.com google]
26502 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26503 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26504 </p>
26505 !! end
26506
26507 !! test
26508 Links 5. ExtLinks: No escapes needed
26509 !! options
26510 parsoid=html2wt
26511 !! html/parsoid
26512 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26513 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26514 !! wikitext
26515 [http://google.com [google]
26516
26517 [[http://google.com]]
26518 !! html/php
26519 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26520 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26521 </p>
26522 !! end
26523
26524 !! test
26525 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26526 !! options
26527 parsoid=html2wt
26528 !! html/parsoid
26529 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26530 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26531 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26532 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26533 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26534 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26535 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26536 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26537 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26538 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26539 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26540 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26541 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26542 </p>
26543 !! wikitext
26544 x<nowiki/>http://example.com<nowiki/>y
26545 http://example.com<nowiki/>?x
26546 http://example.com<nowiki/>&x
26547 http://example.com<nowiki/>'x
26548 http://example.com<nowiki/>,x
26549 http://example.com<nowiki/>.x
26550 http://example.com<nowiki/>;x
26551 http://example.com<nowiki/>:x
26552 http://example.com<nowiki/>;x
26553 http://example.com<nowiki/>!x
26554 http://example.com<nowiki/>=x
26555 http://example.com<nowiki/>(x)
26556 http://example.com(x<nowiki/>)
26557 !! end
26558
26559 !! test
26560 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26561 !! options
26562 parsoid=html2wt
26563 !! html/parsoid
26564 <p>x
26565 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26566 y
26567 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26568 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26569 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26570 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26571 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26572 </p>
26573 !! wikitext
26574 x
26575 http://example.com
26576 y
26577 "http://example.com"
26578 (http://example.com)
26579 (http://example.com) foo
26580 http://example.com,
26581 http://example.com, foo
26582 !! html/php
26583 <p>x
26584 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26585 y
26586 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26587 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26588 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26589 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26590 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26591 </p>
26592 !! end
26593
26594 !! test
26595 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26596 !! options
26597 parsoid=html2wt
26598 !! html/parsoid
26599 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26600 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26601 !! wikitext
26602 http://example.com.,;:!?\
26603 -http://example.com:
26604 !! html/php
26605 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26606 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26607 </p>
26608 !! end
26609
26610 !! test
26611 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26612 !! options
26613 parsoid=html2wt
26614 !! html/parsoid
26615 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26616 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26617 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26618 !! wikitext
26619 RFC 123<nowiki/>4
26620 RFC 123<nowiki/>y
26621 X<nowiki/>RFC 123<nowiki/>y
26622 !! end
26623
26624 !! test
26625 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26626 !! options
26627 parsoid=html2wt
26628 !! html/parsoid
26629 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26630 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26631 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26632 </p>
26633 !! wikitext
26634 RFC 123?foo
26635 RFC 123&foo
26636 -RFC 123-
26637 !! html/php
26638 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26639 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26640 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26641 </p>
26642 !! end
26643
26644 !! test
26645 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26646 !! options
26647 parsoid=html2wt
26648 !! html/parsoid
26649 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26650 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26651 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26652 !! wikitext
26653 PMID 123<nowiki/>4
26654 PMID 123<nowiki/>y
26655 X<nowiki/>PMID 123<nowiki/>y
26656 !! end
26657
26658 !! test
26659 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26660 !! options
26661 parsoid=html2wt
26662 !! html/parsoid
26663 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26664 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26665 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26666 </p>
26667 !! wikitext
26668 PMID 123?foo
26669 PMID 123&foo
26670 -PMID 123-
26671 !! html/php
26672 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26673 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26674 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26675 </p>
26676 !! end
26677
26678 !! test
26679 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26680 !! options
26681 parsoid=html2wt
26682 !! html/parsoid
26683 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26684 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26685 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26686 </p>
26687 !! wikitext
26688 ISBN 1234567890<nowiki/>1
26689 ISBN 1234567890<nowiki/>x
26690 a<nowiki/>ISBN 1234567890<nowiki/>b
26691 !! end
26692
26693 !! test
26694 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26695 !! options
26696 parsoid=html2wt
26697 !! html/parsoid
26698 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26699 !! wikitext
26700 -ISBN 1234567890's
26701 !! html/php
26702 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26703 </p>
26704 !! end
26705
26706 !! test
26707 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26708 !! options
26709 parsoid=html2wt
26710 !! html/*
26711 <p>this is not a link: http://example.com
26712 </p>
26713 !! wikitext
26714 this is not a link: <nowiki>http://example.com</nowiki>
26715 !! end
26716
26717 !! test
26718 Links 15. Link trails can't become link prefixes.
26719 !! options
26720 language=is
26721 parsoid=html2wt
26722 !! html/parsoid
26723 <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>
26724 !! wikitext
26725 [[Söfnuður]]-[[00]]
26726 !! html/php
26727 <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>
26728 </p>
26729 !! end
26730
26731 #### --------------- Quotes ---------------
26732 #### 1. Quotes inside <b> and <i>
26733 #### 2. Link fragments separated by <i> and <b> tags
26734 #### 3. Link fragments inside <i> and <b>
26735 #### 4. No escaping needed
26736 #### --------------------------------------
26737 !! test
26738 1a. Quotes inside <b> and <i>
26739 !! options
26740 parsoid=html2wt
26741 !! html/*
26742 <p><i>'foo'</i>
26743 <i>''foo''</i>
26744 <i>'''foo'''</i>
26745 <i>foo</i>'s
26746 <b>'foo'</b>
26747 <b>''foo''</b>
26748 <b>'''foo'''</b>
26749 <b>foo'<i>bar'</i>baz</b>
26750 <b>foo</b>'s
26751 '<i>foo</i>
26752 <i>foo</i>'
26753 <i>foo'</i>'
26754 '<i>foo</i>'
26755 '<b>foo</b>
26756 <b>foo</b>'
26757 '<b>foo</b>'
26758 <i>fools'<span> errand</span></i>
26759 <i><span>fool</span>'s errand</i>
26760 '<i>foo</i> bar '<i>baz</i>
26761 a|!*#-:;+-~[]{}b'<i>x</i>
26762 </p>
26763 !! wikitext
26764 ''<nowiki/>'foo'''
26765 ''<nowiki>''foo''</nowiki>''
26766 ''<nowiki>'''foo'''</nowiki>''
26767 ''foo''<nowiki/>'s
26768 '''<nowiki/>'foo''''
26769 '''<nowiki>''foo''</nowiki>'''
26770 '''<nowiki>'''foo'''</nowiki>'''
26771 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26772 '''foo'''<nowiki/>'s
26773 '''foo''
26774 ''foo''<nowiki/>'
26775 ''foo'''<nowiki/>'
26776 '''foo''<nowiki/>'
26777 ''''foo'''
26778 '''foo'''<nowiki/>'
26779 ''''foo'''<nowiki/>'
26780 ''fools'<span> errand</span>''
26781 ''<span>fool</span>'s errand''
26782 '<nowiki/>''foo'' bar '''baz''
26783 a|!*#-:;+-~[]{}b'''x''
26784 !! end
26785
26786 !! test
26787 1b. Quotes inside <b> and <i> with other tags on same line
26788 !! options
26789 parsoid=html2wt
26790 !! html/parsoid
26791 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26792 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26793 <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>
26794 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26795 '<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>
26796 '<i>foo</i> <div title="name">test</div>
26797 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26798 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26799 <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>
26800 </ol>
26801 !! wikitext
26802 '''a'' foo ''[[bar]]''
26803 ''a''' foo ''[[bar]]''
26804 ''a''' foo '''{{echo|[[bar]]}}'''
26805 [[foo]] x'''[[bar]]''
26806 '''foo'' <ref>test</ref>
26807 '''foo'' <div title="name">test</div>
26808 '''foo'' and <br> bar
26809 <references />
26810 !! end
26811
26812 !! test
26813 2. Link fragments separated by <i> and <b> tags
26814 !! options
26815 parsoid=html2wt
26816 !! html/parsoid
26817 <p>[[<i>foo</i>hello]]</p>
26818 <p>[[<b>foo</b>hello]]</p>
26819 !! wikitext
26820 [[''foo''<nowiki>hello]]</nowiki>
26821
26822 [['''foo'''<nowiki>hello]]</nowiki>
26823 !! end
26824
26825 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26826 # this is one of the shortcomings of this format
26827 !! test
26828 3. Link fragments inside <i> and <b>
26829 !! options
26830 parsoid=html2wt
26831 !! html/parsoid
26832 <p><i>[[foo</i>]]</p>
26833 <p><b>[[foo</b>]]</p>
26834 !! wikitext
26835 ''[[foo''<nowiki>]]</nowiki>
26836
26837 '''[[foo'''<nowiki>]]</nowiki>
26838 !! end
26839
26840 !! test
26841 4. No escaping needed
26842 !! options
26843 parsoid=html2wt
26844 !! html/parsoid
26845 <p>'<span><i>bar</i></span>'
26846 '<span><b>bar</b></span>'
26847 'a:b'foo
26848 </p>
26849 !! wikitext
26850 '<span>''bar''</span>'
26851 '<span>'''bar'''</span>'
26852 'a:b'foo
26853 !! end
26854
26855 #### ----------- Paragraphs ---------------
26856 #### 1. No unnecessary escapes
26857 #### --------------------------------------
26858
26859 !! test
26860 1. No unnecessary escapes
26861 !! options
26862 parsoid=html2wt
26863 !! html/parsoid
26864 <p>bar <span>[[foo]]</span>
26865 </p><p>=bar <span>[[foo]]</span>
26866 </p><p>[[bar <span>[[foo]]</span>
26867 </p><p>]]bar <span>[[foo]]</span>
26868 </p><p>=bar <span>foo]]</span>=
26869 </p>
26870 !! wikitext
26871 bar <span><nowiki>[[foo]]</nowiki></span>
26872
26873 =bar <span><nowiki>[[foo]]</nowiki></span>
26874
26875 [[bar <span><nowiki>[[foo]]</nowiki></span>
26876
26877 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26878
26879 =bar <span>foo]]</span><nowiki>=</nowiki>
26880 !!end
26881
26882 #### ----------------------- PRE --------------------------
26883 !! test
26884 1. Leading whitespace in SOL context should be escaped
26885 !! options
26886 parsoid=html2wt
26887 !! html/parsoid
26888 <p> a</p>
26889
26890 <p> a</p>
26891
26892 <p> a(tab)</p>
26893
26894 <p> a
26895 <!--cmt-->
26896 a</p>
26897
26898 <p>a
26899 b</p>
26900
26901 <p>a
26902 b</p>
26903
26904 <p>a
26905 b</p>
26906 !! wikitext
26907 <nowiki> </nowiki>a
26908
26909 <nowiki> </nowiki> a
26910
26911 a(tab)
26912
26913 <nowiki> </nowiki> a
26914 <!--cmt-->
26915 <nowiki> </nowiki>a
26916
26917 a
26918 <nowiki> </nowiki>b
26919
26920 a
26921 b
26922
26923 a
26924 b
26925 !! html/php
26926 <p> a
26927 </p><p> a
26928 </p><p> a(tab)
26929 </p><p> a
26930 a
26931 </p><p>a
26932 b
26933 </p><p>a
26934 b
26935 </p><p>a
26936 b
26937 </p>
26938 !! end
26939
26940 !! test
26941 2. Leading whitespace in non-indent-pre contexts should not be escaped
26942 !! options
26943 parsoid=html2wt
26944 !! html/parsoid
26945 <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>
26946 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26947 <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>
26948 b</span></li>
26949 </ol>
26950 !! wikitext
26951 foo <ref>''a''
26952 b</ref>
26953 <references />
26954 !! end
26955
26956 !! test
26957 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26958 !! options
26959 parsoid=html2wt
26960 !! html/parsoid
26961 <blockquote>
26962 <p>
26963 a
26964 <span>b</span>
26965 c</p>
26966 </blockquote>
26967 !! wikitext
26968 <blockquote>
26969 a
26970 <span>b</span>
26971 c
26972 </blockquote>
26973 !! end
26974
26975 !! test
26976 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26977 !! options
26978 parsoid=html2wt
26979 !! html/parsoid
26980 <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>
26981 !! wikitext
26982 [[File:Foobar.jpg|thumb|caption]]
26983 !! end
26984
26985 !! test
26986 5. Nowiki escaping should account for indent-pres
26987 !! options
26988 parsoid=html2wt
26989 !! html/parsoid
26990 <pre>==foo==</pre>
26991 !! wikitext
26992 ==foo==
26993 !! end
26994
26995 !! test
26996 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26997 !! options
26998 parsoid=html2wt
26999 !! html/parsoid
27000 <pre>
27001 * foo
27002 * bar
27003 </pre>
27004 !! wikitext
27005 * foo
27006 * bar
27007 !! end
27008
27009 !! test
27010 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27011 !! options
27012 parsoid = {
27013 "modes": ["html2wt"],
27014 "scrubWikitext": true
27015 }
27016 !! html/parsoid
27017 <p> foo</p>
27018 <p> %foo</p>
27019 <p> *foo</p>
27020 <p> #foo</p>
27021 <p> =foo=</p>
27022 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27023 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27024 <p> <!--boo-->*foo</p>
27025 <p><!--boo--> *foo</p>
27026 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27027 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27028 !! wikitext
27029 foo
27030
27031 %foo
27032
27033 <nowiki/>*foo
27034
27035 <nowiki/>#foo
27036
27037 <nowiki/>=foo=
27038
27039 [[Category:Foo]]
27040 <nowiki/>*foo
27041
27042 [[Category:Foo]]
27043 <nowiki>*</nowiki>foo
27044
27045 <nowiki/><!--boo-->*foo
27046
27047 <!--boo--><nowiki/>*foo
27048
27049 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27050
27051 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27052 !! end
27053
27054 #### --------------- Behavior Switches --------------------
27055
27056 !! test
27057 1. Valid behavior switches should be escaped
27058 !! options
27059 parsoid=html2wt
27060 !! html/parsoid
27061 __TOC__
27062 <i>__TOC__</i>
27063 !! wikitext
27064 <nowiki>__TOC__</nowiki>
27065 ''<nowiki>__TOC__</nowiki>''
27066 !! end
27067
27068 !! test
27069 2. Invalid behavior switches should not be escaped
27070 !! options
27071 parsoid=html2wt
27072 !! html/parsoid
27073 __TOO__
27074 __|__
27075 !! wikitext
27076 __TOO__
27077 __|__
27078 !! end
27079
27080 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27081 !! test
27082 Behavior switches should be SOL-transparent
27083 !! options
27084 parsoid=html2wt
27085 !! html/parsoid
27086 <meta property="mw:PageProp/toc" />
27087
27088 <!-- this one's bogus -->
27089 <pre>__TOO__</pre>
27090
27091 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27092
27093 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27094 !! wikitext
27095 __TOC__
27096
27097 <!-- this one's bogus -->
27098 __TOO__
27099
27100 __TOC__ foo
27101
27102 __TOC__
27103 bar
27104 !! end
27105
27106 #### --------------- HTML tags ---------------
27107 #### 1. a tags
27108 #### 2. other tags
27109 #### 3. multi-line html tag
27110 #### 4. extension tags
27111 #### -----------------------------------------
27112 !! test
27113 1. a tags
27114 !! options
27115 parsoid=html2wt
27116 !! html/parsoid
27117 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27118 !! wikitext
27119 <a href="http://google.com">google</a>
27120 !! end
27121
27122 !! test
27123 2. other tags
27124 !! options
27125 parsoid=html2wt
27126 !! html/parsoid
27127 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27128 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27129 <li> &lt;td&gt;</li></ul>
27130
27131 !! wikitext
27132 * <nowiki><div>foo</div></nowiki>
27133 * <nowiki><div style="color:red">foo</div></nowiki>
27134 * <nowiki><td></nowiki>
27135 !! end
27136
27137 !! test
27138 3. multi-line html tag
27139 !! options
27140 parsoid=html2wt
27141 !! html/parsoid
27142 <p>&lt;div
27143 &gt;foo&lt;/div
27144 &gt;
27145 </p>
27146 !! wikitext
27147 <nowiki><div
27148 >foo</div
27149 ></nowiki>
27150 !! end
27151
27152 !! test
27153 4. extension tags
27154 !! options
27155 parsoid=html2wt
27156 !! html/parsoid
27157 <p>&lt;ref&gt;foo&lt;/ref&gt;
27158 </p><p>&lt;ref&gt;bar
27159 </p><p>baz&lt;/ref&gt;
27160 </p>
27161 !! wikitext
27162 <nowiki><ref>foo</ref></nowiki>
27163
27164 <nowiki><ref>bar</nowiki>
27165
27166 baz<nowiki></ref></nowiki>
27167 !! end
27168
27169 !! test
27170 Parsoid: newline inducing block nodes don't suppress <nowiki>
27171 !! options
27172 parsoid=html2wt
27173 !! html/parsoid
27174 a<h1>foo</h1>
27175 !! wikitext
27176 <nowiki> </nowiki>a
27177
27178 = foo =
27179 !! end
27180
27181 #### --------------- Others ---------------
27182 !! test
27183 Escaping nowikis
27184 !! options
27185 parsoid=html2wt
27186 !! html/parsoid
27187 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27188 </p>
27189 !! wikitext
27190 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27191 !! end
27192
27193 ## The quote-char in the input is necessary for triggering the bug
27194 !! test
27195 (T54035) Nowiki-escaping should not get tripped by " :" in text
27196 !! options
27197 parsoid=html2wt
27198 !! html/parsoid
27199 <p>foo's bar :</p>
27200 !! wikitext
27201 foo's bar :
27202 !! end
27203
27204 #----------- End of wikitext escaping tests --------------
27205
27206 !! test
27207
27208 Tag-like HTML structures are passed through as text
27209 !! wikitext
27210 <x y>
27211
27212 <x.y>
27213
27214 <x-y>
27215
27216 1>2
27217
27218 x<y
27219
27220 a>b
27221
27222 1<d e>f
27223 !! html
27224 <p>&lt;x y&gt;
27225 </p><p>&lt;x.y&gt;
27226 </p><p>&lt;x-y&gt;
27227 </p><p>1&gt;2
27228 </p><p>x&lt;y
27229 </p><p>a&gt;b
27230 </p><p>1&lt;d e&gt;f
27231 </p>
27232 !! end
27233
27234 !! test
27235 HTML tag with necessary entities in attributes
27236 !! wikitext
27237 <span title="&amp;amp;">foo</span>
27238 !! html
27239 <p><span title="&amp;amp;">foo</span>
27240 </p>
27241 !! end
27242
27243 !! test
27244 HTML tag with 'unnecessary' entity encoding in attributes
27245 !! wikitext
27246 <span title="&amp;">foo</span>
27247 !! html
27248 <p><span title="&amp;">foo</span>
27249 </p>
27250 !! end
27251
27252 !! test
27253 HTML tag with broken attribute value quoting
27254 !! options
27255 parsoid=wt2html,html2html
27256 !! wikitext
27257 <span title="Hello world>Foo</span>
27258 !! html/php
27259 <p><span title="Hello world">Foo</span>
27260 </p>
27261 !! html/parsoid
27262 <p><span title="Hello world">Foo</span></p>
27263 !! end
27264
27265 !! test
27266 Self-closed tag with broken attribute value quoting
27267 !! options
27268 parsoid=wt2html,html2html
27269 !! wikitext
27270 <div title="Hello world />Foo
27271 !! html/php+tidy
27272 <div title="Hello world"></div><p>Foo
27273 </p>
27274 !! html/parsoid
27275 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27276 !! end
27277
27278 !! test
27279 Table with broken attribute value quoting
27280 !! options
27281 parsoid=wt2html,html2html
27282 !! wikitext
27283 {|
27284 | title="Hello world|Foo
27285 |}
27286 !! html/php
27287 <table>
27288 <tr>
27289 <td title="Hello world">Foo
27290 </td></tr></table>
27291
27292 !! html/parsoid
27293 <table>
27294 <tr>
27295 <td title="Hello world">Foo
27296 </td></tr></table>
27297
27298 !! end
27299
27300 !! test
27301 Table with broken attribute value quoting on consecutive lines
27302 !! options
27303 parsoid=wt2html,html2html
27304 !! wikitext
27305 {|
27306 | title="Hello world|Foo
27307 | style="color:red|Bar
27308 |}
27309 !! html/php
27310 <table>
27311 <tr>
27312 <td title="Hello world">Foo
27313 </td>
27314 <td style="color:red">Bar
27315 </td></tr></table>
27316
27317 !! html/parsoid
27318 <table><tbody>
27319 <tr>
27320 <td title="Hello world">Foo
27321 </td><td style="color: red">Bar
27322 </td></tr></tbody></table>
27323
27324 !! end
27325
27326 !!test
27327 Accept empty td cell attribute
27328 !! wikitext
27329 {|
27330 | align="center" |foo|| |
27331 |}
27332 !! html
27333 <table>
27334 <tr>
27335 <td align="center">foo</td>
27336 <td>
27337 </td></tr></table>
27338
27339 !!end
27340
27341 !!test
27342 Non-empty attributes in th-cells
27343 !! wikitext
27344 {|
27345 !Foo!! style="color: red" |Bar
27346 |}
27347 !! html
27348 <table>
27349 <tr>
27350 <th>Foo</th>
27351 <th style="color: red">Bar
27352 </th></tr></table>
27353
27354 !!end
27355
27356 !!test
27357 Accept empty attributes in th-cells
27358 !! wikitext
27359 {|
27360 !|foo!!|bar
27361 |}
27362 !! html
27363 <table>
27364 <tr>
27365 <th>foo</th>
27366 <th>bar
27367 </th></tr></table>
27368
27369 !!end
27370
27371 !!test
27372 Empty table rows go away
27373 !! wikitext
27374 {|
27375 |Hello
27376 |there
27377 |- class="foo"
27378 |-
27379 |}
27380 !! html
27381 <table>
27382 <tr>
27383 <td>Hello
27384 </td>
27385 <td>there
27386 </td></tr>
27387
27388 </table>
27389
27390 !! end
27391
27392 ###
27393 ### Parsoid-centric tests for testing RTing of inter-element separators
27394 ### Edge cases not tested by existing parser tests and specific to
27395 ### Parsoid-specific serialization strategies.
27396 ###
27397
27398 !!test
27399 RT-ed inter-element separators should be valid separators
27400 !! wikitext
27401 {|
27402 |- [[foo]]
27403 |}
27404 !! html/php
27405 <table>
27406
27407 </table>
27408
27409 !! html/parsoid
27410 <table>
27411 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27412 </tbody></table>
27413 !!end
27414
27415 # Parsoid-only test of a DOM pass
27416 !!test
27417 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27418 !! wikitext
27419 {|
27420 |<small>foo
27421 bar
27422 |}
27423
27424 {|
27425 |<small>foo<small>
27426 |}
27427 !! html/parsoid
27428 <table>
27429 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27430 <p>bar</p></small></td></tr>
27431 </tbody></table>
27432
27433 <table>
27434 <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>
27435 </tbody></table>
27436 !!end
27437
27438 # Note that the "style" attribute is really a template parameter here.
27439 # The = would have to be {{=}} if you wanted the literal.
27440 !!test
27441 Empty TD followed by TD with tpl-generated attribute
27442 !! wikitext
27443 {|
27444 |-
27445 |
27446 |{{echo|style='color:red'}}|foo
27447 |}
27448 !! html
27449 <table>
27450
27451 <tr>
27452 <td>
27453 </td>
27454 <td>foo
27455 </td></tr></table>
27456
27457 !!end
27458
27459 !!test
27460 Indented table with an empty td
27461 !! wikitext
27462 {|
27463 |-
27464 |
27465 |foo
27466 |}
27467 !! html
27468 <table>
27469
27470 <tr>
27471 <td>
27472 </td>
27473 <td>foo
27474 </td></tr></table>
27475
27476 !!end
27477
27478 !! test
27479 Indented table with blank lines in between (T85627)
27480 !! wikitext
27481 {|
27482 |foo
27483
27484
27485 |}
27486 !! html/php
27487 <table>
27488 <tr>
27489 <td>foo
27490 <p><br />
27491 </p>
27492 </td></tr></table>
27493
27494 !! html/parsoid
27495 <table>
27496 <tbody><tr><td>foo
27497 <p>
27498 <br /></p></td></tr>
27499 </tbody></table>
27500 !! end
27501
27502 !!test
27503 Indented block & table
27504 !! wikitext
27505 <div>foo</div>
27506 {|
27507 |foo
27508 |}
27509 !! html/php
27510 <div>foo</div>
27511 <table>
27512 <tr>
27513 <td>foo
27514 </td></tr></table>
27515
27516 !! html/parsoid
27517 <div data-parsoid='{"stx":"html"}'>foo</div>
27518 <table><tbody>
27519 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27520 </tbody></table>
27521 !!end
27522
27523 !! test
27524 Indent and comment before table row
27525 !! wikitext
27526 {|
27527 <!--hi-->|-
27528 |there
27529 |}
27530 !! html/php
27531 <table>
27532
27533 <tr>
27534 <td>there
27535 </td></tr></table>
27536
27537 !! html/parsoid
27538 <table>
27539 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27540 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27541 </tbody></table>
27542 !! end
27543
27544 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27545 !!test
27546 Empty TR followed by a template-generated TR
27547 !!options
27548 parsoid
27549 !! wikitext
27550 {|
27551 |-
27552 {{echo|<tr><td>foo</td></tr>}}
27553 |}
27554 !! html
27555 <table>
27556 <tbody>
27557 <tr class='mw-empty-elt'></tr>
27558 <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}}]}'>
27559 <td>foo</td></tr>
27560 </tbody></table>
27561 !!end
27562
27563 ## PHP and parsoid output differ for this, and since this is primarily
27564 ## for testing Parsoid's serializer, marking this Parsoid only
27565 !!test
27566 Empty TR followed by mixed-ws-comment line should RT correctly
27567 !!options
27568 parsoid
27569 !! wikitext
27570 {|
27571 |-
27572 <!--c-->
27573 |-
27574 <!--c--> <!--d-->
27575 |}
27576 !! html
27577 <table>
27578 <tbody>
27579 <tr class='mw-empty-elt'></tr>
27580 <!--c-->
27581 <tr>
27582 <!--c--> </tr><!--d-->
27583 </tbody></table>
27584
27585 !!end
27586
27587 !!test
27588 Multi-line image caption generated by templates with/without trailing newlines
27589 !! wikitext
27590 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27591 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27592 !! html/parsoid
27593 <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>
27594 <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>
27595 !!end
27596
27597 !! test
27598 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27599 !! options
27600 parsoid=html2wt
27601 !! html/parsoid
27602 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
27603
27604 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27605 !! wikitext
27606 <includeonly>foo</includeonly>
27607 new para
27608
27609 [[Category:Foo]]
27610
27611 = new heading =
27612 !! end
27613
27614 ## PHP emits broken html for this, and since this is primarily
27615 ## a Parsoid serializer test, marking this Parsoid only
27616 !!test
27617 Improperly nested inline or quotes tags with whitespace in between
27618 !! wikitext
27619 <span> <s>x</span> </s>
27620 ''' ''x''' ''
27621 !! html/parsoid
27622 <p><span> <s>x</s></span><s> </s>
27623 <b> <i>x</i></b><i> </i>
27624 </p>
27625 !!end
27626
27627 !!test
27628 Encapsulate protected attributes from wt
27629 !! wikitext
27630 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27631
27632 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27633 |ok
27634 |}
27635 !! html/parsoid
27636 <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>
27637
27638 <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">
27639 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27640 </tbody></table>
27641 !!end
27642
27643 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27644 ## Having nested or stray pre tags results in the attempt to add duplicates,
27645 ## causing an assertion fail. This test tries to prevent that situation.
27646 !! test
27647 Ensure ParagraphWrapper can deal with stray closing pre tags
27648 !! options
27649 parsoid=wt2html
27650 !! wikitext
27651 plain text</pre>
27652 !! html/parsoid
27653 <p>plain text</p>
27654 !! end
27655
27656 ## Remex doesn't account for fostered content.
27657 !! test
27658 1. Ensure fostered text content is wrapped in element nodes
27659 !! options
27660 parsoid=wt2html
27661 !! wikitext
27662 <table>hi</table><table>ho</table>
27663 !! html/php+tidy
27664 hi<table></table>ho<table></table>
27665 !! html/parsoid
27666 <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>
27667 !! end
27668
27669 ## Remex doesn't account for fostered content.
27670 !! test
27671 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27672 !! options
27673 parsoid=wt2html,wt2wt
27674 !! wikitext
27675 <table>
27676 <tr> || ||
27677 <td> a
27678 </table>
27679 !! html/php+tidy
27680 || ||
27681 <table>
27682 <tbody><tr><td> a
27683 </td></tr></tbody></table>
27684 !! html/parsoid
27685 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27686 <table data-parsoid='{"stx":"html"}'>
27687 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27688 </td></tr></tbody></table>
27689 !! end
27690
27691 ## Remex doesn't account for fostered content.
27692 !! test
27693 Encapsulation properly handles null DSR information from foster box
27694 !! options
27695 parsoid=wt2html,wt2wt
27696 !! wikitext
27697 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27698 !! html/parsoid
27699 <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>
27700 !! end
27701
27702 ## Remex doesn't account for fostered content.
27703 !! test
27704 1. Encapsulate foster-parented transclusion content
27705 !! options
27706 parsoid=wt2wt,wt2html
27707 !! wikitext
27708 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27709 !! html/php+tidy
27710 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27711 !! html/parsoid
27712 <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>
27713 !! end
27714
27715 !! test
27716 2. Encapsulate foster-parented transclusion content
27717 !! options
27718 parsoid=wt2wt,wt2html
27719 !! wikitext
27720 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27721 !! html/parsoid
27722 <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>
27723 <table>
27724 <tbody>
27725 <tr>
27726 <td>bar</td>
27727 </tr>
27728 </tbody>
27729 </table>
27730 !! end
27731
27732 !! test
27733 3. Encapsulate foster-parented transclusion content
27734 !! options
27735 parsoid=wt2wt,wt2html
27736 !! wikitext
27737 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27738 !! html/parsoid
27739 <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;]}">
27740 <p>foo</p>
27741 </div>
27742 <table>
27743 <tbody>
27744 <tr>
27745 <td>bar</td>
27746 </tr>
27747 </tbody>
27748 </table>
27749 !! end
27750
27751 !! test
27752 4. Encapsulate foster-parented transclusion content
27753 !! options
27754 parsoid=wt2wt,wt2html
27755 !! wikitext
27756 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27757 !! html/parsoid
27758 <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;]}">
27759 <p>foo</p>
27760 </div>
27761 <table>
27762 <tbody>
27763 <tr>
27764 <td>bar</td>
27765 </tr>
27766 </tbody>
27767 </table>
27768 !! end
27769
27770 ## Remex doesn't account for fostered content.
27771 !! test
27772 5. Encapsulate foster-parented transclusion content
27773 !!options
27774 parsoid=wt2wt,wt2html
27775 !! wikitext
27776 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27777 !! html/php+tidy
27778 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27779 !! html/parsoid
27780 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo"}},"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>
27781 !! end
27782
27783 ## Remex doesn't account for fostered content.
27784 !! test
27785 6. Encapsulate foster-parented transclusion content
27786 !! options
27787 parsoid=wt2wt,wt2html
27788 !! wikitext
27789 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27790 !! html/php+tidy
27791 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27792 !! html/parsoid
27793 <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>
27794 !! end
27795
27796 !! test
27797 7. Encapsulate foster-parented transclusion content
27798 !!options
27799 parsoid=wt2wt,wt2html
27800 !! wikitext
27801 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27802 !! html/parsoid
27803 <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>
27804 <table>
27805 <tbody>
27806 <tr>
27807 <td>bar</td>
27808 </tr>
27809 </tbody>
27810 </table>
27811 !! end
27812
27813 ## Remex doesn't account for fostered content.
27814 # Note that the wt is broken on purpose: the = should be {{=}} if you
27815 # don't want it to be a template parameter key.
27816 !! test
27817 8. Encapsulate foster-parented transclusion content
27818 !! options
27819 parsoid=wt2wt,wt2html
27820 !! wikitext
27821 {{echo|a
27822 }}{|{{echo|style='color:red'}}
27823 |-
27824 |b
27825 |}
27826 !! html/php+tidy
27827 <p>a
27828 </p>
27829 <table>
27830
27831 <tbody><tr>
27832 <td>b
27833 </td></tr></tbody></table>
27834 !! html/parsoid
27835 <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">
27836 </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">
27837 <tbody><tr>
27838 <td>b
27839 </td></tr></tbody></table>
27840 !! end
27841
27842 ## Remex doesn't account for fostered content.
27843 !! test
27844 9. Encapsulate foster-parented transclusion content
27845 !!options
27846 parsoid=wt2wt,wt2html
27847 !! wikitext
27848 <table>{{echo|hi</table>hello}}
27849 !! html/php+tidy
27850 hi<table></table><p>hello
27851 </p>
27852 !! html/parsoid
27853 <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>
27854 !! end
27855
27856 !! test
27857 Table in fosterable position
27858 !!options
27859 parsoid=wt2html
27860 !! wikitext
27861 {{OpenTable}}
27862 <div>
27863 {|
27864 |}
27865 </div>
27866 |}
27867 !! html/parsoid
27868 <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">
27869 </span>
27870 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27871
27872 <table>
27873 </table>
27874 !! end
27875
27876 # Parsoid only for T66747
27877 !! test
27878 Properly encapsulate empty-content transclusions in fosterable positions
27879 !! wikitext
27880 <table>
27881 {{#if:|
27882 <td>foo</td>
27883 }}
27884 </table>
27885 !! html/parsoid
27886 <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"}]]}'>
27887
27888 </table>
27889 !! end
27890
27891 ## No longer captures its original intention
27892 !! test
27893 Always encapsulate foster box when template range is expanded to table
27894 !! options
27895 disabled
27896 parsoid=wt2wt
27897 !! wikitext
27898 {|
27899 hello
27900 {{OpenTable}}
27901 |}
27902 !! html/parsoid
27903
27904 !! end
27905
27906 !! test
27907 T115289: Unclosed table
27908 !! wikitext
27909 {{echo|<table>}}<!--c-->[[Category:Two]]
27910 !! html/parsoid
27911 <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>
27912 !! end
27913
27914 !! test
27915 T115289: Don't migrate newlines out of tables with fostered content
27916 !! wikitext
27917 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27918 !! html/parsoid
27919 <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>
27920 !! end
27921
27922 !! test
27923 T73074: More fostering fun
27924 !! wikitext
27925 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27926 !! html/parsoid
27927 <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>
27928 !! end
27929
27930 !!test
27931 Support <object> element with .data attribute
27932 !!options
27933 parsoid=html2wt
27934 !! html/parsoid
27935 <object data="test.swf"></object>
27936 !! wikitext
27937 <object data="test.swf"></object>
27938 !!end
27939
27940 !! test
27941 Don't block XML namespace declaration
27942 !! wikitext
27943 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27944 !! html/php
27945 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27946 </p>
27947 !! html/parsoid
27948 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27949 !! end
27950
27951 # -----------------------------------------------------------------
27952 # The following section of tests are primarily to spec requirements
27953 # around Parsoid's serialization (old, new, edited content)
27954 #
27955 # All these tests are marked Parsoid html2wt and html2html only
27956 # ----------------------------------------------------------------
27957
27958 !! test
27959 Ignore rel attribute in a-tags during serialization to url-links
27960 !! options
27961 parsoid=html2wt
27962 !! html/parsoid
27963 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27964 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27965 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27966 !! wikitext
27967 http://en.wikipedia.org/wiki/Foobar
27968 http://en.wikipedia.org/wiki/Foobar
27969 http://en.wikipedia.org/wiki/Foobar
27970 !! end
27971
27972 # 'mi' is a localinterwiki prefix as well as a language
27973 !! test
27974 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27975 !! options
27976 parsoid=html2wt
27977 !! html/parsoid
27978 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27979 !! wikitext
27980 [[Foo]]
27981 !! end
27982
27983 !! test
27984 Parsoid should accept interwiki shortcuts
27985 !! options
27986 parsoid=html2wt
27987 !! html/parsoid
27988 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27989 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27990 <a href='./fr:Foo'>Foo</a></p>
27991 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27992 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27993 <a href='fr%3AFoo'>Foo</a></p>
27994 <p><a href='FR%3AFoo'>Foo</a>
27995 <a href='./FR:Foo'>Foo</a></p>
27996 !! wikitext
27997 [[:fr:Foo|Foo]]
27998 [[:fr:Foo|Foo]]
27999 [[:fr:Foo|Foo]]
28000
28001 [[:fr:Foo|Foo]]
28002 [[:fr:Foo|Foo]]
28003 [[:fr:Foo|Foo]]
28004
28005 [[:fr:Foo|Foo]]
28006 [[:fr:Foo|Foo]]
28007 !! end
28008
28009 !! test
28010 Parsoid should not accept invalid interwiki shortcuts
28011 !! options
28012 parsoid=html2wt
28013 !! html/parsoid
28014 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28015 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28016 <a href='news:Foo'>Foo</a></p>
28017 !! wikitext
28018 [news:Foo Foo]
28019 [news:Foo Foo]
28020 [news:Foo Foo]
28021 !! end
28022
28023 # See T93839
28024 !! test
28025 New wikilinks should be serialized properly
28026 !! options
28027 parsoid=html2wt
28028 !! html/parsoid
28029 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28030 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28031 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28032 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28033 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28034 !! wikitext
28035 [[Foo]]
28036 [[Foo]]
28037 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28038 http://en.wikipedia.org/wiki/Foo
28039 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28040 !! end
28041
28042 !! test
28043 New wiki links (href variations)
28044 !! options
28045 parsoid=html2wt
28046 !! html/parsoid
28047 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28048 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28049 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28050 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28051 !! wikitext
28052 [[Foo_bar]]
28053 [[Foo_bar]]
28054 [[Foo_bar]]
28055 [[Toxine bactérienne]]
28056 !! end
28057
28058 !! test
28059 New wiki links (content string variations)
28060 !! options
28061 parsoid=html2wt
28062 !! html/parsoid
28063 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28064 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28065 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28066 !! wikitext
28067 [[Foo_bar]]
28068 [[Foo bar]]
28069 [[Foo_bar|./Foo_bar]]
28070 !! end
28071
28072 !! test
28073 New category links (href variations)
28074 !! options
28075 parsoid=html2wt
28076 !! html/parsoid
28077 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28078 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28079 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28080 !! wikitext
28081 [[Category:Toxine bactérienne]]
28082 [[Category:Toxine bactérienne]]
28083 [[Category:Toxine bactérienne]]
28084 !! end
28085
28086 !! test
28087 New sol transparent links don't need indent-pre nowiki protection
28088 !! options
28089 parsoid=html2wt
28090 language=de
28091 !! html/parsoid
28092 <link rel="mw:PageProp/redirect" href="./Main_Page">
28093 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28094 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28095 !! wikitext
28096 #WEITERLEITUNG [[Main Page]]
28097 <!-- this is good --> [[Category:Good]]
28098 <!-- this is great --> [[Kategorie:Great]]
28099 !! end
28100
28101 !! test
28102 New interlanguage links (href variations)
28103 !! options
28104 parsoid=html2wt
28105 !! html/parsoid
28106 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28107 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28108 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28109 !! wikitext
28110 [[es:Toxine bactérienne]]
28111 [[es:Toxine_bactérienne]]
28112 [[es:Toxine_bactérienne]]
28113 !! end
28114
28115 !! test
28116 Image: Modifying size of an image (1)
28117 !! options
28118 parsoid={
28119 "modes": ["wt2wt"],
28120 "changes": [
28121 ["img[height]", "attr", "height", "22"],
28122 ["img[width]", "attr", "width", "200"]
28123 ]
28124 }
28125 !! wikitext
28126 [[Image:Foobar.jpg|230x230px]]
28127 !! wikitext/edited
28128 [[Image:Foobar.jpg|200x200px]]
28129 !!end
28130
28131 !! test
28132 Image: Modifying size of an image (2)
28133 !! options
28134 parsoid={
28135 "modes": ["wt2wt"],
28136 "changes": [
28137 ["img[height]", "attr", "height", "100"],
28138 ["img[width]", "attr", "width", "500"]
28139 ]
28140 }
28141 !! wikitext
28142 [[Image:Foobar.jpg|230x230px]]
28143 !! wikitext/edited
28144 [[Image:Foobar.jpg|500x500px]]
28145 !!end
28146
28147 # Change in size is ignored so long as class='mw-default-size'
28148 !! test
28149 Image: Modifying size of an image (3)
28150 !! options
28151 parsoid={
28152 "modes": ["wt2wt"],
28153 "changes": [
28154 ["figure[class]", "removeClass", "mw-default-size"],
28155 ["figure img", "attr", "height", "19"],
28156 ["figure img", "attr", "width", "170"]
28157 ]
28158 }
28159 !! wikitext
28160 [[Image:Foobar.jpg|thumb]]
28161 !! wikitext/edited
28162 [[Image:Foobar.jpg|thumb|170x170px]]
28163 !!end
28164
28165 !! test
28166 Image: Modifying alignment of an image (T50665)
28167 !! options
28168 parsoid={
28169 "modes": ["wt2wt"],
28170 "changes": [
28171 ["figure[class]", "removeClass", "mw-halign-right"],
28172 ["figure[class]", "addClass", "mw-halign-left"]
28173 ]
28174 }
28175 !! wikitext
28176 [[Image:Foobar.jpg|thumb|caption|right]]
28177 !! wikitext/edited
28178 [[Image:Foobar.jpg|thumb|caption|left]]
28179 !! end
28180
28181 !! test
28182 Image: Modifying mw-default-size of an frameless image (T64805)
28183 !! options
28184 parsoid={
28185 "modes": ["wt2wt"],
28186 "changes": [
28187 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28188 ]
28189 }
28190 !! wikitext
28191 [[Image:Foobar.jpg|frameless|right]]
28192 !! wikitext/edited
28193 [[Image:Foobar.jpg|frameless|right|220x220px]]
28194 !! end
28195
28196 !! test
28197 Image: Modifying valign of an image (T51221)
28198 !! options
28199 parsoid={
28200 "modes": ["wt2wt"],
28201 "changes": [
28202 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28203 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28204 ]
28205 }
28206 !! wikitext
28207 [[File:Foobar.jpg|20px|middle]]
28208 !! wikitext/edited
28209 [[File:Foobar.jpg|20px|text-top]]
28210 !! end
28211
28212 !! test
28213 Image: Modifying alt attribute of an image (T58400)
28214 !! options
28215 parsoid={
28216 "modes": ["wt2wt"],
28217 "changes": [
28218 ["img[alt]", "attr", "alt", "some alternate edited text"]
28219 ]
28220 }
28221 !! wikitext
28222 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28223 !! wikitext/edited
28224 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28225 !!end
28226
28227 !! test
28228 Image: Modifying caption of an image
28229 !! options
28230 parsoid={
28231 "modes": ["wt2wt"],
28232 "changes": [
28233 ["figcaption", "text", "new caption"]
28234 ]
28235 }
28236 !! wikitext
28237 [[Image:Foobar.jpg|thumb|original caption]]
28238 !! wikitext/edited
28239 [[Image:Foobar.jpg|thumb|new caption]]
28240 !!end
28241
28242 !! test
28243 Image: empty alt attribute (T50924)
28244 !! options
28245 parsoid
28246 !! wikitext
28247 [[File:Foobar.jpg|thumb|alt=|bar]]
28248 !! html
28249 <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>
28250 !! end
28251
28252 !! test
28253 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28254 !! options
28255 parsoid=html2wt
28256 language=ar
28257 disabled
28258 !! html/parsoid
28259 <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>
28260 !! wikitext
28261 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28262 !! end
28263
28264 !! test
28265 Image: Block level image should have \n before and after
28266 !! wikitext
28267 123
28268 [[File:Foobar.jpg|right|thumb|150x150px]]
28269 456
28270 !! html/parsoid
28271 <p>123</p>
28272 <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>
28273 <p>456</p>
28274 !! end
28275
28276 !! test
28277 Image: New block level image should have \n before and after (existing content)
28278 !! wikitext
28279 123
28280 [[File:Foobar.jpg|right|thumb|150x150px]]
28281 456
28282 !! html/parsoid
28283 <p>123</p>
28284 <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>
28285 <p>456</p>
28286 !! end
28287
28288 !! test
28289 Image: upright option (parsoid)
28290 !! wikitext
28291 [[File:Foobar.jpg|thumb|upright|caption]]
28292 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28293 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28294 !! html/parsoid
28295 <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>
28296 <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>
28297 <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>
28298 !! end
28299
28300 !! test
28301 Image: upright option is ignored on inline and frame images (parsoid)
28302 !! wikitext
28303 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28304 !! html/parsoid
28305 <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>
28306 !! end
28307
28308 !! test
28309 Image: in template parameter with empty parameter
28310 !! wikitext
28311 {{echo|[[File:Foobar.jpg|link=]]}}
28312 !! html/parsoid
28313 <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>
28314 !! end
28315
28316 !! test
28317 Image: from basic HTML (1)
28318 !! options
28319 parsoid=html2wt
28320 !! html/parsoid
28321 <span typeof="mw:Image">
28322 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28323 </span>
28324 !! wikitext
28325 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28326 !! end
28327
28328 !! test
28329 Image: from basic HTML (2)
28330 !! options
28331 parsoid=html2wt
28332 !! html/parsoid
28333 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28334 !! wikitext
28335 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28336 !! end
28337
28338 !! test
28339 Image: from basic HTML (3)
28340 !! options
28341 parsoid=html2wt
28342 !! html/parsoid
28343 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28344 !! wikitext
28345 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28346 !! end
28347
28348 !! test
28349 Image: from basic HTML (4)
28350 !! options
28351 parsoid=html2wt
28352 !! html/parsoid
28353 <img src="./File:Foobar.jpg">
28354 !! wikitext
28355 [[File:Foobar.jpg|link=]]
28356 !! end
28357
28358 !! test
28359 Image: Invalid title as link
28360 !! wikitext
28361 [[File:Foobar.jpg|link=<]]
28362 !! html/php
28363 <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>
28364 </p>
28365 !! html/parsoid
28366 <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>
28367 !! end
28368
28369 !! test
28370 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28371 !! options
28372 parsoid=html2wt
28373 !! html/parsoid
28374 <ul>
28375 <li><p>foo</p></li>
28376 </ul>
28377 !! wikitext
28378 * foo
28379 !! end
28380
28381 !! test
28382 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28383 !! options
28384 parsoid=html2wt
28385 !! html/parsoid
28386 <ul> <li>foo</li></ul>
28387 !! wikitext
28388 * foo
28389 !! end
28390
28391 !! test
28392 Don't strip leading whitespace when handling indent-pre suppressing tags
28393 !! options
28394 parsoid=html2wt
28395 !! html/parsoid
28396 <table>
28397 <tr><td> indented row</td></tr>
28398 </table>
28399 <blockquote><p>
28400 <b>This is very bold of you!</b>
28401 </p>
28402 <table><tr><td>
28403 indented cell (no pre-wrapping!)
28404 </td></tr></table>
28405 </blockquote>
28406 <p>foo</p>
28407 <div>bar</div>
28408 !! wikitext
28409 {|
28410 | indented row
28411 |}
28412 <blockquote>
28413 '''This is very bold of you!'''
28414
28415 {|
28416 |
28417 indented cell (no pre-wrapping!)
28418 |}
28419 </blockquote>
28420 foo
28421 <div>bar</div>
28422 !! end
28423
28424 !! test
28425 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28426 !! options
28427 parsoid=html2wt
28428 !! html/parsoid
28429 <p>foo</p>
28430 <span>bar</span>
28431
28432 <span>foo2
28433 </span>bar2
28434
28435 <div>foo</div>
28436 <span>bar</span>
28437
28438 <div>
28439 <span>foo</span>
28440 </div>
28441 !! wikitext
28442 foo
28443
28444 <span>bar</span>
28445
28446 <span>foo2
28447 <nowiki> </nowiki></span>bar2
28448
28449 <div>foo</div>
28450 <nowiki> </nowiki><span>bar</span>
28451
28452 <div>
28453 <nowiki> </nowiki><span>foo</span>
28454 </div>
28455 !! end
28456
28457 !! test
28458 Lists: Dont insert newlines in a serialized list item.
28459 !! options
28460 parsoid=html2wt
28461 !! html/parsoid
28462 <ul><li>a<br>b</li><li>c</li></ul>
28463 !! wikitext
28464 * a<br />b
28465 * c
28466 !! end
28467
28468 !! test
28469 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28470 !! options
28471 parsoid={
28472 "modes": ["html2wt"],
28473 "scrubWikitext": false
28474 }
28475 !! html/parsoid
28476 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28477 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28478
28479 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28480 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28481
28482 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28483
28484 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28485 !! wikitext
28486 == hello there [[Category:A1]] ==
28487
28488 == [[Category:A2]] hi pal ==
28489
28490 == <!--foo--> [[Category:A3]] how goes it ==
28491
28492 == it goes well [[Category:A4]] <!--bar--> ==
28493
28494 ==howdy [[Category:A5]]==
28495
28496 == __TOC__ ok ==
28497 !! end
28498
28499 !! test
28500 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28501 !! options
28502 parsoid={
28503 "modes": ["html2wt"],
28504 "scrubWikitext": true
28505 }
28506 !! html/parsoid
28507 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28508 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28509
28510 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28511 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28512
28513 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28514 !! wikitext
28515 == hello there ==
28516 [[Category:A1]]
28517 [[Category:A2]]
28518
28519 == hi pal ==
28520
28521 <!--foo-->[[Category:A3]]
28522
28523 == how goes it ==
28524
28525 == it goes well ==
28526 [[Category:A4]] <!--bar-->
28527
28528 __TOC__
28529
28530 == ok ==
28531 !! end
28532
28533 !! test
28534 Headings: Don't hoist metas that come from templates
28535 !! options
28536 parsoid={
28537 "modes": ["html2wt"],
28538 "scrubWikitext": true
28539 }
28540 !! html/parsoid
28541 <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>
28542 !! wikitext
28543 == {{echo|foo [[Category:Foo]]}} ==
28544 !! end
28545
28546 !! test
28547 Headings: Category in ref isn't hoisted
28548 !! options
28549 parsoid={
28550 "modes": ["html2wt"],
28551 "scrubWikitext": true
28552 }
28553 !! html/parsoid
28554 <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>
28555
28556 <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>
28557 !! wikitext
28558 == foo <ref>bar
28559 [[Category:Baz]] </ref> ==
28560
28561 <references />
28562 !! end
28563
28564 !! test
28565 Parsoid: Serialize positional parameters with = in them as named parameter
28566 !! options
28567 parsoid=html2wt
28568 !! html/parsoid
28569 <p about="#mwt1" typeof="mw:Transclusion"
28570 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28571
28572 <p about="#mwt1" typeof="mw:Transclusion"
28573 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28574
28575 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28576 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28577 <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>
28578 !! wikitext
28579 {{echo|1=f=oo}}
28580
28581 {{echo|1=f=oo|2=bar}}
28582
28583 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28584 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28585 {{echo|<nowiki>f=oo</nowiki>|bar}}
28586 !! end
28587
28588 !! test
28589 Parsoid: Serialize positional parameters with = in extlink as named parameter
28590 !! options
28591 parsoid=html2wt
28592 !! html/parsoid
28593 <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>
28594 !! wikitext
28595 {{echo|1=http://stuff?is=ok}}
28596 !! end
28597
28598 !! test
28599 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28600 !! options
28601 parsoid=html2wt
28602 !! html/parsoid
28603 <div>a<p>b</p></div>
28604 <div>a
28605 <p>b</p></div>
28606 <div>
28607 a
28608 <p>b</p></div>
28609 !! wikitext
28610 <div>a
28611 b
28612 </div>
28613 <div>a
28614 b
28615 </div>
28616 <div>
28617 a
28618
28619 b
28620 </div>
28621 !! end
28622
28623 !! test
28624 Substrings resembling wikitext in hrefs should not get nowiki escapes
28625 !! options
28626 parsoid=html2wt
28627 !! html/parsoid
28628 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28629 !! wikitext
28630 [[Foo''bar''baz]]
28631 !! end
28632
28633 !! test
28634 Enforce single-line context in the serializer
28635 !! options
28636 parsoid=html2wt
28637 !! html/parsoid
28638 <h2>testing
28639 123</h2>
28640
28641 <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">
28642 </span><span about="#mwt1">you</span> </h2>
28643
28644 <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>
28645
28646 <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
28647 there</span></li></ol>
28648
28649 <ul><li>asd
28650 sdf</li></ul>
28651
28652 <ul><li>foo
28653 bar
28654 baz</li>
28655 <li>foo <b>bar</b>
28656 baz</li></ul>
28657
28658 <dl><dt>hi
28659 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28660 ho</dd></dl>
28661
28662 <dl><dd> <table>
28663 <tbody><tr><td> ha
28664 ha
28665 ha</td></tr>
28666 </tbody></table></dd></dl>
28667 !! wikitext
28668 == testing 123 ==
28669
28670 == hi {{bogus|there
28671 you}} ==
28672
28673 == foo <ref>hello
28674 there</ref> ==
28675
28676 <references />
28677
28678 * asd sdf
28679
28680 * foo bar baz
28681 * foo '''bar''' baz
28682
28683 ; hi ho : hi ho
28684
28685 : {|
28686 | ha
28687 ha
28688 ha
28689 |}
28690 !! end
28691
28692 !! test
28693 Serialize new placeholder space without spans
28694 !! options
28695 parsoid=html2wt
28696 !! html/parsoid
28697 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28698
28699 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28700
28701 <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>
28702 !! wikitext
28703 foo : bar
28704
28705 foo : bar
28706
28707 <ref>foo : bar</ref>ok
28708 !! end
28709
28710
28711 #-----------------------
28712 # Tag minimization tests
28713 #-----------------------
28714
28715 !! test
28716 1. I/B quote minimization: wikitext-only tags should be combined
28717 !! options
28718 parsoid=html2wt
28719 !! html/parsoid
28720 <p><i>A</i><i>B</i></p>
28721 <p><b>A</b><b>B</b></p>
28722 <p><i>A</i><b><i>B</i></b></p>
28723 <p><b>A</b><i><b>B</b></i></p>
28724 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28725 <p><i><b>A</b></i><i><b>B</b></i></p>
28726 <p><i><b>A</b></i><b><i>B</i></b></p>
28727 <p><b><i>A</i></b><i><b>B</b></i></p>
28728 !! wikitext
28729 ''AB''
28730
28731 '''AB'''
28732
28733 ''A'''B'''''
28734
28735 '''A''B'''''
28736
28737 '''A''BC''D'''
28738
28739 '''''AB'''''
28740
28741 '''''AB'''''
28742
28743 '''''AB'''''
28744 !! end
28745
28746 !! test
28747 2. I/B quote minimization: wikitext and html tags should not be combined
28748 !! options
28749 parsoid=html2wt
28750 !! html/parsoid
28751 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28752 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28753 !! wikitext
28754 ''A''<i>B</i>
28755
28756 ''A''<nowiki/>'''<i>B</i>'''
28757 !! end
28758
28759 !! test
28760 3. I/B quote minimization: templated content stops minimization
28761 !! options
28762 parsoid=html2wt
28763 !! html/parsoid
28764 <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>
28765 <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>
28766 !! wikitext
28767 ''A''{{echo|''B''}}
28768
28769 ''A''{{echo|'''''B'''''}}
28770 !! end
28771
28772 !! test
28773 4. I/B quote minimization: new content should be mimimized with adjacent old content
28774 !! options
28775 parsoid=html2wt
28776 !! html/parsoid
28777 <p><i>A</i><i>B</i></p>
28778 <p><b>A</b><b>B</b></p>
28779 <p><i>A</i><b><i>B</i></b></p>
28780 !! wikitext
28781 ''AB''
28782
28783 '''AB'''
28784
28785 ''A'''B'''''
28786 !! end
28787
28788 !! test
28789 5a. Merge adjacent quote nodes if they've been edited
28790 !! options
28791 parsoid={
28792 "modes": ["wt2wt", "selser"],
28793 "changes": [
28794 ["p", "contents", "remove", ":contains('b')"]
28795 ]
28796 }
28797 !! wikitext
28798 ''a''b''c''
28799 !! wikitext/edited
28800 ''ac''
28801 !! end
28802
28803 !! test
28804 5b. Merge adjacent quote nodes if they've been edited
28805 !! options
28806 parsoid={
28807 "modes": ["wt2wt", "selser"],
28808 "changes": [
28809 ["#x", "remove"]
28810 ]
28811 }
28812 !! wikitext
28813 ''a''<span id="x">b</span>''c''
28814 !! wikitext/edited
28815 ''ac''
28816 !! end
28817
28818 !! test
28819 1. Merge adjacent link nodes as long as at least one element is new
28820 !! options
28821 parsoid={
28822 "modes": ["html2wt"],
28823 "scrubWikitext": true
28824 }
28825 !! html/parsoid
28826 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28827 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28828 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28829 !! wikitext
28830 [[Football]]
28831 [[Football]]
28832 [[Football|Foot]][[Football|ball]]
28833 !! end
28834
28835 !! test
28836 2. Merge adjacent link nodes and enable additional normalizations
28837 !! options
28838 parsoid={
28839 "modes": ["html2wt"],
28840 "scrubWikitext": true
28841 }
28842 !! html/parsoid
28843 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28844 !! wikitext
28845 ''[[Football]]''
28846 !! end
28847
28848 !! test
28849 3. Don't merge adjacent link nodes if scrubWikitext is false
28850 !! options
28851 parsoid={
28852 "modes": ["html2wt"],
28853 "scrubWikitext": false
28854 }
28855 !! html/parsoid
28856 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28857 !! wikitext
28858 [[Football|Foot]][[Football|ball]]
28859 !! end
28860
28861 !! test
28862 1. Move format tags outside of WikiLink
28863 !! options
28864 parsoid={
28865 "modes": ["html2wt"],
28866 "scrubWikitext": true
28867 }
28868 !! html/parsoid
28869 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28870 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28871 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28872 !! wikitext
28873 ''[[Football]]''
28874 '''''[[Football]]'''''
28875 <u>'''''[[Football]]'''''</u>
28876 !! end
28877
28878 !! test
28879 2. Move format tags outside of WikiLink with mergable A tags
28880 !! options
28881 parsoid={
28882 "modes": ["html2wt"],
28883 "scrubWikitext": true
28884 }
28885 !! html/parsoid
28886 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28887 !! wikitext
28888 '''''[[Football]]'''''
28889 !! end
28890
28891 !! test
28892 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28893 !! options
28894 parsoid={
28895 "modes": ["html2wt"],
28896 "scrubWikitext": true
28897 }
28898 !! html/parsoid
28899 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28900 !! wikitext
28901 <font color="red"><u>'''[[Foo]]'''</u></font>
28902 !! end
28903
28904 !! test
28905 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28906 !! options
28907 parsoid={
28908 "modes": ["html2wt"],
28909 "scrubWikitext": true
28910 }
28911 !! html/parsoid
28912 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28913 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28914 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28915 !! wikitext
28916 [[Foo|<font color="red">Foo</font>]]
28917 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28918 [[Foo|<span class="Bar">Foo</span>]]
28919 !! end
28920
28921 !! test
28922 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28923 !! options
28924 parsoid={
28925 "modes": ["selser"],
28926 "scrubWikitext": true,
28927 "changes": [
28928 ["a", "html", "<i>Foo</i>"]
28929 ]
28930 }
28931 !! wikitext
28932 [[Foo]]
28933 !! wikitext/edited
28934 ''[[Foo]]''
28935 !! end
28936
28937 !! test
28938 6. Regression test: Manual edit test to ensure diff markers are not lost
28939 !! options
28940 parsoid={
28941 "modes": ["selser"],
28942 "scrubWikitext": true,
28943 "changes": [
28944 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28945 ]
28946 }
28947 !! wikitext
28948 ''Foo''
28949 !! wikitext/edited
28950 ''[[Foo]]''
28951 !! end
28952
28953 !! test
28954 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
28955 !! options
28956 parsoid={
28957 "modes": ["selser"],
28958 "scrubWikitext": true,
28959 "changes": [
28960 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
28961 ]
28962 }
28963 !! wikitext
28964 <div>placeholder</div>
28965 !! wikitext/edited
28966 <div>placeholder</div>
28967 [[Foo]] , placeholder
28968 !! end
28969
28970 #------------------------------
28971 # End of tag minimization tests
28972 #------------------------------
28973
28974 !!test
28975 T56262: New entities
28976 !! options
28977 parsoid=html2wt
28978 !! html/parsoid
28979 <span typeof="mw:Entity">&nbsp;</span>
28980 !! wikitext
28981 &nbsp;
28982 !! end
28983
28984 ## Note that there is no wikitext output for 'unknownproperty' ##
28985 ## Unknown magic words are silently dropped ##
28986
28987 !! test
28988 Magic words
28989 !! options
28990 parsoid=html2wt
28991 !! html/parsoid
28992 <meta property='mw:PageProp/toc' />
28993 <meta property='mw:PageProp/notoc' />
28994 <meta property='mw:PageProp/forcetoc' />
28995 <meta property='mw:PageProp/index' />
28996 <meta property='mw:PageProp/noindex' />
28997 <meta property='mw:PageProp/nogallery' />
28998 <meta property='mw:PageProp/noeditsection' />
28999 <meta property='mw:PageProp/notitleconvert' />
29000 <meta property='mw:PageProp/nocontentconvert' />
29001 <meta property='mw:PageProp/unknownproperty' />
29002 !! wikitext
29003 __TOC__
29004 __NOTOC__
29005 __FORCETOC__
29006 __INDEX__
29007 __NOINDEX__
29008 __NOGALLERY__
29009 __NOEDITSECTION__
29010 __NOTITLECONVERT__
29011 __NOCONTENTCONVERT__
29012 !! end
29013
29014 !! test
29015 Consecutive <pre>s should not get merged
29016 !! options
29017 parsoid=html2wt,html2html
29018 !! html/parsoid
29019 <pre>a</pre><pre>b</pre>
29020
29021 <pre>c
29022 </pre><pre>
29023 d</pre>
29024
29025 <pre>e
29026
29027 </pre><pre>
29028
29029 f</pre>
29030 !! wikitext
29031 a
29032
29033 b
29034
29035 c
29036
29037 d
29038
29039 e
29040
29041
29042
29043 f
29044 !! end
29045
29046 !! test
29047 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29048 !! options
29049 parsoid=html2wt
29050 !! html/parsoid
29051 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29052 !! wikitext
29053 [[Special:BookSources/1234567890|ISBN 1234567895]]
29054 !! end
29055
29056 !! test
29057 Edited RFC links not serializable as RFC links should serialize as extlinks
29058 !! options
29059 parsoid=html2wt
29060 !! html/parsoid
29061 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29062 !! wikitext
29063 [https://tools.ietf.org/html/rfc123 New RFC]
29064 !! end
29065
29066 !! test
29067 Edited PMID links not serializable as PMID links should serialize as extlinks
29068 !! options
29069 parsoid=html2wt
29070 !! html/parsoid
29071 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29072 !! wikitext
29073 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29074 !! end
29075
29076 !! test
29077 WTS of autolinks with trailing/surrounding context
29078 !! options
29079 parsoid=html2wt
29080 !! html/parsoid
29081 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29082 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29083 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29084 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29085 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29086 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29087 !! wikitext
29088 http://cscott.net'''foo'''
29089
29090 http://cscott.net<b>foo</b>
29091
29092 '''http://cscott.net'''
29093
29094 '''http://cscott.net '''
29095
29096 '''http://cscott.net<nowiki/>x'''
29097
29098 http://cscott.net<nowiki/>x
29099 !! end
29100
29101 !! test
29102 WTS of autolinks with nowikis (round-trip)
29103 !! wikitext
29104 x<nowiki/>http://cscott.net<nowiki/>x
29105 !! html/parsoid
29106 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29107 !! end
29108
29109 # this is the "easy" test because it leaves in place all the
29110 # data-parsoid information indicating this is an autolink
29111 !! test
29112 WTS of autolinks with escapes (editing)
29113 !! options
29114 parsoid={
29115 "modes": ["wt2wt"],
29116 "changes": [
29117 [ "span", "remove" ]
29118 ]
29119 }
29120 !! wikitext
29121 x<nowiki/>http://cscott.net<nowiki/>x
29122 !! wikitext/edited
29123 x<nowiki/>http://cscott.net<nowiki/>x
29124 !! end
29125
29126 !! test
29127 WTS of edited autolink-like text (T103364)
29128 !! options
29129 parsoid={
29130 "modes": ["wt2wt"],
29131 "changes": [
29132 [ "span[typeof]", "removeAttr", "typeof" ]
29133 ]
29134 }
29135 !! wikitext
29136 Not a link: <nowiki>http://example.com</nowiki>.
29137 !! wikitext/edited
29138 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29139 !! end
29140
29141 !! test
29142 WTS of newly-authored autolink-like text (T103364)
29143 !! options
29144 parsoid=html2wt
29145 !! html/parsoid
29146 <p>http://example.com is not a link.</p>
29147 !! wikitext
29148 <nowiki>http://example.com</nowiki> is not a link.
29149 !! end
29150
29151 !! test
29152 WTS of autolink-like text after an autolink (T108563)
29153 !! options
29154 parsoid=html2wt
29155 !! html/parsoid
29156 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29157 !! wikitext
29158 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29159 !! end
29160
29161 !! test
29162 Magic links inside links (not autolinked)
29163 !! wikitext
29164 [[Foo|http://example.com]]
29165 [[Foo|RFC 1234]]
29166 [[Foo|PMID 1234]]
29167 [[Foo|ISBN 123456789x]]
29168
29169 [http://foo.com http://example.com]
29170 [http://foo.com RFC 1234]
29171 [http://foo.com PMID 1234]
29172 [http://foo.com ISBN 123456789x]
29173 !! html+tidy
29174 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29175 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29176 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29177 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29178 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29179 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29180 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29181 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29182 </p>
29183 !! html/parsoid
29184 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29185 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29186 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29187 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29188
29189 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29190 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29191 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29192 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29193 !! end
29194
29195 !! test
29196 Magic links inside image captions (autolinked)
29197 !! wikitext
29198 [[File:Foobar.jpg|thumb|http://example.com]]
29199 [[File:Foobar.jpg|thumb|RFC 1234]]
29200 [[File:Foobar.jpg|thumb|PMID 1234]]
29201 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29202 !! html+tidy
29203 <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>
29204 <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>
29205 <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>
29206 <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>
29207 !! html/parsoid
29208 <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>
29209 <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>
29210 <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>
29211 <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>
29212 !! end
29213
29214 !! test
29215 WTS of magic word text (T109371)
29216 !! options
29217 parsoid=html2wt
29218 !! html/parsoid
29219 <p>RFC 1234</p>
29220 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29221 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29222 !! wikitext
29223 <nowiki>RFC 1234</nowiki>
29224
29225 [http://foo.com RFC 1234]
29226
29227 [[Foo|RFC 1234]]
29228 !! end
29229
29230 !! test
29231 Edited Redirect link should emit a non-piped wikitext link
29232 !! options
29233 parsoid=html2wt
29234 !! html/parsoid
29235 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29236 !! wikitext
29237 #REDIRECT [[Bar]]
29238 !! end
29239
29240 !! test
29241 T75121: Infer extension name from typeOf if data-mw is not present
29242 !! options
29243 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29244 !! html/parsoid
29245 <div typeOf="mw:Extension/foo"></div>
29246 !! wikitext
29247 <foo />
29248 !! end
29249
29250 # Note that the <p> wrapping isn't present in PHP parser output
29251 # The important thing for this test is that P-wrapping doesn't
29252 # interfere with the <nowiki> protection for leading - in <td>
29253 # (which isn't necessary for <th>).
29254 !! test
29255 T88318: p-wrapped dash in table.
29256 !! options
29257 parsoid=html2wt,wt2wt
29258 !! html/parsoid
29259 <table><tbody>
29260 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29261 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29262 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29263 </tbody></table>
29264 !! wikitext
29265 {|
29266 !-
29267 !-
29268 |-
29269 |<nowiki>-</nowiki>
29270 |<nowiki>- </nowiki>
29271 |-
29272 |<small>-</small>
29273 |<br />
29274 -
29275 |<br />-
29276 |}
29277 !! html/php+tidy
29278 <table>
29279 <tbody><tr>
29280 <th>-
29281 </th>
29282 <th>-
29283 </th></tr>
29284 <tr>
29285 <td>-
29286 </td>
29287 <td>-
29288 </td></tr>
29289 <tr>
29290 <td><small>-</small>
29291 </td>
29292 <td><br />
29293 <p>-
29294 </p>
29295 </td>
29296 <td><br />-
29297 </td></tr></tbody></table>
29298 !! end
29299
29300 !! test
29301 T149209: WTS: Handle newlines in table cells properly
29302 !! options
29303 parsoid=html2wt
29304 !! html/parsoid
29305 <table>
29306 <tbody>
29307 <tr><td>a
29308 b
29309 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29310 <tr><td><p>x</p>
29311 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29312 </tbody></table>
29313 <table>
29314 <tbody>
29315 <tr><th>a
29316 b
29317 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29318 <tr><th><p>x</h>
29319 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29320 </tbody></table>
29321 !! wikitext
29322 {|
29323 |a
29324 b
29325 |c
29326 |-
29327 |x
29328 {{!}}y
29329 |}
29330 {|
29331 !a
29332 b
29333 !c
29334 |-
29335 !x
29336 !y
29337 |}
29338 !! end
29339
29340 !! test
29341 T149209: Selser: Handle newlines in table cells properly
29342 !! options
29343 parsoid={
29344 "modes": ["selser"],
29345 "changes": [
29346 [ "#h1", "html", "a\nb\n" ],
29347 [ "#h2", "html", "a\nb\n" ],
29348 [ "#c1", "html", "a\nb\n" ],
29349 [ "#c2", "html", "<p>a</p>" ],
29350 [ "#c3", "html", "<p>a</p>" ],
29351 [ "#c4", "html", "edit-me<p>a</p>" ]
29352 ]
29353 }
29354 !! wikitext
29355 {|
29356 ! id="h1" |edit-me!!1
29357 |-
29358 ! id="h2" |edit-me||2
29359 |-
29360 | id="c1" |edit-me||3
29361 |-
29362 | id="c2" |edit-me||4
29363 |-
29364 | id="c3" |edit-me||p||q||r
29365 |-
29366 | id="c4" |edit-me||p||q||r
29367 |}
29368 !! wikitext/edited
29369 {|
29370 ! id="h1" |a
29371 b
29372 !1
29373 |-
29374 ! id="h2" |a
29375 b
29376 !2
29377 |-
29378 | id="c1" |a
29379 b
29380 |3
29381 |-
29382 | id="c2" |a
29383 |4
29384 |-
29385 | id="c3" |a
29386 |p||q||r
29387 |-
29388 | id="c4" |edit-me
29389 a
29390 |p||q||r
29391 |}
29392 !! end
29393
29394 !! test
29395 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29396 !! options
29397 parsoid=html2wt
29398 !! html/parsoid
29399 <table id='mwAb'>
29400 <td id='mwAc'>foo</td>
29401 <td id='serialize-this'>bar</td>
29402 </table>
29403 !! wikitext
29404 {|
29405 |foo
29406 | id="serialize-this" |bar
29407 |}
29408 !! end
29409
29410 !! test
29411 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29412 !! options
29413 parsoid=html2wt
29414 !! html/parsoid
29415 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29416 !! wikitext
29417 <div id="hello">ok</div>
29418 !! end
29419
29420 !! test
29421 Testing serialization after deletion in references
29422 !! options
29423 parsoid={
29424 "modes": ["wt2wt"],
29425 "changes": [
29426 ["#x", "remove"]
29427 ]
29428 }
29429 !! wikitext
29430 hi <ref><div id="x">ho</div></ref>
29431
29432 <references />
29433 !! wikitext/edited
29434 hi <ref></ref>
29435
29436 <references />
29437 !! end
29438
29439 !!test
29440 Testing serialization after deletion of table cells
29441 !!options
29442 parsoid={
29443 "modes": ["wt2wt", "selser"],
29444 "changes": [
29445 ["#x", "remove"]
29446 ]
29447 }
29448 !!wikitext
29449 {|
29450 !h1 !!h2 !!h3
29451 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29452 |}
29453 !! wikitext/edited
29454 {|
29455 !h1!!h2!!h3
29456 |c2|||c3
29457 |}
29458 !!end
29459
29460 !! test
29461 Testing selser after addition of new row before first row (T125419)
29462 !! options
29463 parsoid={
29464 "modes": ["wt2wt", "selser"],
29465 "changes": [
29466 [ "tr", "before", "<tr><td>X</td></tr>" ]
29467 ]
29468 }
29469 !! wikitext
29470 {|
29471 |a
29472 |}
29473 !! wikitext/edited
29474 {|
29475 |X
29476 |-
29477 |a
29478 |}
29479 !! end
29480
29481 !! test
29482 Serialize new table rows in a HTML table using HTML tags
29483 !! options
29484 parsoid={
29485 "modes": ["wt2wt", "selser"],
29486 "changes": [
29487 [ "tr", "before", "<tr><td>X</td></tr>" ]
29488 ]
29489 }
29490 !! wikitext
29491 <table><tr><td>a</td></tr></table>
29492 !! wikitext/edited
29493 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29494 !! end
29495
29496 !! test
29497 Serialize new table cells in a HTML row using HTML tags
29498 !! options
29499 parsoid={
29500 "modes": ["wt2wt", "selser"],
29501 "changes": [
29502 [ "td", "before", "<td>X</td>" ]
29503 ]
29504 }
29505 !! wikitext
29506 <table><tr><td>a</td></tr></table>
29507 !! wikitext/edited
29508 <table><tr><td>X</td><td>a</td></tr></table>
29509 !! end
29510
29511 !! test
29512 Serialize wikitext list items as HTML list items when embedded in a HTML list
29513 !! options
29514 parsoid=html2wt
29515 !! html
29516 <ul data-parsoid='{"stx": "html"}'>
29517 <li data-parsoid='{}'>a</li>
29518 <li>b</li>
29519 </ul>
29520 !! wikitext
29521 <ul>
29522 <li>a</li>
29523 <li>b</li>
29524 </ul>
29525 !! end
29526
29527 # SSS FIXME: Is this actually a good thing given the
29528 # odd nested list output that is generated by MW?
29529 # <ul><li>foo<ul>..</ul></li></ul> instead of
29530 # <ul><li>foo</li><ul>..</ul></ul>
29531 !! test
29532 Wikitext lists can be nested inside HTML lists
29533 !! options
29534 parsoid=html2wt
29535 !! html
29536 <ul data-parsoid='{"stx": "html"}'>
29537 <li data-parsoid='{"stx": "html"}'>a
29538 <ul><li>b</li></ul>
29539 </li>
29540 </ul>
29541
29542 <ul data-parsoid='{"stx": "html"}'>
29543 <li>x
29544 <ul><li>y</li></ul>
29545 </li>
29546 </ul>
29547 !! wikitext
29548 <ul>
29549 <li>a
29550 * b
29551 </li>
29552 </ul>
29553
29554 <ul>
29555 <li>x
29556 * y
29557 </li>
29558 </ul>
29559 !! end
29560
29561 !! test
29562 WTS change modes
29563 !! options
29564 parsoid={
29565 "modes": ["wt2wt"],
29566 "changes": [
29567 [ "#xyz", "before", "<b>before</b> stuff " ],
29568 [ "#xyz", "after", " stuff <i>after</i>" ],
29569 [ "#xyz", "html", "x <b>y</b> z" ]
29570 ]
29571 }
29572 !! wikitext
29573 <span id="xyz">hello</span>
29574 !! wikitext/edited
29575 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29576 !! end
29577
29578 !! test
29579 Never serialize a-tag as html, regardless of what data-parsoid has to say
29580 !! options
29581 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29582 !! html/parsoid
29583 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29584 !! wikitext
29585 [[Foo]]
29586 !! end
29587
29588 ## SSS FIXME: This is broken output nevertheless.
29589 ## What might be a reasonable non-broken output for this?
29590 ## This is an edge case unlikely to be seen in production
29591 ## that I am not wasting more time on this right now.
29592 !! test
29593 Never serialize a-tag as html, no matter what attributes it has
29594 !! options
29595 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29596 !! html/parsoid
29597 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29598 !! wikitext
29599 [http://boo.org http://boohoo.org]
29600 !! end
29601
29602 # Misnested is an indication that selser can reuse the source but these have
29603 # shown to sneak through on occasion. See T101768.
29604 # The original wikitext here is: [http://test.com [[one]] two three]
29605 !! test
29606 Strip span tags added to mark misnested links
29607 !! options
29608 parsoid=html2wt
29609 !! html/parsoid
29610 <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>
29611 !! wikitext
29612 [http://test.com][[one]] two three
29613 !! end
29614
29615 !! test
29616 Catch regression when unpacking misnested links
29617 !! options
29618 parsoid=wt2html
29619 !! wikitext
29620 {{echo|hi}}[http://example.com [[ho]]]
29621 !! html/parsoid
29622 <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>
29623 !! end
29624
29625 !! test
29626 Catch regression when unpacking with trailing content
29627 !! wikitext
29628 {{echo|Foo <references/> bar}}
29629 !! html/parsoid
29630 <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>
29631 !! end
29632
29633 !! test
29634 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29635 !! options
29636 parsoid=html2wt
29637 !! html/parsoid
29638 <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|}"]}'>
29639 <tbody><tr><td>d
29640 </td></tr>
29641 </tbody></table>
29642 !! wikitext
29643 {{echo|a}}
29644 {|{{echo|c
29645 {{!}}d
29646 }}
29647 |}
29648 !! end
29649
29650 ## This test verifies the presence and computation of this attribute indirectly
29651 ## by making an edit and ensuring that the serialization is correct (which it would be
29652 ## only if firstWikitextNode is properly set).
29653 !! test
29654 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29655 !! options
29656 parsoid= {
29657 "modes": ["wt2wt"],
29658 "changes": [
29659 [ "div#x", "remove" ],
29660 [ "div", "before", "<div>new</div>" ]
29661 ]
29662 }
29663 !! wikitext
29664 <div id="x">foo</div>
29665 {|
29666 {{echo|<div>boo</div>
29667 {{!}}b}}
29668 |c
29669 |}
29670 !! wikitext/edited
29671
29672 <div>new</div>
29673 {|
29674 {{echo|<div>boo</div>
29675 {{!}}b}}
29676 |c
29677 |}
29678 !! end
29679
29680 # --------------------------------------------
29681 # Tests spec'ing wikitext serialization norms |
29682 # --------------------------------------------
29683
29684 !! test
29685 Serialize multi-line indent-pre starting with wikitext syntax
29686 !! options
29687 parsoid=html2wt
29688 !! html/parsoid
29689 <pre>* 1
29690 ** 2
29691 * 3</pre>
29692 !! wikitext
29693 * 1
29694 ** 2
29695 * 3
29696 !! end
29697
29698 !! test
29699 1. Categories should always be serialized on their own line
29700 !! options
29701 parsoid=html2wt
29702 !! html/parsoid
29703 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29704 !! wikitext
29705 foo
29706 [[Category:Foo]]
29707 bar
29708 !! end
29709
29710 !! test
29711 2. Categories that are part of templates should not introduce a line break
29712 !! wikitext
29713 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29714 !! html/parsoid
29715 <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>
29716 !! end
29717
29718 # Careful while editing these next 2 tests. There are \u200f characters
29719 # before and after the <link> tags in the HTML and following some
29720 # of the categories in wikitext
29721 # Do not remove these characters in edits.
29722 #
29723 # As part of the serialization, these bidi characters will get stripped.
29724 !! test
29725 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29726 !! options
29727 parsoid={
29728 "modes": ["html2wt"],
29729 "scrubWikitext": true
29730 }
29731 !! html/parsoid
29732 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29733 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29734 !! wikitext
29735 [[קטגוריה:טקסים]]
29736 [[קטגוריה: שיטות משפט]]
29737 !! end
29738
29739 !! test
29740 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29741 !! options
29742 parsoid={
29743 "modes": ["html2wt"],
29744 "scrubWikitext": true
29745 }
29746 !! html/parsoid
29747 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29748 !! wikitext
29749 [[קטגוריה:טקסים]]
29750 ‏y
29751 !! end
29752
29753 !! test
29754 Lists: Add space after bullets
29755 !! options
29756 parsoid=html2wt
29757 !! html/parsoid
29758 <ul>
29759 <li>foo</li>
29760 <li> bar</li>
29761 <li><span> baz</span></li>
29762 </ul>
29763 !! wikitext
29764 * foo
29765 * bar
29766 * <span> baz</span>
29767 !! end
29768
29769 !! test
29770 1. Headings: Add space before/after == (T53744)
29771 !! options
29772 parsoid=html2wt
29773 !! html/parsoid
29774 <h2>foo</h2>
29775 <h2> bar</h2>
29776 <h2>baz </h2>
29777 <h2><span> baz</span></h2>
29778 !! wikitext
29779 == foo ==
29780
29781 == bar ==
29782
29783 == baz ==
29784
29785 == <span> baz</span> ==
29786 !! end
29787
29788 !! test
29789 2. Headings: Add space before/after == even after hoisted content
29790 !! options
29791 parsoid={
29792 "modes": ["html2wt"],
29793 "scrubWikitext": true
29794 }
29795 !! html/parsoid
29796 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29797 !! wikitext
29798 [[Category:A2]]
29799
29800 == ok ==
29801 !! end
29802
29803 !! test
29804 1. Headings: suppress newly created empty headings
29805 !! options
29806 parsoid={
29807 "modes": ["html2wt"],
29808 "scrubWikitext": true
29809 }
29810 !! html/parsoid
29811 <h2></h2>
29812 !! wikitext
29813 !! end
29814
29815 !! test
29816 2. Headings: don't suppress empty headings if scrubWikitext is false
29817 !! options
29818 parsoid=html2wt
29819 !! html/parsoid
29820 <h2></h2>
29821 !! wikitext
29822 ==<nowiki/>==
29823 !! end
29824
29825 !! test
29826 3. Headings: suppress empty headings on edits
29827 !! options
29828 parsoid={
29829 "modes": ["selser"],
29830 "scrubWikitext": true,
29831 "changes": [
29832 [ "#x", "remove"]
29833 ]
29834 }
29835 !! wikitext
29836 ==<span id="x">foo</span>==
29837 !! wikitext/edited
29838 !! end
29839
29840 !! test
29841 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29842 !! options
29843 parsoid={
29844 "modes": ["html2wt"],
29845 "scrubWikitext": true
29846 }
29847 !! html/parsoid
29848 <h2>foo<br/>bar</h2>
29849 <h2>foo <span><br/>bar</span> baz</h2>
29850 !! wikitext
29851 == foo bar ==
29852
29853 == foo <span> bar</span> baz ==
29854 !! end
29855
29856 !! test
29857 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29858 !! options
29859 parsoid={
29860 "modes": ["html2wt"],
29861 "scrubWikitext": false
29862 }
29863 !! html/parsoid
29864 <h2>foo<br/>bar</h2>
29865 !! wikitext
29866 == foo<br />bar ==
29867 !! end
29868
29869 !! test
29870 1. WT Quote Tags: suppress newly created empty style tags
29871 !! options
29872 parsoid={
29873 "modes": ["html2wt"],
29874 "scrubWikitext": true
29875 }
29876 !! html/parsoid
29877 <i></i><b></b>
29878 !! wikitext
29879 !! end
29880
29881 !! test
29882 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29883 !! options
29884 parsoid=html2wt
29885 !! html/parsoid
29886 <i></i><b></b>
29887 !! wikitext
29888 ''<nowiki/>'''''<nowiki/>'''
29889 !! end
29890
29891 !! test
29892 3. WT Quote Tags: suppress empty style tags on edits
29893 !! options
29894 parsoid={
29895 "modes": ["selser"],
29896 "scrubWikitext": true,
29897 "changes": [
29898 [ "#x", "remove"]
29899 ]
29900 }
29901 !! wikitext
29902 '''<span id="x">foo</span>'''
29903 !! wikitext/edited
29904 !! end
29905
29906 !! test
29907 1. Anchors: suppress newly created empty anchors
29908 !! options
29909 parsoid={
29910 "modes": ["html2wt"],
29911 "scrubWikitext": true
29912 }
29913 !! html/parsoid
29914 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29915 !! wikitext
29916 !! end
29917
29918 !! test
29919 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29920 !! options
29921 parsoid={
29922 "modes": ["html2wt"],
29923 "scrubWikitext": false
29924 }
29925 !! html/parsoid
29926 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29927 !! wikitext
29928 [[Test|<nowiki/>]]
29929 !! end
29930
29931 !! test
29932 3. Anchors: suppress empty anchors on edits
29933 !! options
29934 parsoid={
29935 "modes": ["selser"],
29936 "scrubWikitext": true,
29937 "changes": [
29938 [ "#x", "remove"]
29939 ]
29940 }
29941 !! wikitext
29942 [[Test|<span id="x">foo</span>]]
29943 !! wikitext/edited
29944 !! end
29945
29946 !! test
29947 3a. Anchors: do not suppress numbered extlinks
29948 !! options
29949 parsoid={
29950 "modes": ["wt2wt"],
29951 "scrubWikitext": true
29952 }
29953 !! wikitext
29954 [http://foo.com]
29955 !! html/parsoid
29956 <a rel="mw:ExtLink" href="http://foo.com"></a>
29957 !! end
29958
29959 !! test
29960 3b. Anchors: do not suppress numbered extlinks
29961 !! options
29962 parsoid={
29963 "modes": ["wt2wt"],
29964 "scrubWikitext": true,
29965 "changes": [
29966 [ "#x", "remove"]
29967 ]
29968 }
29969 !! wikitext
29970 [http://foo.com <span id="x">foo</span>]
29971 !! wikitext/edited
29972 [http://foo.com]
29973 !! end
29974
29975 !!test
29976 Normalizations should be restricted to edited content
29977 !!options
29978 parsoid={
29979 "modes": ["selser"],
29980 "scrubWikitext": true,
29981 "changes": [
29982 [ "h1", "before", "<i></i>"]
29983 ]
29984 }
29985 !!wikitext
29986 a
29987 = =
29988 b
29989 !!wikitext/edited
29990 a
29991 = =
29992 b
29993 !!end
29994
29995 !! test
29996 1. Multiple normalizations (html2wt)
29997 !! options
29998 parsoid={
29999 "modes": ["html2wt"],
30000 "scrubWikitext": true
30001 }
30002 !! html
30003 <h2><i></i></h2>
30004 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30005 </a><b><i></i></b>x</p>
30006 !! wikitext
30007
30008 [[foo]]
30009 x
30010
30011 !! end
30012
30013 !! test
30014 2. Multiple normalizations (selser)
30015 !! options
30016 parsoid={
30017 "modes": ["selser"],
30018 "scrubWikitext": true,
30019 "changes": [
30020 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
30021 ]
30022 }
30023 !! wikitext
30024 <span id="x">foo</span>
30025 !! wikitext/edited
30026 <span id="x">foo</span>
30027
30028 x
30029 !! end
30030
30031 !! test
30032 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30033 !! options
30034 parsoid={
30035 "modes": ["html2wt"],
30036 "scrubWikitext": true
30037 }
30038 !! html/parsoid
30039 <p> hi</p>
30040 <p> hello</p>
30041 !! wikitext
30042 hi
30043
30044 hello
30045 !! end
30046
30047 !! test
30048 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30049 !! options
30050 parsoid=html2wt
30051 !! html/parsoid
30052 <p> hi</p>
30053 <p> hello</p>
30054 !! wikitext
30055 <nowiki> </nowiki>hi
30056
30057 <nowiki> </nowiki> hello
30058 !! end
30059
30060 !! test
30061 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30062 !! options
30063 parsoid={
30064 "modes": ["html2wt"],
30065 "scrubWikitext": true
30066 }
30067 !! html/parsoid
30068 <p>Foo
30069 bar
30070 baz</p>
30071
30072 <table><tr><td>Foo
30073 bar
30074 baz bang</td></tr></table>
30075
30076 <p><!--boo--> foo
30077 bar</p>
30078
30079 <p> foo
30080 bar<span>boo</span></p>
30081 !! wikitext
30082 Foo
30083 bar
30084 baz
30085
30086 {|
30087 |Foo
30088 bar
30089 baz bang
30090 |}
30091
30092 <!--boo-->foo
30093 bar
30094
30095 foo
30096 bar<span>boo</span>
30097 !! end
30098
30099 !! test
30100 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30101 !! options
30102 parsoid={
30103 "modes": ["selser"],
30104 "scrubWikitext": true,
30105 "changes": [
30106 [ "p", "html", " a\n b" ]
30107 ]
30108 }
30109 !! wikitext
30110 xyz
30111 !! wikitext/edited
30112 a
30113 b
30114 !! end
30115
30116 !! test
30117 1. New links that end in spaces
30118 !! options
30119 parsoid={
30120 "modes": ["html2wt"],
30121 "scrubWikitext": false
30122 }
30123 !! html/parsoid
30124 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30125 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30126 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30127 !! wikitext
30128 [[Berlin ]]<nowiki/>is the capital of Germany.
30129
30130 [[Foo ]]'''bar'''
30131
30132 [[Boston ]] is a city.
30133 !! end
30134
30135 !! test
30136 2. New links that end in spaces
30137 !! options
30138 parsoid={
30139 "modes": ["html2wt"],
30140 "scrubWikitext": true
30141 }
30142 !! html/parsoid
30143 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30144 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30145 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30146 !! wikitext
30147 [[Berlin]] is the capital of Germany.
30148
30149 [[Foo]] '''bar'''
30150
30151 [[Boston]] is a city.
30152 !! end
30153
30154 !! test
30155 1. Table cells with escapable prefixes
30156 !! options
30157 parsoid={
30158 "modes": ["html2wt"],
30159 "scrubWikitext": false
30160 }
30161 !! html
30162 <table>
30163 <tr><td>a</td></tr>
30164 <tr><td>-</td></tr>
30165 <tr><td>+</td></tr>
30166 </table>
30167 !! wikitext
30168 {|
30169 |a
30170 |-
30171 |<nowiki>-</nowiki>
30172 |-
30173 |<nowiki>+</nowiki>
30174 |}
30175 !! end
30176
30177 !! test
30178 2. Table cells with escapable prefixes
30179 !! options
30180 parsoid={
30181 "modes": ["html2wt"],
30182 "scrubWikitext": true
30183 }
30184 !! html
30185 <table>
30186 <tr><td>a</td></tr>
30187 <tr><td>-</td></tr>
30188 <tr><td>+</td></tr>
30189 </table>
30190 !! wikitext
30191 {|
30192 |a
30193 |-
30194 | -
30195 |-
30196 | +
30197 |}
30198 !! end
30199
30200 !! test
30201 3a. Table cells with escapable prefixes after edits
30202 !! options
30203 parsoid={
30204 "modes": ["selser"],
30205 "scrubWikitext": true,
30206 "changes": [
30207 [ "table tbody tr:first-child td:first-child", "remove"]
30208 ]
30209 }
30210 !! wikitext
30211 {|
30212 |a||-
30213 |}
30214 !! wikitext/edited
30215 {|
30216 | -
30217 |}
30218 !! end
30219
30220 !! test
30221 3b. Table cells with escapable prefixes after edits
30222 !! options
30223 parsoid={
30224 "modes": ["selser"],
30225 "scrubWikitext": true,
30226 "changes": [
30227 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30228 [ "#x", "remove" ]
30229 ]
30230 }
30231 !! wikitext
30232 {|
30233 |pqr
30234 |<span id="x">foo</span>+
30235 |}
30236 !! wikitext/edited
30237 {|
30238 | -
30239 | +
30240 |}
30241 !! end
30242
30243 # FIXME: This test will fail because
30244 # normalization doesn't realize that the id attribute
30245 # will eliminate the escapable scenario
30246 !! test
30247 4a. Table cells without escapable prefixes after edits
30248 !! options
30249 parsoid={
30250 "modes": ["selser"],
30251 "scrubWikitext": true,
30252 "changes": [
30253 [ "#x", "html", "-" ]
30254 ]
30255 }
30256 !! wikitext
30257 {|
30258 | id="x" |abcd
30259 |}
30260 !! wikitext/edited
30261 {|
30262 | id="x" |-
30263 |}
30264 !! end
30265
30266 ## This tests normalizer's ability to discriminate between
30267 ## cells having identical content.
30268 !! test
30269 4b. Table cells without escapable prefixes after edits
30270 !! options
30271 parsoid={
30272 "modes": ["selser"],
30273 "scrubWikitext": true,
30274 "changes": [
30275 [ "td", "html", "-" ]
30276 ]
30277 }
30278 !! wikitext
30279 {|
30280 |a||b
30281 |}
30282 !! wikitext/edited
30283 {|
30284 | -||-
30285 |}
30286 !! end
30287
30288 ## This tests normalizer's ability to not be tripped by
30289 ## comments (and whitespace)
30290 !! test
30291 4c. Table cells without escapable prefixes after edits
30292 !! options
30293 parsoid={
30294 "modes": ["selser"],
30295 "scrubWikitext": true,
30296 "changes": [
30297 [ "table tbody tr td:first-child", "remove" ]
30298 ]
30299 }
30300 !! wikitext
30301 {|
30302 |-
30303 <!--foo--> |a||-
30304 |}
30305 !! wikitext/edited
30306 {|
30307 |-
30308 <!--foo--> | -
30309 |}
30310 !! end
30311
30312 ## This tests normalizer's ability to handle HTML cells
30313 !! test
30314 4d. Table cells without escapable prefixes after edits
30315 !! options
30316 parsoid={
30317 "modes": ["selser"],
30318 "scrubWikitext": true,
30319 "changes": [
30320 [ "td", "html", "-" ]
30321 ]
30322 }
30323 !! wikitext
30324 <table>
30325 <tr><td>a</td></tr>
30326 </table>
30327 !! wikitext/edited
30328 <table>
30329 <tr><td>-</td></tr>
30330 </table>
30331 !! end
30332
30333 ## T111151 Remove font elements without attributes
30334 !! test
30335 5a. font tags without attributes should be dropped in scrubWikitext mode
30336 !! options
30337 parsoid={
30338 "modes": ["html2wt"],
30339 "scrubWikitext": true
30340 }
30341 !! html
30342 <font>foo</font>
30343 <font><font>bar</font></font>
30344 <font class="x">boo</font>
30345 !! wikitext
30346 foo
30347 bar
30348 <font class="x">boo</font>
30349 !! end
30350
30351 !! test
30352 5b. font tags should not be dropped without scrubWikitext being enabled
30353 !! options
30354 parsoid={
30355 "modes": ["html2wt"],
30356 "scrubWikitext": false
30357 }
30358 !! html
30359 <font>foo</font>
30360 !! wikitext
30361 <font>foo</font>
30362 !! end
30363
30364 !! test
30365 Escape nowiki DOM elements
30366 !! options
30367 parsoid=html2wt
30368 !! html/parsoid
30369 <nowiki><i>foo</i></nowiki>
30370 !! wikitext
30371 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30372 !! end
30373
30374 # This is meant to be an interim fix while we go about figuring out
30375 # how to not introduce these trailing <nowiki/>s in the first place.
30376 !! test
30377 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30378 !! options
30379 parsoid=html2wt
30380 !! html/parsoid
30381 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30382 y</p>
30383 <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>
30384 <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>
30385 !! wikitext
30386 x
30387 y
30388
30389 {{echo|
30390 1 = <nowiki/>}}
30391
30392 {{echo|
30393 1 = <nowiki/>
30394 }}
30395 !! end
30396
30397 !! test
30398 New list is serialized on newlines
30399 !! options
30400 parsoid=html2wt
30401 !! html/parsoid
30402 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30403 <li>Yesterday</li>
30404 <li>Today</li>
30405 <li>Tomorrow</li>
30406 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30407 !! wikitext
30408 The quick brown fox jumps over the lazy dog.
30409
30410 * Yesterday
30411 * Today
30412 * Tomorrow
30413
30414 The quick onyx goblin jumps over the lazy dwarf.
30415 !! end
30416
30417 !! test
30418 New lists in formatting elements serialized w/o newlines
30419 !! options
30420 parsoid=html2wt
30421 !! html/parsoid
30422 <small>
30423
30424 <ul>
30425 <li>123</li>
30426 </ul>
30427
30428 </small>
30429
30430 <small><ul><li>hi</li></ul></small>
30431 !! wikitext
30432 <small>
30433 * 123
30434 </small>
30435
30436 <small>
30437 * hi
30438 </small>
30439 !! end
30440
30441 !! test
30442 New list in table doesn't need newlines
30443 !! options
30444 parsoid=html2wt
30445 !! html/parsoid
30446 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30447 !! wikitext
30448 {|
30449 |
30450 * test
30451 * 123
30452 |}
30453 !! end
30454
30455 # ---------------------------------------------------
30456 # End of tests spec'ing wikitext serialization norms |
30457 # ---------------------------------------------------
30458
30459 # T104032
30460 !! test
30461 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30462 !! options
30463 parsoid=html2wt
30464 !! html/parsoid
30465 a<p>b</p>
30466 <b>c</b><p>d</p>
30467 <table><tr>
30468 <td>a<p>b</p></td>
30469 <td><b>c</b><p>d</p></td>
30470 </tr></table>
30471 !! wikitext
30472 a
30473
30474 b
30475
30476 '''c'''
30477
30478 d
30479 {|
30480 |a
30481 b
30482 |'''c'''
30483 d
30484 |}
30485 !! end
30486
30487 !! test
30488 Anchor without href scenarios
30489 !! options
30490 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30491 !! html/parsoid
30492 <a class="bc"></a>
30493 <a class="no">dice</a>
30494 <a name="foo"></a>
30495 !! wikitext
30496
30497 dice
30498 <span name="foo"></span>
30499 !! end
30500
30501 !! test
30502 New transclusion added after a list should be serialized after the list
30503 !! options
30504 parsoid=html2wt
30505 !! html/parsoid
30506 <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>
30507 !! wikitext
30508 * a
30509 {{echo|foo}}
30510 !! end
30511
30512 # -----------------------------------------------------------------
30513 # End of section for Parsoid-only html2wt tests for serialization
30514 # of new content
30515 # -----------------------------------------------------------------
30516
30517 # -----------------------------------------------------------------
30518 # The following section of tests are primarily to spec behavior of
30519 # the selective serializer. All these tests have manual selser
30520 # changes. The automated selser changes for all tests handle the
30521 # wide variation of changes, but these tests here capture specs
30522 # deterministically.
30523 # ----------------------------------------------------------------
30524
30525 ## T90517
30526 !! test
30527 Selser: New comments should not be lost
30528 !! options
30529 parsoid={
30530 "modes": ["selser"],
30531 "changes": [
30532 [ "#a", "after", "<!--c1-->" ],
30533 [ "#b", "before", "<!--c2-->" ]
30534 ]
30535 }
30536 !! wikitext
30537 <span id="a">a</span>
30538
30539 <span id="b">b</span>
30540 !! wikitext/edited
30541 <span id="a">a</span><!--c1-->
30542
30543 <!--c2--><span id="b">b</span>
30544 !! end
30545
30546 ## T89383
30547 !! test
30548 Selser: Check for validity of DSR before using it
30549 !! options
30550 parsoid={
30551 "modes": ["selser"],
30552 "changes": [
30553 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30554 ]
30555 }
30556 !! wikitext
30557 <span id="a">a</span>
30558 !! wikitext/edited
30559 {{DISPLAYTITLE:foo}}
30560 <span id="a">a</span>
30561 !! end
30562
30563 !! test
30564 1. DOMDiff: Changes to <ref> content should be looked up using id
30565 !! options
30566 parsoid={
30567 "modes": ["selser"],
30568 "changes": [
30569 ["#X", "after", "bar"],
30570 ["#Y", "after", "baz"]
30571 ]
30572 }
30573 !! wikitext
30574 X <ref><span id="X">foo</span></ref>
30575 Y <ref name="a" />
30576 <references>
30577 <ref name="a"><span id="Y">foo</span></ref>
30578 </references>
30579 !! wikitext/edited
30580 X <ref><span id="X">foo</span>bar</ref>
30581 Y <ref name="a" />
30582 <references>
30583 <ref name="a"><span id="Y">foo</span>baz</ref>
30584 </references>
30585 !! end
30586
30587 !! test
30588 2. DOMDiff: Changes to <ref> content should be looked up using id
30589 !! options
30590 parsoid={
30591 "modes": ["selser"],
30592 "changes": [
30593 ["#Z", "after", "bar"]
30594 ]
30595 }
30596 !! wikitext
30597 A <ref>foo bar for a</ref>
30598 B <ref group="X" name="b" />
30599
30600 <references />
30601
30602 <references group="X">
30603 <ref name="b"><span id="Z">foo</span></ref>
30604 </references>
30605 !! wikitext/edited
30606 A <ref>foo bar for a</ref>
30607 B <ref group="X" name="b" />
30608
30609 <references />
30610
30611 <references group="X">
30612 <ref name="b"><span id="Z">foo</span>bar</ref>
30613 </references>
30614 !! end
30615
30616 !! test
30617 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30618 !! options
30619 parsoid={
30620 "modes": ["selser"],
30621 "changes": [
30622 [ "div:first-child", "text", "bar" ]
30623 ]
30624 }
30625 !! wikitext
30626 <div style="{{1x|color:red;}}%">foo</div>
30627 !! wikitext/edited
30628 <div style="{{1x|color:red;}}%">bar</div>
30629 !! end
30630
30631 !! test
30632 Empty LI (T49673)
30633 !! wikitext
30634 *a
30635 *
30636 *
30637 *b
30638 !! html+tidy
30639 <ul><li>a</li>
30640 <li class="mw-empty-elt"></li>
30641 <li class="mw-empty-elt"></li>
30642 <li>b</li></ul>
30643 !! end
30644
30645 !! test
30646 Thumbnail output
30647 !! wikitext
30648 [[File:Thumb.png|thumb]]
30649 !! html/php+tidy
30650 <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>
30651 !! html/parsoid
30652 <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>
30653 !! end
30654
30655 !! test
30656 unclosed internal link XSS (T137264)
30657 !! wikitext
30658 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30659 !! html/php
30660 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30661 </p>
30662 !! html/parsoid
30663 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30664 !! end
30665
30666 !! test
30667 Validating that <style> isn't eaten by tidy (T167349)
30668 !! options
30669 styletag=1
30670 !! wikitext
30671 <div class="foo">
30672 <style>.foo::before { content: "<foo>"; }</style>
30673 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30674 </div>
30675 !! html/php+tidy
30676 <div class="foo">
30677 <style>.foo::before { content: "<foo>"; }</style>
30678 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30679 </div>
30680 !! end
30681
30682 !! test
30683 Validating that <style> isn't wrapped in a paragraph (T186965)
30684 !! options
30685 styletag=1
30686 !! wikitext
30687 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30688
30689 <style>.foo::before { content: "<foo>"; }</style>
30690
30691 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30692
30693 But if it's on a line with other content, let it be wrapped.
30694
30695 <style>.foo::before { content: "<foo>"; }</style> bar
30696
30697 foo <style>.foo::before { content: "<foo>"; }</style>
30698
30699 foo <style>.foo::before { content: "<foo>"; }</style> bar
30700
30701 And the same if we have non-paragraph-breaking whitespace
30702
30703 foo
30704 <style>.foo::before { content: "<foo>"; }</style>
30705 bar
30706 !! html/php
30707 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30708 </p>
30709 <style>.foo::before { content: "<foo>"; }</style>
30710 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30711 <p>But if it's on a line with other content, let it be wrapped.
30712 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30713 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30714 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30715 </p><p>And the same if we have non-paragraph-breaking whitespace
30716 </p><p>foo
30717 <style>.foo::before { content: "<foo>"; }</style>
30718 bar
30719 </p>
30720 !! end
30721
30722 !! test
30723 Validating that <link> isn't wrapped in a paragraph (T186965)
30724 !! options
30725 styletag=1
30726 !! wikitext
30727 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30728
30729 <link rel="foo" href="bar"/>
30730
30731 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30732
30733 But if it's on a line with other content, let it be wrapped.
30734
30735 <link rel="foo" href="bar"/> bar
30736
30737 foo <link rel="foo" href="bar"/>
30738
30739 foo <link rel="foo" href="bar"/> bar
30740
30741 And the same if we have non-paragraph-breaking whitespace
30742
30743 foo
30744 <link rel="foo" href="bar"/>
30745 bar
30746 !! html/php
30747 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30748 </p>
30749 <link rel="foo" href="bar"/>
30750 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30751 <p>But if it's on a line with other content, let it be wrapped.
30752 </p><p><link rel="foo" href="bar"/> bar
30753 </p><p>foo <link rel="foo" href="bar"/>
30754 </p><p>foo <link rel="foo" href="bar"/> bar
30755 </p><p>And the same if we have non-paragraph-breaking whitespace
30756 </p><p>foo
30757 <link rel="foo" href="bar"/>
30758 bar
30759 </p>
30760 !! end
30761
30762 !! test
30763 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30764 !! config
30765 wgFragmentMode=[ 'html5', 'legacy' ]
30766 !! wikitext
30767 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30768 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30769 !! html/php
30770 <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>
30771 <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>
30772 </p>
30773 !! html/parsoid
30774 <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>
30775 <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>
30776 !! end
30777
30778 !! test
30779 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30780 !! config
30781 wgFragmentMode=[ 'legacy' ]
30782 !! wikitext
30783 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30784 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30785 !! html/php
30786 <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>
30787 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30788 </p>
30789 !! end
30790
30791 !! test
30792 Decoding of HTML entities in embedded HTML tags
30793 !! wikitext
30794 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30795 !! html/php
30796 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30797
30798 !! html/parsoid
30799 <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>
30800 !! end
30801
30802 !! test
30803 Decoding of HTML entities in indicator names for IDs (T104196)
30804 !! options
30805 parsoid=wt2html,html2html
30806 showindicators
30807 !! wikitext
30808 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30809 !! html/php
30810 1&2&3&amp;4&amp;amp;5=Indicator
30811
30812 !! html/parsoid
30813 <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>
30814 !! end
30815
30816 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30817 !! test
30818 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30819 !! options
30820 showindicators
30821 !! wikitext
30822 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30823 !! html/php
30824 1&2&3&amp;4&amp;amp;5=Indicator
30825
30826 !! html/parsoid
30827 <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>
30828 !! end
30829
30830 # This fragment mode is what Parsoid supports.
30831 !! test
30832 HTML5 ids: fallback to legacy
30833 !! config
30834 wgFragmentMode=[ 'html5', 'legacy' ]
30835 !! wikitext
30836 ==Foo bar==
30837
30838 ==foo Bar==
30839
30840 ==Тест==
30841
30842 ==Тест==
30843
30844 ==тест==
30845
30846 ==Hey < # " > % : '==
30847 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30848
30849 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30850
30851 <!-- These two links should produce identical HTML -->
30852 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30853
30854 !! html/php
30855 <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>
30856 <ul>
30857 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30858 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30859 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30860 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30861 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30862 <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>
30863 </ul>
30864 </div>
30865
30866 <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>
30867 <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>
30868 <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>
30869 <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>
30870 <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>
30871 <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>
30872 <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>
30873 </p><p>💩 <span id="💩"></span>
30874 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30875 </p>
30876 !! html/parsoid
30877 <h2 id="Foo_bar">Foo bar</h2>
30878
30879 <h2 id="foo_Bar_2">foo Bar</h2>
30880
30881 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30882
30883 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30884
30885 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30886
30887 <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>
30888 <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>
30889
30890 <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>
30891
30892 <!-- These two links should produce identical HTML -->
30893 <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>
30894 !! end
30895
30896 # Parsoid doesn't support this mode
30897 !! test
30898 HTML5 ids: legacy with a fallback to modern
30899 !! config
30900 wgFragmentMode=[ 'legacy', 'html5' ]
30901 !! wikitext
30902 ==Foo bar==
30903
30904 ==foo Bar==
30905
30906 ==Тест==
30907
30908 ==Тест==
30909
30910 ==тест==
30911
30912 ==Hey < # " > % : '==
30913 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30914
30915 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30916
30917 <!-- These two links should produce identical HTML -->
30918 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30919
30920 !! html/php
30921 <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>
30922 <ul>
30923 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30924 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30925 <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>
30926 <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>
30927 <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>
30928 <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>
30929 </ul>
30930 </div>
30931
30932 <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>
30933 <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>
30934 <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>
30935 <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>
30936 <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>
30937 <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>
30938 <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>
30939 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30940 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30941 </p>
30942 !! end
30943
30944 # Parsoid doesn't support this mode.
30945 !! test
30946 HTML5 ids: no legacy
30947 !! config
30948 wgFragmentMode=[ 'html5' ]
30949 !! wikitext
30950 ==Foo bar==
30951
30952 ==foo Bar==
30953
30954 ==Тест==
30955
30956 ==Тест==
30957
30958 ==тест==
30959
30960 ==Hey < # " > % : '==
30961 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30962
30963 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30964
30965 <!-- These two links should produce identical HTML -->
30966 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30967
30968 !! html/php
30969 <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>
30970 <ul>
30971 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30972 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30973 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30974 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30975 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30976 <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>
30977 </ul>
30978 </div>
30979
30980 <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>
30981 <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>
30982 <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>
30983 <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>
30984 <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>
30985 <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>
30986 <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>
30987 </p><p>💩 <span id="💩"></span>
30988 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30989 </p>
30990 !! end
30991
30992 !! test
30993 T90902: Normalize weird characters in section IDs
30994 !! config
30995 wgFragmentMode=[ 'html5', 'legacy' ]
30996 !! wikitext
30997 ==Foo&nbsp;bar==
30998 [[#Foo&nbsp;bar]]
30999
31000 !! html/php
31001 <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>
31002 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31003 </p>
31004 !! html/parsoid
31005 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31006 <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>
31007 !! end
31008
31009 !! test
31010 T51672: Test for brackets in attributes of elements in external link texts
31011 !! wikitext
31012 [http://example.com/ link <span title="title with [brackets]">span</span>]
31013 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31014
31015 !! html/php
31016 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31017 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31018 </p>
31019 !! html/parsoid
31020 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31021 <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>
31022 !! end
31023
31024 !! test
31025 T72875: Test for brackets in attributes of elements in internal link texts
31026 !! wikitext
31027 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31028 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31029
31030 !! html/php
31031 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31032 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31033 </p>
31034 !! html/parsoid
31035 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31036 <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>
31037 !! end
31038
31039 !! test
31040 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31041 !! options
31042 parsoid={
31043 "modes": ["html2wt"]
31044 }
31045 !! html/parsoid
31046 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31047 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total">10</a>
31048 !! wikitext
31049 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31050 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31051 !! end
31052
31053 !! test
31054 T179544: {{anchorencode:}} output should be always usable in links
31055 !! config
31056 wgFragmentMode=[ 'html5' ]
31057 !! wikitext
31058 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31059 !! html/php
31060 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31061 </p>
31062 !! html/parsoid
31063 <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>
31064 !! end
31065
31066 ## ------------------------------
31067 ## Parsoid section-wrapping tests
31068 ## ------------------------------
31069 !! test
31070 Section wrapping for well-nested sections (no leading content)
31071 !! options
31072 parsoid={
31073 "wrapSections": true
31074 }
31075 !! wikitext
31076 =1=
31077 a
31078
31079 =2=
31080 b
31081
31082 ==2.1==
31083 c
31084
31085 ==2.2==
31086 d
31087
31088 ===2.2.1===
31089 e
31090
31091 =3=
31092 f
31093 !! html/parsoid
31094 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31095 <p>a</p>
31096
31097 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31098 <p>b</p>
31099
31100 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31101 <p>c</p>
31102
31103 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31104 <p>d</p>
31105
31106 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31107 <p>e</p>
31108
31109 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31110 <p>f</p>
31111
31112 </section>
31113 !! end
31114
31115 !! test
31116 Section wrapping for well-nested sections (with leading content)
31117 !! options
31118 parsoid={
31119 "wrapSections": true
31120 }
31121 !! wikitext
31122 Para 1.
31123
31124 Para 2 with a <div>nested in it</div>
31125
31126 Para 3.
31127
31128 =1=
31129 a
31130
31131 =2=
31132 b
31133
31134 ==2.1==
31135 c
31136 !! html/parsoid
31137 <section data-mw-section-id="0"><p>Para 1.</p>
31138
31139 <p>Para 2 with a </p><div>nested in it</div>
31140
31141 <p>Para 3.</p>
31142
31143 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31144 <p>a</p>
31145
31146 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31147 <p>b</p>
31148
31149 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31150 <p>c</p>
31151
31152 </section></section>
31153 !! end
31154
31155 !! test
31156 Section wrapping with template-generated sections (good nesting 1)
31157 !! options
31158 parsoid={
31159 "wrapSections": true
31160 }
31161 !! wikitext
31162 =1=
31163 a
31164
31165 {{echo|1=
31166 ==1.1==
31167 b
31168 }}
31169
31170 ==1.2==
31171 c
31172
31173 =2=
31174 d
31175 !! html/parsoid
31176 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31177 <p>a</p>
31178
31179 <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">
31180 </span><p about="#mwt1">b</p>
31181 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31182 <p>c</p>
31183
31184 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31185 <p>d</p></section>
31186 !! end
31187
31188 # In this example, the template scope is mildly expanded to incorporate the
31189 # trailing newline after the transclusion since that is part of section 1.1.1
31190 !! test
31191 Section wrapping with template-generated sections (good nesting 2)
31192 !! options
31193 parsoid={
31194 "wrapSections": true,
31195 "modes": ["wt2html", "wt2wt"]
31196 }
31197 !! wikitext
31198 =1=
31199 a
31200
31201 {{echo|1=
31202 ==1.1==
31203 b
31204 ===1.1.1===
31205 d
31206 }}
31207 =2=
31208 e
31209 !! html/parsoid
31210 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31211 <p>a</p>
31212
31213 <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">
31214 </span><p about="#mwt1">b</p><span about="#mwt1">
31215 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31216 </span><p about="#mwt1">d</p><span about="#mwt1">
31217 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31218 <p>e</p></section>
31219 !! end
31220
31221 # In this example, the template scope is mildly expanded to incorporate the
31222 # trailing newline after the transclusion since that is part of section 1.2.1
31223 !! test
31224 Section wrapping with template-generated sections (good nesting 3)
31225 !! options
31226 parsoid={
31227 "wrapSections": true,
31228 "modes": ["wt2html", "wt2wt"]
31229 }
31230 !! wikitext
31231 =1=
31232 a
31233
31234 {{echo|1=
31235 x
31236 ==1.1==
31237 b
31238 ==1.2==
31239 c
31240 ===1.2.1===
31241 d
31242 }}
31243 =2=
31244 e
31245 !! html/parsoid
31246 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31247 <p>a</p>
31248
31249 <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">
31250 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31251 </span><p about="#mwt1">b</p><span about="#mwt1">
31252 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31253 </span><p about="#mwt1">c</p><span about="#mwt1">
31254 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31255 </span><p about="#mwt1">d</p><span about="#mwt1">
31256 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31257 <p>e</p></section>
31258 !! end
31259
31260 # Because of section-wrapping and template-wrapping interactions,
31261 # the scope of the template is expanded so that the template markup
31262 # is valid in the presence of <section> tags.
31263 # This exercises the s1 is null scenario in the wrapSections code
31264 !! test
31265 Section wrapping with template-generated sections (bad nesting 1)
31266 !! options
31267 parsoid={
31268 "wrapSections": true
31269 }
31270 !! wikitext
31271 <div>
31272 a
31273
31274 {{echo|
31275 =1=
31276 b
31277 }}
31278
31279 c
31280 </div>
31281 !! html/parsoid
31282 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31283 <p>a</p>
31284
31285 <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"]}'>
31286 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31287 </span><p about="#mwt1">b
31288 </p><span about="#mwt1">
31289
31290 </span><p about="#mwt1">c</p><span about="#mwt1">
31291 </span></section></div></section>
31292 !! end
31293
31294 # Because of section-wrapping and template-wrapping interactions,
31295 # the scope of the template is expanded so that the template markup
31296 # is valid in the presence of <section> tags.
31297 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31298 !! test
31299 Section wrapping with template-generated sections (bad nesting 2)
31300 !! options
31301 parsoid={
31302 "wrapSections": true
31303 }
31304 !! wikitext
31305 =1=
31306 a
31307
31308 {{echo|1=
31309 =2=
31310 b
31311 ==2.1==
31312 c
31313 }}
31314
31315 d
31316
31317 =3=
31318 e
31319 !! html/parsoid
31320 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31321 <p>a</p>
31322
31323 </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">
31324 </span><p about="#mwt1">b</p><span about="#mwt1">
31325 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31326 </span><p about="#mwt1">c</p><span about="#mwt1">
31327
31328 </span><p about="#mwt1">d</p><span about="#mwt1">
31329
31330 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31331 <p>e</p></section>
31332 !! end
31333
31334 # Because of section-wrapping and template-wrapping interactions,
31335 # additional template wrappers are added to <section> tags
31336 # so that template wrapping semantics are valid whether section
31337 # tags are retained or stripped. But, the template scope can expand
31338 # greatly when accounting for section tags.
31339 # This exercises the s1 and s2 are in different subtrees scenario
31340 !! test
31341 Section wrapping with template-generated sections (bad nesting 3)
31342 !! options
31343 parsoid={
31344 "wrapSections": true,
31345 "modes": ["wt2html", "wt2wt"]
31346 }
31347 !! wikitext
31348 =1=
31349 a
31350
31351 {{echo|1=
31352 ==1.2==
31353 b
31354 =2=
31355 c
31356 }}
31357
31358 d
31359
31360 =3=
31361 e
31362 !! html/parsoid
31363 <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>
31364 <p>a</p>
31365
31366 <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">
31367 </span><p about="#mwt1">b</p><span about="#mwt1">
31368 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31369 </span><p about="#mwt1">c</p>
31370
31371 <p>d</p>
31372 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31373 <p>e</p></section>
31374 !! end
31375
31376 !! test
31377 Section wrapping with uneditable lead section + div wrapping multiple sections
31378 !! options
31379 parsoid={
31380 "wrapSections": true
31381 }
31382 !! wikitext
31383 foo
31384
31385 <div style="border:1px solid red;">
31386 =1=
31387 a
31388
31389 ==1.1==
31390 b
31391
31392 =2=
31393 c
31394 </div>
31395
31396 =3=
31397 d
31398
31399 ==3.1==
31400 e
31401 !! html/parsoid
31402 <section data-mw-section-id="-1"><p>foo</p>
31403
31404 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31405 <section data-mw-section-id="1"><h1 id="1">1</h1>
31406 <p>a</p>
31407
31408 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31409 <p>b</p>
31410
31411 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31412 <p>c</p>
31413 </section></div>
31414
31415 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31416 <p>d</p>
31417
31418 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31419 <p>e</p>
31420 </section></section>
31421 !! end
31422
31423 !! test
31424 Section wrapping with editable lead section + div overlapping multiple sections
31425 !! options
31426 parsoid={
31427 "wrapSections": true
31428 }
31429 !! wikitext
31430 foo
31431
31432 =1=
31433 a
31434 <div style="border:1px solid red;">
31435 b
31436
31437 ==1.1==
31438 c
31439
31440 =2=
31441 d
31442 </div>
31443 e
31444
31445 =3=
31446 f
31447
31448 ==3.1==
31449 g
31450 !! html/parsoid
31451 <section data-mw-section-id="0"><p>foo</p>
31452
31453 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31454 <p>a</p>
31455 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31456 <p>b</p>
31457
31458 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31459 <p>c</p>
31460
31461 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31462 <p>d</p>
31463 </section></div>
31464 <p>e</p>
31465
31466 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31467 <p>f</p>
31468
31469 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31470 <p>g</p>
31471 </section></section>
31472 !! end
31473
31474 !! test
31475 HTML header tags should not be wrapped in section tags
31476 !! options
31477 parsoid={
31478 "wrapSections": true
31479 }
31480 !! wikitext
31481 foo
31482
31483 <h1>a</h1>
31484
31485 =b=
31486
31487 <h1>c</h1>
31488
31489 =d=
31490 !! html/parsoid
31491 <section data-mw-section-id="0"><p>foo</p>
31492
31493 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31494
31495 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31496
31497 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31498
31499 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31500 !! end
31501
31502 !! test
31503 Lead section containing only whitespace and comments.
31504 !! options
31505 parsoid={
31506 "wrapSections": true
31507 }
31508 !! wikitext
31509
31510 <!-- this is a comment, presumably significant to editors -->
31511 =1=
31512 a
31513
31514 =2=
31515 b
31516 !! html/parsoid
31517 <section data-mw-section-id="0" data-parsoid="{}">
31518 <!-- this is a comment, presumably significant to editors -->
31519 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31520 <p>a</p>
31521
31522 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31523 <p>b</p></section>
31524 !! end
31525
31526 !! test
31527 Pseudo-sections emitted by templates should have id -2
31528 !! options
31529 parsoid={
31530 "wrapSections": true
31531 }
31532 !! wikitext
31533 foo
31534 {{echo|<div>
31535 ==a==
31536 ==b==
31537 </div>
31538 }}
31539 !! html/parsoid
31540 <section data-mw-section-id="-1"><p>foo</p>
31541 </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}}]}'>
31542 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31543 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31544 </section></div><span about="#mwt1">
31545 </span></section>
31546 !! end
31547
31548 ##########################################################################
31549 Tests demonstrating white-space insensitivity in input wikitext
31550 for wikitext headings, wikitext list items, and wikitext table captions,
31551 headings, and cells. HTML versions of the same should preserve whitespace.
31552 ##########################################################################
31553 !! test
31554 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31555 !! options
31556 parsoid={
31557 "modes": ["wt2html"],
31558 "preserveIEW": true
31559 }
31560 !! wikitext
31561 __NOTOC__
31562 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31563 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31564 == <!--Headings with fallback ids--> Личная жизнь ==
31565 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31566 ; <!--term to define--> term : <!--term's definition--> definition
31567 {|
31568 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31569 |-
31570 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31571 |-
31572 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31573 |-
31574 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31575 |-
31576 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31577 |}
31578 : {|
31579 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31580 |} foo <!--c1-->
31581 !! html/php+tidy
31582 <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>
31583 <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>
31584 <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>
31585 <ul><li>List item</li></ul>
31586 <dl><dt>term&#160;</dt>
31587 <dd>definition</dd></dl>
31588 <table>
31589 <caption>Table Caption
31590 </caption>
31591 <tbody><tr>
31592 <th>Table Heading 1</th>
31593 <th>Table Heading 2
31594 </th></tr>
31595 <tr>
31596 <td>Table Cell 1</td>
31597 <td>Table Cell 2
31598 </td></tr>
31599 <tr>
31600 <td>class="foo"</td>
31601 <td>Table Cell 3
31602 </td></tr>
31603 <tr>
31604 <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
31605 </td></tr></tbody></table>
31606 <dl><dd><table>
31607 <tbody><tr>
31608 <td>Table Cell 1</td>
31609 <td>Table Cell 2
31610 </td></tr></tbody></table> foo</dd></dl>
31611 !! html/parsoid
31612 <meta property="mw:PageProp/notoc">
31613 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31614 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31615 <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>
31616 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31617 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31618 <table>
31619 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31620 <tbody><tr>
31621 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31622 <tr>
31623 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31624 <tr>
31625 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31626 <tr>
31627 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31628 </tbody></table>
31629 <dl><dd><table>
31630 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31631 </tbody></table> foo<!--c1--></dd></dl>
31632 !! end
31633
31634 # Looks like <caption> is not accepted in HTML
31635 !! test
31636 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31637 !! options
31638 parsoid={
31639 "modes": ["wt2html"],
31640 "preserveIEW": true
31641 }
31642 !! wikitext
31643 __NOTOC__
31644 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31645 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31646 <table>
31647 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31648 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31649 </table>
31650 !! html/php+tidy
31651 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31652 <ul><li> List item </li></ul>
31653 <table>
31654 <tbody><tr><th> Table Heading </th><th></th></tr>
31655 <tr><td> Table Cell </td><th></th></tr>
31656 </tbody></table>
31657 !! html/parsoid
31658 <meta property="mw:PageProp/notoc"/>
31659 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31660 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31661 <table>
31662 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31663 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31664 </tbody></table>
31665 !! end
31666
31667 !! test
31668 Do not trim whitespace in links and quotes
31669 !! options
31670 parsoid={
31671 "modes": ["wt2html"],
31672 "preserveIEW": true
31673 }
31674 !! wikitext
31675 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31676 [[Foo| some text ]]
31677 !! html/php+tidy
31678 <p>foo <i> italic </i> and <b> bold </b>
31679 <a href="/wiki/Foo" title="Foo"> some text </a>
31680 </p>
31681 !! html/parsoid
31682 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31683 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31684 !! end
31685
31686 !! test
31687 Remove p tags surrounding a single element in a figcaption
31688 !! options
31689 parsoid=html2wt
31690 !! wikitext
31691 [[File:Foobar.jpg|right|200x200px|Caption]]
31692 !! html/parsoid
31693 <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>
31694 !! end
31695
31696 !! test
31697 Selser preserves lack of newline before list and allows newline after the list
31698 !! options
31699 parsoid={
31700 "modes": ["selser"],
31701 "scrubWikitext": true,
31702 "changes": [
31703 [ "ul", "after", "<p>footer</p>" ]
31704 ]
31705 }
31706 !! wikitext
31707 header
31708 *foo
31709 *bar
31710 !! wikitext/edited
31711 header
31712 *foo
31713 *bar
31714
31715 footer
31716 !! end
31717
31718
31719 !! test
31720 Selser does not introduce newlines between unedited paragraph preceding the list
31721 !! options
31722 parsoid={
31723 "modes": ["selser"],
31724 "changes": [
31725 [ "table tbody tr td p:last-child", "empty" ]
31726 ]
31727 }
31728 !! wikitext
31729 {|
31730 |
31731 header
31732 *foo
31733 *bar
31734 footer
31735 |}
31736 !! wikitext/edited
31737 {|
31738 |
31739 header
31740 *foo
31741 *bar
31742
31743 |}
31744 !! end
31745
31746 !! test
31747 Selser does not introduce newlines between unedited paragraph following the list
31748 !! options
31749 parsoid={
31750 "modes": ["selser"],
31751 "changes": [
31752 [ "table tbody tr td p:first-child", "empty" ]
31753 ]
31754 }
31755 !! wikitext
31756 {|
31757 |
31758 header
31759 *foo
31760 *bar
31761 footer
31762 |}
31763 !! wikitext/edited
31764 {|
31765 |
31766
31767 *foo
31768 *bar
31769 footer
31770 |}
31771 !! end
31772
31773 !! test
31774 Remove a list item but do not insert newline above list
31775 !! options
31776 parsoid={
31777 "modes": ["selser"],
31778 "changes": [
31779 [ "ul li:last-child", "remove" ]
31780 ]
31781 }
31782 !! wikitext
31783 header
31784 *foo
31785 *bar
31786 footer
31787 !! wikitext/edited
31788 header
31789 *foo
31790 footer
31791 !! end