Merge "RollbackAction/SpecialUndelete: Use OutputPage::addWikiMsg() where possible"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks, wgMediaInTargetLanguage
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 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 SVG thumbnails in page language
15375 !! options
15376 language=ru
15377 wgMediaInTargetLanguage = true
15378 !! wikitext
15379 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15380 !! html/php
15381 <p><a href="/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/langru-240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langru-360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langru-480px-Foobar.svg.png 2x" /></a> <a href="/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:Foobar.svg&amp;lang=en" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/480px-Foobar.svg.png 2x" /></a>
15382 </p>
15383 !! end
15384
15385 !! test
15386 SVG thumbnails in page language not present in the file
15387 !! options
15388 language=de
15389 wgMediaInTargetLanguage = true
15390 !! wikitext
15391 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15392 !! html/php
15393 <p><a href="/wiki/Datei:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/480px-Foobar.svg.png 2x" /></a> <a href="/index.php?title=Datei:Foobar.svg&amp;lang=ru" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/langru-240px-Foobar.svg.png" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langru-360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langru-480px-Foobar.svg.png 2x" /></a>
15394 </p>
15395 !! end
15396
15397 !! test
15398 T3887: A ISBN with a thumbnail
15399 !! wikitext
15400 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15401 !! html/php
15402 <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>
15403
15404 !! html/parsoid
15405 <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>
15406 !! end
15407
15408 !! test
15409 T3887: A RFC with a thumbnail
15410 !! wikitext
15411 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15412 !! html/php
15413 <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>
15414
15415 !! html/parsoid
15416 <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>
15417 !! end
15418
15419 !! test
15420 T3887: A mailto link with a thumbnail
15421 !! wikitext
15422 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15423 !! html/php
15424 <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>
15425
15426 !! html/parsoid
15427 <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>
15428 !! end
15429
15430 # Pending resolution to T2368
15431 !! test
15432 T2648: Frameless image caption with a link
15433 !! wikitext
15434 [[File:Foobar.jpg|text with a [[link]] in it]]
15435 !! html/php
15436 <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>
15437 </p>
15438 !! html/parsoid
15439 <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>
15440 !! end
15441
15442 !! test
15443 T2648: Frameless image caption with a link (suffix)
15444 !! wikitext
15445 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15446 !! html/php
15447 <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>
15448 </p>
15449 !! html/parsoid
15450 <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>
15451 !! end
15452
15453 !! test
15454 T2648: Frameless image caption with an interwiki link
15455 !! wikitext
15456 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15457 !! html/php
15458 <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>
15459 </p>
15460 !! html/parsoid
15461 <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>
15462 !! end
15463
15464 !! test
15465 T2648: Frameless image caption with a piped interwiki link
15466 !! wikitext
15467 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15468 !! html/php
15469 <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>
15470 </p>
15471 !! html/parsoid
15472 <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>
15473 !! end
15474
15475 !! test
15476 T107474: Frameless image caption with <nowiki>
15477 !! wikitext
15478 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15479 !! html/parsoid
15480 <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>
15481 !! end
15482
15483 !! test
15484 Escape HTML special chars in image alt text
15485 !! wikitext
15486 [[File:Foobar.jpg|& < > "]]
15487 !! html/php
15488 <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>
15489 </p>
15490 !! html/parsoid
15491 <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>
15492 !! end
15493
15494 !! test
15495 Escape HTML special chars in image alt text with LanguageConverter
15496 !! options
15497 language=zh
15498 !! wikitext
15499 [[File:Foobar.jpg|& < > "]]
15500 !! html/php
15501 <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>
15502 </p>
15503 !! html/parsoid
15504 <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>
15505 !! end
15506
15507 !! test
15508 Entities in file name and attributes
15509 !! wikitext
15510 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15511 !! html/php
15512 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15513 </p>
15514 !! html/parsoid
15515 <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>
15516 !! end
15517
15518 !! test
15519 T2499: Alt text should have &#1234;, not &amp;1234;
15520 !! wikitext
15521 [[File:Foobar.jpg|&#9792;]]
15522 !! html/php
15523 <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>
15524 </p>
15525 !! html/parsoid
15526 <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>
15527 !! end
15528
15529 !! test
15530 Broken image caption with link
15531 !! options
15532 parsoid=wt2html,wt2wt,html2html
15533 !! wikitext
15534 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15535 !! html/php
15536 <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.
15537 </p>
15538 !! html/parsoid
15539 <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>
15540 !! end
15541
15542 !! test
15543 Image caption containing another image
15544 !! wikitext
15545 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
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>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>
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>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>
15551 !! end
15552
15553 !! test
15554 Image: caption containing a newline
15555 !! wikitext
15556 [[File:Foobar.jpg|This
15557 *is some text]]
15558 !! html/php
15559 <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>
15560 </p>
15561 !! html/parsoid
15562 <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>
15563 !!end
15564
15565 !!test
15566 Image: caption containing leading space
15567 (The leading space should not trigger nowiki escaping in wt2wt mode)
15568 !! wikitext
15569 [[File:Foobar.jpg|thumb| bar]]
15570 !! html/php
15571 <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>
15572
15573 !! html/parsoid
15574 <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>
15575 !!end
15576
15577 # html/php output not have newlines after table, td, th, etc. because
15578 # Linker::makeThumbLink2() replaces the newlines with spaces since
15579 # the table is inside a caption.
15580 # FIXME: Verify if that circa 2004 fix is still required.
15581 !! test
15582 Image: caption containing a table
15583 !! options
15584 parsoid=wt2html,wt2wt,html2html
15585 !! wikitext
15586 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15587 {|
15588 !Foo!!Bar
15589 |-
15590 |Foo1||Bar1
15591 |}
15592 and some more text.]]
15593 !! html/php
15594 <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>
15595
15596 !! html/parsoid
15597 <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
15598 <table>
15599 <tbody>
15600 <tr><th>Foo</th><th>Bar</th></tr>
15601 <tr>
15602 <td>Foo1</td>
15603 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15604 !! end
15605
15606 !! test
15607 T5090: External links other than http: in image captions
15608 !! wikitext
15609 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15610 !! html/php
15611 <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>
15612
15613 !! html/parsoid
15614 <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>
15615 !! end
15616
15617 !! test
15618 Custom class
15619 !! options
15620 parsoid=wt2html,wt2wt,html2html
15621 !! wikitext
15622 [[Image:foobar.jpg|a|class=b]]
15623 !! html/php
15624 <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>
15625 </p>
15626 !! html/parsoid
15627 <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>
15628 !! end
15629
15630 !! test
15631 Localized image handling (1).
15632 !! options
15633 parsoid=wt2html,wt2wt,html2html
15634 language=es
15635 !! wikitext
15636 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15637 !! html/php
15638 <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>
15639
15640 !! html/parsoid
15641 <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>
15642 !! end
15643
15644 !! test
15645 Localized image handling (2).
15646 !! options
15647 thumbsize=220
15648 parsoid=wt2html,wt2wt,html2html
15649 language=es
15650 !! wikitext
15651 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15652 !! html/php
15653 <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>
15654
15655 !! html/parsoid
15656 <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>
15657 !! end
15658
15659 !! test
15660 Localized image handling (3).
15661 !! options
15662 language=fa
15663 parsoid=html2wt
15664 !! html/parsoid
15665 <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>
15666 !! wikitext
15667 [[File:Foobar.jpg|بندانگشتی]]
15668 !! end
15669
15670 !! test
15671 "border", "frameless" and "class" attributes on an image.
15672 !! options
15673 thumbsize=220
15674 parsoid=wt2html,wt2wt,html2html
15675 !! wikitext
15676 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15677 !! html/php
15678 <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>
15679 </p>
15680 !! html/parsoid
15681 <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>
15682 !! end
15683
15684 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15685 !! test
15686 Invalid image attributes (T64500)
15687 !! options
15688 thumbsize=220
15689 parsoid=wt2html,wt2wt,html2html
15690 !! wikitext
15691 [[File:Foobar.jpg|thumb|float|left|caption]]
15692
15693 [[File:Foobar.jpg|thumb|righ|caption]]
15694
15695 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15696 !! html/php
15697 <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>
15698 <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>
15699 <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>
15700
15701 !! html/parsoid
15702 <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>
15703 <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>
15704 <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>
15705 !! end
15706
15707 !! article
15708 File:Barfoo.jpg
15709 !! text
15710 #REDIRECT [[File:Barfoo.jpg]]
15711 !! endarticle
15712
15713 # FIXME: Parsoid should run this test -- but we'd need to teach the
15714 # mockAPI about the redirected Barfoo.jpg image.
15715 !! test
15716 Redirected image
15717 !! wikitext
15718 [[Image:Barfoo.jpg]]
15719 !! html/php
15720 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15721 </p>
15722 !! end
15723
15724 !! test
15725 Missing image with uploads disabled
15726 !! options
15727 wgEnableUploads=0
15728 !! wikitext
15729 [[File:Foobaz.jpg]]
15730 !! html/php
15731 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15732 </p>
15733 !! html/parsoid
15734 <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>
15735 !! end
15736
15737 # Parsoid-specific testing for images
15738 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15739 # Currently imperfect due to a flaw in the Parsoid testrunner
15740 # Work in progress
15741 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15742 # image tests.
15743
15744 !! test
15745 Parsoid-specific image handling - simple image with size and middle alignment
15746 !! wikitext
15747 [[File:Foobar.jpg|middle|50px]]
15748 !! html/parsoid
15749 <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>
15750 !! end
15751
15752 !! test
15753 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
15754 !! options
15755 parsoid=wt2wt,wt2html,html2html
15756 !! wikitext
15757 [[Image:Foobar.jpg|middle|50px]]
15758 !! html/parsoid
15759 <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>
15760 !! end
15761
15762 !! test
15763 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
15764 !! wikitext
15765 [[File:Foobar.jpg|50px|middle]]
15766 !! html/parsoid
15767 <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>
15768 !! end
15769
15770 !! test
15771 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
15772 !! options
15773 parsoid=wt2html,wt2wt,html2html
15774 !! wikitext
15775 [[Image:Foobar.jpg|50px|middle]]
15776 !! html/parsoid
15777 <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>
15778 !! end
15779
15780 !! test
15781 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15782 !! wikitext
15783 [[File:Foobar.jpg|500x10px|baseline|caption]]
15784 !! html/parsoid
15785 <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>
15786 !! end
15787
15788 !! test
15789 Parsoid-specific image handling - simple image with border and size spec
15790 !! wikitext
15791 [[File:Foobar.jpg|50px|border|caption]]
15792 !! html/parsoid
15793 <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>
15794 !! end
15795
15796 !! test
15797 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15798 !! options
15799 parsoid=wt2html,html2html
15800 !! wikitext
15801 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15802 !! html/parsoid
15803 <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>
15804 !! end
15805
15806 !! test
15807 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
15808 !! options
15809 parsoid=wt2html,html2html
15810 !! wikitext
15811 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15812 !! html/parsoid
15813 <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>
15814 !! end
15815
15816 !! test
15817 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15818 !! options
15819 parsoid=wt2html,html2html
15820 !! wikitext
15821 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15822 !! html/parsoid
15823 <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>
15824 !! end
15825
15826 !! test
15827 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
15828 !! options
15829 parsoid=wt2html,html2html
15830 !! wikitext
15831 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15832 !! html/parsoid
15833 <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>
15834 !! end
15835
15836 !! test
15837 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
15838 !! options
15839 parsoid=wt2html,wt2wt,html2html
15840 !! wikitext
15841 [[File:Foobar.jpg|frame|500x50px|caption]]
15842 !! html/parsoid
15843 <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>
15844 !! end
15845
15846 !! test
15847 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
15848 !! options
15849 parsoid=wt2html,html2html
15850 !! wikitext
15851 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15852 !! html/parsoid
15853 <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>
15854 !! end
15855
15856 !! test
15857 Parsoid-specific image handling - frameless image with specific size, border, and caption
15858 !! wikitext
15859 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15860 !! html/parsoid
15861 <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>
15862 !! end
15863
15864 !! test
15865 Parsoid-specific image handling - simple image with a formatted caption
15866 !! wikitext
15867 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15868 !! html/parsoid
15869 <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>
15870 !! end
15871
15872 !! test
15873 Parsoid-specific image handling - caption with a template in it
15874 !! wikitext
15875 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15876 !! html/parsoid
15877 <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>
15878 !! end
15879
15880 !! test
15881 Parsoid-specific image handling - caption with unbalanced tags in it
15882 !! options
15883 parsoid=wt2html,wt2wt,html2html
15884 !! wikitext
15885 foo
15886 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15887 bar
15888 !! html/parsoid
15889 <p>foo</p>
15890 <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>
15891 <p>bar</p>
15892 !! end
15893
15894 !! test
15895 Parsoid-specific image handling - empty caption (1)
15896 !! options
15897 parsoid=wt2html,wt2wt
15898 !! wikitext
15899 [[File:Foobar.jpg|thumb|]]
15900 !! html/parsoid
15901 <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>
15902 !! end
15903
15904 # empty captions don't get serialized unless we're in the "round trip" case
15905 !! test
15906 Parsoid-specific image handling - empty caption (2)
15907 !! options
15908 parsoid=html2wt
15909 !! html/parsoid
15910 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15911 <a href="./File:Foobar.jpg">
15912 <img resource="./File:Foobar.jpg"
15913 src="//example.com/images/3/3a/Foobar.jpg"
15914 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15915 height="25" width="220"/>
15916 </a>
15917 <figcaption></figcaption>
15918 </figure>
15919 !! wikitext
15920 [[File:Foobar.jpg|thumb]]
15921 !! end
15922
15923 !! test
15924 Parsoid-specific image handling - whitespace caption
15925 !! wikitext
15926 [[File:Foobar.jpg|thumb| ]]
15927 !! html/parsoid
15928 <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>
15929 !! end
15930
15931 !! test
15932 Parsoid-specific image handling - lang option
15933 !! wikitext
15934 foo
15935 [[File:Foobar.svg|lang=de|caption]]
15936 bar
15937 !! html/parsoid
15938 <p>foo
15939 <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>
15940 bar</p>
15941 !! end
15942
15943 ## Edge case bugs in Parsoid from T93580
15944 !! test
15945 T93580: 1. Templated <ref> inside block images
15946 !! wikitext
15947 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15948
15949 <references />
15950 !! html/parsoid
15951 <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>
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" data-parsoid="{}">foo</span></li></ol>
15954 !! end
15955
15956 !! test
15957 T93580: 2. <ref> inside inline images
15958 !! wikitext
15959 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15960
15961 <references />
15962 !! html/parsoid
15963 <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>
15964
15965 <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>
15966 !! end
15967
15968 !! test
15969 T93580: 3. Templated <ref> inside inline images
15970 !! wikitext
15971 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15972
15973 <references />
15974 !! html/parsoid
15975 <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>
15976
15977 <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>
15978 !! end
15979
15980 ###
15981 ### Subpages
15982 ###
15983 !! article
15984 Subpage test/subpage
15985 !! text
15986 foo
15987 !! endarticle
15988
15989 !! test
15990 Subpage link
15991 !! options
15992 subpage title=[[Subpage test]]
15993 !! wikitext
15994 [[/subpage]]
15995 !! html
15996 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15997 </p>
15998 !! end
15999
16000 !! test
16001 Subpage noslash link
16002 !! options
16003 subpage title=[[Subpage test]]
16004 !! wikitext
16005 [[/subpage/]]
16006 !! html
16007 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16008 </p>
16009 !! end
16010
16011 !! article
16012 Subpage test/1/2/subpage
16013 !! text
16014 blah
16015 !! endarticle
16016
16017 !! test
16018 Relative subpage noslash link
16019 !! options
16020 parsoid=wt2wt,wt2html,html2html
16021 subpage title=[[Subpage test/1/2/3/4]]
16022 !! wikitext
16023 [[../../subpage/]]
16024
16025 [[../../subpage]]
16026 !! html/php
16027 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16028 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16029 </p>
16030 !! html/parsoid
16031 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16032 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16033 !! end
16034
16035 !! test
16036 Parsoid: dot-slash prefixed wikilinks
16037 !! wikitext
16038 [[./foo]]
16039
16040 [[././bar]]
16041
16042 [[././baz/]]
16043 !! html/php
16044 <p>[[./foo]]
16045 </p><p>[[././bar]]
16046 </p><p>[[././baz/]]
16047 </p>
16048 !! html/parsoid
16049 <p>[[./foo]]
16050 </p><p>[[././bar]]
16051 </p><p>[[././baz/]]
16052 </p>
16053 !! end
16054
16055 !! test
16056 Render invalid page names as plain text (T53090)
16057 !! wikitext
16058 [[./../foo|bar]]
16059 [[foo�|bar]]
16060 [[foo/.|bar]]
16061 [[foo/..|bar]]
16062 [[foo~~~bar]]
16063 [[foo>bar]]
16064 [[foo[bar]]
16065 [[.]]
16066 [[..]]
16067 [[foo././bar]]
16068 [[foo[http://example.com]xyz]]
16069
16070 [[{{echo|./../foo}}|bar]]
16071 [[{{echo|foo/.}}|bar]]
16072 [[{{echo|foo/..}}|bar]]
16073 [[{{echo|foo~~~~bar}}]]
16074 [[{{echo|foo>bar}}]]
16075 [[{{echo|foo././bar}}]]
16076 [[{{echo|foo{bar}}]]
16077 [[{{echo|foo}bar}}]]
16078 [[{{echo|foo[bar}}]]
16079 [[{{echo|foo]bar}}]]
16080 [[{{echo|foo<bar}}]]
16081 !!html/php
16082 <p>[[./../foo|bar]]
16083 [[foo�|bar]]
16084 [[foo/.|bar]]
16085 [[foo/..|bar]]
16086 [[foo~~~bar]]
16087 [[foo&gt;bar]]
16088 [[foo[bar]]
16089 [[.]]
16090 [[..]]
16091 [[foo././bar]]
16092 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16093 </p><p>[[./../foo|bar]]
16094 [[foo/.|bar]]
16095 [[foo/..|bar]]
16096 [[foo~~~~bar]]
16097 [[foo&gt;bar]]
16098 [[foo././bar]]
16099 [[foo{bar]]
16100 [[foo}bar]]
16101 [[foo[bar]]
16102 [[foo]bar]]
16103 [[foo&lt;bar]]
16104 </p>
16105 !!html/parsoid
16106 <p>[[./../foo|bar]]
16107 [[foo�|bar]]
16108 [[foo/.|bar]]
16109 [[foo/..|bar]]
16110 [[foo~~~bar]]
16111 [[foo>bar]]
16112 [[foo[bar]]
16113 [[.]]
16114 [[..]]
16115 [[foo././bar]]
16116 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16117
16118 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16119 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16120 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16121 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16122 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16123 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16124 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16125 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16126 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16127 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16128 [[<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>
16129 !!end
16130
16131 !! test
16132 Disabled subpages
16133 !! wikitext
16134 [[/subpage]]
16135 !! html
16136 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16137 </p>
16138 !! end
16139
16140 !! test
16141 T2561: {{/Subpage}}
16142 !! options
16143 subpage title=[[Page]]
16144 !! wikitext
16145 {{/Subpage}}
16146 !! html
16147 <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>
16148 </p>
16149 !! end
16150
16151 ###
16152 ### Categories
16153 ###
16154 !! article
16155 Category:MediaWiki User's Guide
16156 !! text
16157 blah
16158 !! endarticle
16159
16160 !! test
16161 Link to category
16162 !! wikitext
16163 [[:Category:MediaWiki User's Guide]]
16164 !! html
16165 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16166 </p>
16167 !! end
16168
16169 !! test
16170 Simple category
16171 !! options
16172 cat
16173 !! wikitext
16174 [[Category:MediaWiki User's Guide]]
16175 !! html/php
16176 cat=MediaWiki_User's_Guide sort=
16177 !! html/parsoid
16178 <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"}}'/>
16179 !! end
16180
16181 !! test
16182 PAGESINCATEGORY invalid title fatal (r33546 fix)
16183 !! wikitext
16184 {{PAGESINCATEGORY:<bogus>}}
16185 !! html
16186 <p>0
16187 </p>
16188 !! end
16189
16190 !! test
16191 Category with different sort key
16192 !! options
16193 cat
16194 !! wikitext
16195 [[Category:MediaWiki User's Guide|Foo]]
16196 !! html/php
16197 cat=MediaWiki_User's_Guide sort=Foo
16198 !! html/parsoid
16199 <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"}}'/>
16200 !! end
16201
16202 !! test
16203 Category with identical sort key
16204 !! options
16205 cat
16206 !! wikitext
16207 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16208 !! html/php
16209 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16210 !! html/parsoid
16211 <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"}}'/>
16212 !! end
16213
16214 !! test
16215 Category with empty sort key
16216 !! options
16217 cat
16218 pst
16219 !! wikitext
16220 [[Category:MediaWiki User's Guide|]]
16221 !! html/php
16222 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16223 !! end
16224
16225 !! test
16226 Category with empty sort key and parentheses
16227 !! options
16228 cat
16229 pst
16230 !! wikitext
16231 [[Category:Foo (bar)|]]
16232 !! html/php
16233 [[Category:Foo (bar)|Foo]]
16234 !! end
16235
16236 !! test
16237 Category with link tail
16238 !! options
16239 cat
16240 pst
16241 !! wikitext
16242 123[[Category:Foo]]456
16243 !! html/php
16244 123[[Category:Foo]]456
16245 !! end
16246
16247 !! test
16248 Category with template
16249 !! options
16250 cat
16251 pst
16252 !! wikitext
16253 [[Category:{{echo|Foo}}]]
16254 !! html/php
16255 [[Category:{{echo|Foo}}]]
16256 !! end
16257
16258 !! test
16259 Category with template in sort key
16260 !! options
16261 cat
16262 pst
16263 !! wikitext
16264 [[Category:Foo|{{echo|Bar}}]]
16265 !! html/php
16266 [[Category:Foo|{{echo|Bar}}]]
16267 !! end
16268
16269 !! test
16270 Category with template in sort key and title
16271 !! options
16272 cat
16273 pst
16274 !! wikitext
16275 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16276 !! html/php
16277 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16278 !! end
16279
16280 ## We used to, but no longer wt2wt this test since the default serializer
16281 ## will normalize all categories to serialize on their own line.
16282 ## This wikitext usage is going to be fairly uncommon in production and
16283 ## selser will take care of preserving formatting in those scenarios.
16284 !! test
16285 Category / paragraph interactions
16286 !! options
16287 parsoid=wt2html
16288 !! wikitext
16289 Foo [[Category:Baz]] Bar
16290
16291 Foo [[Category:Baz]]
16292 Bar
16293
16294 Foo
16295 [[Category:Baz]]
16296 Bar
16297
16298 Foo
16299 [[Category:Baz]] Bar
16300
16301 Foo
16302 [[Category:Baz]]
16303 [[Category:Baz]]
16304 [[Category:Baz]]
16305 Bar
16306
16307 [[Category:Baz]]
16308 [[Category:Baz]]
16309 [[Category:Baz]]
16310
16311 [[Category:Baz]]
16312 {{echo|[[Category:Baz]]}}
16313 [[Category:Baz]]
16314 !! html/php
16315 <p>Foo Bar
16316 </p><p>Foo
16317 Bar
16318 </p><p>Foo
16319 Bar
16320 </p><p>Foo Bar
16321 </p><p>Foo
16322 Bar
16323 </p>
16324 !! html/parsoid
16325 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16326 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16327 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16328 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16329 <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>
16330 <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}}]}'/>
16331 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16332 !! end
16333
16334 ## We used to, but no longer wt2wt this test since the default serializer
16335 ## will normalize all categories to serialize on their own line.
16336 ## This wikitext usage is going to be fairly uncommon in production and
16337 ## selser will take care of preserving formatting in those scenarios.
16338 ##
16339 ## The whitespace on the empty line is part of the test. Please do not delete
16340 !! test
16341 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16342 !! options
16343 parsoid=wt2html
16344 !! wikitext
16345 This
16346
16347 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16348
16349 {{echo|[[Category:Foo]] and so should this!}}
16350 !! html/php
16351 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16352 </p>
16353 !! html/parsoid
16354 <p>This
16355
16356 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16357
16358 <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>
16359 !! end
16360
16361 ## Parsoid will not try to wt2wt this while preserving newlines because
16362 ## it suppresses excess newlines within list items -- and we don't want to
16363 ## introduce a special case just for categories, which is, in reality somewhat
16364 ## odd behavior -- categories are unlikely to be used in list items like this
16365 ## in top-level pages and are only likely to show up in template-generated
16366 ## list items where this RT-ing is a non-issue.
16367 ##
16368 ## The whitespace on the empty line is part of the test. Please do not delete
16369 !! test
16370 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16371 !! options
16372 parsoid=wt2html
16373 !! wikitext
16374 * This
16375
16376 [[Category:Foo]] and this should be part of the same list item
16377 * So should this
16378
16379 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16380 !! html
16381 <ul><li>This and this should be part of the same list item</li>
16382 <li>So should this and this should be part of the same list item</li></ul>
16383 !! html/parsoid
16384 <ul>
16385 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16386 <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>
16387 </ul>
16388 !! end
16389
16390 ## Newlines and categories that follow the last item of a list
16391 ## are treated differently because this (list followed by categories)
16392 ## is an extremely common pattern on wikis.
16393 !! test
16394 3. Categories and newlines: newline suppression for last list item should RT properly
16395 !! wikitext
16396 *a
16397 *b
16398
16399 [[Category:Foo]]
16400
16401 [[Category:Bar]]
16402 [[Category:Baz]]
16403
16404 :c
16405
16406 [[Category:C]]
16407
16408 ;d
16409
16410 [[Category:D]]
16411 !! html/parsoid
16412 <ul><li>a</li>
16413 <li>b</li></ul>
16414
16415 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16416
16417 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16418 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16419
16420 <dl><dd>c</dd></dl>
16421
16422 <link rel="mw:PageProp/Category" href="./Category:C"/>
16423
16424 <dl><dt>d</dt></dl>
16425
16426 <link rel="mw:PageProp/Category" href="./Category:D"/>
16427 !! end
16428
16429 !! test
16430 4. Categories and newlines: newline suppression for last list item should RT properly
16431 !! wikitext
16432 *a
16433 ****b
16434
16435 [[Category:Foo]]
16436 !! html/parsoid
16437 <ul><li>a
16438 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16439
16440 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16441 !! end
16442
16443 ## only wt2html for this to make sure the algo only applies to the rightmost path
16444 !! test
16445 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16446 !! options
16447 parsoid=wt2html
16448 !! wikitext
16449 *a
16450 **b
16451 [[Category:Foo]]
16452 *c
16453 **d
16454 [[Category:Foo]]
16455 !! html/parsoid
16456 <ul><li>a
16457 <ul><li>b
16458 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16459 <li>c
16460 <ul><li>d</li></ul></li></ul>
16461 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16462 !! end
16463
16464 ## We used to, but no longer wt2wt this test since the default serializer
16465 ## will normalize all categories to serialize on their own line.
16466 ## This wikitext usage is going to be fairly uncommon in production and
16467 ## selser will take care of preserving formatting in those scenarios.
16468 !! test
16469 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16470 !! options
16471 parsoid=wt2html
16472 !! wikitext
16473 *a [[Category:Foo]]
16474 !! html/parsoid
16475 <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>
16476 !! end
16477
16478 # This test also demonstrates because of newline+category tunneling
16479 # through the list hander, template wrapping doesn't expand to the
16480 # containing list when the list item swallows the category.
16481 !! test
16482 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16483 !! wikitext
16484 *{{echo|a
16485 [[Category:Foo]]}}
16486 !! html/parsoid
16487 <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
16488 </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>
16489 !! end
16490
16491 !! test
16492 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16493 !! wikitext
16494 *a
16495
16496 {{echo|[[Category:Foo]]
16497 [[Category:Bar]]}}
16498 [[Category:Baz]]
16499 !! html/parsoid
16500 <ul><li>a</li></ul>
16501
16502 <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">
16503 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16504 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16505 !! end
16506
16507 !! test
16508 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
16509 !! wikitext
16510 *a
16511
16512 [[Category:Bar]]<!--boo1--> <!--boo2-->
16513 [[Category:Baz]]<!--boo3--> <!--boo4-->
16514 !! html/parsoid
16515 <ul><li>a</li></ul>
16516
16517 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
16518 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
16519 !! end
16520
16521 !! test
16522 Categories and newlines: should behave properly with linkprefix (T87753)
16523 !! options
16524 language=ar
16525 !! wikitext
16526 foo bar
16527 foo bar
16528 [[تصنيف:Foo]]
16529 [[تصنيف:Bar]]
16530 !! html/php
16531 <p>foo bar
16532 foo bar
16533 </p>
16534 !! html/parsoid
16535 <p>foo bar
16536 foo bar</p>
16537 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16538 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16539 !! end
16540
16541 !! test
16542 No regressions on internal links following category (T174639)
16543 !! options
16544 parsoid=wt2html,html2html
16545 !! wikitext
16546 [[Category:Foo]]<div>a
16547
16548 [[Foo]]</div>
16549 !! html/php
16550 <div>a
16551 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16552
16553 !! html/parsoid
16554 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16555
16556 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16557 !! end
16558
16559 # Note that Parsoid differs slightly from PHP due to T175421
16560 !! test
16561 11. Special case where only newlines separate links (T175416)
16562 !! options
16563 parsoid=wt2html,html2html
16564 !! wikitext
16565 [[Category:Foo]]
16566
16567 [[Foo]][[es:Alimento]]
16568
16569 [[Foo]]
16570 !! html/php
16571 <p><br />
16572 <a href="/wiki/Foo" title="Foo">Foo</a>
16573 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16574 </p>
16575 !! html/parsoid
16576 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16577
16578 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16579
16580 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16581 !! end
16582
16583 !! test
16584 Category links with multiple namespaces
16585 !! wikitext
16586 [[Category:Project:Foo]]
16587 !! html/parsoid
16588 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16589 !! end
16590
16591 !! test
16592 Parsoid: Serialize link to category page with colon escape
16593 !! options
16594 parsoid
16595 !! wikitext
16596
16597 [[:Category:Foo]]
16598 [[:Category:Foo|Bar]]
16599 !! html
16600 <p>
16601 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16602 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16603 </p>
16604 !! end
16605
16606 # We used to, but no longer wt2wt this test since the default serializer
16607 # will normalize all categories to serialize on their own line.
16608 # This wikitext usage is going to be fairly uncommon in production and
16609 # selser will take care of preventing whitespace insertion if this
16610 # occurs in an article.
16611 #
16612 # html2html disabled for the same reason (whitespace insertion between
16613 # x and y).
16614 #
16615 # html2wt disabled because it localizes the "Category" namespace.
16616 !! test
16617 Link prefix/suffixes aren't applied to category links
16618 !! options
16619 parsoid=wt2html
16620 language=is
16621 !! wikitext
16622 x[[Category:Foo]]y
16623 !! html/php
16624 <p>xy
16625 </p>
16626 !! html/parsoid
16627 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16628 !! end
16629
16630 !! test
16631 Link prefix/suffixes aren't applied to language links
16632 !! options
16633 parsoid=wt2html
16634 language=is
16635 !! wikitext
16636 x[[es:Foo]]y
16637 !! html/php
16638 <p>xy
16639 </p>
16640 !! html/parsoid
16641 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16642 !! end
16643
16644 !! test
16645 Parsoid: Serialize link to file page with colon escape
16646 !! options
16647 parsoid
16648 !! wikitext
16649
16650 [[:File:Foo.png]]
16651 [[:File:Foo.png|Bar]]
16652 !! html
16653 <p>
16654 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16655 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16656 </p>
16657 !! end
16658
16659 !! test
16660 Parsoid: Serialize a genuine category link without colon escape
16661 !! options
16662 parsoid
16663 !! wikitext
16664 [[Category:Foo]]
16665 [[Category:Foo|Bar]]
16666 !! html
16667 <link rel="mw:PageProp/Category" href="./Category:Foo">
16668 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16669 !! end
16670
16671 !! test
16672 Normalize hrefs properly before testing for invalid link targets (T72894)
16673 !! options
16674 parsoid=html2wt
16675 !! html/parsoid
16676 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16677 !! wikitext
16678 [[Category:Toxine bactérienne]]
16679 !! end
16680
16681 !! test
16682 Parsoid: Defaultsort
16683 !! wikitext
16684 {{DEFAULTSORT:Foo}}
16685 !! html/parsoid
16686 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16687 !! end
16688
16689 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16690 # But, this is a limitation of our representation and is documented in
16691 # TemplateHandler.js in processSpecialMagicWord
16692 !! test
16693 Parsoid: Defaultsort (template-generated)
16694 !! wikitext
16695 {{{{echo|DEFAULTSORT}}:Foo}}
16696 !! html/parsoid
16697 <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"}]]}'/>
16698 !! end
16699
16700 ###
16701 ### Inter-language links
16702 ###
16703 !! test
16704 Interlanguage links
16705 !! options
16706 ill
16707 !! wikitext
16708 [[es:Alimento]]
16709 [[fr:Nourriture]]
16710 [[zh:食品]]
16711 !! html/php
16712 es:Alimento fr:Nourriture zh:食品
16713 !! html/parsoid
16714 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16715 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16716 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16717 !! end
16718
16719 !! test
16720 Duplicate interlanguage links (T26502)
16721 !! options
16722 ill
16723 !! wikitext
16724 [[es:1]]
16725 [[es:2]]
16726 [[fr:1]]
16727 [[fr:2]]
16728 !! html/php
16729 es:1 fr:1
16730 !! html/parsoid
16731 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16732 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16733 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16734 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16735 !! end
16736
16737 ###
16738 ### Sections
16739 ###
16740 !! test
16741 Basic section headings
16742 !! wikitext
16743 ==Headline 1==
16744 Some text
16745
16746 ==Headline 2==
16747 More
16748 ===Smaller headline===
16749 Blah blah
16750 !! html
16751 <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>
16752 <p>Some text
16753 </p>
16754 <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>
16755 <p>More
16756 </p>
16757 <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>
16758 <p>Blah blah
16759 </p>
16760 !! end
16761
16762 !! test
16763 Section headings with TOC
16764 !! wikitext
16765 ==Headline 1==
16766 ===Subheadline 1===
16767 =====Skipping a level=====
16768 ======Skipping a level======
16769
16770 ==Headline 2==
16771 Some text
16772 ===Another headline===
16773 !! html
16774 <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>
16775 <ul>
16776 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16777 <ul>
16778 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16779 <ul>
16780 <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>
16781 <ul>
16782 <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>
16783 </ul>
16784 </li>
16785 </ul>
16786 </li>
16787 </ul>
16788 </li>
16789 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16790 <ul>
16791 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16792 </ul>
16793 </li>
16794 </ul>
16795 </div>
16796
16797 <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>
16798 <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>
16799 <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>
16800 <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>
16801 <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>
16802 <p>Some text
16803 </p>
16804 <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>
16805
16806 !! end
16807
16808 !! test
16809 TOC anchors don't collide
16810 !! wikitext
16811 __FORCETOC__
16812 ==Headline 2==
16813 ==Headline==
16814 ==Headline 2==
16815 ==Headline==
16816 !! html/php
16817 <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>
16818 <ul>
16819 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16820 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16821 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16822 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16823 </ul>
16824 </div>
16825
16826 <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>
16827 <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>
16828 <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>
16829 <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>
16830
16831 !! end
16832
16833 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16834 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16835 !! test
16836 Handling of sections up to level 6 and beyond
16837 !! options
16838 parsoid=wt2html
16839 !! wikitext
16840 =Level 1 Heading=
16841 ==Level 2 Heading==
16842 ===Level 3 Heading===
16843 ====Level 4 Heading====
16844 =====Level 5 Heading=====
16845 ======Level 6 Heading======
16846 =======Level 7 Heading=======
16847 ========Level 8 Heading========
16848 =========Level 9 Heading=========
16849 ==========Level 10 Heading==========
16850 !! html/php
16851 <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>
16852 <ul>
16853 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16854 <ul>
16855 <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>
16856 <ul>
16857 <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>
16858 <ul>
16859 <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>
16860 <ul>
16861 <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>
16862 <ul>
16863 <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>
16864 <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>
16865 <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>
16866 <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>
16867 <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>
16868 </ul>
16869 </li>
16870 </ul>
16871 </li>
16872 </ul>
16873 </li>
16874 </ul>
16875 </li>
16876 </ul>
16877 </li>
16878 </ul>
16879 </div>
16880
16881 <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>
16882 <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>
16883 <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>
16884 <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>
16885 <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>
16886 <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>
16887 <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>
16888 <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>
16889 <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>
16890 <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>
16891
16892 !! html/parsoid
16893 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16894 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16895 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16896 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16897 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16898 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16899 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16900 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16901 <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>
16902 <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>
16903 !! end
16904
16905 !! test
16906 TOC regression (T11764)
16907 !! wikitext
16908 ==title 1==
16909 ===title 1.1===
16910 ====title 1.1.1====
16911 ===title 1.2===
16912 ==title 2==
16913 ===title 2.1===
16914 !! html
16915 <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>
16916 <ul>
16917 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16918 <ul>
16919 <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>
16920 <ul>
16921 <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>
16922 </ul>
16923 </li>
16924 <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>
16925 </ul>
16926 </li>
16927 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16928 <ul>
16929 <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>
16930 </ul>
16931 </li>
16932 </ul>
16933 </div>
16934
16935 <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>
16936 <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>
16937 <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>
16938 <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>
16939 <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>
16940 <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>
16941
16942 !! end
16943
16944 !! test
16945 TOC for heading containing <span id="..."></span> (T96153)
16946 !! wikitext
16947 __FORCETOC__
16948 ==<span id="old-anchor"></span>New title==
16949 !! html/php
16950 <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>
16951 <ul>
16952 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16953 </ul>
16954 </div>
16955
16956 <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>
16957
16958 !! end
16959
16960 !! test
16961 TOC with wgMaxTocLevel=3 (T8204)
16962 !! options
16963 wgMaxTocLevel=3
16964 !! wikitext
16965 ==title 1==
16966 ===title 1.1===
16967 ====title 1.1.1====
16968 ===title 1.2===
16969 ==title 2==
16970 ===title 2.1===
16971 !! html
16972 <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>
16973 <ul>
16974 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16975 <ul>
16976 <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>
16977 <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>
16978 </ul>
16979 </li>
16980 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16981 <ul>
16982 <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>
16983 </ul>
16984 </li>
16985 </ul>
16986 </div>
16987
16988 <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>
16989 <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>
16990 <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>
16991 <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>
16992 <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>
16993 <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>
16994
16995 !! end
16996
16997 !! test
16998 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16999 !! options
17000 wgMaxTocLevel=3
17001 !! wikitext
17002 ==Section 1==
17003 ===Section 1.1===
17004 ====Section 1.1.1====
17005 ====Section 1.1.1.1====
17006 ==Section 2==
17007 !! html
17008 <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>
17009 <ul>
17010 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17011 <ul>
17012 <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>
17013 </ul>
17014 </li>
17015 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17016 </ul>
17017 </div>
17018
17019 <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>
17020 <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>
17021 <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>
17022 <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>
17023 <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>
17024
17025 !! end
17026
17027
17028 !! test
17029 Resolving duplicate section names
17030 !! wikitext
17031 ==Foo bar==
17032 ==Foo bar==
17033 !! html
17034 <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>
17035 <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>
17036
17037 !! end
17038
17039 !! test
17040 Resolving duplicate section names with differing case (T12721)
17041 !! wikitext
17042 ==Foo bar==
17043 ==Foo Bar==
17044 !! html
17045 <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>
17046 <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>
17047
17048 !! end
17049
17050 !! article
17051 Template:sections
17052 !! text
17053 ===Section 1===
17054 ==Section 2==
17055 !! endarticle
17056
17057 !! test
17058 Template with sections, __NOTOC__
17059 !! wikitext
17060 __NOTOC__
17061 ==Section 0==
17062 {{sections}}
17063 ==Section 4==
17064 !! html
17065 <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>
17066 <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>
17067 <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>
17068 <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>
17069
17070 !! end
17071
17072 !! test
17073 __NOEDITSECTION__ keyword
17074 !! wikitext
17075 __NOEDITSECTION__
17076 ==Section 1==
17077 ==Section 2==
17078 !! html
17079 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17080 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17081
17082 !! end
17083
17084 !! test
17085 Link inside a section heading
17086 !! wikitext
17087 ==Section with a [[Main Page|link]] in it==
17088 !! html
17089 <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>
17090
17091 !! end
17092
17093 !! test
17094 TOC regression (T14077)
17095 !! wikitext
17096 __TOC__
17097 ==title 1==
17098 ===title 1.1===
17099 ==title 2==
17100 !! html
17101 <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>
17102 <ul>
17103 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17104 <ul>
17105 <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>
17106 </ul>
17107 </li>
17108 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17109 </ul>
17110 </div>
17111
17112 <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>
17113 <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>
17114 <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>
17115
17116 !! end
17117
17118 !! test
17119 T3219 URL next to image (good)
17120 !! wikitext
17121 http://example.com [[File:Foobar.jpg]]
17122 !! html/php
17123 <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>
17124 </p>
17125 !! html/parsoid
17126 <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>
17127 !!end
17128
17129 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17130 !! test
17131 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17132 !! options
17133 parsoid=wt2html,html2html
17134 !! wikitext
17135 ===
17136 The line above must have a trailing space!
17137 === <!--
17138 --> <!-- -->
17139 But just in case it doesn't...
17140 !! html/php
17141 <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>
17142 <p>The line above must have a trailing space!
17143 </p>
17144 <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>
17145 <p>But just in case it doesn't...
17146 </p>
17147 !! html/parsoid
17148 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17149 <p>The line above must have a trailing space!</p>
17150 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17151 --> <!-- -->
17152 <p>But just in case it doesn't...</p>
17153 !! end
17154
17155 !! test
17156 Header with special characters (T27462)
17157 !! wikitext
17158 The tooltips shall not show entities to the user (ie. be double escaped)
17159
17160 ==text > text==
17161 section 1
17162
17163 ==text < text==
17164 section 2
17165
17166 ==text & text==
17167 section 3
17168
17169 ==text ' text==
17170 section 4
17171
17172 ==text " text==
17173 section 5
17174 !! html/php
17175 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17176 </p>
17177 <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>
17178 <ul>
17179 <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>
17180 <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>
17181 <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>
17182 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17183 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17184 </ul>
17185 </div>
17186
17187 <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>
17188 <p>section 1
17189 </p>
17190 <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>
17191 <p>section 2
17192 </p>
17193 <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>
17194 <p>section 3
17195 </p>
17196 <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>
17197 <p>section 4
17198 </p>
17199 <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>
17200 <p>section 5
17201 </p>
17202 !! html/parsoid
17203 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17204
17205 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17206 <p>section 1</p>
17207
17208 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17209 <p>section 2</p>
17210
17211 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17212 <p>section 3</p>
17213
17214 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17215 <p>section 4</p>
17216
17217 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17218 <p>section 5</p>
17219 !! end
17220
17221 !! test
17222 Header with space, plus and underscore as entity
17223 !! wikitext
17224 Id should not contain + for spaces
17225
17226 ==Space between Text==
17227 section 1
17228
17229 ==Space-Entity&#32;between&#32;Text==
17230 section 2
17231
17232 ==Plus+between+Text==
17233 section 3
17234
17235 ==Plus-Entity&#43;between&#43;Text==
17236 section 4
17237
17238 ==Underscore_between_Text==
17239 section 5
17240
17241 ==Underscore-Entity&#95;between&#95;Text==
17242 section 6
17243
17244 [[#Space between Text]]
17245 [[#Space-Entity&#32;between&#32;Text]]
17246 [[#Plus+between+Text]]
17247 [[#Plus-Entity&#43;between&#43;Text]]
17248 [[#Underscore_between_Text]]
17249 [[#Underscore-Entity&#95;between&#95;Text]]
17250 !! html/php
17251 <p>Id should not contain + for spaces
17252 </p>
17253 <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>
17254 <ul>
17255 <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>
17256 <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>
17257 <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>
17258 <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>
17259 <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>
17260 <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>
17261 </ul>
17262 </div>
17263
17264 <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>
17265 <p>section 1
17266 </p>
17267 <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>
17268 <p>section 2
17269 </p>
17270 <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>
17271 <p>section 3
17272 </p>
17273 <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>
17274 <p>section 4
17275 </p>
17276 <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>
17277 <p>section 5
17278 </p>
17279 <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>
17280 <p>section 6
17281 </p><p><a href="#Space_between_Text">#Space between Text</a>
17282 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17283 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17284 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17285 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17286 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17287 </p>
17288 !! html/parsoid
17289 <p>Id should not contain + for spaces</p>
17290
17291 <h2 id="Space_between_Text">Space between Text</h2>
17292 <p>section 1</p>
17293
17294 <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>
17295 <p>section 2</p>
17296
17297 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17298 <p>section 3</p>
17299
17300 <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>
17301 <p>section 4</p>
17302
17303 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17304 <p>section 5</p>
17305
17306 <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>
17307 <p>section 6</p>
17308
17309 <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>
17310 <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>
17311 <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>
17312 <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>
17313 <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>
17314 <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>
17315 !! end
17316
17317 # Parsoid html2wt disabled because it adds padding spaces around =
17318 !! test
17319 Headers with excess '=' characters
17320 (Are similar tests necessary beyond the 1st level?)
17321 !! options
17322 parsoid=wt2html,wt2wt,html2html
17323 !! wikitext
17324 =foo==
17325 ==foo=
17326 =''italic'' heading==
17327 ==''italic'' heading=
17328 !! html/php
17329 <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>
17330 <ul>
17331 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17332 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17333 <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>
17334 <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>
17335 </ul>
17336 </div>
17337
17338 <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>
17339 <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>
17340 <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>
17341 <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>
17342
17343 !! html/parsoid
17344 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17345 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17346 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17347 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17348 !! end
17349
17350 !! test
17351 HTML headers vs TOC (T25393)
17352 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17353 !! wikitext
17354 <h1>Header 1</h1>
17355 ==Header 1.1==
17356 ==Header 1.2==
17357
17358 <h1>Header 2
17359 </h1>
17360 ==Header 2.1==
17361 ==Header 2.2==
17362 __NOEDITSECTION__
17363 !! html/php
17364 <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>
17365 <ul>
17366 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17367 <ul>
17368 <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>
17369 <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>
17370 </ul>
17371 </li>
17372 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17373 <ul>
17374 <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>
17375 <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>
17376 </ul>
17377 </li>
17378 </ul>
17379 </div>
17380
17381 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17382 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17383 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17384 <h1><span class="mw-headline" id="Header_2">Header 2
17385 </span></h1>
17386 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17387 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17388
17389 !! html/parsoid
17390 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17391 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17392 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17393
17394 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17395 </h1>
17396 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17397 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17398 <meta property="mw:PageProp/noeditsection"/>
17399 !! end
17400
17401 !! test
17402 Single-line or multiline-comments can follow headings
17403 !! options
17404 parsoid=wt2html,wt2wt
17405 !! wikitext
17406 ==foo==<!---->
17407 ==bar==<!--c1-->
17408 ==baz==<!--
17409 c2
17410 c3-->
17411 !! html/php
17412 <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>
17413 <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>
17414 <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>
17415
17416 !! html/parsoid
17417 <h2 id="foo">foo</h2><!---->
17418 <h2 id="bar">bar</h2><!--c1-->
17419 <h2 id="baz">baz</h2><!--
17420 c2
17421 c3-->
17422 !! end
17423
17424 !! test
17425 T3219 URL next to image (broken)
17426 !! wikitext
17427 http://example.com[[File:Foobar.jpg]]
17428 !! html/php
17429 <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>
17430 </p>
17431 !! html/parsoid
17432 <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>
17433 !!end
17434
17435 !! test
17436 T3186 news: in the middle of text
17437 !! wikitext
17438 http://en.wikinews.org/wiki/Wikinews:Workplace
17439 !! html
17440 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17441 </p>
17442 !!end
17443
17444
17445 !! test
17446 Namespaced link must have a title
17447 !! wikitext
17448 [[Project:]]
17449 !! html
17450 <p>[[Project:]]
17451 </p>
17452 !!end
17453
17454 !! test
17455 Namespaced link must have a title (bad fragment version)
17456 !! wikitext
17457 [[Project:#fragment]]
17458 !! html
17459 <p>[[Project:#fragment]]
17460 </p>
17461 !!end
17462
17463
17464 ###
17465 ### HTML tags and HTML attributes
17466 ###
17467
17468 !! test
17469 div with no attributes
17470 !! wikitext
17471 <div>HTML rocks</div>
17472 !! html
17473 <div>HTML rocks</div>
17474
17475 !! end
17476
17477 !! test
17478 div with double-quoted attribute
17479 !! wikitext
17480 <div id="rock">HTML rocks</div>
17481 !! html
17482 <div id="rock">HTML rocks</div>
17483
17484 !! end
17485
17486 !! test
17487 div with single-quoted attribute
17488 !! wikitext
17489 <div id='rock'>HTML rocks</div>
17490 !! html
17491 <div id="rock">HTML rocks</div>
17492
17493 !! end
17494
17495 !! test
17496 div with unquoted attribute
17497 !! wikitext
17498 <div id=rock>HTML rocks</div>
17499 !! html
17500 <div id="rock">HTML rocks</div>
17501
17502 !! end
17503
17504 !! test
17505 div with illegal double attributes
17506 !! wikitext
17507 <div id="a" id="b">HTML rocks</div>
17508 !! html
17509 <div id="b">HTML rocks</div>
17510
17511 !!end
17512
17513 !! test
17514 div with empty attribute value, space before equals
17515 !! options
17516 parsoid=wt2html,html2html
17517 !! wikitext
17518 <div class =>HTML rocks</div>
17519 !! html/php
17520 <div class="">HTML rocks</div>
17521
17522 !! html/parsoid
17523 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17524 !! end
17525
17526 !! test
17527 div with multiple empty attribute values
17528 !! config
17529 wgFragmentMode=[ 'html5', 'legacy' ]
17530 !! options
17531 parsoid=wt2html,html2html
17532 !! wikitext
17533 <div id= title=>HTML rocks</div>
17534 !! html/php
17535 <div id="title=">HTML rocks</div>
17536
17537 !! html/parsoid
17538 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17539 !! end
17540
17541 # FIXME Parsoid doesn't actually match PHP here.
17542 # Probably we should use the synthetic <foo /> or <indicator>
17543 # extensions for this test, which are enabled when running parser tests.
17544 !! test
17545 Extension tag in attribute value
17546 !! wikitext
17547 <span title="<translate>123</translate>">ok</span>
17548 !! html/php+disabled
17549 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17550 </p>
17551 !! html/parsoid
17552 <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>
17553 !! end
17554
17555 !! test
17556 table with multiple empty attribute values
17557 !! options
17558 parsoid=wt2html,html2html
17559 !! wikitext
17560 {| title= id=
17561 |hi
17562 |}
17563 !! html/php
17564 <table title="id=">
17565 <tr>
17566 <td>hi
17567 </td></tr></table>
17568
17569 !! html/parsoid
17570 <table title="id=">
17571 <tbody><tr><td>hi</td></tr>
17572 </tbody></table>
17573 !! end
17574
17575 !! test
17576 div with braces in attribute value
17577 !! wikitext
17578 <div title="{}">Foo</div>
17579 !! html/php
17580 <div title="&#123;&#125;">Foo</div>
17581
17582 !! html/parsoid
17583 <div title="{}">Foo</div>
17584 !! end
17585
17586 !! test
17587 div with empty attribute value, no space before equals
17588 !! options
17589 parsoid=wt2html,html2html
17590 !! wikitext
17591 <div class=>HTML rocks</div>
17592 !! html/php
17593 <div class="">HTML rocks</div>
17594
17595 !! html/parsoid
17596 <div class="">HTML rocks</div>
17597 !! end
17598
17599 !! test
17600 HTML multiple attributes correction
17601 !! wikitext
17602 <p class="error" class="awesome">Awesome!</p>
17603 !! html
17604 <p class="awesome">Awesome!</p>
17605
17606 !!end
17607
17608 !! test
17609 Table multiple attributes correction
17610 !! wikitext
17611 {|
17612 !+ class="error" class="awesome"|status
17613 |}
17614 !! html
17615 <table>
17616 <tr>
17617 <th class="awesome">status
17618 </th></tr></table>
17619
17620 !!end
17621
17622 !! test
17623 DIV IN UPPERCASE
17624 !! wikitext
17625 <DIV ID="x">HTML ROCKS</DIV>
17626 !! html
17627 <div id="x">HTML ROCKS</div>
17628
17629 !!end
17630
17631 !! test
17632 Non-ASCII pseudo-tags are rendered as text
17633 !! wikitext
17634 <khyô>
17635 !! html
17636 <p>&lt;khyô&gt;
17637 </p>
17638 !! end
17639
17640 !! test
17641 Pseudo-tag with URL 'name' renders as url link
17642 !! wikitext
17643 <http://example.com/>
17644 !! html
17645 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17646 </p>
17647 !! end
17648
17649 !! test
17650 text with amp in the middle of nowhere
17651 !! wikitext
17652 Remember AT&T?
17653 !! html
17654 <p>Remember AT&amp;T?
17655 </p>
17656 !! end
17657
17658 !! test
17659 text with character entity: eacute
17660 !! wikitext
17661 I always thought &eacute; was a cute letter.
17662 !! html+tidy
17663 <p>I always thought &#233; was a cute letter.
17664 </p>
17665 !! end
17666
17667 !! test
17668 text with entity-escaped character entity-like string: eacute
17669 !! wikitext
17670 I always thought &amp;eacute; was a cute letter.
17671 !! html
17672 <p>I always thought &amp;eacute; was a cute letter.
17673 </p>
17674 !! end
17675
17676 !! test
17677 text with undefined character entity: xacute
17678 !! wikitext
17679 I always thought &xacute; was a cute letter.
17680 !! html
17681 <p>I always thought &amp;xacute; was a cute letter.
17682 </p>
17683 !! end
17684
17685 !! test
17686 HTML5 tags
17687 !! wikitext
17688 <data value="5">five</data>
17689 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17690 <mark>This highlighted text</mark>
17691 !! html
17692 <p><data value="5">five</data>
17693 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17694 <mark>This highlighted text</mark>
17695 </p>
17696 !! end
17697
17698 !! test
17699 HTML tag with leading space is parsed as text
17700 !! wikitext
17701 < div>foo< /div>
17702 !! html
17703 <p>&lt; div&gt;foo&lt; /div&gt;
17704 </p>
17705 !! end
17706
17707 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17708 ## the HTML5 parsing spec.
17709 !! test
17710 Element with broken attribute syntax
17711 !! options
17712 parsoid=wt2html
17713 !! wikitext
17714 <div style=" style="123">hi</div>
17715 <div =>ho</div>
17716 !! html/php
17717 <div style="123">hi</div>
17718 <div>ho</div>
17719
17720 !! html/parsoid
17721 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17722 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17723 !! end
17724
17725 ###
17726 ### Nesting tests (see T43545, T52604, T53081)
17727 ###
17728
17729 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17730 # Note that html2wt is considerably more difficult if we use <b> in
17731 # the test case, instead of <small>
17732 !! test
17733 Ensure that HTML adoption agency algorithm is properly implemented.
17734 !! wikitext
17735 <small>X<small>Y</small>Z</small>
17736 !! html
17737 <p><small>X<small>Y</small>Z</small>
17738 </p>
17739 !! end
17740
17741 # This was T43545 in the PHP parser.
17742 !! test
17743 Nesting of <kbd>
17744 !! wikitext
17745 <kbd>X<kbd>Y</kbd>Z</kbd>
17746 !! html+tidy
17747 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17748 </p>
17749 !! end
17750
17751 # The following cases were T53081 in the PHP parser.
17752 # Note that there are some other nestable tags (b, i, etc) which are
17753 # not covered; see T53081 for discussion.
17754
17755 !! test
17756 Nesting of <em>
17757 !! wikitext
17758 <em>X<em>Y</em>Z</em>
17759 !! html+tidy
17760 <p><em>X<em>Y</em>Z</em>
17761 </p>
17762 !! end
17763
17764 !! test
17765 Nesting of <strong>
17766 !! wikitext
17767 <strong>X<strong>Y</strong>Z</strong>
17768 !! html+tidy
17769 <p><strong>X<strong>Y</strong>Z</strong>
17770 </p>
17771 !! end
17772
17773 !! test
17774 Nesting of <q>
17775 !! wikitext
17776 <q>X<q>Y</q>Z</q>
17777 !! html+tidy
17778 <p><q>X<q>Y</q>Z</q>
17779 </p>
17780 !! end
17781
17782 !! test
17783 Nesting of <ruby>
17784 !! wikitext
17785 <ruby>X<ruby>Y</ruby>Z</ruby>
17786 !! html
17787 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17788 </p>
17789 !! end
17790
17791 !! test
17792 Nesting of <bdo>
17793 !! wikitext
17794 <bdo>X<bdo>Y</bdo>Z</bdo>
17795 !! html
17796 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17797 </p>
17798 !! end
17799
17800
17801 ###
17802 ### Media links
17803 ###
17804
17805 !! test
17806 Media link
17807 !! wikitext
17808 [[Media:Foobar.jpg]]
17809 [[Media:Video.ogv]]
17810 [[:Media:Video.ogv]]
17811 !! html/php
17812 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17813 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17814 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17815 </p>
17816 !! html/parsoid
17817 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17818 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17819 <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>
17820 !! end
17821
17822 !! test
17823 Media link with text
17824 !! wikitext
17825 [[Media:Foobar.jpg|A neat file to look at]]
17826 !! html/php
17827 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17828 </p>
17829 !! html/parsoid
17830 <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>
17831 !! end
17832
17833 !! test
17834 Localized media link
17835 !! options
17836 language=is
17837 !! wikitext
17838 [[Miðill:Foobar.jpg]]
17839
17840 [[Miðill:Foobar.jpg|Icelandic]]
17841 !! html/php
17842 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
17843 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
17844 </p>
17845 !! html/parsoid
17846 <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>
17847 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
17848 !! end
17849
17850 # FIXME: this is still bad HTML tag nesting
17851 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17852 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17853 !! test
17854 Media link with nasty text
17855 !! options
17856 parsoid=wt2html,html2html
17857 !! wikitext
17858 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17859 !! html/php
17860 <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>
17861
17862 !! html/php+tidy
17863 <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>
17864 !! html/parsoid
17865 <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>
17866 !! end
17867
17868 !! test
17869 Media link from missing resource (parsoid-only)
17870 !! options
17871 parsoid=html2wt
17872 !! html/parsoid
17873 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
17874 !! wikitext
17875 [[Media:Foobar.jpg|Bat!]]
17876 !! end
17877
17878 !! test
17879 Media link from missing resource, localized (parsoid-only)
17880 !! options
17881 parsoid=html2wt
17882 language=is
17883 !! html/parsoid
17884 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
17885 !! wikitext
17886 [[Miðill:Foobar.jpg|Bat!]]
17887 !! end
17888
17889 # This is a sanity test to ensure we don't crash or choke when given
17890 # old cached 1.7.0 HTML for media links; we don't require that the
17891 # result be "valid" because wt2wt was completely broken in 1.7.0
17892 !! test
17893 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
17894 !! options
17895 parsoid=html2wt
17896 !! html/parsoid
17897 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
17898 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17899 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
17900 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17901 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
17902 !! wikitext
17903 This is what Parsoid would emit (and we still handle this HTML fine):
17904
17905 [[Media:Foobar.jpg|A neat file to look at]]
17906
17907 But VisualEditor would mangle the rel attribute, and give us back this:
17908
17909 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
17910
17911 But at least we don't crash when trying to handle the mangled HTML!
17912 !! end
17913
17914 !! test
17915 Media link to nonexistent file (T3702)
17916 !! wikitext
17917 [[Media:No such.jpg]]
17918 [[Media:No_such file.jpg]]
17919 !! html/php
17920 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17921 <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>
17922 </p>
17923 !! html/parsoid
17924 <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>
17925 <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>
17926 !! end
17927
17928 !! test
17929 Image link to nonexistent file (T3850 - good)
17930 !! wikitext
17931 [[File:No_such.jpg]]
17932 !! html/php
17933 <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>
17934 </p>
17935 !! html/parsoid
17936 <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>
17937 !! end
17938
17939 !! test
17940 :Image link to nonexistent file (T3850 - bad)
17941 !! wikitext
17942 [[:Image:No such.jpg]]
17943 !! html/php
17944 <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>
17945 </p>
17946 !! html/parsoid
17947 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17948 !! end
17949
17950 !! test
17951 Character reference normalization in link text (T3938)
17952 !! wikitext
17953 [[Main Page|this&that]]
17954 !! html
17955 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17956 </p>
17957 !!end
17958
17959 !! article
17960 אַ
17961 !! text
17962 Test for unicode normalization
17963
17964 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17965 !! endarticle
17966
17967 !! test
17968 (T21451) Links should refer to the normalized form.
17969 !! wikitext
17970 [[&#xFB2E;]]
17971 [[&#x5d0;&#x5b7;]]
17972 [[&#x5d0;ַ]]
17973 [[א&#x5b7;]]
17974 [[אַ]]
17975 !! html
17976 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17977 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17978 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17979 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17980 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17981 </p>
17982 !! end
17983
17984 !! test
17985 Empty attribute crash test (T4067)
17986 !! wikitext
17987 <font color="">foo</font>
17988 !! html
17989 <p><font color="">foo</font>
17990 </p>
17991 !! end
17992
17993 !! test
17994 Empty attribute crash test single-quotes (T4067)
17995 !! wikitext
17996 <font color=''>foo</font>
17997 !! html
17998 <p><font color="">foo</font>
17999 </p>
18000 !! end
18001
18002 !! test
18003 Attribute test: equals, then nothing
18004 !! options
18005 parsoid=wt2html,html2html
18006 !! wikitext
18007 <font color=>foo</font>
18008 !! html/php
18009 <p><font color="">foo</font>
18010 </p>
18011 !! html/parsoid
18012 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18013 !! end
18014
18015 !! test
18016 Attribute test: unquoted value
18017 !! options
18018 parsoid=wt2html,html2html
18019 !! wikitext
18020 <font color=x>foo</font>
18021 !! html/php
18022 <p><font color="x">foo</font>
18023 </p>
18024 !! html/parsoid
18025 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18026 !! end
18027
18028 !! test
18029 Attribute test: unquoted but illegal value (hash)
18030 !! wikitext
18031 <font color=#x>foo</font>
18032 !! html
18033 <p><font color="#x">foo</font>
18034 </p>
18035 !! end
18036
18037 # Parsoid does not serialize to empty attribute syntax,
18038 # so wt2wt and html2wt cases are skipped
18039 !! test
18040 Attribute test: no value (T54330)
18041 !! options
18042 parsoid=wt2html,html2html
18043 !! wikitext
18044 <font color>foo</font>
18045 !! html/php
18046 <p><font color="">foo</font>
18047 </p>
18048 !! html/parsoid
18049 <p><font color="">foo</font></p>
18050 !! end
18051
18052 !! test
18053 T4095: link with three closing brackets
18054 !! wikitext
18055 [[Main Page]]]
18056 !! html/php
18057 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18058 </p>
18059 !! html/parsoid
18060 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18061 !! end
18062
18063 !! test
18064 T4095: link with pipe and three closing brackets
18065 !! wikitext
18066 [[Main Page|link]]]
18067 !! html/php
18068 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18069 </p>
18070 !! html/parsoid
18071 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18072 !! end
18073
18074 !! test
18075 T4095: link with pipe and three closing brackets, version 2
18076 !! wikitext
18077 [[Main Page|[http://example.com/]]]
18078 !! html/php
18079 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18080 </p>
18081 !! html/parsoid
18082 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18083 !! end
18084
18085
18086 ###
18087 ### Safety
18088 ###
18089
18090 !! article
18091 Template:Dangerous attribute
18092 !! text
18093 " onmouseover="alert(document.cookie)
18094 !! endarticle
18095
18096 !! article
18097 Template:Dangerous style attribute
18098 !! text
18099 border-size: expression(alert(document.cookie))
18100 !! endarticle
18101
18102 !! article
18103 Template:Div style
18104 !! text
18105 <div style="float: right; {{{1}}}">Magic div</div>
18106 !! endarticle
18107
18108 !! test
18109 T4304: HTML attribute safety (safe template; regression T4309)
18110 !! wikitext
18111 <div title="{{test}}"></div>
18112 !! html/php
18113 <div title="This is a test template"></div>
18114
18115 !! html/parsoid
18116 <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>
18117 !! end
18118
18119 # Parsoid has enough context to handle this case
18120 !! test
18121 T4304: HTML attribute safety (dangerous template; 2309)
18122 !! wikitext
18123 <div title="{{dangerous attribute}}"></div>
18124 !! html/php
18125 <div title=""></div>
18126
18127 !! html/parsoid
18128 <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>
18129 !! end
18130
18131 !! test
18132 T4304: HTML attribute safety (dangerous style template; 2309)
18133 !! wikitext
18134 <div style="{{dangerous style attribute}}"></div>
18135 !! html/php
18136 <div style="/* insecure input */"></div>
18137
18138 !! html/parsoid
18139 <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>
18140 !! end
18141
18142 !! test
18143 T4304: HTML attribute safety (safe parameter; 2309)
18144 !! wikitext
18145 {{div style|width: 200px}}
18146 !! html/php
18147 <div style="float: right; width: 200px">Magic div</div>
18148
18149 !! html/parsoid
18150 <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>
18151 !! end
18152
18153 !! test
18154 T4304: HTML attribute safety (unsafe parameter; 2309)
18155 !! wikitext
18156 {{div style|width: expression(alert(document.cookie))}}
18157 !! html/php
18158 <div style="/* insecure input */">Magic div</div>
18159
18160 !! html/parsoid
18161 <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>
18162 !! end
18163
18164 ## Parsoid output here differs; needs investigation.
18165 !! test
18166 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18167 !! wikitext
18168 {{div style|"><script>alert(document.cookie)</script>}}
18169 !! html
18170 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18171
18172 !! end
18173
18174 ## Parsoid output here differs; needs investigation.
18175 !! test
18176 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18177 !! wikitext
18178 {{div style|" ><script>alert(document.cookie)</script>}}
18179 !! html
18180 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18181
18182 !! end
18183
18184 !! test
18185 T4304: HTML attribute safety (link)
18186 !! wikitext
18187 <div title="[[Main Page]]"></div>
18188 !! html/php
18189 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18190
18191 !! html/parsoid
18192 <div title="[[Main Page]]"></div>
18193 !! end
18194
18195 !! test
18196 T4304: HTML attribute safety (italics)
18197 !! wikitext
18198 <div title="''foobar''"></div>
18199 !! html
18200 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18201
18202 !! end
18203
18204 !! test
18205 T4304: HTML attribute safety (bold)
18206 !! wikitext
18207 <div title="'''foobar'''"></div>
18208 !! html
18209 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18210
18211 !! end
18212
18213 !! test
18214 T4304: HTML attribute safety (ISBN)
18215 !! wikitext
18216 <div title="ISBN 1234567890"></div>
18217 !! html
18218 <div title="&#73;SBN 1234567890"></div>
18219
18220 !! end
18221
18222 !! test
18223 T4304: HTML attribute safety (RFC)
18224 !! wikitext
18225 <div title="RFC 1234"></div>
18226 !! html
18227 <div title="&#82;FC 1234"></div>
18228
18229 !! end
18230
18231 !! test
18232 T4304: HTML attribute safety (PMID)
18233 !! wikitext
18234 <div title="PMID 1234567890"></div>
18235 !! html
18236 <div title="&#80;MID 1234567890"></div>
18237
18238 !! end
18239
18240 !! test
18241 T4304: HTML attribute safety (web link)
18242 !! wikitext
18243 <div title="http://example.com/"></div>
18244 !! html
18245 <div title="http&#58;//example.com/"></div>
18246
18247 !! end
18248
18249 !! test
18250 T4304: HTML attribute safety (named web link)
18251 !! wikitext
18252 <div title="[http://example.com/ link]"></div>
18253 !! html/php
18254 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18255
18256 !! html/parsoid
18257 <div title="[http://example.com/ link]"></div>
18258 !! end
18259
18260 !! test
18261 T5244: HTML attribute safety (extension; safe)
18262 !! wikitext
18263 <div style="<nowiki>background:blue</nowiki>"></div>
18264 !! html/php
18265 <div style="background:blue"></div>
18266
18267 !! html/parsoid
18268 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
18269 !! end
18270
18271 !! test
18272 T5244: HTML attribute safety (extension; unsafe)
18273 !! wikitext
18274 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18275 !! html/php
18276 <div style="/* insecure input */"></div>
18277
18278 !! html/parsoid
18279 <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>
18280 !! end
18281
18282 # More MSIE fun discovered by Tom Gilder
18283
18284 !! test
18285 MSIE CSS safety test: spurious slash
18286 !! wikitext
18287 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18288 !! html/php
18289 <div style="/* insecure input */">evil</div>
18290
18291 !! html/parsoid
18292 <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>
18293 !! end
18294
18295 !! test
18296 MSIE CSS safety test: hex code
18297 !! wikitext
18298 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18299 !! html/php
18300 <div style="/* insecure input */">evil</div>
18301
18302 !! html/parsoid
18303 <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>
18304 !! end
18305
18306 !! test
18307 MSIE CSS safety test: comment in url
18308 !! wikitext
18309 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18310 !! html/php
18311 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18312
18313 !! html/parsoid
18314 <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>
18315 !! end
18316
18317 !! test
18318 MSIE CSS safety test: comment in expression
18319 !! wikitext
18320 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18321 !! html/php
18322 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18323
18324 !! html/parsoid
18325 <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>
18326 !! end
18327
18328 !! test
18329 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18330 !! wikitext
18331 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18332 !! html/php
18333 <p style="/* invalid control char */">A</p>
18334
18335 !! html/parsoid
18336 <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>
18337 !! end
18338
18339 !! test
18340 MSIE 6 CSS safety test: Fullwidth (T57332)
18341 !! wikitext
18342 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18343 <div style="top:EXPRESSION(alert())">B</div>
18344 !! html/php
18345 <p style="/* insecure input */">A</p>
18346 <div style="/* insecure input */">B</div>
18347
18348 !! html/parsoid
18349 <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>
18350 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18351 !! end
18352
18353 !! test
18354 MSIE 6 CSS safety test: IPA extensions (T57332)
18355 !! wikitext
18356 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18357 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18358 !! html/php
18359 <div style="/* insecure input */">A</div>
18360 <p style="/* insecure input */">B</p>
18361
18362 !! html/parsoid
18363 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18364 <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>
18365 !! end
18366
18367 !! test
18368 MSIE 6 CSS safety test: sup/sub script (T57332)
18369 !! wikitext
18370 <div style="background-image:url⁽javascript:alert())">A</div>
18371 <div style="background-image:url₍javascript:alert())">B</div>
18372 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18373 !! html/php
18374 <div style="/* insecure input */">A</div>
18375 <div style="/* insecure input */">B</div>
18376 <p style="/* insecure input */">C</p>
18377
18378 !! html/parsoid
18379 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18380 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18381 <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>
18382 !! end
18383
18384 !! test
18385 Opera -o-link CSS
18386 !! options
18387 parsoid=wt2html,html2html
18388 !! wikitext
18389 <div
18390 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;"
18391 style="-o-link:attr(title);-o-link-source:current">X</div>
18392 !! html/php
18393 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18394
18395 !! html/parsoid
18396 <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>
18397 !! end
18398
18399 !! test
18400 MSIE 6 CSS safety test: Repetition markers (T57332)
18401 !! wikitext
18402 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18403 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18404 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18405 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18406 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18407 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18408 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18409 !! html/php
18410 <p style="/* insecure input */">A</p>
18411 <p style="/* insecure input */">B</p>
18412 <p style="/* insecure input */">C</p>
18413 <p style="/* insecure input */">D</p>
18414 <p style="/* insecure input */">E</p>
18415 <p style="/* insecure input */">F</p>
18416 <p style="/* insecure input */">G</p>
18417
18418 !! html/parsoid
18419 <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>
18420 <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>
18421 <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>
18422 <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>
18423 <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>
18424 <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>
18425 <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>
18426 !! end
18427
18428 !! test
18429 Table attribute legitimate extension
18430 !! wikitext
18431 {|
18432 !+ style="<nowiki>color:blue</nowiki>"|status
18433 |}
18434 !! html
18435 <table>
18436 <tr>
18437 <th style="color:blue">status
18438 </th></tr></table>
18439
18440 !!end
18441
18442 !! test
18443 Table attribute safety
18444 !! wikitext
18445 {|
18446 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18447 |}
18448 !! html
18449 <table>
18450 <tr>
18451 <th style="/* insecure input */">status
18452 </th></tr></table>
18453
18454 !! end
18455
18456 !! test
18457 CSS line continuation 1
18458 !! wikitext
18459 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18460 !! html
18461 <div style="/* insecure input */"></div>
18462
18463 !! end
18464
18465 !! test
18466 CSS line continuation 2
18467 !! wikitext
18468 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18469 !! html
18470 <div style="/* invalid control char */"></div>
18471
18472 !! end
18473
18474 !! article
18475 Template:Identity
18476 !! text
18477 {{{1}}}
18478 !! endarticle
18479
18480 !! test
18481 Expansion of multi-line templates in attribute values (T8255)
18482 !! wikitext
18483 <div style="background: {{identity|#00FF00}}">-</div>
18484 !! html
18485 <div style="background: #00FF00">-</div>
18486
18487 !! end
18488
18489 !! test
18490 Expansion of multi-line templates in attribute values (T8255 sanity check)
18491 !! wikitext
18492 <div style="background:
18493 #00FF00">-</div>
18494 !! html/php
18495 <div style="background: #00FF00">-</div>
18496
18497 !! html/parsoid
18498 <div style="background:
18499 #00FF00">-</div>
18500 !! end
18501
18502 !! test
18503 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18504 !! wikitext
18505 <div style="background: &#10;#00FF00">-</div>
18506 !! html
18507 <div style="background: &#10;#00FF00">-</div>
18508
18509 !! end
18510
18511 !! test
18512 Tags which are hidden from tidiers cannot pass through the Sanitizer
18513 !! wikitext
18514 <mw:toc><script>alert();</script></mw:toc>
18515 !! html+tidy
18516 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18517 </p>
18518 !! end
18519
18520 ###
18521 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18522 ###
18523
18524 !! test
18525 Parser hook: empty input
18526 !! wikitext
18527 <tag></tag>
18528 !! html/php
18529 <pre>
18530 ''
18531 array (
18532 )
18533 </pre>
18534
18535 !! html/parsoid
18536 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18537 !! end
18538
18539 ## Don't expect parsoid to rt this form.
18540 !! test
18541 Parser hook: empty input using terminated empty elements
18542 !! options
18543 parsoid=wt2html,html2html
18544 !! wikitext
18545 <tag/>
18546 !! html/php
18547 <pre>
18548 NULL
18549 array (
18550 )
18551 </pre>
18552
18553 !! html/parsoid
18554 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18555 !! end
18556
18557 !! test
18558 Parser hook: empty input using terminated empty elements (space before)
18559 !! wikitext
18560 <tag />
18561 !! html/php
18562 <pre>
18563 NULL
18564 array (
18565 )
18566 </pre>
18567
18568 !! html/parsoid
18569 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
18570 !! end
18571
18572 !! test
18573 Parser hook: basic input
18574 !! wikitext
18575 <tag>input</tag>
18576 !! html/php
18577 <pre>
18578 'input'
18579 array (
18580 )
18581 </pre>
18582
18583 !! html/parsoid
18584 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18585 !! end
18586
18587 ## Don't expect parsoid to rt this form.
18588 !! test
18589 Parser hook: case insensitive
18590 !! options
18591 parsoid=wt2html,html2html
18592 !! wikitext
18593 <TAG>input</TAG>
18594 !! html/php
18595 <pre>
18596 'input'
18597 array (
18598 )
18599 </pre>
18600
18601 !! html/parsoid
18602 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18603 !! end
18604
18605 ## Don't expect parsoid to rt this form.
18606 !! test
18607 Parser hook: case insensitive, redux
18608 !! options
18609 parsoid=wt2html,html2html
18610 !! wikitext
18611 <TaG>input</TAg>
18612 !! html/php
18613 <pre>
18614 'input'
18615 array (
18616 )
18617 </pre>
18618
18619 !! html/parsoid
18620 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18621 !! end
18622
18623 !! test
18624 Parser hook: nested tags
18625 !! options
18626 parsoid=wt2html
18627 !! wikitext
18628 <tag><tag></tag></tag>
18629 !! html/php
18630 <pre>
18631 '<tag>'
18632 array (
18633 )
18634 </pre>&lt;/tag&gt;
18635
18636 !! html/php+tidy
18637 <pre>'<tag>'
18638 array (
18639 )
18640 </tag></pre><p>&lt;/tag&gt;
18641 </p>
18642 !! html/parsoid
18643 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
18644 !! end
18645
18646 !! test
18647 Parser hook: basic arguments
18648 !! wikitext
18649 <tag width="200" height="100" depth="50" square=""></tag>
18650 !! html/php
18651 <pre>
18652 ''
18653 array (
18654 'width' => '200',
18655 'height' => '100',
18656 'depth' => '50',
18657 'square' => '',
18658 )
18659 </pre>
18660
18661 !! html/parsoid
18662 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18663 !! end
18664
18665 ## Don't expect parsoid to rt this form.
18666 !! test
18667 Parser hook: basic arguments, variations
18668 !! options
18669 parsoid=wt2html,html2html
18670 !! wikitext
18671 <tag width=200 height = "100" depth = '50' square></tag>
18672 !! html/php
18673 <pre>
18674 ''
18675 array (
18676 'width' => '200',
18677 'height' => '100',
18678 'depth' => '50',
18679 'square' => '',
18680 )
18681 </pre>
18682
18683 !! html/parsoid
18684 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18685 !! end
18686
18687 !! test
18688 Parser hook: argument containing a forward slash (T7344)
18689 !! wikitext
18690 <tag filename="/tmp/bla"></tag>
18691 !! html/php
18692 <pre>
18693 ''
18694 array (
18695 'filename' => '/tmp/bla',
18696 )
18697 </pre>
18698
18699 !! html/parsoid
18700 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18701 !! end
18702
18703 ## Don't expect parsoid to rt this form.
18704 !! test
18705 Parser hook: empty input using terminated empty elements (T4374)
18706 !! options
18707 parsoid=wt2html,html2html
18708 !! wikitext
18709 <tag foo=bar/>text
18710 !! html/php
18711 <pre>
18712 NULL
18713 array (
18714 'foo' => 'bar',
18715 )
18716 </pre>text
18717
18718 !! html/parsoid
18719 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
18720 !! end
18721
18722 ## </tag> should be output literally since there is no matching tag that begins it
18723 ## Don't expect parsoid to rt this form.
18724 !! test
18725 Parser hook: basic arguments using terminated empty elements (T4374)
18726 !! options
18727 parsoid=wt2html
18728 !! wikitext
18729 <tag width=200 height = "100" depth = '50' square/>
18730 other stuff
18731 </tag>
18732 !! html/php
18733 <pre>
18734 NULL
18735 array (
18736 'width' => '200',
18737 'height' => '100',
18738 'depth' => '50',
18739 'square' => '',
18740 )
18741 </pre>
18742 <p>other stuff
18743 &lt;/tag&gt;
18744 </p>
18745 !! html/parsoid
18746 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
18747 &lt;/tag></p>
18748 !! end
18749
18750 ## Don't expect parsoid to rt this form.
18751 !! test
18752 Parser hook: Don't allow unclosed extension tags
18753 !! options
18754 parsoid=wt2html
18755 !! wikitext
18756 test <tag>123
18757
18758 this is a '''test'''
18759 !! html/php
18760 <p>test &lt;tag&gt;123
18761 </p><p>this is a <b>test</b>
18762 </p>
18763 !! html/parsoid
18764 <p>test &lt;tag>123</p>
18765
18766 <p>this is a <b>test</b></p>
18767 !! end
18768
18769 !! test
18770 Parser hook: horizontal rule inside extension tag that outputs <pre>
18771 !! wikitext
18772 <tag>
18773 Hello
18774 <hr/>
18775 Goodbye
18776 </tag>
18777 !! html/php
18778 <pre>
18779 '
18780 Hello
18781 <hr/>
18782 Goodbye
18783 '
18784 array (
18785 )
18786 </pre>
18787
18788 !! end
18789
18790 ###
18791 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18792 ###
18793
18794 !! test
18795 Parser hook: static parser hook not inside a comment
18796 !! wikitext
18797 <statictag>hello, world</statictag>
18798
18799 <statictag action="flush" />
18800 !! html/php
18801 <p><br />
18802 hello, world
18803 </p>
18804 !! html/parsoid
18805 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18806 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about="#mwt4">hello, world</p>
18807 !! end
18808
18809 !! test
18810 Parser hook: static parser hook inside a comment
18811 !! wikitext
18812 <!-- <statictag>hello, world</statictag> -->
18813 <statictag action="flush" />
18814 !! html/php
18815 <p><br />
18816 </p>
18817 !! html/parsoid
18818 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18819 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></p>
18820 !! end
18821
18822 # Nested template calls; this case was broken by Parser.php rev 1.506,
18823 # since reverted.
18824
18825 !! article
18826 Template:One-parameter
18827 !! text
18828 (My parameter is: {{{1}}})
18829 !! endarticle
18830
18831 !! article
18832 Template:Map-one-parameter
18833 !! text
18834 {{{{{1}}}|{{{2}}}}}
18835 !! endarticle
18836
18837 !! test
18838 Nested template calls
18839 !! wikitext
18840 {{Map-one-parameter|One-parameter|param}}
18841 !! html
18842 <p>(My parameter is: param)
18843 </p>
18844 !! end
18845
18846
18847 ###
18848 ### Sanitizer
18849 ###
18850
18851 !! test
18852 Sanitizer: Closing of open tags
18853 !! wikitext
18854 <s></s><table></table>
18855 !! html/php+tidy
18856 <p><s></s></p><table></table>
18857 !! html/parsoid
18858 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
18859 !! end
18860
18861 !! test
18862 Sanitizer: Closing of open but not closed tags
18863 !! wikitext
18864 <s>foo
18865 !! html
18866 <p><s>foo</s>
18867 </p>
18868 !! end
18869
18870 !! test
18871 Sanitizer: Closing of closed but not open tags
18872 !! options
18873 parsoid=wt2html
18874 !! wikitext
18875 </s>
18876 !! html+tidy
18877 <p class="mw-empty-elt">
18878 </p>
18879 !! end
18880
18881 !! test
18882 Sanitizer: Closing of closed but not open table tags
18883 !! options
18884 parsoid=wt2html
18885 !! wikitext
18886 Table not started</td></tr></table>
18887 !! html+tidy
18888 <p>Table not started
18889 </p>
18890 !! end
18891
18892 !! test
18893 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18894 !! config
18895 wgFragmentMode=[ 'html5', 'legacy' ]
18896 !! wikitext
18897 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18898 !! html/php
18899 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18900 </p>
18901 !! html/parsoid
18902 <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>
18903 !! end
18904
18905 !! test
18906 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18907 !! config
18908 wgFragmentMode=[ 'legacy' ]
18909 !! wikitext
18910 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18911 !! html/php
18912 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18913 </p>
18914 !! end
18915
18916 # In HTML5, the restrictions are that id must contain at least one character,
18917 # and must not contain any space characters.
18918 !! test
18919 Sanitizer: Validating the contents of the id attribute (T6515)
18920 !! options
18921 disabled
18922 !! wikitext
18923 <br id="" /><br id="a space" />
18924 !! html
18925 Something ...
18926 !! end
18927
18928 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18929 !! test
18930 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18931 !! options
18932 disabled
18933 !! wikitext
18934 <br id="foo" /><br id="foo" />
18935 !! html
18936 Something need to be done. foo-2 ?
18937 !! end
18938
18939 !! test
18940 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18941 !! wikitext
18942 <div itemscope>
18943 <meta itemprop="hello" content="world">
18944 <meta http-equiv="refresh" content="5">
18945 <meta itemprop="hello" http-equiv="refresh" content="5">
18946 <link itemprop="hello" href="{{SERVER}}">
18947 <link rel="stylesheet" href="{{SERVER}}">
18948 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18949 </div>
18950 !! html
18951 <div itemscope="">
18952 <p> <meta itemprop="hello" content="world" />
18953 &lt;meta http-equiv="refresh" content="5"&gt;
18954 <meta itemprop="hello" content="5" />
18955 <link itemprop="hello" href="http&#58;//example.org" />
18956 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18957 <link itemprop="hello" href="http&#58;//example.org" />
18958 </p>
18959 </div>
18960
18961 !! end
18962
18963 !! test
18964 Sanitizer: Strip comments from CSS attributes
18965 !! options
18966 parsoid=wt2html,wt2wt
18967 !! wikitext
18968 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18969 !! html/php
18970 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18971 </p>
18972 !! html/parsoid
18973 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18974 !! end
18975
18976 !! test
18977 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18978 !! wikitext
18979 [[meatball:Soft"Security]]
18980 !! html/php
18981 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18982 </p>
18983 !! html/parsoid
18984 <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>
18985 !! end
18986
18987 !! test
18988 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18989 !! wikitext
18990 [[meatball:Foo<Bar]]
18991 [[meatball:Foo>Bar]]
18992 [[meatball:Foo&lt;bar]]
18993 [[meatball:Foo&gt;bar]]
18994 !! html/php
18995 <p>[[meatball:Foo&lt;Bar]]
18996 [[meatball:Foo&gt;Bar]]
18997 [[meatball:Foo&lt;bar]]
18998 [[meatball:Foo&gt;bar]]
18999 </p>
19000 !! html/parsoid
19001 <p>[[meatball:Foo&lt;Bar]]
19002 [[meatball:Foo>Bar]]
19003 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19004 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19005 !! end
19006
19007 !! test
19008 Language converter: output gets cut off unexpectedly (T7757)
19009 !! options
19010 language=zh
19011 !! wikitext
19012 this bit is safe: }-
19013
19014 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19015
19016 then we get cut off here: }-
19017
19018 all additional text is vanished
19019 !! html/php
19020 <p>this bit is safe: }-
19021 </p><p>but if we add a conversion instance: xxx
19022 </p><p>then we get cut off here: }-
19023 </p><p>all additional text is vanished
19024 </p>
19025 !! html/parsoid
19026 <p>this bit is safe: }-</p>
19027 <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>
19028 <p>then we get cut off here: }-</p>
19029 <p>all additional text is vanished</p>
19030 !! end
19031
19032 !! test
19033 Language converter glossary rules inside attributes (T119158)
19034 !! options
19035 language=sr variant=sr-el
19036 !! wikitext
19037 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19038
19039 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19040 !! html/php
19041 <p>
19042 </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>
19043 </p>
19044 !! html/parsoid
19045 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19046
19047 <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>
19048 !! end
19049
19050 !! test
19051 Self closed html pairs (T7487)
19052 !! wikitext
19053 <center><font id="bug" />Centered text</center>
19054 <div><font id="bug2" />In div text</div>
19055 !! html+tidy
19056 <center><font id="bug"></font>Centered text</center>
19057 <div><font id="bug2"></font>In div text</div>
19058 !! end
19059
19060 !! test
19061 Punctuation: nbsp before exclamation
19062 !! wikitext
19063 C'est grave !
19064 !! html
19065 <p>C'est grave&#160;!
19066 </p>
19067 !! end
19068
19069 !! test
19070 Punctuation: CSS !important (T13874)
19071 !! wikitext
19072 <div style="width:50% !important">important</div>
19073 !! html
19074 <div style="width:50% !important">important</div>
19075
19076 !!end
19077
19078 !! test
19079 Punctuation: CSS ! important (T13874; with space after)
19080 !! wikitext
19081 <div style="width:50% ! important">important</div>
19082 !! html
19083 <div style="width:50%&#32;! important">important</div>
19084
19085 !!end
19086
19087 !! test
19088 HTML bullet list, closed tags (T7497)
19089 !! wikitext
19090 <ul>
19091 <li>One</li>
19092 <li>Two</li>
19093 </ul>
19094 !! html/php
19095 <ul>
19096 <li>One</li>
19097 <li>Two</li>
19098 </ul>
19099
19100 !! html/parsoid
19101 <ul data-parsoid='{"stx":"html"}'>
19102 <li data-parsoid='{"stx":"html"}'>One</li>
19103 <li data-parsoid='{"stx":"html"}'>Two</li>
19104 </ul>
19105
19106 !! end
19107
19108 !! test
19109 HTML bullet list, unclosed tags (T7497)
19110 !! wikitext
19111 <ul>
19112 <li>One
19113 <li>Two
19114 </ul>
19115 !! html/php+tidy
19116 <ul>
19117 <li>One
19118 </li><li>Two
19119 </li></ul>
19120 !! html/parsoid
19121 <ul data-parsoid='{"stx":"html"}'>
19122 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19123 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19124 </ul>
19125
19126 !! end
19127
19128 !! test
19129 HTML ordered list, closed tags (T7497)
19130 !! wikitext
19131 <ol>
19132 <li>One</li>
19133 <li>Two</li>
19134 </ol>
19135 !! html/php
19136 <ol>
19137 <li>One</li>
19138 <li>Two</li>
19139 </ol>
19140
19141 !! html/parsoid
19142 <ol data-parsoid='{"stx":"html"}'>
19143 <li data-parsoid='{"stx":"html"}'>One</li>
19144 <li data-parsoid='{"stx":"html"}'>Two</li>
19145 </ol>
19146
19147 !! end
19148
19149 !! test
19150 HTML ordered list, unclosed tags (T7497)
19151 !! options
19152 !! wikitext
19153 <ol>
19154 <li>One
19155 <li>Two
19156 </ol>
19157 !! html/php+tidy
19158 <ol>
19159 <li>One
19160 </li><li>Two
19161 </li></ol>
19162 !! html/parsoid
19163 <ol data-parsoid='{"stx":"html"}'>
19164 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19165 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19166 </ol>
19167
19168 !! end
19169
19170 !! test
19171 HTML nested bullet list, closed tags (T7497)
19172 !! wikitext
19173 <ul>
19174 <li>One</li>
19175 <li>Two:
19176 <ul>
19177 <li>Sub-one</li>
19178 <li>Sub-two</li>
19179 </ul>
19180 </li>
19181 </ul>
19182 !! html/php
19183 <ul>
19184 <li>One</li>
19185 <li>Two:
19186 <ul>
19187 <li>Sub-one</li>
19188 <li>Sub-two</li>
19189 </ul>
19190 </li>
19191 </ul>
19192
19193 !! html/parsoid
19194 <ul data-parsoid='{"stx":"html"}'>
19195 <li data-parsoid='{"stx":"html"}'>One</li>
19196 <li data-parsoid='{"stx":"html"}'>Two:
19197 <ul data-parsoid='{"stx":"html"}'>
19198 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19199 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19200 </ul>
19201 </li>
19202 </ul>
19203 !! end
19204
19205 !! test
19206 HTML nested bullet list, open tags (T7497)
19207 !! wikitext
19208 <ul>
19209 <li>One
19210 <li>Two:
19211 <ul>
19212 <li>Sub-one
19213 <li>Sub-two
19214 </ul>
19215 </ul>
19216 !! html+tidy
19217 <ul>
19218 <li>One
19219 </li><li>Two:
19220 <ul>
19221 <li>Sub-one
19222 </li><li>Sub-two
19223 </li></ul>
19224 </li></ul>
19225 !! end
19226
19227 !! test
19228 HTML nested ordered list, closed tags (T7497)
19229 !! wikitext
19230 <ol>
19231 <li>One</li>
19232 <li>Two:
19233 <ol>
19234 <li>Sub-one</li>
19235 <li>Sub-two</li>
19236 </ol>
19237 </li>
19238 </ol>
19239 !! html
19240 <ol>
19241 <li>One</li>
19242 <li>Two:
19243 <ol>
19244 <li>Sub-one</li>
19245 <li>Sub-two</li>
19246 </ol>
19247 </li>
19248 </ol>
19249
19250 !! end
19251
19252 !! test
19253 HTML nested ordered list, open tags (T7497)
19254 !! wikitext
19255 <ol>
19256 <li>One
19257 <li>Two:
19258 <ol>
19259 <li>Sub-one
19260 <li>Sub-two
19261 </ol>
19262 </ol>
19263 !! html/php
19264 <ol>
19265 <li>One
19266 <li>Two:
19267 <ol>
19268 <li>Sub-one
19269 <li>Sub-two
19270 </ol>
19271 </ol>
19272
19273 !! html/parsoid
19274 <ol>
19275 <li>One
19276 </li>
19277 <li>Two:
19278 <ol>
19279 <li>Sub-one
19280 </li>
19281 <li>Sub-two
19282 </li>
19283 </ol>
19284 </li>
19285 </ol>
19286
19287 !! end
19288
19289 !! test
19290 HTML ordered list item with parameters oddity
19291 !! wikitext
19292 <ol><li id="fragment">One</li>
19293 </ol>
19294 !! html
19295 <ol><li id="fragment">One</li>
19296 </ol>
19297
19298 !! end
19299
19300 # parsoid doesn't explicitly mark autonumbered links, see T55505
19301 !!test
19302 T7918: autonumbering
19303 !! wikitext
19304 [http://first/] [http://second] [ftp://ftp]
19305
19306 ftp://inlineftp
19307
19308 [mailto:enclosed@mail.tld With target]
19309
19310 [mailto:enclosed@mail.tld]
19311
19312 mailto:inline@mail.tld
19313 !! html/php
19314 <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>
19315 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19316 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19317 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19318 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19319 </p>
19320 !! html/parsoid
19321 <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>
19322 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19323 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19324 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19325 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19326 !! end
19327
19328
19329 #
19330 # Security and HTML correctness
19331 # From Nick Jenkins' fuzz testing
19332 #
19333
19334 !! test
19335 Fuzz testing: Parser13
19336 !! wikitext
19337 {|
19338 | http://a|
19339 !! html
19340 <table>
19341 <tr>
19342 <td>
19343 </td>
19344 </tr>
19345 </table>
19346
19347 !! end
19348
19349 # Note that Parsoid output differs from the PHP parser here: the PHP
19350 # parser breaks the URL for the magic word, while in Parsoid the URL
19351 # production takes precedence.
19352 !! test
19353 Fuzz testing: Parser14
19354 !! wikitext
19355 ==onmouseover===
19356 http://__TOC__
19357 !! html/php
19358 <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>
19359 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>
19360 <ul>
19361 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19362 </ul>
19363 </div>
19364
19365
19366 !! html/php+tidy
19367 <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>
19368 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>
19369 <ul>
19370 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19371 </ul>
19372 </div>
19373 !! html/parsoid
19374 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19375 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19376 !! end
19377
19378 !! test
19379 Fuzz testing: Parser14-table
19380 !! options
19381 parsoid=wt2html,html2html
19382 !! wikitext
19383 ==a==
19384 {| STYLE=__TOC__
19385 !! html
19386 <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>
19387 <table style="&#95;_TOC&#95;_">
19388 <tr><td></td></tr>
19389 </table>
19390
19391 !! html+tidy
19392 <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>
19393 <table style="__TOC__">
19394 <tr>
19395 <td></td>
19396 </tr>
19397 </table>
19398 !! html/parsoid
19399 <h2 id="a">a</h2>
19400 <table style="__TOC__"></table>
19401 !! end
19402
19403 # Known to produce bogus xml (extra </td>)
19404 # Don't add the html/php section since it generates broken HTML
19405 !! test
19406 Fuzz testing: Parser16
19407 !! wikitext
19408 {|
19409 !https://||||||
19410 !! html+tidy
19411 <table>
19412 <tbody><tr>
19413 <th>https://</th>
19414 <th></th>
19415 <th></th>
19416 <th>
19417
19418 </th></tr>
19419 </tbody></table>
19420 !! end
19421
19422 !! test
19423 Fuzz testing: Parser21
19424 !! wikitext
19425 {|
19426 !irc://{{ftp://a" onmouseover="alert('hello world');"
19427 |
19428 !! html
19429 <table>
19430 <tr>
19431 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19432 </th>
19433 <td>
19434 </td>
19435 </tr>
19436 </table>
19437
19438 !! end
19439
19440 !! test
19441 Fuzz testing: Parser22
19442 !! wikitext
19443 http://===r:::https://b
19444
19445 {|
19446 !! html
19447 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19448 </p>
19449 <table>
19450 <tr><td></td></tr>
19451 </table>
19452
19453 !! end
19454
19455 ## Remex doesn't account for fostered content.
19456 ## Known to produce bad XML for now
19457 !! test
19458 Fuzz testing: Parser24
19459 !! options
19460 parsoid=wt2html
19461 !! wikitext
19462 {|
19463 {{{|
19464 <u CLASS=
19465 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19466 <br style="onmouseover='alert(document.cookie);' " />
19467
19468 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19469 |
19470 !! html/php
19471 <table>
19472 {{{|
19473 <u class="&#124;">}}}} &gt;
19474 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19475
19476 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19477 <tr>
19478 <td></u>
19479 </td>
19480 </tr>
19481 </table>
19482
19483 !! html/php+tidy
19484
19485 {{{|
19486 <u class="&#124;">}}}} &gt;
19487 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19488
19489 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19490 </u><table><tbody><tr>
19491 <td>
19492 </td>
19493 </tr>
19494 </tbody></table><p><u class="&#124;">
19495 </u></p>
19496 !! html/parsoid
19497 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19498 {{{|
19499 <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>"}'/>}}}} >
19500 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19501
19502 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19503 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19504 !! end
19505
19506 # Note: the current result listed for this is not what the original one was,
19507 # but the original bug was JavaScript injection, which is fixed in any case.
19508 # It's not clear that the original result listed was any more correct than the
19509 # current one. Original result:
19510 # <p>{{{|
19511 # </p>
19512 # <li class="&#124;&#124;">
19513 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19514 !!test
19515 Fuzz testing: Parser25 (T8055)
19516 !! wikitext
19517 {{{
19518 |
19519 <LI CLASS=||
19520 >
19521 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19522 !! html/php
19523 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19524 </p>
19525 !! html/parsoid
19526 <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"]}'>
19527 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19528 !! end
19529
19530 !!test
19531 Fuzz testing: URL adjacent extension (with space, clean)
19532 !! wikitext
19533 http://example.com <nowiki>junk</nowiki>
19534 !! html/php
19535 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19536 </p>
19537 !! html/parsoid
19538 <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>
19539 !! end
19540
19541 !!test
19542 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19543 !! wikitext
19544 http://example.com<nowiki>junk</nowiki>
19545 !! html/php
19546 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19547 </p>
19548 !! html/parsoid
19549 <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>
19550 !! end
19551
19552 !! test
19553 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19554 !! wikitext
19555 http://example.com<pre>junk</pre>
19556 !! html/php
19557 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19558
19559 !! html/php+tidy
19560 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19561 !! html/parsoid
19562 <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>
19563 !! end
19564
19565 !! test
19566 Fuzz testing: image with bogus manual thumbnail
19567 !! wikitext
19568 [[Image:foobar.jpg|thumbnail= ]]
19569 !! html/php
19570 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19571
19572 !! html/parsoid
19573 <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>
19574 !! end
19575
19576 # Parsoid will emit the newline literally in wt2wt; see next test case.
19577 !! test
19578 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19579 !! options
19580 parsoid=wt2html
19581 !! wikitext
19582 <pre dir="&#10;"></pre>
19583 !! html/php
19584 <pre dir="&#10;"></pre>
19585
19586 !! html/parsoid
19587 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19588 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19589 !! end
19590
19591 !! test
19592 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19593 !! options
19594 parsoid=html2wt
19595 !! html/parsoid
19596 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19597 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19598 !! wikitext
19599 <pre dir="
19600 "></pre>
19601 !! html/php
19602 <pre dir=""></pre>
19603
19604 !! end
19605
19606 !! test
19607 Templates in extension attributes are not expanded
19608 !! wikitext
19609 <pre dir="{{echo|ltr}}"></pre>
19610 !! html/php
19611 <pre dir="{{echo|ltr}}"></pre>
19612
19613 !! html/parsoid
19614 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19615 !! end
19616
19617 !! test
19618 Parsing optional HTML elements (T8171)
19619 !! options
19620 !! wikitext
19621 <table>
19622 <tr>
19623 <td> Some tabular data</td>
19624 <td> More tabular data ...
19625 <td> And yet som tabular data</td>
19626 </tr>
19627 </table>
19628 !! html
19629 <table>
19630 <tr>
19631 <td> Some tabular data</td>
19632 <td> More tabular data ...
19633 </td><td> And yet som tabular data</td>
19634 </tr>
19635 </table>
19636
19637 !! end
19638
19639 !! test
19640 Correct handling of <td>, <tr> (T8171)
19641 !! options
19642 !! wikitext
19643 <table>
19644 <tr>
19645 <td> Some tabular data</td>
19646 <td> More tabular data ...</td>
19647 <td> And yet som tabular data</td>
19648 </tr>
19649 </table>
19650 !! html
19651 <table>
19652 <tr>
19653 <td> Some tabular data</td>
19654 <td> More tabular data ...</td>
19655 <td> And yet som tabular data</td>
19656 </tr>
19657 </table>
19658
19659 !! end
19660
19661
19662 !! test
19663 Parsing crashing regression (fr:JavaScript)
19664 !! wikitext
19665 </body></x>
19666 !! html
19667 <p>&lt;/body&gt;&lt;/x&gt;
19668 </p>
19669 !! end
19670
19671 !! test
19672 Inline wiki vs wiki block nesting
19673 !! wikitext
19674 '''Bold paragraph
19675
19676 New wiki paragraph
19677 !! html
19678 <p><b>Bold paragraph</b>
19679 </p><p>New wiki paragraph
19680 </p>
19681 !! end
19682
19683 # FIXME: The current php output is documented
19684 # and desired output is the parsoid target.
19685 !! test
19686 Inline HTML vs wiki block nesting
19687 !! wikitext
19688 <b>Bold paragraph
19689
19690 New wiki paragraph
19691 !! html/php
19692 <p><b>Bold paragraph
19693 </p><p>New wiki paragraph</b>
19694 </p>
19695 !! html/php+tidy
19696 <p><b>Bold paragraph
19697 </b></p><p><b>New wiki paragraph
19698 </b></p>
19699 !! html/parsoid
19700 <p><b>Bold paragraph</b>
19701 </p><p>New wiki paragraph
19702 </p>
19703 !! end
19704
19705 # Original result was this:
19706 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19707 # </p>
19708 # While that might be marginally more intuitive, maybe, the six-apostrophe
19709 # construct is clearly pathological and the result stated here (which is what
19710 # the parser actually does) is about as reasonable as anything.
19711 !!test
19712 Mixing markup for italics and bold
19713 !! options
19714 !! wikitext
19715 '''bold''''''bold''bolditalics'''''
19716 !! html
19717 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19718 </p>
19719 !! end
19720
19721
19722 !! article
19723 Xyzzyx
19724 !! text
19725 Article for special page transclusion test
19726 !! endarticle
19727
19728 !! test
19729 Special page transclusion
19730 !! options
19731 !! wikitext
19732 {{Special:Prefixindex/Xyzzyx}}
19733 !! html
19734 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19735 </ul>
19736
19737 !! end
19738
19739 !! test
19740 Special page transclusion twice (T7021)
19741 !! options
19742 !! wikitext
19743 {{Special:Prefixindex/Xyzzyx}}
19744 {{Special:Prefixindex/Xyzzyx}}
19745 !! html
19746 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19747 </ul>
19748 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19749 </ul>
19750
19751 !! end
19752
19753 !! test
19754 Transclusion of default MediaWiki message
19755 !! wikitext
19756 {{MediaWiki:Mainpage}}
19757 !! html
19758 <p>Main Page
19759 </p>
19760 !! end
19761
19762 !! test
19763 Transclusion of nonexistent MediaWiki message
19764 !! wikitext
19765 {{MediaWiki:Mainpagexxx}}
19766 !! html
19767 <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>
19768 </p>
19769 !! end
19770
19771 !! test
19772 Transclusion of MediaWiki message with underscore
19773 !! wikitext
19774 {{MediaWiki:history_short}}
19775 !! html
19776 <p>History
19777 </p>
19778 !! end
19779
19780 !! test
19781 Transclusion of MediaWiki message with space
19782 !! wikitext
19783 {{MediaWiki:history short}}
19784 !! html
19785 <p>History
19786 </p>
19787 !! end
19788
19789 !! test
19790 Invalid header with following text
19791 !! wikitext
19792 = x = y
19793 !! html
19794 <p>= x = y
19795 </p>
19796 !! end
19797
19798
19799 !! test
19800 Section extraction test (section 0)
19801 !! options
19802 section=0
19803 !! wikitext
19804 start
19805 ==a==
19806 ===aa===
19807 ====aaa====
19808 ==b==
19809 ===ba===
19810 ===bb===
19811 ====bba====
19812 ===bc===
19813 ==c==
19814 ===ca===
19815 !! html/php
19816 start
19817 !! end
19818
19819 !! test
19820 Section extraction test (section 1)
19821 !! options
19822 section=1
19823 !! wikitext
19824 start
19825 ==a==
19826 ===aa===
19827 ====aaa====
19828 ==b==
19829 ===ba===
19830 ===bb===
19831 ====bba====
19832 ===bc===
19833 ==c==
19834 ===ca===
19835 !! html/php
19836 ==a==
19837 ===aa===
19838 ====aaa====
19839 !! end
19840
19841 !! test
19842 Section extraction test (section 2)
19843 !! options
19844 section=2
19845 !! wikitext
19846 start
19847 ==a==
19848 ===aa===
19849 ====aaa====
19850 ==b==
19851 ===ba===
19852 ===bb===
19853 ====bba====
19854 ===bc===
19855 ==c==
19856 ===ca===
19857 !! html/php
19858 ===aa===
19859 ====aaa====
19860 !! end
19861
19862 !! test
19863 Section extraction test (section 3)
19864 !! options
19865 section=3
19866 !! wikitext
19867 start
19868 ==a==
19869 ===aa===
19870 ====aaa====
19871 ==b==
19872 ===ba===
19873 ===bb===
19874 ====bba====
19875 ===bc===
19876 ==c==
19877 ===ca===
19878 !! html/php
19879 ====aaa====
19880 !! end
19881
19882 !! test
19883 Section extraction test (section 4)
19884 !! options
19885 section=4
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 ==b==
19900 ===ba===
19901 ===bb===
19902 ====bba====
19903 ===bc===
19904 !! end
19905
19906 !! test
19907 Section extraction test (section 5)
19908 !! options
19909 section=5
19910 !! wikitext
19911 start
19912 ==a==
19913 ===aa===
19914 ====aaa====
19915 ==b==
19916 ===ba===
19917 ===bb===
19918 ====bba====
19919 ===bc===
19920 ==c==
19921 ===ca===
19922 !! html/php
19923 ===ba===
19924 !! end
19925
19926 !! test
19927 Section extraction test (section 6)
19928 !! options
19929 section=6
19930 !! wikitext
19931 start
19932 ==a==
19933 ===aa===
19934 ====aaa====
19935 ==b==
19936 ===ba===
19937 ===bb===
19938 ====bba====
19939 ===bc===
19940 ==c==
19941 ===ca===
19942 !! html/php
19943 ===bb===
19944 ====bba====
19945 !! end
19946
19947 !! test
19948 Section extraction test (section 7)
19949 !! options
19950 section=7
19951 !! wikitext
19952 start
19953 ==a==
19954 ===aa===
19955 ====aaa====
19956 ==b==
19957 ===ba===
19958 ===bb===
19959 ====bba====
19960 ===bc===
19961 ==c==
19962 ===ca===
19963 !! html/php
19964 ====bba====
19965 !! end
19966
19967 !! test
19968 Section extraction test (section 8)
19969 !! options
19970 section=8
19971 !! wikitext
19972 start
19973 ==a==
19974 ===aa===
19975 ====aaa====
19976 ==b==
19977 ===ba===
19978 ===bb===
19979 ====bba====
19980 ===bc===
19981 ==c==
19982 ===ca===
19983 !! html/php
19984 ===bc===
19985 !! end
19986
19987 !! test
19988 Section extraction test (section 9)
19989 !! options
19990 section=9
19991 !! wikitext
19992 start
19993 ==a==
19994 ===aa===
19995 ====aaa====
19996 ==b==
19997 ===ba===
19998 ===bb===
19999 ====bba====
20000 ===bc===
20001 ==c==
20002 ===ca===
20003 !! html/php
20004 ==c==
20005 ===ca===
20006 !! end
20007
20008 !! test
20009 Section extraction test (section 10)
20010 !! options
20011 section=10
20012 !! wikitext
20013 start
20014 ==a==
20015 ===aa===
20016 ====aaa====
20017 ==b==
20018 ===ba===
20019 ===bb===
20020 ====bba====
20021 ===bc===
20022 ==c==
20023 ===ca===
20024 !! html/php
20025 ===ca===
20026 !! end
20027
20028 !! test
20029 Section extraction test (nonexistent section 11)
20030 !! options
20031 section=11
20032 !! wikitext
20033 start
20034 ==a==
20035 ===aa===
20036 ====aaa====
20037 ==b==
20038 ===ba===
20039 ===bb===
20040 ====bba====
20041 ===bc===
20042 ==c==
20043 ===ca===
20044 !! html/php
20045 !! end
20046
20047 !! test
20048 Section extraction test with bogus heading (section 1)
20049 !! options
20050 section=1
20051 !! wikitext
20052 ==a==
20053 ==bogus== not a legal section
20054 ==b==
20055 !! html/php
20056 ==a==
20057 ==bogus== not a legal section
20058 !! end
20059
20060 !! test
20061 Section extraction test with bogus heading (section 2)
20062 !! options
20063 section=2
20064 !! wikitext
20065 ==a==
20066 ==bogus== not a legal section
20067 ==b==
20068 !! html/php
20069 ==b==
20070 !! end
20071
20072 !! test
20073 Section extraction test with comment after heading (section 1)
20074 !! options
20075 section=1
20076 !! wikitext
20077 ==a==
20078 ==b== <!-- -->
20079 ==c==
20080 !! html/php
20081 ==a==
20082 !! end
20083
20084 !! test
20085 Section extraction test with comment after heading (section 2)
20086 !! options
20087 section=2
20088 !! wikitext
20089 ==a==
20090 ==b== <!-- -->
20091 ==c==
20092 !! html/php
20093 ==b== <!-- -->
20094 !! end
20095
20096 !! test
20097 Section extraction test with bogus <nowiki> heading (section 1)
20098 !! options
20099 section=1
20100 !! wikitext
20101 ==a==
20102 ==bogus== <nowiki>not a legal section</nowiki>
20103 ==b==
20104 !! html/php
20105 ==a==
20106 ==bogus== <nowiki>not a legal section</nowiki>
20107 !! end
20108
20109 !! test
20110 Section extraction test with bogus <nowiki> heading (section 2)
20111 !! options
20112 section=2
20113 !! wikitext
20114 ==a==
20115 ==bogus== <nowiki>not a legal section</nowiki>
20116 ==b==
20117 !! html/php
20118 ==b==
20119 !! end
20120
20121 # Formerly testing for T4587, now resolved by the use of unmarked sections
20122 # instead of respecting commented sections
20123 !! test
20124 Section extraction prefixed by comment (section 1)
20125 !! options
20126 section=1
20127 !! wikitext
20128 <!-- -->==sec1==
20129 ==sec2==
20130 !! html/php
20131 ==sec2==
20132 !!end
20133
20134 !! test
20135 Section extraction prefixed by comment (section 2)
20136 !! options
20137 section=2
20138 !! wikitext
20139 <!-- -->==sec1==
20140 ==sec2==
20141 !! html/php
20142
20143 !!end
20144
20145 # Formerly testing for T4607, now resolved by the use of unmarked sections
20146 # instead of respecting HTML-style headings
20147 !! test
20148 Section extraction, mixed wiki and html (section 1)
20149 !! options
20150 section=1
20151 !! wikitext
20152 <h2>unmarked</h2>
20153 unmarked
20154 ==1==
20155 one
20156 ==2==
20157 two
20158 !! html/php
20159 ==1==
20160 one
20161 !! end
20162
20163 !! test
20164 Section extraction, mixed wiki and html (section 2)
20165 !! options
20166 section=2
20167 !! wikitext
20168 <h2>unmarked</h2>
20169 unmarked
20170 ==1==
20171 one
20172 ==2==
20173 two
20174 !! html/php
20175 ==2==
20176 two
20177 !! end
20178
20179
20180 # Formerly testing for T5342
20181 !! test
20182 Section extraction, heading surrounded by <noinclude>
20183 !! options
20184 section=1
20185 !! wikitext
20186 <noinclude>==unmarked==</noinclude>
20187 ==marked==
20188 !! html/php
20189 ==marked==
20190 !!end
20191
20192 # Test behavior of T21910
20193 !! test
20194 Sectiion with all-equals
20195 !! options
20196 section=2
20197 !! wikitext
20198 ===
20199 The line above must have a trailing space
20200 === <!--
20201 --> <!-- -->
20202 But just in case it doesn't...
20203 !! html/php
20204 === <!--
20205 --> <!-- -->
20206 But just in case it doesn't...
20207 !! end
20208
20209 !! test
20210 Section replacement test (section 0)
20211 !! options
20212 replace=0,"xxx"
20213 !! wikitext
20214 start
20215 ==a==
20216 ===aa===
20217 ====aaa====
20218 ==b==
20219 ===ba===
20220 ===bb===
20221 ====bba====
20222 ===bc===
20223 ==c==
20224 ===ca===
20225 !! html/php
20226 xxx
20227
20228 ==a==
20229 ===aa===
20230 ====aaa====
20231 ==b==
20232 ===ba===
20233 ===bb===
20234 ====bba====
20235 ===bc===
20236 ==c==
20237 ===ca===
20238 !! end
20239
20240 !! test
20241 Section replacement test (section 1)
20242 !! options
20243 replace=1,"xxx"
20244 !! wikitext
20245 start
20246 ==a==
20247 ===aa===
20248 ====aaa====
20249 ==b==
20250 ===ba===
20251 ===bb===
20252 ====bba====
20253 ===bc===
20254 ==c==
20255 ===ca===
20256 !! html/php
20257 start
20258 xxx
20259
20260 ==b==
20261 ===ba===
20262 ===bb===
20263 ====bba====
20264 ===bc===
20265 ==c==
20266 ===ca===
20267 !! end
20268
20269 !! test
20270 Section replacement test (section 2)
20271 !! options
20272 replace=2,"xxx"
20273 !! wikitext
20274 start
20275 ==a==
20276 ===aa===
20277 ====aaa====
20278 ==b==
20279 ===ba===
20280 ===bb===
20281 ====bba====
20282 ===bc===
20283 ==c==
20284 ===ca===
20285 !! html/php
20286 start
20287 ==a==
20288 xxx
20289
20290 ==b==
20291 ===ba===
20292 ===bb===
20293 ====bba====
20294 ===bc===
20295 ==c==
20296 ===ca===
20297 !! end
20298
20299 !! test
20300 Section replacement test (section 3)
20301 !! options
20302 replace=3,"xxx"
20303 !! wikitext
20304 start
20305 ==a==
20306 ===aa===
20307 ====aaa====
20308 ==b==
20309 ===ba===
20310 ===bb===
20311 ====bba====
20312 ===bc===
20313 ==c==
20314 ===ca===
20315 !! html/php
20316 start
20317 ==a==
20318 ===aa===
20319 xxx
20320
20321 ==b==
20322 ===ba===
20323 ===bb===
20324 ====bba====
20325 ===bc===
20326 ==c==
20327 ===ca===
20328 !! end
20329
20330 !! test
20331 Section replacement test (section 4)
20332 !! options
20333 replace=4,"xxx"
20334 !! wikitext
20335 start
20336 ==a==
20337 ===aa===
20338 ====aaa====
20339 ==b==
20340 ===ba===
20341 ===bb===
20342 ====bba====
20343 ===bc===
20344 ==c==
20345 ===ca===
20346 !! html/php
20347 start
20348 ==a==
20349 ===aa===
20350 ====aaa====
20351 xxx
20352
20353 ==c==
20354 ===ca===
20355 !! end
20356
20357 !! test
20358 Section replacement test (section 5)
20359 !! options
20360 replace=5,"xxx"
20361 !! wikitext
20362 start
20363 ==a==
20364 ===aa===
20365 ====aaa====
20366 ==b==
20367 ===ba===
20368 ===bb===
20369 ====bba====
20370 ===bc===
20371 ==c==
20372 ===ca===
20373 !! html/php
20374 start
20375 ==a==
20376 ===aa===
20377 ====aaa====
20378 ==b==
20379 xxx
20380
20381 ===bb===
20382 ====bba====
20383 ===bc===
20384 ==c==
20385 ===ca===
20386 !! end
20387
20388 !! test
20389 Section replacement test (section 6)
20390 !! options
20391 replace=6,"xxx"
20392 !! wikitext
20393 start
20394 ==a==
20395 ===aa===
20396 ====aaa====
20397 ==b==
20398 ===ba===
20399 ===bb===
20400 ====bba====
20401 ===bc===
20402 ==c==
20403 ===ca===
20404 !! html/php
20405 start
20406 ==a==
20407 ===aa===
20408 ====aaa====
20409 ==b==
20410 ===ba===
20411 xxx
20412
20413 ===bc===
20414 ==c==
20415 ===ca===
20416 !! end
20417
20418 !! test
20419 Section replacement test (section 7)
20420 !! options
20421 replace=7,"xxx"
20422 !! wikitext
20423 start
20424 ==a==
20425 ===aa===
20426 ====aaa====
20427 ==b==
20428 ===ba===
20429 ===bb===
20430 ====bba====
20431 ===bc===
20432 ==c==
20433 ===ca===
20434 !! html/php
20435 start
20436 ==a==
20437 ===aa===
20438 ====aaa====
20439 ==b==
20440 ===ba===
20441 ===bb===
20442 xxx
20443
20444 ===bc===
20445 ==c==
20446 ===ca===
20447 !! end
20448
20449 !! test
20450 Section replacement test (section 8)
20451 !! options
20452 replace=8,"xxx"
20453 !! wikitext
20454 start
20455 ==a==
20456 ===aa===
20457 ====aaa====
20458 ==b==
20459 ===ba===
20460 ===bb===
20461 ====bba====
20462 ===bc===
20463 ==c==
20464 ===ca===
20465 !! html/php
20466 start
20467 ==a==
20468 ===aa===
20469 ====aaa====
20470 ==b==
20471 ===ba===
20472 ===bb===
20473 ====bba====
20474 xxx
20475
20476 ==c==
20477 ===ca===
20478 !!end
20479
20480 !! test
20481 Section replacement test (section 9)
20482 !! options
20483 replace=9,"xxx"
20484 !! wikitext
20485 start
20486 ==a==
20487 ===aa===
20488 ====aaa====
20489 ==b==
20490 ===ba===
20491 ===bb===
20492 ====bba====
20493 ===bc===
20494 ==c==
20495 ===ca===
20496 !! html/php
20497 start
20498 ==a==
20499 ===aa===
20500 ====aaa====
20501 ==b==
20502 ===ba===
20503 ===bb===
20504 ====bba====
20505 ===bc===
20506 xxx
20507 !! end
20508
20509 !! test
20510 Section replacement test (section 10)
20511 !! options
20512 replace=10,"xxx"
20513 !! wikitext
20514 start
20515 ==a==
20516 ===aa===
20517 ====aaa====
20518 ==b==
20519 ===ba===
20520 ===bb===
20521 ====bba====
20522 ===bc===
20523 ==c==
20524 ===ca===
20525 !! html/php
20526 start
20527 ==a==
20528 ===aa===
20529 ====aaa====
20530 ==b==
20531 ===ba===
20532 ===bb===
20533 ====bba====
20534 ===bc===
20535 ==c==
20536 xxx
20537 !! end
20538
20539 !! test
20540 Section replacement test with initial whitespace (T15728)
20541 !! options
20542 replace=2,"xxx"
20543 !! wikitext
20544 Preformatted initial line
20545 ==a==
20546 ===a===
20547 !! html/php
20548 Preformatted initial line
20549 ==a==
20550 xxx
20551 !! end
20552
20553
20554 !! test
20555 Section extraction, heading followed by pre with 20 spaces (T8398)
20556 !! options
20557 section=1
20558 !! wikitext
20559 ==a==
20560 a
20561 !! html/php
20562 ==a==
20563 a
20564 !! end
20565
20566 !! test
20567 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20568 !! options
20569 section=1
20570 !! wikitext
20571 ==a==
20572 a
20573 !! html/php
20574 ==a==
20575 a
20576 !! end
20577
20578
20579 !! test
20580 Section extraction, <pre> around bogus header (T12309)
20581 !! options
20582 section=2
20583 !! wikitext
20584 == Section One ==
20585 <pre>
20586 =======
20587 </pre>
20588
20589 == Section Two ==
20590 stuff
20591 !! html/php
20592 == Section Two ==
20593 stuff
20594 !! end
20595
20596 !! test
20597 Section replacement, <pre> around bogus header (T12309)
20598 !! options
20599 replace=2,"xxx"
20600 !! wikitext
20601 == Section One ==
20602 <pre>
20603 =======
20604 </pre>
20605
20606 == Section Two ==
20607 stuff
20608 !! html/php
20609 == Section One ==
20610 <pre>
20611 =======
20612 </pre>
20613
20614 xxx
20615 !! end
20616
20617 !! test
20618 Handling of &#x0A; in URLs
20619 !! wikitext
20620 *irc://&#x0A;a
20621 !! html/php
20622 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20623
20624 !! html/parsoid
20625 <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>
20626 !! end
20627
20628 !! test
20629 Handling of %0A in URLs
20630 !! wikitext
20631 *irc://%0Aa
20632 !! html/php
20633 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20634
20635 !! html/parsoid
20636 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20637 !! end
20638
20639 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20640 !! test
20641 5 quotes, code coverage +1 line
20642 !! options
20643 parsoid=wt2html
20644 !! wikitext
20645 '''''
20646 !! html/php
20647 !! html/parsoid
20648 <p><b><i></i></b></p>
20649 !! end
20650
20651 # same html as previous, but wikitext adjusted to match parsoid html2wt
20652 # note that wt2html and html2html will put the <i> before the <b>
20653 !! test
20654 5 quotes, code coverage +1 line w/ nowiki (1)
20655 !! options
20656 parsoid=wt2wt,html2wt
20657 !! wikitext
20658 '''''<nowiki/>'''''
20659 !! html/php
20660 <p><i></i>
20661 </p>
20662 !! html/parsoid
20663 <p><b><i></i></b></p>
20664 !! end
20665
20666 # same as previous, just swapping the <i> and <b>
20667 !! test
20668 5 quotes, code coverage +1 line w/ nowiki (2)
20669 !! wikitext
20670 '''''<nowiki/>'''''
20671 !! html/php
20672 <p><i></i>
20673 </p>
20674 !! html/parsoid
20675 <p><i><b></b></i></p>
20676 !! end
20677
20678 !! test
20679 Special:Search page linking.
20680 !! wikitext
20681 {{Special:search}}
20682 !! html
20683 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20684 </p>
20685 !! end
20686
20687 !! test
20688 {{!}} is a magic word
20689 !! wikitext
20690 {{!}} is a magic word there and {{!}} is still a magic word here
20691 | is not a magic word here but {{!}} is still a magic word here
20692 !! html/php
20693 <p>| is a magic word there and | is still a magic word here
20694 | is not a magic word here but | is still a magic word here
20695 </p>
20696 !! html/parsoid
20697 <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
20698 | 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>
20699 !! end
20700
20701 !! test
20702 Say the magic word
20703 !! options
20704 title=[[Parser test]]
20705 !! wikitext
20706 *{{PAGENAME}}
20707 *{{PAGENAMEE}}
20708 *{{FULLPAGENAME}}
20709 *{{FULLPAGENAMEE}}
20710 *{{BASEPAGENAME}}
20711 *{{BASEPAGENAMEE}}
20712 *{{SUBPAGENAME}}
20713 *{{SUBPAGENAMEE}}
20714 *{{ROOTPAGENAME}}
20715 *{{ROOTPAGENAMEE}}
20716 *{{TALKPAGENAME}}
20717 *{{TALKPAGENAMEE}}
20718 *{{SUBJECTPAGENAME}}
20719 *{{SUBJECTPAGENAMEE}}
20720 *{{NAMESPACEE}}
20721 *{{NAMESPACE}}
20722 *{{NAMESPACENUMBER}}
20723 *{{TALKSPACE}}
20724 *{{TALKSPACEE}}
20725 *{{SUBJECTSPACE}}
20726 *{{SUBJECTSPACEE}}
20727 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20728 !! html
20729 <ul><li>Parser test</li>
20730 <li>Parser_test</li>
20731 <li>Parser test</li>
20732 <li>Parser_test</li>
20733 <li>Parser test</li>
20734 <li>Parser_test</li>
20735 <li>Parser test</li>
20736 <li>Parser_test</li>
20737 <li>Parser test</li>
20738 <li>Parser_test</li>
20739 <li>Talk:Parser test</li>
20740 <li>Talk:Parser_test</li>
20741 <li>Parser test</li>
20742 <li>Parser_test</li>
20743 <li></li>
20744 <li></li>
20745 <li>0</li>
20746 <li>Talk</li>
20747 <li>Talk</li>
20748 <li></li>
20749 <li></li>
20750 <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>
20751
20752 !! end
20753 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20754
20755 !! test
20756 Gallery with valid attributes
20757 !! wikitext
20758 <gallery type="123" summary="345">
20759 File:File:Foobar.jpg
20760 </gallery>
20761 !! html/php
20762 <ul class="gallery mw-gallery-traditional" type="123">
20763 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20764 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20765 <div class="gallerytext">
20766 </div>
20767 </div></li>
20768 </ul>
20769
20770 !! html/parsoid
20771 <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"}}'>
20772 <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>
20773 </ul>
20774 !! end
20775
20776 ## Parsoid thinks the "centre" here is a property, not a caption.
20777 !! test
20778 Gallery
20779 !! options
20780 parsoid={
20781 "modes": ["wt2html"],
20782 "nativeGallery": true
20783 }
20784 !! wikitext
20785 <gallery>
20786 image1.png |
20787 image2.gif|||||
20788
20789 image3|
20790 image4 |300px| centre
20791 image5.svg| http://///////
20792 [[x|xx]]]]
20793 * image6
20794 </gallery>
20795 !! html/php
20796 <ul class="gallery mw-gallery-traditional">
20797 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20798 <div class="thumb" style="height: 150px;">Image1.png</div>
20799 <div class="gallerytext">
20800 </div>
20801 </div></li>
20802 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20803 <div class="thumb" style="height: 150px;">Image2.gif</div>
20804 <div class="gallerytext">
20805 </div>
20806 </div></li>
20807 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20808 <div class="thumb" style="height: 150px;">Image3</div>
20809 <div class="gallerytext">
20810 </div>
20811 </div></li>
20812 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20813 <div class="thumb" style="height: 150px;">Image4</div>
20814 <div class="gallerytext">
20815 <pre>centre
20816 </pre>
20817 </div>
20818 </div></li>
20819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20820 <div class="thumb" style="height: 150px;">Image5.svg</div>
20821 <div class="gallerytext">
20822 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20823 </p>
20824 </div>
20825 </div></li>
20826 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20827 <div class="thumb" style="height: 150px;">* image6</div>
20828 <div class="gallerytext">
20829 </div>
20830 </div></li>
20831 </ul>
20832
20833 !! html/parsoid
20834 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20835 <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>
20836 <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>
20837 <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>
20838 <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>
20839 <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>
20840 <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>
20841 </ul>
20842 !! end
20843
20844 !! test
20845 Gallery (with options, html)
20846 !! options
20847 parsoid={
20848 "modes": ["wt2html", "html2html"],
20849 "nativeGallery": true
20850 }
20851 !! wikitext
20852 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20853 File:Nonexistent.jpg|caption
20854 File:Nonexistent.jpg
20855 image:foobar.jpg|some '''caption''' [[Main Page]]
20856 image:foobar.jpg
20857 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20858 </gallery>
20859 !! html/php
20860 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20861 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20862 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20863 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20864 <div class="gallerytext">
20865 <p>caption
20866 </p>
20867 </div>
20868 </div></li>
20869 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20870 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20871 <div class="gallerytext">
20872 </div>
20873 </div></li>
20874 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20875 <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>
20876 <div class="gallerytext">
20877 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20878 </p>
20879 </div>
20880 </div></li>
20881 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20882 <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>
20883 <div class="gallerytext">
20884 </div>
20885 </div></li>
20886 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20887 <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>
20888 <div class="gallerytext">
20889 <p>blabla.
20890 </p>
20891 </div>
20892 </div></li>
20893 </ul>
20894
20895 !! html/parsoid
20896 <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":{}}'>
20897 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20898 <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>
20899 <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>
20900 <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>
20901 <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>
20902 <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>
20903 </ul>
20904 !! end
20905
20906 !! test
20907 Gallery (with options, extsrc)
20908 !! options
20909 parsoid={
20910 "nativeGallery": false
20911 }
20912 !! wikitext
20913 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20914 File:Nonexistent.jpg|caption
20915 File:Nonexistent.jpg
20916 image:foobar.jpg|some '''caption''' [[Main Page]]
20917 image:foobar.jpg
20918 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20919 </gallery>
20920 !! html/php
20921 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20922 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20923 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20924 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20925 <div class="gallerytext">
20926 <p>caption
20927 </p>
20928 </div>
20929 </div></li>
20930 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20931 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20932 <div class="gallerytext">
20933 </div>
20934 </div></li>
20935 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20936 <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>
20937 <div class="gallerytext">
20938 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20939 </p>
20940 </div>
20941 </div></li>
20942 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20943 <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>
20944 <div class="gallerytext">
20945 </div>
20946 </div></li>
20947 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20948 <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>
20949 <div class="gallerytext">
20950 <p>blabla.
20951 </p>
20952 </div>
20953 </div></li>
20954 </ul>
20955
20956 !! html/parsoid
20957 <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"}}'>
20958 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20959 <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>
20960 <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>
20961 <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>
20962 <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>
20963 <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>
20964 </ul>
20965 !! end
20966
20967 !! test
20968 Gallery (without px units)
20969 !! wikitext
20970 <gallery widths="70" heights="40">
20971 File:Foobar.jpg
20972 </gallery>
20973 !! html/php
20974 <ul class="gallery mw-gallery-traditional">
20975 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20976 <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>
20977 <div class="gallerytext">
20978 </div>
20979 </div></li>
20980 </ul>
20981
20982 !! html/parsoid
20983 <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"}}'>
20984 <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>
20985 </ul>
20986 !! end
20987
20988 !! test
20989 Gallery (with invalid units)
20990 !! wikitext
20991 <gallery widths="70em" heights="40em">
20992 File:Foobar.jpg
20993 </gallery>
20994 !! html/php
20995 <ul class="gallery mw-gallery-traditional">
20996 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20997 <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>
20998 <div class="gallerytext">
20999 </div>
21000 </div></li>
21001 </ul>
21002
21003 !! html/parsoid
21004 <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"}}'>
21005 <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>
21006 </ul>
21007 !! end
21008
21009 !! test
21010 Gallery with link that has fragment
21011 !! options
21012 parsoid={
21013 "modes": ["wt2html", "html2html"],
21014 "nativeGallery": true
21015 }
21016 !! wikitext
21017 <gallery>
21018 image:foobar.jpg|link=Main_Page
21019 image:foobar.jpg|link=Main_Page#section
21020 image:foobar.jpg|link=Main Page#section|caption
21021 </gallery>
21022 !! html/php
21023 <ul class="gallery mw-gallery-traditional">
21024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21025 <div class="thumb" style="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>
21026 <div class="gallerytext">
21027 </div>
21028 </div></li>
21029 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21030 <div class="thumb" style="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>
21031 <div class="gallerytext">
21032 </div>
21033 </div></li>
21034 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21035 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
21036 <div class="gallerytext">
21037 <p>caption
21038 </p>
21039 </div>
21040 </div></li>
21041 </ul>
21042
21043 !! html/parsoid
21044 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21045 <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>
21046 <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>
21047 <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>
21048 </ul>
21049 !! end
21050
21051 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
21052 !! test
21053 Gallery with template inside caption
21054 !! options
21055 parsoid={
21056 "nativeGallery": true
21057 }
21058 !! wikitext
21059 <gallery caption="{{echo|hi}}">
21060 File:Foobar.jpg|{{echo|ho}}
21061 </gallery>
21062 !! html/php
21063 <ul class="gallery mw-gallery-traditional">
21064 <li class='gallerycaption'>{{echo|hi}}</li>
21065 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21066 <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>
21067 <div class="gallerytext">
21068 <p>ho
21069 </p>
21070 </div>
21071 </div></li>
21072 </ul>
21073
21074 !! html/parsoid
21075 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21076 <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>
21077 <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>
21078 </ul>
21079 !! end
21080
21081 !! test
21082 Gallery with wikitext inside caption
21083 !! options
21084 parsoid={
21085 "nativeGallery": true
21086 }
21087 !! wikitext
21088 <gallery>
21089 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21090 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21091 </gallery>
21092 !! html/php
21093 <ul class="gallery mw-gallery-traditional">
21094 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21095 <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>
21096 <div class="gallerytext">
21097 <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>
21098 </p>
21099 </div>
21100 </div></li>
21101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21102 <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>
21103 <div class="gallerytext">
21104 <p>This is a test template
21105 </p>
21106 </div>
21107 </div></li>
21108 </ul>
21109
21110 !! html/parsoid
21111 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21112 <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>
21113 <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>
21114 </ul>
21115 !! end
21116
21117 !! test
21118 Gallery (with showfilename option)
21119 !! options
21120 parsoid={
21121 "nativeGallery": true
21122 }
21123 !! wikitext
21124 <gallery showfilename="">
21125 File:Nonexistent.jpg|caption
21126 File:Nonexistent.jpg
21127 File:Foobar.jpg|some '''caption''' [[Main Page]]
21128 File:Foobar.jpg
21129 </gallery>
21130 !! html/php
21131 <ul class="gallery mw-gallery-traditional">
21132 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21133 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21134 <div class="gallerytext">
21135 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21136 caption
21137 </p>
21138 </div>
21139 </div></li>
21140 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21141 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21142 <div class="gallerytext">
21143 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21144 </p>
21145 </div>
21146 </div></li>
21147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21148 <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>
21149 <div class="gallerytext">
21150 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21151 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21152 </p>
21153 </div>
21154 </div></li>
21155 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21156 <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>
21157 <div class="gallerytext">
21158 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21159 </p>
21160 </div>
21161 </div></li>
21162 </ul>
21163
21164 !! html/parsoid
21165 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21166 <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>
21167 <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>
21168 <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>
21169 <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>
21170 </ul>
21171 !! end
21172
21173 ## Should Parsoid be preserving these variations? See T151367
21174 !! test
21175 Gallery (with namespace-less filenames)
21176 !! options
21177 parsoid={
21178 "modes": ["wt2html", "html2html"],
21179 "nativeGallery": true
21180 }
21181 !! wikitext
21182 <gallery>
21183 File:Nonexistent.jpg
21184 Nonexistent.jpg
21185 image:foobar.jpg
21186 foobar.jpg
21187 </gallery>
21188 !! html/php
21189 <ul class="gallery mw-gallery-traditional">
21190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21191 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21192 <div class="gallerytext">
21193 </div>
21194 </div></li>
21195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21196 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21197 <div class="gallerytext">
21198 </div>
21199 </div></li>
21200 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21201 <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>
21202 <div class="gallerytext">
21203 </div>
21204 </div></li>
21205 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21206 <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>
21207 <div class="gallerytext">
21208 </div>
21209 </div></li>
21210 </ul>
21211
21212 !! html/parsoid
21213 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21214 <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>
21215 <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>
21216 <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>
21217 <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>
21218 </ul>
21219 !! end
21220
21221 !! test
21222 Gallery override link with wikilink (T36852)
21223 !! options
21224 parsoid={
21225 "nativeGallery": true
21226 }
21227 !! wikitext
21228 <gallery>
21229 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21230 </gallery>
21231 !! html/php
21232 <ul class="gallery mw-gallery-traditional">
21233 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21234 <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>
21235 <div class="gallerytext">
21236 </div>
21237 </div></li>
21238 </ul>
21239
21240 !! html/parsoid
21241 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21242 <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>
21243 </ul>
21244 !! end
21245
21246 !! test
21247 Gallery override link with absolute external link (T36852)
21248 !! options
21249 parsoid={
21250 "nativeGallery": true
21251 }
21252 !! wikitext
21253 <gallery>
21254 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21255 </gallery>
21256 !! html/php
21257 <ul class="gallery mw-gallery-traditional">
21258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21259 <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>
21260 <div class="gallerytext">
21261 </div>
21262 </div></li>
21263 </ul>
21264
21265 !! html/parsoid
21266 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21267 <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>
21268 </ul>
21269 !! end
21270
21271 !! test
21272 Gallery override link with absolute external link with LanguageConverter
21273 !! options
21274 language=zh
21275 !! wikitext
21276 <gallery>
21277 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21278 </gallery>
21279 !! html/php
21280 <ul class="gallery mw-gallery-traditional">
21281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21282 <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>
21283 <div class="gallerytext">
21284 <p>caption
21285 </p>
21286 </div>
21287 </div></li>
21288 </ul>
21289
21290 !! html/parsoid
21291 <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"}}'>
21292 <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>
21293 </ul>
21294 !! end
21295
21296 !! test
21297 Gallery override link with malicious javascript (T36852)
21298 !! options
21299 parsoid={
21300 "modes": ["wt2html", "html2html"],
21301 "nativeGallery": true
21302 }
21303 !! wikitext
21304 <gallery>
21305 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21306 </gallery>
21307 !! html/php
21308 <ul class="gallery mw-gallery-traditional">
21309 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21310 <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>
21311 <div class="gallerytext">
21312 </div>
21313 </div></li>
21314 </ul>
21315
21316 !! html/parsoid
21317 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21318 <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>
21319 </ul>
21320 !! end
21321
21322 # Note that parsoid uses the invalid link as a caption, PHP does not.
21323 !! test
21324 Gallery with invalid title as link (T45964)
21325 !! options
21326 parsoid={
21327 "modes": ["wt2html", "html2html"],
21328 "nativeGallery": true
21329 }
21330 !! wikitext
21331 <gallery>
21332 File:Foobar.jpg|link=<
21333 </gallery>
21334 !! html/php
21335 <ul class="gallery mw-gallery-traditional">
21336 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21337 <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>
21338 <div class="gallerytext">
21339 </div>
21340 </div></li>
21341 </ul>
21342
21343 !! html/parsoid
21344 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21345 <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>
21346 </ul>
21347 !! end
21348
21349 !! test
21350 Serialize gallery without attrs in data-mw
21351 !! options
21352 parsoid={
21353 "modes": ["html2wt"],
21354 "nativeGallery": true
21355 }
21356 !! html/parsoid
21357 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21358 <li class="gallerycaption">123</li>
21359 <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>
21360 </ul>
21361 !! wikitext
21362 <gallery caption="123">
21363 File:Test.png
21364 </gallery>
21365 !! end
21366
21367 !! test
21368 Gallery with class and style attributes
21369 !! options
21370 parsoid={
21371 "nativeGallery": true
21372 }
21373 !! wikitext
21374 <gallery class="center" style="text-align: center;">
21375 File:Foobar.jpg
21376 </gallery>
21377 !! html/php
21378 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21379 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21380 <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>
21381 <div class="gallerytext">
21382 </div>
21383 </div></li>
21384 </ul>
21385
21386 !! html/parsoid
21387 <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":{}}'>
21388 <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>
21389 </ul>
21390 !! end
21391
21392 !! test
21393 Gallery in slideshow mode
21394 !! options
21395 parsoid={
21396 "nativeGallery": true
21397 }
21398 !! wikitext
21399 <gallery mode="slideshow" showthumbnails="">
21400 File:Foobar.jpg
21401 </gallery>
21402 !! html/php
21403 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21404 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21405 <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>
21406 <div class="gallerytext">
21407 </div>
21408 </div></li>
21409 </ul>
21410
21411 !! html/parsoid
21412 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21413 <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>
21414 </ul>
21415 !! end
21416
21417 !! test
21418 Serialize gallery image captions on a line
21419 !! options
21420 parsoid={
21421 "modes": ["html2wt"],
21422 "nativeGallery": true
21423 }
21424 !! html/parsoid
21425 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21426 <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>
21427 <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>
21428 </ul>
21429 !! wikitext
21430 <gallery>
21431 File:Foobar.jpg| hi ho
21432 File:Foobar.jpg|hi<br />ho
21433 </gallery>
21434 !! end
21435
21436 !! test
21437 HTML Hex character encoding (spells the word "JavaScript")
21438 !! options
21439 parsoid=wt2html,wt2wt,html2html
21440 !! wikitext
21441 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21442 !! html/php
21443 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21444 </p>
21445 !! html/parsoid
21446 <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>
21447 !! end
21448
21449 !! test
21450 HTML Hex character encoding bogus encoding (T28437 regression check)
21451 !! wikitext
21452 &#xsee;&#XSEE;
21453 !! html
21454 <p>&amp;#xsee;&amp;#XSEE;
21455 </p>
21456 !! end
21457
21458 !! test
21459 HTML Hex character encoding mixed case
21460 !! options
21461 parsoid=wt2html,wt2wt,html2html
21462 !! wikitext
21463 &#xEE;&#Xee;
21464 !! html/php
21465 <p>&#xee;&#xee;
21466 </p>
21467 !! html/parsoid
21468 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21469 !! end
21470
21471 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21472 # Note that U+000C (form feed) is not a valid XML character, so
21473 # it is banned even though allowed in HTML5.
21474 !! test
21475 Illegal character references (T106578)
21476 !! wikitext
21477 ; Null: &#00;
21478 ; FF: &#xC;
21479 ; CR: &#xD;
21480 ; Control (low): &#8;
21481 ; Control (high): &#x7F; &#x9F;
21482 ; Surrogate: &#xD83D;&#xDCA9;
21483 ; This is an okay astral character: &#x1F4A9;
21484 !! html+tidy
21485 <dl><dt>Null</dt>
21486 <dd>&amp;#00;</dd>
21487 <dt>FF</dt>
21488 <dd>&amp;#xC;</dd>
21489 <dt>CR</dt>
21490 <dd>&amp;#xD;</dd>
21491 <dt>Control (low)</dt>
21492 <dd>&amp;#8;</dd>
21493 <dt>Control (high)</dt>
21494 <dd>&amp;#x7F; &amp;#x9F;</dd>
21495 <dt>Surrogate</dt>
21496 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21497 <dt>This is an okay astral character</dt>
21498 <dd>&#x1f4a9;</dd></dl>
21499 !! end
21500
21501 !! test
21502 __FORCETOC__ override
21503 !! wikitext
21504 __NEWSECTIONLINK__
21505 __FORCETOC__
21506 !! html/php
21507 <p><br />
21508 </p>
21509 !! end
21510
21511 !! test
21512 ISBN code coverage
21513 !! wikitext
21514 ISBN 978-0-1234-56&#x20;789
21515 !! html/php
21516 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21517 </p>
21518 !! html/parsoid
21519 <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>
21520 !! end
21521
21522 !! test
21523 ISBN followed by 5 spaces
21524 !! wikitext
21525 ISBN
21526 !! html
21527 <p>ISBN
21528 </p>
21529 !! end
21530
21531 !! test
21532 Double ISBN
21533 !! wikitext
21534 ISBN ISBN 1234567890
21535 !! html/php
21536 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21537 </p>
21538 !! html/parsoid
21539 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21540 !! end
21541
21542 # Uppercase X and lowercase x as well
21543 !! test
21544 ISBN with an X
21545 !! wikitext
21546 ISBN 3-462-04561-X
21547 ISBN 3-462-04561-x
21548 ISBN 080442957X
21549 ISBN 080442957x
21550 ISBN 978080442957X
21551 ISBN 978080442957x
21552 !! html/php
21553 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21554 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21555 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21556 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21557 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21558 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21559 </p>
21560 !! html/parsoid
21561 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21562 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21563 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21564 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21565 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21566 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21567 !! end
21568
21569 !! test
21570 ISBN with empty prefix (parsoid test)
21571 !! wikitext
21572 ISBN 1234567890
21573 !! html/php
21574 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21575 </p>
21576 !! html/parsoid
21577 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21578 !! end
21579
21580 !! test
21581 T24905: <abbr> followed by ISBN followed by </a>
21582 !! wikitext
21583 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21584 !! html/php
21585 <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>
21586 </p>
21587 !! html/parsoid
21588 <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>
21589 !! end
21590
21591 !! test
21592 Double RFC
21593 !! wikitext
21594 RFC RFC 1234
21595 !! html/php
21596 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21597 </p>
21598 !! html/parsoid
21599 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
21600 !! end
21601
21602 !! test
21603 Double RFC with a wiki link
21604 !! wikitext
21605 RFC [[RFC 1234]]
21606 !! html/php
21607 <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>
21608 </p>
21609 !! html/parsoid
21610 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
21611 !! end
21612
21613 !! test
21614 RFC code coverage
21615 !! wikitext
21616 RFC 983&#x20;987
21617 !! html/php
21618 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21619 </p>
21620 !! html/parsoid
21621 <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>
21622 !! end
21623
21624 !! test
21625 Centre-aligned image
21626 !! wikitext
21627 [[Image:foobar.jpg|centre]]
21628 !! html/php
21629 <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>
21630
21631 !! html/parsoid
21632 <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>
21633 !! end
21634
21635 !! test
21636 None-aligned image
21637 !! wikitext
21638 [[Image:foobar.jpg|none]]
21639 !! html/php
21640 <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>
21641
21642 !! html/parsoid
21643 <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>
21644 !! end
21645
21646 !! test
21647 Width + Height sized image (using px) (height is ignored)
21648 !! wikitext
21649 [[Image:foobar.jpg|640x480px]]
21650 !! html/php
21651 <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>
21652 </p>
21653 !! html/parsoid
21654 <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>
21655 !! end
21656
21657 !! test
21658 Width-sized image (using px, no following whitespace)
21659 !! wikitext
21660 [[Image:foobar.jpg|640px]]
21661 !! html/php
21662 <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>
21663 </p>
21664 !! html/parsoid
21665 <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>
21666 !! end
21667
21668 !! test
21669 Width-sized image (using px, with following whitespace - test regression from r39467)
21670 !! wikitext
21671 [[Image:foobar.jpg|640px ]]
21672 !! html/php
21673 <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>
21674 </p>
21675 !! html/parsoid
21676 <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>
21677 !!end
21678
21679 !! test
21680 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21681 !! wikitext
21682 [[Image:foobar.jpg| 640px]]
21683 !! html/php
21684 <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>
21685 </p>
21686 !! html/parsoid
21687 <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>
21688 !! end
21689
21690 !! test
21691 Image with page parameter
21692 !! options
21693 djvu
21694 !! wikitext
21695 [[File:LoremIpsum.djvu|page=2]]
21696 !! html/php
21697 <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>
21698 </p>
21699 !! html/parsoid
21700 <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>
21701 !! end
21702
21703 !! test
21704 Another italics / bold test
21705 !! wikitext
21706 ''' ''x'
21707 !! html
21708 <pre>'<i> </i>x'
21709 </pre>
21710 !!end
21711
21712 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21713 !! test
21714 dt/dd/dl test
21715 !! wikitext
21716 :;;;::
21717 !! html/php
21718 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21719
21720 !! html/parsoid
21721 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21722
21723 !!end
21724
21725 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21726 !! test
21727 Images with the "|" character in the comment
21728 !! wikitext
21729 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21730 !! html/php
21731 <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>
21732
21733 !! html/parsoid
21734 <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>
21735 !! end
21736
21737 !! test
21738 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21739 !! wikitext
21740 <html><script>alert(1);</script></html>
21741 !! html
21742 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21743 </p>
21744 !! end
21745
21746 !! test
21747 HTML with raw HTML ($wgRawHtml==true)
21748 !! options
21749 wgRawHtml=1
21750 !! wikitext
21751 <html><script>alert(1);</script></html>
21752 !! html/php
21753 <p><script>alert(1);</script>
21754 </p>
21755 !! end
21756
21757 !! test
21758 Parents of subpages, one level up
21759 !! options
21760 subpage title=[[Subpage test/L1/L2/L3]]
21761 !! wikitext
21762 [[../|L2]]
21763 !! html
21764 <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>
21765 </p>
21766 !! end
21767
21768
21769 !! test
21770 Parents of subpages, one level up, not named
21771 !! options
21772 subpage title=[[Subpage test/L1/L2/L3]]
21773 !! wikitext
21774 [[../]]
21775 !! html
21776 <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>
21777 </p>
21778 !! end
21779
21780
21781
21782 !! test
21783 Parents of subpages, two levels up
21784 !! options
21785 subpage title=[[Subpage test/L1/L2/L3]]
21786 !! wikitext
21787 [[../../|L1]]2
21788
21789 [[../../|L1]]l
21790 !! html
21791 <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
21792 </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>
21793 </p>
21794 !! end
21795
21796 !! test
21797 Parents of subpages, two levels up, without trailing slash or name.
21798 !! options
21799 subpage title=[[Subpage test/L1/L2/L3]]
21800 !! wikitext
21801 [[../..]]
21802 !! html
21803 <p>[[../..]]
21804 </p>
21805 !! end
21806
21807 !! test
21808 Parents of subpages, two levels up, with lots of extra trailing slashes.
21809 !! options
21810 subpage title=[[Subpage test/L1/L2/L3]]
21811 !! wikitext
21812 [[../../////]]
21813 !! html
21814 <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>
21815 </p>
21816 !! end
21817
21818 !! article
21819 Subpage test/L1/L2/L3Sibling
21820 !! text
21821 Sibling article
21822 !! endarticle
21823
21824 !! test
21825 Transclusion of a sibling page (one level up)
21826 !! options
21827 subpage title=[[Subpage test/L1/L2/L3]]
21828 !! wikitext
21829 {{../L3Sibling}}
21830 !! html
21831 <p>Sibling article
21832 </p>
21833 !! end
21834
21835 !! test
21836 Transclusion of a child page
21837 !! options
21838 subpage title=[[Subpage test/L1/L2]]
21839 !! wikitext
21840 {{/L3Sibling}}
21841 !! html
21842 <p>Sibling article
21843 </p>
21844 !! end
21845
21846 # This is wt2html only in Parsoid because we add <nowiki>
21847 # because of {{..}} and we don't expect to fix that to
21848 # eliminate the nowikis selective for {{..}} markup.
21849 !! test
21850 Non-transclusion because of too many up levels
21851 !! options
21852 subpage title=[[Subpage test/L1/L2/L3]]
21853 parsoid=wt2html
21854 !! wikitext
21855 {{../../../../More than parent}}
21856 !! html/php
21857 <p>{{../../../../More than parent}}
21858 </p>
21859 !! html/parsoid
21860 <p>{{../../../../More than parent}}</p>
21861 !! end
21862
21863 !! test
21864 Definition list code coverage
21865 !! wikitext
21866 ;title :def
21867 ;title :def
21868 ;title:def
21869 !! html/php
21870 <dl><dt>title</dt>
21871 <dd>def</dd>
21872 <dt>title</dt>
21873 <dd>def</dd>
21874 <dt>title</dt>
21875 <dd>def</dd></dl>
21876
21877 !! html/parsoid
21878 <dl><dt>title </dt><dd>def</dd>
21879 <dt>title </dt><dd>def</dd>
21880 <dt>title</dt><dd>def</dd></dl>
21881 !! end
21882
21883 !! test
21884 Don't fall for the self-closing div
21885 !! wikitext
21886 <div>hello world</div/>
21887 !! html
21888 <div>hello world</div>
21889
21890 !! end
21891
21892 !! test
21893 MSGNW magic word
21894 !! wikitext
21895 {{MSGNW:msg}}
21896 !! html/php
21897 <p>&#91;&#91;:Template:Msg&#93;&#93;
21898 </p>
21899 !! end
21900
21901 !! test
21902 RAW magic word
21903 !! wikitext
21904 {{RAW:QUERTY}}
21905 !! html
21906 <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>
21907 </p>
21908 !! end
21909
21910 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21911 !! test
21912 Always escape literal '>' in output, not just after '<'
21913 !! wikitext
21914 ><>
21915 !! html
21916 <p>&gt;&lt;&gt;
21917 </p>
21918 !! end
21919
21920 !! test
21921 Template caching
21922 !! wikitext
21923 {{Test}}
21924 {{Test}}
21925 !! html
21926 <p>This is a test template
21927 This is a test template
21928 </p>
21929 !! end
21930
21931
21932 !! article
21933 MediaWiki:Fake
21934 !! text
21935 ==header==
21936 !! endarticle
21937
21938 !! test
21939 Inclusion of !userCanEdit() content
21940 !! wikitext
21941 {{MediaWiki:Fake}}
21942 !! html
21943 <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>
21944
21945 !! end
21946
21947
21948 !! test
21949 Out-of-order TOC heading levels
21950 !! wikitext
21951 ==2==
21952 ======6======
21953 ===3===
21954 =1=
21955 =====5=====
21956 ==2==
21957 !! html
21958 <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>
21959 <ul>
21960 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21961 <ul>
21962 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21963 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21964 </ul>
21965 </li>
21966 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21967 <ul>
21968 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21969 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21970 </ul>
21971 </li>
21972 </ul>
21973 </div>
21974
21975 <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>
21976 <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>
21977 <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>
21978 <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>
21979 <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>
21980 <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>
21981
21982 !! end
21983
21984
21985 !! test
21986 ISBN with a dummy number
21987 !! wikitext
21988 ISBN ---
21989 !! html
21990 <p>ISBN ---
21991 </p>
21992 !! end
21993
21994
21995 !! test
21996 ISBN with space-delimited number
21997 !! wikitext
21998 ISBN 92 9017 032 8
21999 !! html/php
22000 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22001 </p>
22002 !! html/parsoid
22003 <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>
22004 !! end
22005
22006
22007 !! test
22008 ISBN with multiple spaces, no number
22009 !! wikitext
22010 ISBN foo
22011 !! html
22012 <p>ISBN foo
22013 </p>
22014 !! end
22015
22016
22017 !! test
22018 ISBN length
22019 !! wikitext
22020 ISBN 123456789
22021
22022 ISBN 1234567890
22023
22024 ISBN 12345678901
22025 !! html/php
22026 <p>ISBN 123456789
22027 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22028 </p><p>ISBN 12345678901
22029 </p>
22030 !! html/parsoid
22031 <p>ISBN 123456789</p>
22032
22033 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22034
22035 <p>ISBN 12345678901</p>
22036 !! end
22037
22038
22039 !! test
22040 ISBN with trailing year (T9110)
22041 !! wikitext
22042 ISBN 1-234-56789-0 - 2006
22043
22044 ISBN 1 234 56789 0 - 2006
22045 !! html/php
22046 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22047 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22048 </p>
22049 !! html/parsoid
22050 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22051
22052 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22053 !! end
22054
22055
22056 !! test
22057 anchorencode
22058 !! config
22059 wgFragmentMode=[ 'html5', 'legacy' ]
22060 !! wikitext
22061 {{anchorencode:foo bar©#%n}}
22062 !! html/php
22063 <p>foo_bar©#%n
22064 </p>
22065 !! html/parsoid
22066 <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>
22067 !! end
22068
22069 !! test
22070 anchorencode (legacy)
22071 !! config
22072 wgFragmentMode=[ 'legacy' ]
22073 !! wikitext
22074 {{anchorencode:foo bar©#%n}}
22075 !! html/php
22076 <p>foo_bar.C2.A9.23.25n
22077 </p>
22078 !! end
22079
22080 !! test
22081 anchorencode trims spaces
22082 !! config
22083 wgFragmentMode=[ 'html5', 'legacy' ]
22084 !! wikitext
22085 {{anchorencode: __pretty__please__}}
22086 !! html/php
22087 <p>pretty_please
22088 </p>
22089 !! html/parsoid
22090 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22091 !! end
22092
22093 !! test
22094 anchorencode deals with links
22095 !! config
22096 wgFragmentMode=[ 'html5', 'legacy' ]
22097 !! wikitext
22098 {{anchorencode: [[hello|world]] [[hi]]}}
22099 !! html/php
22100 <p>world_hi
22101 </p>
22102 !! html/parsoid
22103 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22104 !! end
22105
22106 !! test
22107 anchorencode deals with templates
22108 !! config
22109 wgFragmentMode=[ 'html5', 'legacy' ]
22110 !! wikitext
22111 {{anchorencode: {{Foo}} x}}
22112 !! html/php
22113 <p>FOO_x
22114 </p>
22115 !! html/parsoid
22116 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22117 !! end
22118
22119 !! test
22120 anchorencode encodes like the TOC generator: (T20431)
22121 !! config
22122 wgFragmentMode=[ 'html5', 'legacy' ]
22123 !! wikitext
22124 ===_ +:.3A%3A _ &&amp;]] x===
22125 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22126 __NOEDITSECTION__
22127 !! html/php
22128 <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>
22129 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22130 </p>
22131 !! html/parsoid
22132 <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>
22133 <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>
22134 <meta property="mw:PageProp/noeditsection"/>
22135 !! end
22136
22137 !! test
22138 anchorencode encodes like the TOC generator: (T20431) (legacy)
22139 !! config
22140 wgFragmentMode=[ 'legacy' ]
22141 !! wikitext
22142 ===_ +:.3A%3A&&amp;]]===
22143 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22144 __NOEDITSECTION__
22145 !! html/php
22146 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22147 <p>.2B:.3A.253A.26.26.5D.5D
22148 </p>
22149 !! end
22150
22151 !! test
22152 T8200: blockquotes and paragraph formatting
22153 !! wikitext
22154 <blockquote>
22155 foo
22156 </blockquote>
22157
22158 bar
22159
22160 baz
22161 !! html
22162 <blockquote>
22163 <p>foo
22164 </p>
22165 </blockquote>
22166 <p>bar
22167 </p>
22168 <pre>baz
22169 </pre>
22170 !! end
22171
22172 !! test
22173 T10293: Use of center tag ruins paragraph formatting
22174 !! wikitext
22175 <center>
22176 foo
22177 </center>
22178
22179 bar
22180
22181 baz
22182 !! html
22183 <center>
22184 <p>foo
22185 </p>
22186 </center>
22187 <p>bar
22188 </p>
22189 <pre>baz
22190 </pre>
22191 !! end
22192
22193 !!test
22194 Parsing of overlapping (improperly nested) inline html tags
22195 !! wikitext
22196 <span><s>x</span></s>
22197 !! html/php
22198 <p><span><s>x&lt;/span&gt;</s></span>
22199 </p>
22200 !! html/parsoid
22201 <p><span><s>x</s></span>
22202 </p>
22203 !!end
22204
22205 ###
22206 ### Language variants related tests
22207 ###
22208
22209 # Parsoid does not mark self-links.
22210 # Parsoid does not convert links; PHP will do any necessary redirects.
22211
22212 !! test
22213 Self-link in language variants
22214 !! options
22215 title=[[Dunav]] language=sr
22216 !! wikitext
22217 Both [[Dunav]] and [[Дунав]] are names for this river.
22218 !! html/php
22219 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22220 </p>
22221 !! html/parsoid
22222 <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>
22223 !! end
22224
22225 !! article
22226 Дуна
22227 !! text
22228 content
22229 !! endarticle
22230
22231 !! test
22232 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22233 !! options
22234 title=[[Duna]] language=sr
22235 !! wikitext
22236 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22237 !! html/php
22238 <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.
22239 </p>
22240 !! html/parsoid
22241 <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>
22242 !! end
22243
22244 !! test
22245 Link to a section of a variant of this title shouldn't be parsed as self-link
22246 !! options
22247 title=[[Duna]] language=sr
22248 !! wikitext
22249 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22250 !! html/php
22251 <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.
22252 </p>
22253 !! html/parsoid
22254 <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>
22255 !! end
22256
22257 !! test
22258 Link to pages in language variants
22259 !! options
22260 language=sr
22261 !! wikitext
22262 Main Page can be written as [[Маин Паге]]
22263 !! html/php
22264 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22265 </p>
22266 !! html/parsoid
22267 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22268 !! end
22269
22270
22271 !! test
22272 Multiple links to pages in language variants
22273 !! options
22274 language=sr
22275 !! wikitext
22276 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22277 !! html/php
22278 <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>.
22279 </p>
22280 !! html/parsoid
22281 <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>
22282 !! end
22283
22284
22285 !! test
22286 Simple template in language variants
22287 !! options
22288 language=sr
22289 !! wikitext
22290 {{тест}}
22291 !! html/php
22292 <p>This is a test template
22293 </p>
22294 !! end
22295
22296
22297 !! test
22298 Template with explicit namespace in language variants
22299 !! options
22300 language=sr
22301 !! wikitext
22302 {{Template:тест}}
22303 !! html/php
22304 <p>This is a test template
22305 </p>
22306 !! end
22307
22308
22309 !! test
22310 Basic test for template parameter in language variants
22311 !! options
22312 language=sr
22313 !! wikitext
22314 {{парамтест|param=foo}}
22315 !! html/php
22316 <p>This is a test template with parameter foo
22317 </p>
22318 !! end
22319
22320 !! test
22321 Simple category in language variants
22322 !! options
22323 language=sr cat
22324 !! wikitext
22325 [[Category:МедиаWики Усер'с Гуиде]]
22326 !! html/php
22327 cat=МедиаWики_Усер'с_Гуиде sort=
22328 !! html/parsoid
22329 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22330 !! end
22331
22332 !! article
22333 Category:分类
22334 !! text
22335 blah
22336 !! endarticle
22337
22338 !! article
22339 Category:分類
22340 !! text
22341 blah
22342 !! endarticle
22343
22344 ## We used to, but no longer wt2wt this test since the default serializer
22345 ## will normalize all categories to serialize on their own line.
22346 ## This wikitext usage is going to be fairly uncommon in production and
22347 ## selser will take care of preserving formatting in those scenarios.
22348 !! test
22349 Don't convert blue categorylinks to another variant (T35210)
22350 !! options
22351 cat
22352 language=zh
22353 parsoid=wt2html
22354 !! wikitext
22355 [[A]][[Category:分类]]
22356 !! html/php
22357 cat=分类 sort=
22358 !! html/parsoid
22359 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22360 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22361 !! end
22362
22363 !! test
22364 Stripping -{}- tags (language variants)
22365 !! options
22366 language=sr
22367 !! wikitext
22368 Latin proverb: -{Ne nuntium necare}-
22369 !! html/php
22370 <p>Latin proverb: Ne nuntium necare
22371 </p>
22372 !! html/parsoid
22373 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22374 !! end
22375
22376
22377 !! test
22378 Prevent conversion with -{}- tags (language variants)
22379 !! options
22380 language=sr variant=sr-ec
22381 !! wikitext
22382 Latinski: -{Ne nuntium necare}-
22383 !! html/php
22384 <p>Латински: Ne nuntium necare
22385 </p>
22386 !! html/parsoid
22387 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22388 !! end
22389
22390
22391 !! test
22392 Prevent conversion of text with -{}- tags (language variants)
22393 !! options
22394 language=sr variant=sr-ec
22395 !! wikitext
22396 Latinski: -{Ne nuntium necare}-
22397 !! html/php
22398 <p>Латински: Ne nuntium necare
22399 </p>
22400 !! html/parsoid
22401 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22402 !! end
22403
22404
22405 !! test
22406 Prevent conversion of links with -{}- tags (language variants)
22407 !! options
22408 language=sr variant=sr-ec
22409 !! wikitext
22410 -{[[Main Page]]}-
22411 !! html/php
22412 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22413 </p>
22414 !! html/parsoid
22415 <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>
22416 !! end
22417
22418
22419 !! test
22420 -{}- tags within headlines (within html for parserConvert())
22421 !! config
22422 wgFragmentMode=[ 'html5', 'legacy' ]
22423 !! options
22424 language=sr variant=sr-ec
22425 !! wikitext
22426 ==-{Naslov}-==
22427
22428 Note that even an unprotected headline ID is not affected by language
22429 conversion:
22430
22431 ==Latinski==
22432 !! html/php
22433 <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>
22434 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22435 цонверсион:
22436 </p>
22437 <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>
22438
22439 !! html/parsoid
22440 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22441
22442 <p>Note that even an unprotected headline ID is not affected by language
22443 conversion:</p>
22444
22445 <h2 id="Latinski">Latinski</h2>
22446 !! end
22447
22448 !! test
22449 Explicit definition of language variant alternatives
22450 !! options
22451 language=zh variant=zh-tw
22452 !! wikitext
22453 -{zh:China;zh-tw:Taiwan}-, not China
22454 !! html/php
22455 <p>Taiwan, not China
22456 </p>
22457 !! html/parsoid
22458 <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>
22459 !! end
22460
22461 !! test
22462 Filter syntax for language variants
22463 !! options
22464 language=zh variant=zh-tw
22465 !! wikitext
22466 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22467 !! html/php
22468 <p>fooblog, WEBJOURNAL, WEBLOGquux
22469 </p>
22470 !! html/parsoid
22471 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22472 !! end
22473
22474 # Note that Parsoid post-processing for language variants needs to
22475 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22476 !! test
22477 Conversion around HTML tags
22478 !! options
22479 language=sr variant=sr-ec
22480 !! wikitext
22481 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22482 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22483 !! html/php
22484 <p>
22485 <span title="ЛаCтин">ски</span>
22486 </p>
22487 !! html/parsoid
22488 <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"}]}'/>
22489 <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>
22490 !! end
22491
22492 !! test
22493 Explicit session-wise two-way language variant mapping (A flag and - flag)
22494 !! options
22495 language=zh variant=zh-tw
22496 !! wikitext
22497 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22498
22499 Taiwan is not China.
22500
22501 But -{A|zh:China; zh-tw:Taiwan}- is China,
22502
22503 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22504
22505 and -{China}- is China.
22506 !! html/php
22507 <p>This is Taiwan, but we'll forget that now.
22508 </p><p>Taiwan is not China.
22509 </p><p>But Taiwan is Taiwan,
22510 </p><p>(This should be stripped!)
22511 </p><p>and China is China.
22512 </p>
22513 !! html/parsoid
22514 <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>
22515 <p>Taiwan is not China.</p>
22516 <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>
22517 <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>
22518 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22519 !! end
22520
22521 !! test
22522 Explicit session-wise one-way language variant mapping (A flag and - flag)
22523 !! options
22524 language=zh variant=zh-tw
22525 !! wikitext
22526 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22527
22528 COUNTRY is China or Taiwan.
22529
22530 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22531
22532 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22533
22534 and -{COUNTRY}- is COUNTRY.
22535 !! html/php
22536 <p>This is Taiwan, but we'll forget that now.
22537 </p><p>COUNTRY is China or Taiwan.
22538 </p><p>But Taiwan is Taiwan,
22539 </p><p>(This should be stripped!)
22540 </p><p>and COUNTRY is COUNTRY.
22541 </p>
22542 !! html/parsoid
22543 <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>
22544 <p>COUNTRY is China or Taiwan.</p>
22545 <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>
22546 <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>
22547 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22548 !! end
22549
22550 !! test
22551 Explicit session-wise two-way language variant mapping (H flag for hide)
22552 !! options
22553 language=zh variant=zh-tw
22554 !! wikitext
22555 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22556
22557 Taiwan is China.
22558 !! html/php
22559 <p>(This should be stripped!)
22560 </p><p>Taiwan is Taiwan.
22561 </p>
22562 !! html/parsoid
22563 <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>
22564 <p>Taiwan is China.</p>
22565 !! end
22566
22567 !! test
22568 Explicit session-wise one-way language variant mapping (H flag for hide)
22569 !! options
22570 language=zh variant=zh-tw
22571 !! wikitext
22572 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22573
22574 COUNTRY is Taiwan or China.
22575 !! html/php
22576 <p>(This should be stripped!)
22577 </p><p>Taiwan is Taiwan or China.
22578 </p>
22579 !! html/parsoid
22580 <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>
22581 <p>COUNTRY is Taiwan or China.</p>
22582 !! end
22583
22584 ## Note that parsoid test runner does not support 'showtitle' option.
22585 !! test
22586 Adding explicit conversion rule for title (T flag)
22587 !! options
22588 language=zh variant=zh-tw showtitle
22589 !! wikitext
22590 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22591
22592 Taiwan is China.
22593 !! html/php
22594 Taiwan
22595 <p>Should be stripped!
22596 </p><p>Taiwan is China.
22597 </p>
22598 !! html/parsoid
22599 <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>
22600 <p>Taiwan is China.</p>
22601 !! end
22602
22603 !! test
22604 Code coverage: T combined with H flag
22605 !! options
22606 language=zh variant=zh-tw showtitle
22607 !! wikitext
22608 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22609
22610 Taiwan is China.
22611 !! html/php
22612 Taiwan
22613 <p>Should be stripped!
22614 </p><p>Taiwan is Taiwan.
22615 </p>
22616 !! html/parsoid
22617 <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>
22618 <p>Taiwan is China.</p>
22619 !! end
22620
22621 !! test
22622 Code coverage: T with no variants
22623 !! options
22624 language=zh variant=zh-tw showtitle
22625 !! wikitext
22626 -{H|zh:China; zh-tw:Taiwan}-
22627 Taiwan is China.-{T|Taiwan is China}-
22628 !! html/php
22629 Taiwan is China
22630 <p>
22631 Taiwan is Taiwan.
22632 </p>
22633 !! html/parsoid
22634 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22635 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22636 !! end
22637
22638 !! test
22639 Code coverage: rules with no variants
22640 !! options
22641 language=zh variant=zh-tw
22642 !! wikitext
22643 -{H|zh:China; zh-tw:Taiwan}-
22644 Taiwan is China.
22645 -{H|China}-
22646 Taiwan is China.
22647 !! html/php
22648 <p>
22649 Taiwan is Taiwan.
22650
22651 Taiwan is China.
22652 </p>
22653 !! html/parsoid
22654 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22655 Taiwan is China.
22656 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22657 Taiwan is China.</p>
22658 !! end
22659
22660
22661 !! test
22662 Code coverage: D flag for conversion rule
22663 !! options
22664 language=zh variant=zh-tw
22665 !! wikitext
22666 -{D|zh-cn:XA; zh-tw:YA}-
22667 -{A;D|zh-cn:XB; zh-tw:YB}-
22668 -{D;H|zh-cn:XC; zh-tw:YC}-
22669
22670 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22671
22672 -{D|0=>zh-tw:1}-
22673 -{A;D|2=>zh-tw:3}-
22674 -{D;H|4=>zh-tw:5}-
22675
22676 XA XB XC YA YB YC FOO BAR BAT 012345
22677 !! html/php
22678 <p>大陆:XA;台灣:YA;
22679
22680 大陆:XC;台灣:YC;
22681 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22682 </p><p>0⇒台灣:1;
22683
22684 4⇒台灣:5;
22685 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22686 </p>
22687 !! html/parsoid
22688 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22689 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22690 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22691 <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>
22692 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22693 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22694 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22695 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22696 !! end
22697
22698 !! test
22699 Code coverage: N flag for conversion rule
22700 !! options
22701 language=zh variant=zh-cn
22702 !! wikitext
22703 -{N|zh-cn}-
22704
22705 -{N|zh-tw}-
22706
22707 -{N|sr-ec}-
22708 !! html/php
22709 <p>大陆
22710 </p><p>台灣
22711 </p><p>српски (ћирилица)‎
22712 </p>
22713 !! html/parsoid
22714 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22715 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22716 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22717 !! end
22718
22719 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22720 !! test
22721 Code coverage: N flag for conversion rule (wt2html only)
22722 !! options
22723 language=zh variant=zh-cn
22724 parsoid=wt2html,html2html
22725 !! wikitext
22726 -{D;N|en}-
22727 !! html/php
22728 <p>English
22729 </p>
22730 !! html/parsoid
22731 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22732 !! end
22733
22734 !! test
22735 Testing that changing the language variant here in the tests actually works
22736 !! options
22737 language=zh variant=zh showtitle
22738 !! wikitext
22739 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22740 !! html/php
22741 China
22742 <p>Should be stripped!
22743 </p>
22744 !! html/parsoid
22745 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22746 !! end
22747
22748 !! test
22749 Recursive conversion of alt and title attrs shouldn't clear converter state
22750 !! options
22751 language=zh variant=zh-cn
22752 showtitle
22753 !! wikitext
22754 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22755 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22756 !! html/php
22757 China
22758 <p>
22759 Should be stripped<span title="Exclamation">!</span>
22760 </p>
22761 !! html/parsoid
22762 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22763 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>
22764 !! end
22765
22766 !! test
22767 T26072: more test on conversion rule for title
22768 !! options
22769 language=zh variant=zh-tw showtitle
22770 !! wikitext
22771 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22772
22773 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22774 !! html/php
22775 Taiwan
22776 <p>This should be stripped!
22777 </p><p>This won't take interferes with the title rule.
22778 </p>
22779 !! html/parsoid
22780 <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>
22781 <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>
22782 !! end
22783
22784 !! test
22785 Partly disable title conversion if variant == main language code
22786 !! options
22787 language=zh variant=zh title=[[ZH]] showtitle
22788 !! wikitext
22789 -{T|zh-cn:CN;zh-tw:TW}-
22790 !! html/php
22791 ZH
22792 <p>
22793 </p>
22794 !! html/parsoid
22795 <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>
22796 !! end
22797
22798 !! test
22799 Partly disable title conversion if variant == main language code, more
22800 !! options
22801 language=zh variant=zh title=[[ZH]] showtitle
22802 !! wikitext
22803 -{T|TW}-
22804 !! html/php
22805 ZH
22806 <p>
22807 </p>
22808 !! html/parsoid
22809 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22810 !! end
22811
22812 !! test
22813 Raw output of variant escape tags (R flag)
22814 !! options
22815 language=zh variant=zh-tw
22816 !! wikitext
22817 Raw: -{R|zh:China;zh-tw:Taiwan}-
22818 !! html/php
22819 <p>Raw: zh:China;zh-tw:Taiwan
22820 </p>
22821 !! html/parsoid
22822 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22823 !! end
22824
22825 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22826 !! test
22827 Raw output of variant escape tags (R flag) (wt2html only)
22828 !! options
22829 language=zh variant=zh-tw
22830 parsoid=wt2html,html2html
22831 !! wikitext
22832 -{Variant}- -{D|syntax}- -{D;R|options}-
22833 !! html/php
22834 <p>Variant syntax options
22835 </p>
22836 !! html/parsoid
22837 <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>
22838 !! end
22839
22840 !! test
22841 Nested markup inside raw output of variant escape tags (R flag)
22842 !! options
22843 language=zh variant=zh-tw
22844 !! wikitext
22845 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22846 !! html/php
22847 <p>Nested raw: nested Taiwan nested
22848 </p>
22849 !! html/parsoid
22850 <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>
22851 !! end
22852
22853 !! test
22854 Nested markup and spaces inside raw output of variant escape tags (R flag)
22855 !! options
22856 language=zh variant=zh-tw
22857 !! wikitext
22858 X-{ outer -{ inner }- outer }-X
22859 !! html/php
22860 <p>X outer inner outer X
22861 </p>
22862 !! html/parsoid
22863 <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>
22864 !! end
22865
22866 !! test
22867 Templates inside raw output of variant escape tags (R flag)
22868 !! options
22869 language=zh variant=zh-tw
22870 !! wikitext
22871 Nested raw: -{R|nested {{echo|hi}} templates}-
22872 !! html/php
22873 <p>Nested raw: nested hi templates
22874 </p>
22875 !! html/parsoid
22876 <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>
22877 !! end
22878
22879 !! test
22880 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22881 !! options
22882 language=zh variant=zh-cn
22883 !! wikitext
22884 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22885 !! html/php
22886 <p>0
22887 </p>
22888 !! html/parsoid
22889 <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>
22890 !! end
22891
22892 !! test
22893 Conversion rules from [numeric-only string] to [something else] (T48634)
22894 !! options
22895 language=zh variant=zh-cn
22896 !! wikitext
22897 -{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
22898 !! html/php
22899 <p>D12345EE12345
22900 </p>
22901 !! html/parsoid
22902 <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>
22903 !! end
22904
22905 !! test
22906 Two-way converter rule entries with an empty value should be ignored (T53551)
22907 !! options
22908 language=zh variant=zh-cn
22909 !! wikitext
22910 -{H|zh-cn:foo;zh-tw:;}-foobar
22911 !! html/php
22912 <p>foobar
22913 </p>
22914 !! html/parsoid
22915 <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>
22916 !! end
22917
22918 !! test
22919 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22920 !! options
22921 language=zh variant=zh-cn
22922 !! wikitext
22923 -{H|=>zh-cn:foo;}-foobar
22924 !! html/php
22925 <p>foobar
22926 </p>
22927 !! html/parsoid
22928 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22929 !! end
22930
22931 !! test
22932 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22933 !! options
22934 language=zh variant=zh-cn
22935 !! wikitext
22936 -{H|}-foobar
22937 !! html/php
22938 <p>foobar
22939 </p>
22940 !! html/parsoid
22941 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22942 !! end
22943
22944 !! test
22945 Nested using of manual convert syntax
22946 !! options
22947 language=zh variant=zh-hk
22948 !! wikitext
22949 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22950 !! html/php
22951 <p>Nested: Hello Hong Kong!
22952 </p>
22953 !! html/parsoid
22954 <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>
22955 !! end
22956
22957 !! test
22958 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22959 !! options
22960 language=zh variant=zh-cn
22961 !! wikitext
22962 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22963 !! html/php
22964 <p><span title="X">A</span>
22965 </p>
22966 !! html/parsoid
22967 <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>
22968 !! end
22969
22970 !! test
22971 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22972 !! options
22973 language=zh variant=zh-cn
22974 !! wikitext
22975 -{<span title="-{X}-">A</span>}-
22976 !! html/php+disabled
22977 <p><span title="X">A</span>
22978 </p>
22979 !! html/parsoid
22980 <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>
22981 !! end
22982
22983 # Parsoid and PHP disagree on how to parse this example: Parsoid
22984 # insists that the content of a language converter element be a valid
22985 # DOM fragment or attribute string
22986 !! test
22987 Language converter markup with block content
22988 !! options
22989 language=zh variant=zh-cn
22990 !! wikitext
22991 <span>a-{b<div>c}-d
22992
22993 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22994
22995 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22996 !! html/php+tidy
22997 <span>ab<div>cd
22998 <span>ab<div>cd
22999 <span>ad
23000 </span></div></span></div></span>
23001 !! html/parsoid
23002 <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
23003
23004 <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
23005
23006 <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>
23007 !! end
23008
23009 !! test
23010 LanguageConverter selser (1)
23011 !! options
23012 language=zh variant=zh-cn
23013 parsoid={
23014 "modes": ["wt2wt", "selser"],
23015 "changes": [
23016 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23017 ]
23018 }
23019 !! wikitext
23020 -{raw}-
23021 !! wikitext/edited
23022 -{edited}-
23023 !! end
23024
23025 !! test
23026 LanguageConverter selser (2)
23027 !! options
23028 language=zh variant=zh-cn
23029 parsoid={
23030 "modes": ["wt2wt", "selser"],
23031 "changes": [
23032 ["span[class='x']", "contents", "text", "-{foo}-"],
23033 ["a", "contents", "text", "-{"],
23034 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23035 ]
23036 }
23037 !! wikitext
23038 <span class="x">TEXT1</span>
23039 [http://example.com TEXT2]
23040 [[Foo|TEXT3]]
23041 {{echo|TEXT4}}
23042 !! wikitext/edited
23043 <span class="x"><nowiki>-{foo}-</nowiki></span>
23044 [http://example.com -{]
23045 [[Foo|<nowiki>-{</nowiki>]]
23046 {{1x|<nowiki>-{</nowiki>}}
23047 !! end
23048
23049 # Tests LanguageVariantText in ConstrainedText
23050 !! test
23051 LanguageConverter selser (3)
23052 !! options
23053 language=zh variant=zh-cn
23054 parsoid={
23055 "modes": ["wt2wt", "selser"],
23056 "changes": [
23057 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23058 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23059 ]
23060 }
23061 !! wikitext
23062 {|
23063 |-
23064 |<span>Foo</span>
23065 |}
23066 !! wikitext/edited
23067 {|
23068 |-
23069 |<nowiki/>-{edited}-
23070 |}
23071 !! end
23072
23073 # Tests LanguageVariantText._fromSelSer
23074 !! test
23075 LanguageConverter selser (4)
23076 !! options
23077 language=zh variant=zh-cn
23078 parsoid={
23079 "modes": ["wt2wt", "selser"],
23080 "changes": [
23081 ["td > span.x", "remove"]
23082 ]
23083 }
23084 !! wikitext
23085 {|
23086 |-
23087 |<span class="x">Foo</span>-{Bar}-
23088 ||<span class="x">Foo</span>-{Bar}-
23089 |}
23090 !! wikitext/edited
23091 {|
23092 |-
23093 |<nowiki/>-{Bar}-
23094 ||-{Bar}-
23095 |}
23096 !! end
23097
23098 # Since Parsoid is starting to emit canonical wikitext for links,
23099 # [http://example.com http://example.com] will not RT back to that
23100 # form anymore.
23101 # Parsoid does not language-convert links (it is done in a
23102 # post-processing step)
23103 !! test
23104 Proper conversion of text in external links
23105 !! options
23106 language=sr variant=sr-ec
23107 parsoid=wt2html
23108 !! wikitext
23109 http://www.google.com
23110 gopher://www.google.com
23111 [http://www.google.com http://www.google.com]
23112 [gopher://www.google.com gopher://www.google.com]
23113 [https://www.google.com irc://www.google.com]
23114 [ftp://www.google.com www.google.com/ftp://dir]
23115 [//www.google.com www.google.com]
23116 !! html/php
23117 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23118 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23119 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23120 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23121 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23122 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23123 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23124 </p>
23125 !! html/parsoid
23126 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23127 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23128 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23129 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23130 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23131 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23132 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23133 !! end
23134
23135 !! test
23136 Do not convert roman numbers to language variants
23137 !! options
23138 language=sr variant=sr-ec
23139 !! wikitext
23140 Fridrih IV je car.
23141 !! html/php
23142 <p>Фридрих IV је цар.
23143 </p>
23144 !! html/parsoid
23145 <p>Fridrih IV je car.</p>
23146 !! end
23147
23148 !! test
23149 Unclosed language converter markup "-{"
23150 !! options
23151 language=sr
23152 !! wikitext
23153 -{T|hello
23154 !! html
23155 <p>-{T|hello
23156 </p>
23157 !! end
23158
23159 !! test
23160 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23161 !! options
23162 language=sr
23163 !! wikitext
23164 -{R|=&gt;}-
23165 !! html/php
23166 <p>=&gt;
23167 </p>
23168 !! html/parsoid
23169 <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>
23170 !!end
23171
23172 !! test
23173 Don't break link parsing if language converter markup is in the caption.
23174 !! options
23175 language=sr variant=sr-ec
23176 !! wikitext
23177 [[Main Page|-{R|main page}-]]
23178 !! html/php
23179 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23180 </p>
23181 !! html/parsoid
23182 <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>
23183 !! end
23184
23185 !! test
23186 T146304: Don't break template parsing if language converter markup is in the parameter.
23187 !! options
23188 language=sr variant=sr-ec
23189 !! wikitext
23190 {{echo|-{R|foo}-}}
23191 !! html/php
23192 <p>foo
23193 </p>
23194 !! html/parsoid
23195 <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>
23196 !! end
23197
23198 !! test
23199 T146305: Don't break image parsing if language converter markup is in the caption.
23200 !! options
23201 language=sr
23202 !! wikitext
23203 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23204 !! html/php
23205 <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>
23206
23207 !! html/parsoid
23208 <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>
23209 !! end
23210
23211 !! test
23212 T146305: Don't break image parsing if nested language converter markup is in the caption.
23213 !! options
23214 language=zh variant=zh-cn
23215 !! wikitext
23216 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23217 !! html/php
23218 <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>
23219
23220 !! html/parsoid
23221 <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>
23222 !! end
23223
23224 # XXX html2wt disabled because rich markup in alt is not preserved.
23225 !! test
23226 Don't break gallery if language converter markup is inside.
23227 !! options
23228 language=zh
23229 !! wikitext
23230 <gallery>
23231 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
23232 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
23233 </gallery>
23234 !! html/php
23235 <ul class="gallery mw-gallery-traditional">
23236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23237 <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>
23238 <div class="gallerytext">
23239 <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>
23240 </p>
23241 </div>
23242 </div></li>
23243 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23244 <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>
23245 <div class="gallerytext">
23246 <p>This is a test template
23247 </p>
23248 </div>
23249 </div></li>
23250 </ul>
23251
23252 !! html/parsoid
23253 <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"}}'>
23254 <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>
23255 <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>
23256 </ul>
23257 !! end
23258
23259 !! test
23260 T153135: Don't break list handling if language converter markup is in the item.
23261 !! options
23262 language=zh variant=zh-cn
23263 !! wikitext
23264 ;-{zh-cn:AAA;zh-tw:BBB}-
23265 ;-{R|foo:bar}-
23266 !! html/php
23267 <dl><dt>AAA</dt>
23268 <dt>foo:bar</dt></dl>
23269
23270 !! html/parsoid
23271 <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>
23272 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23273 </dl>
23274 !! end
23275
23276 // Note that parsoid does not protect colons unless language converter
23277 // markup is properly nested, because it is a backtracking parser.
23278 !! test
23279 T153135: Unclosed markup in definition list (code coverage)
23280 !! options
23281 language=zh variant=zh-cn
23282 !! wikitext
23283 ;<b>foo:bar
23284 ;-{zh-cn:AAA
23285 !! html/php+tidy
23286 <dl><dt><b>foo:bar</b></dt><b>
23287 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
23288 </b></p>
23289 !! html/parsoid
23290 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23291 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23292 !! end
23293
23294 !! test
23295 T153135: Nested language converter markup in definition list (code coverage)
23296 !! options
23297 language=zh variant=zh-cn
23298 !! wikitext
23299 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23300 !! html/php
23301 <dl><dt>AAA foo:bar bat:baz</dt>
23302 <dd>def</dd></dl>
23303
23304 !! html/parsoid
23305 <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>
23306 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23307 </dl>
23308 !! end
23309
23310 # html2wt mode disabled due to <nowiki> insertion.
23311 !! test
23312 T153140: Don't break table handling if language converter markup is in the cell.
23313 !! options
23314 language=sr variant=sr-ec
23315 parsoid=wt2html,wt2wt,html2html
23316 !! wikitext
23317 {|
23318 |-
23319 | -{R|B}-
23320 |}
23321 !! html/php
23322 <table>
23323
23324 <tr>
23325 <td>B
23326 </td></tr></table>
23327
23328 !! html/parsoid
23329 <table>
23330 <tbody>
23331 <tr>
23332 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23333 </tr>
23334 </tbody>
23335 </table>
23336 !! end
23337
23338 !! test
23339 Language converter tricky html2wt cases (1)
23340 !! options
23341 language=sr
23342 parsoid=html2wt,wt2wt
23343 !! html/parsoid
23344 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23345 !! wikitext
23346 -{<nowiki>}-</nowiki>}-
23347 !! html/php
23348 <p>&#125;-
23349 </p>
23350 !! end
23351
23352 !! test
23353 Language converter tricky html2wt cases (2)
23354 !! options
23355 language=sr
23356 parsoid=html2wt,wt2wt
23357 !! html/parsoid
23358 <p>-{foo}-</p>
23359 !! wikitext
23360 <nowiki>-{foo}-</nowiki>
23361 !! html/php
23362 <p>-&#123;foo&#125;-
23363 </p>
23364 !! end
23365
23366 !! test
23367 Language converter tricky html2wt cases (3)
23368 !! options
23369 language=sr
23370 parsoid=html2wt,wt2wt
23371 !! html/parsoid
23372 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23373 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23374 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23375 !! wikitext
23376 -{R||}-
23377
23378 -{R|R|raw}-
23379
23380 -{<nowiki>-{foo}-</nowiki>}-
23381 !! html/php
23382 <p>|
23383 </p><p>R|raw
23384 </p><p>-&#123;foo&#125;-
23385 </p>
23386 !! end
23387
23388 !! test
23389 Language converter tricky html2wt cases (4)
23390 !! options
23391 language=sr
23392 parsoid=html2wt,wt2wt
23393 !! html/parsoid
23394 <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>
23395 !! wikitext
23396 -{R|{{echo|hey}}}-
23397 !! html/php
23398 <p>hey
23399 </p>
23400 !! end
23401
23402 # Note that the <nowiki> escaping added by parsoid for source text,
23403 # destination text, and language names only works on the PHP side
23404 # for *destination text*. (HTML entity escaping wouldn't work
23405 # any better.) This is probably a bug, at least for source texts.
23406 # (For language names PHP uses a precise regexp based on the languages
23407 # it currently knows have variants, which is fragile since this set
23408 # can grow/shrink over time.)
23409 !! test
23410 Language converter tricky html2wt cases (5)
23411 !! options
23412 language=zh variant=zh-cn
23413 !! html/parsoid
23414 <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>
23415 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23416 <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>
23417 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23418 <p>a:b=>c xyz</p>
23419 !! wikitext
23420 -{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
23421
23422 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23423
23424 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23425
23426 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23427
23428 a:b=>c xyz
23429 !! html/php+disabled
23430 <p>foobat;xyz=&gt;zh-cn:abc
23431 </p><p>A
23432 </p><p>0;zh-tw:bar
23433 </p><p>abc
23434 </p><p>a:b=&gt;c 0;zh-tw:bar
23435 </p>
23436 !! end
23437
23438 !! test
23439 T179579: Nowiki and lc interaction
23440 !! options
23441 parsoid=wt2html
23442 language=sr
23443 !! wikitext
23444 -{</nowiki>123}-
23445
23446 -{123<nowiki>|</nowiki>456}-
23447 !! html/parsoid
23448 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23449
23450 <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>
23451 !! end
23452
23453 !! test
23454 T2529: Uncovered bullet
23455 !! wikitext
23456 *Foo {{bullet}}
23457 !! html
23458 <ul><li>Foo</li>
23459 <li>Bar</li></ul>
23460
23461 !! end
23462
23463 !! test
23464 T2529: Uncovered bullet in a deeply nested list
23465 !! wikitext
23466 *******Foo {{bullet}}
23467 !! html
23468 <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>
23469 <li>Bar</li></ul>
23470
23471 !! end
23472
23473 !! test
23474 T2529: Uncovered table already at line-start
23475 !! wikitext
23476 x
23477
23478 {{table}}
23479 y
23480 !! html
23481 <p>x
23482 </p>
23483 <table>
23484 <tr>
23485 <td>1</td>
23486 <td>2
23487 </td></tr>
23488 <tr>
23489 <td>3</td>
23490 <td>4
23491 </td></tr></table>
23492 <p>y
23493 </p>
23494 !! end
23495
23496 !! test
23497 T2529: Uncovered bullet in parser function result
23498 !! wikitext
23499 *Foo {{lc:{{bullet}} }}
23500 !! html
23501 <ul><li>Foo</li>
23502 <li>bar</li></ul>
23503
23504 !! end
23505
23506 !! test
23507 T7678: Double-parsed template argument
23508 !! wikitext
23509 {{lc:{{{1}}}|hello}}
23510 !! html
23511 <p>{{{1}}}
23512 </p>
23513 !! end
23514
23515 !! test
23516 T7678: Double-parsed template invocation
23517 !! wikitext
23518 {{lc:{{paramtest {{!}} param = hello }} }}
23519 !! html
23520 <p>{{paramtest | param = hello }}
23521 </p>
23522 !! end
23523
23524 !! test
23525 Case insensitivity of parser functions for non-ASCII characters (T10143)
23526 !! options
23527 language=cs
23528 title=[[Main Page]]
23529 !! wikitext
23530 {{PRVNÍVELKÉ:ěščř}}
23531 {{prvnívelké:ěščř}}
23532 {{PRVNÍMALÉ:ěščř}}
23533 {{prvnímalé:ěščř}}
23534 {{MALÁ:ěščř}}
23535 {{malá:ěščř}}
23536 {{VELKÁ:ěščř}}
23537 {{velká:ěščř}}
23538 !! html
23539 <p>Ěščř
23540 Ěščř
23541 ěščř
23542 ěščř
23543 ěščř
23544 ěščř
23545 ĚŠČŘ
23546 ĚŠČŘ
23547 </p>
23548 !! end
23549
23550 !! test
23551 Morwen/13: Unclosed link followed by heading
23552 !! wikitext
23553 [[link
23554 ==heading==
23555 !! html
23556 <p>[[link
23557 </p>
23558 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
23559
23560 !! end
23561
23562 !! test
23563 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23564 !! wikitext
23565 {{foo|
23566 =heading=
23567 !! html
23568 <p>{{foo|
23569 </p>
23570 <h1><span class="mw-headline" id="heading">heading</span></h1>
23571
23572 !! end
23573
23574 !! test
23575 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23576 !! wikitext
23577 {{foo|
23578 ==heading==
23579 !! html
23580 <p>{{foo|
23581 </p>
23582 <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>
23583
23584 !! end
23585
23586 !! test
23587 Tildes in comments
23588 !! options
23589 pst
23590 !! wikitext
23591 <!-- ~~~~ -->
23592 !! html/php
23593 <!-- ~~~~ -->
23594 !! end
23595
23596 !! test
23597 Paragraphs inside divs (no extra line breaks)
23598 !! wikitext
23599 <div>Line one
23600
23601 Line two</div>
23602 !! html
23603 <div>Line one
23604 Line two</div>
23605
23606 !! end
23607
23608 !! test
23609 Paragraphs inside divs (extra line break on open)
23610 !! wikitext
23611 <div>
23612 Line one
23613
23614 Line two</div>
23615 !! html
23616 <div>
23617 <p>Line one
23618 </p>
23619 Line two</div>
23620
23621 !! end
23622
23623 !! test
23624 Paragraphs inside divs (extra line break on close)
23625 !! wikitext
23626 <div>Line one
23627
23628 Line two
23629 </div>
23630 !! html
23631 <div>Line one
23632 <p>Line two
23633 </p>
23634 </div>
23635
23636 !! end
23637
23638 !! test
23639 Paragraphs inside divs (extra line break on open and close)
23640 !! wikitext
23641 <div>
23642 Line one
23643
23644 Line two
23645 </div>
23646 !! html
23647 <div>
23648 <p>Line one
23649 </p><p>Line two
23650 </p>
23651 </div>
23652
23653 !! end
23654
23655 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23656 !! test
23657 Nesting tags, paragraphs on lines which begin with <div>
23658 !! wikitext
23659 <div></div><strong>A
23660 B</strong>
23661 !! html/php+tidy
23662 <div></div><p><strong>A
23663 </strong></p><strong></strong><p><strong>B</strong>
23664 </p>
23665 !! html/parsoid
23666 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
23667 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
23668 !! end
23669
23670 # T8200: <blockquote> should behave like <div> with respect to line breaks
23671 !! test
23672 T8200: paragraphs inside blockquotes (no extra line breaks)
23673 !! wikitext
23674 <blockquote>Line one
23675
23676 Line two</blockquote>
23677 !! html
23678 <blockquote>Line one
23679 Line two</blockquote>
23680
23681 !! html+tidy
23682 <blockquote><p>Line one
23683 Line two</p></blockquote>
23684 !! end
23685
23686 !! test
23687 T8200: paragraphs inside blockquotes (extra line break on open)
23688 !! wikitext
23689 <blockquote>
23690 Line one
23691
23692 Line two</blockquote>
23693 !! html
23694 <blockquote>
23695 <p>Line one
23696 </p>
23697 Line two</blockquote>
23698
23699 !! html+tidy
23700 <blockquote>
23701 <p>Line one
23702 </p><p>
23703 Line two</p></blockquote>
23704 !! end
23705
23706 !! test
23707 T8200: paragraphs inside blockquotes (extra line break on close)
23708 !! wikitext
23709 <blockquote>Line one
23710
23711 Line two
23712 </blockquote>
23713 !! html
23714 <blockquote>Line one
23715 <p>Line two
23716 </p>
23717 </blockquote>
23718
23719 !! html+tidy
23720 <blockquote><p>Line one
23721 </p><p>Line two
23722 </p>
23723 </blockquote>
23724 !! end
23725
23726 !! test
23727 T8200: paragraphs inside blockquotes (extra line break on open and close)
23728 !! wikitext
23729 <blockquote>
23730 Line one
23731
23732 Line two
23733 </blockquote>
23734 !! html
23735 <blockquote>
23736 <p>Line one
23737 </p><p>Line two
23738 </p>
23739 </blockquote>
23740
23741 !! end
23742
23743 ## This is a corner case interaction between the paragraph wrapping in the
23744 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
23745 ## some tags which close paragraphs (and thus prevent wrapping on their line),
23746 ## of which "div" is one, but do p-wrapping inside them. These are referred
23747 ## to as "never suppressing". Remex, for its part, doesn't traverse into
23748 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
23749 !! test
23750 Paragraphs inside blockquotes/divs (no extra line breaks)
23751 !! wikitext
23752 <blockquote><div>Line one
23753
23754 Line two</div></blockquote>
23755 !! html
23756 <blockquote><div>Line one
23757 Line two</div></blockquote>
23758
23759 !! end
23760
23761 !! test
23762 Paragraphs inside blockquotes/divs (extra line break on open)
23763 !! wikitext
23764 <blockquote><div>
23765 Line one
23766
23767 Line two</div></blockquote>
23768 !! html
23769 <blockquote><div>
23770 <p>Line one
23771 </p>
23772 Line two</div></blockquote>
23773
23774 !! end
23775
23776 !! test
23777 Paragraphs inside blockquotes/divs (extra line break on close)
23778 !! wikitext
23779 <blockquote><div>Line one
23780
23781 Line two
23782 </div></blockquote>
23783 !! html
23784 <blockquote><div>Line one
23785 <p>Line two
23786 </p>
23787 </div></blockquote>
23788
23789 !! end
23790
23791 !! test
23792 Paragraphs inside blockquotes/divs (extra line break on open and close)
23793 !! wikitext
23794 <blockquote><div>
23795 Line one
23796
23797 Line two
23798 </div></blockquote>
23799 !! html
23800 <blockquote><div>
23801 <p>Line one
23802 </p><p>Line two
23803 </p>
23804 </div></blockquote>
23805
23806 !! end
23807
23808 !! test
23809 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23810 !! options
23811 wgLinkHolderBatchSize=0
23812 !! wikitext
23813 [[meatball:1]]
23814 [[meatball:2]]
23815 [[meatball:3]]
23816 !! html
23817 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23818 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23819 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23820 </p>
23821 !! end
23822
23823 !! test
23824 Free external link invading image caption
23825 !! wikitext
23826 [[Image:Foobar.jpg|thumb|http://x|hello]]
23827 !! html/php
23828 <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>
23829
23830 !! html/parsoid
23831 <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>
23832 !! end
23833
23834 !! test
23835 T17196: localised external link numbers
23836 !! options
23837 language=fa
23838 !! wikitext
23839 [http://en.wikipedia.org/]
23840 !! html/php
23841 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23842 </p>
23843 !! html/parsoid
23844 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23845 !! end
23846
23847 !! test
23848 Multibyte character in padleft
23849 !! wikitext
23850 {{padleft:-Hello|7|Æ}}
23851 !! html/php
23852 <p>Æ-Hello
23853 </p>
23854 !! html/parsoid
23855 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23856 !! end
23857
23858 !! test
23859 Multibyte character in padright
23860 !! wikitext
23861 {{padright:Hello-|7|Æ}}
23862 !! html/php
23863 <p>Hello-Æ
23864 </p>
23865 !! html/parsoid
23866 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23867 !! end
23868
23869 !!test
23870 formatdate parser function
23871 !! wikitext
23872 {{#formatdate:2009-03-24}}
23873 !! html
23874 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23875 </p>
23876 !! end
23877
23878 !!test
23879 formatdate parser function, with default format
23880 !! wikitext
23881 {{#formatdate:2009-03-24|mdy}}
23882 !! html
23883 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23884 </p>
23885 !! end
23886
23887 !! test
23888 Spacing of numbers in formatted dates
23889 !! wikitext
23890 {{#formatdate:January 15}}
23891 !! html
23892 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23893 </p>
23894 !! end
23895
23896 !! test
23897 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
23898 !! options
23899 language=nl title=[[MediaWiki:Common.css]]
23900 !! wikitext
23901 {{#formatdate:2009-03-24|dmy}}
23902 !! html
23903 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23904 </p>
23905 !! end
23906
23907 #
23908 #
23909 #
23910
23911 #
23912 # Edit comments
23913 #
23914
23915 !! test
23916 Edit comment with link
23917 !! options
23918 comment
23919 !! wikitext
23920 I like the [[Main Page]] a lot
23921 !! html/php
23922 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23923 !!end
23924
23925 !! test
23926 Edit comment with link and link text
23927 !! options
23928 comment
23929 !! wikitext
23930 I like the [[Main Page|best pages]] a lot
23931 !! html/php
23932 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23933 !!end
23934
23935 !! test
23936 Edit comment with link and link text with suffix
23937 !! options
23938 comment
23939 !! wikitext
23940 I like the [[Main Page|best page]]s a lot
23941 !! html/php
23942 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23943 !!end
23944
23945 !! test
23946 Edit comment with section link (non-local, eg in history list)
23947 !! options
23948 comment title=[[Main Page]]
23949 !! wikitext
23950 /* External links */ removed bogus entries
23951 !! html/php
23952 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23953 !!end
23954
23955 !! test
23956 Edit comment with section link and text before it (non-local, eg in history list)
23957 !! options
23958 comment title=[[Main Page]]
23959 !! wikitext
23960 pre-comment text /* External links */ removed bogus entries
23961 !! html/php
23962 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>
23963 !!end
23964
23965 !! test
23966 Edit comment with section link (local, eg in diff view)
23967 !! options
23968 comment local title=[[Main Page]]
23969 !! wikitext
23970 /* External links */ removed bogus entries
23971 !! html/php
23972 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23973 !!end
23974
23975 !! test
23976 Edit comment with subpage link (T16080)
23977 !! options
23978 comment
23979 subpage
23980 title=[[Subpage test]]
23981 !! wikitext
23982 Poked at a [[/subpage]] here...
23983 !! html/php
23984 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23985 !!end
23986
23987 !! test
23988 Edit comment with subpage link and link text (T16080)
23989 !! options
23990 comment
23991 subpage
23992 title=[[Subpage test]]
23993 !! wikitext
23994 Poked at a [[/subpage|neat little page]] here...
23995 !! html/php
23996 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23997 !!end
23998
23999 !! test
24000 Edit comment with bogus subpage link in non-subpage NS (T16080)
24001 !! options
24002 comment
24003 title=[[Subpage test]]
24004 !! wikitext
24005 Poked at a [[/subpage]] here...
24006 !! html/php
24007 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...
24008 !!end
24009
24010 !! test
24011 Edit comment with bare anchor link (local, as on diff)
24012 !! options
24013 comment
24014 local
24015 title=[[Main Page]]
24016 !! wikitext
24017 [[#section]]
24018 !! html/php
24019 <a href="#section">#section</a>
24020 !! end
24021
24022 !! test
24023 Edit comment with bare anchor link (non-local, as on history)
24024 !! options
24025 comment
24026 title=[[Main Page]]
24027 !! wikitext
24028 [[#section]]
24029 !! html/php
24030 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24031 !! end
24032
24033 !! test
24034 Anchor starting with underscore
24035 !! options
24036 title=[[Foo]]
24037 !! wikitext
24038 [[#_ref|One]]
24039 !! html/php
24040 <p><a href="#_ref">One</a>
24041 </p>
24042 !! html/parsoid
24043 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24044 !! end
24045
24046 !! test
24047 Id starting with underscore
24048 !! wikitext
24049 <div id="_ref"></div>
24050 !! html/*
24051 <div id="_ref"></div>
24052
24053 !! end
24054
24055 !! test
24056 Edit comment with link with more than one pipe (T99346)
24057 !! options
24058 comment
24059 !! wikitext
24060 [[Main Page|Many|pipes]]
24061 !! html/php
24062 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24063 !! end
24064
24065 !! test
24066 Complex edit comment with link with more than one pipe (T99346)
24067 !! options
24068 comment
24069 !! wikitext
24070 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24071 !! html/php
24072 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;
24073 !! end
24074
24075 !! test
24076 Space normalisation on autocomment (T24784)
24077 !! options
24078 comment
24079 title=[[Main Page]]
24080 !! wikitext
24081 /* __hello__world__ */
24082 !! html/php
24083 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
24084 !! end
24085
24086 !! test
24087 percent-encoding and + signs in comments (T28410)
24088 !! options
24089 comment
24090 !! wikitext
24091 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24092 !! html/php
24093 <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>
24094 !! end
24095
24096 # Parsoid doesn't support this yet: see T75581
24097 # but it *should* omit the 'src' attribute if the image is bad.
24098 # PHP side of tests was disabled in
24099 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24100 # because of issues in the PHP parserTests infrastructure
24101 # (but the output below is indeed what the PHP side emits)
24102 !! test
24103 Bad images - basic functionality
24104 !! wikitext
24105 [[File:Bad.jpg]]
24106 !! html/php+disabled
24107 !! html/parsoid
24108 <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>
24109 !! end
24110
24111 !! test
24112 Bad images - T18039: text after bad image disappears
24113 !! wikitext
24114 Foo bar
24115 [[File:Bad.jpg]]
24116 Bar foo
24117 !! html/php+disabled
24118 <p>Foo bar
24119 </p><p>Bar foo
24120 </p>
24121 !! html/parsoid
24122 <p>Foo bar
24123 <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>
24124 Bar foo</p>
24125 !! end
24126
24127 !! test
24128 Verify that displaytitle works (T24501) no displaytitle
24129 !! options
24130 showtitle
24131 !! config
24132 wgAllowDisplayTitle=true
24133 wgRestrictDisplayTitle=false
24134 !! wikitext
24135 this is not the the title
24136 !! html/php
24137 Parser test
24138 <p>this is not the the title
24139 </p>
24140 !! end
24141
24142 !! test
24143 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24144 !! options
24145 showtitle
24146 title=[[Screen]]
24147 !! config
24148 wgAllowDisplayTitle=true
24149 wgRestrictDisplayTitle=false
24150 !! wikitext
24151 this is not the the title
24152 {{DISPLAYTITLE:whatever}}
24153 !! html/php
24154 whatever
24155 <p>this is not the the title
24156 </p>
24157 !! end
24158
24159 !! test
24160 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24161 !! options
24162 showtitle
24163 title=[[Screen]]
24164 !! config
24165 wgAllowDisplayTitle=true
24166 wgRestrictDisplayTitle=true
24167 !! wikitext
24168 this is not the the title
24169 {{DISPLAYTITLE:whatever}}
24170 !! html/php
24171 Screen
24172 <p>this is not the the title
24173 </p>
24174 !! end
24175
24176 !! test
24177 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24178 !! options
24179 showtitle
24180 title=[[Screen]]
24181 !! config
24182 wgAllowDisplayTitle=true
24183 wgRestrictDisplayTitle=true
24184 !! wikitext
24185 this is not the the title
24186 {{DISPLAYTITLE:screen}}
24187 !! html/php
24188 screen
24189 <p>this is not the the title
24190 </p>
24191 !! end
24192
24193 !! test
24194 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24195 !! options
24196 showtitle
24197 title=[[Screen]]
24198 !! config
24199 wgAllowDisplayTitle=false
24200 !! wikitext
24201 this is not the the title
24202 {{DISPLAYTITLE:screen}}
24203 !! html/php
24204 Screen
24205 <p>this is not the the title
24206 <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>
24207 </p>
24208 !! end
24209
24210 !! test
24211 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24212 !! options
24213 showtitle
24214 title=[[Screen]]
24215 !! config
24216 wgAllowDisplayTitle=false
24217 !! wikitext
24218 this is not the the title
24219 !! html/php
24220 Screen
24221 <p>this is not the the title
24222 </p>
24223 !! end
24224
24225 !! test
24226 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24227 !! options
24228 showtitle
24229 title=[[Screen]]
24230 !! config
24231 wgAllowDisplayTitle=true
24232 wgRestrictDisplayTitle=true
24233 !! wikitext
24234 this is not the the title
24235 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24236 !! html/php
24237 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24238 <p>this is not the the title
24239 </p>
24240 !! end
24241
24242 !! test
24243 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24244 !! options
24245 showtitle
24246 title=[[Screen]]
24247 !! config
24248 wgAllowDisplayTitle=true
24249 wgRestrictDisplayTitle=true
24250 !! wikitext
24251 this is not the the title
24252 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24253 !! html/php
24254 <span style="color: red;">s</span>creen
24255 <p>this is not the the title
24256 </p>
24257 !! end
24258
24259 !! test
24260 Page status indicators: Empty name is invalid
24261 !! options
24262 showindicators
24263 !! wikitext
24264 <indicator name=" "></indicator>
24265 <indicator></indicator>
24266 !! html/php
24267 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24268 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24269 </p>
24270 !! end
24271
24272 !! test
24273 Page status indicators: Weird syntaxes that are okay
24274 !! options
24275 showindicators
24276 !! wikitext
24277 <indicator name="empty" />
24278 <indicator name="name"></indicator>
24279 !! html/php
24280 empty=
24281 name=
24282 <p><br />
24283 </p>
24284 !! end
24285
24286 !! test
24287 Page status indicators: Torture test
24288 !! options
24289 showindicators
24290 !! wikitext
24291 <indicator name="01">hello world</indicator>
24292 <indicator name="02">[[Main Page]]</indicator>
24293 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24294 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24295 <indicator name="05">*foo
24296 *bar</indicator>
24297 <indicator name="06"><nowiki>foo</nowiki></indicator>
24298 <indicator name="07"> Preformatted</indicator>
24299 <indicator name="08"><div>Broken tag</indicator>
24300 <indicator name="09">{| class=wikitable
24301 |cell
24302 |}</indicator>
24303 <indicator name="10">Two
24304
24305 paragraphs</indicator>
24306 !! html/php
24307 01=hello world
24308 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24309 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" />
24310 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>
24311 05=<ul><li>foo</li>
24312 <li>bar</li></ul>
24313
24314 06=foo
24315 07=<pre>Preformatted
24316 </pre>
24317 08=<div>Broken tag</div>
24318
24319 09=<table class="wikitable">
24320 <tr>
24321 <td>cell
24322 </td></tr></table>
24323
24324 10=<p>Two
24325 </p><p>paragraphs
24326 </p>
24327 <p><br />
24328 </p><p><br />
24329 </p><p><br />
24330 </p><p><br />
24331 </p><p><br />
24332 </p>
24333 !! end
24334
24335 !! test
24336 preload: check <noinclude> and <includeonly>
24337 !! options
24338 preload
24339 !! wikitext
24340 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24341 !! html/php
24342 Hello kind world.
24343 !! end
24344
24345 !! test
24346 preload: check <onlyinclude>
24347 !! options
24348 preload
24349 !! wikitext
24350 Goodbye <onlyinclude>Hello world</onlyinclude>
24351 !! html/php
24352 Hello world
24353 !! end
24354
24355 !! test
24356 preload: can pass tags through if we want to
24357 !! options
24358 preload
24359 !! wikitext
24360 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24361 !! html/php
24362 <includeonly>Hello world</includeonly>
24363 !! end
24364
24365 !! test
24366 preload: check that it doesn't try to do tricks
24367 !! options
24368 preload
24369 !! wikitext
24370 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24371 !! html/php
24372 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24373 !! end
24374
24375 !! test
24376 Play a bit with r67090 and T5158
24377 !! wikitext
24378 <div style="width:50% !important">&nbsp;</div>
24379 <div style="width:50%&nbsp;!important">&nbsp;</div>
24380 <div style="width:50%&#160;!important">&nbsp;</div>
24381 <div style="border : solid;">&nbsp;</div>
24382 !! html/php
24383 <div style="width:50% !important">&#160;</div>
24384 <div style="width:50% !important">&#160;</div>
24385 <div style="width:50% !important">&#160;</div>
24386 <div style="border&#32;: solid;">&#160;</div>
24387
24388 !! html/parsoid
24389 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24390 <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>
24391 <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>
24392 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24393
24394 !! end
24395
24396 !! test
24397 French spaces in wikitext
24398 !! wikitext
24399 foo ! bar ? bat 50 % is less than 75 %.
24400
24401 Hello : this ; is « something ‹ else › again »
24402 !! html
24403 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24404 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24405 </p>
24406 !! end
24407
24408 # It would be reasonable for Parsoid and PHP to differ here.
24409 # The PHP behavior is arguably a bug.
24410 !! test
24411 Corner case: french spaces in definition list
24412 !! wikitext
24413 ;foo : bar
24414 !! html+tidy
24415 <dl><dt>foo&#160;</dt>
24416 <dd>bar</dd></dl>
24417 !! end
24418
24419 !! test
24420 T5158: Test for French spaces in attributes
24421 !! wikitext
24422 <br style=" clear : both ; " />
24423 !! html/php
24424 <p><br style="clear&#32;: both&#32;;" />
24425 </p>
24426 !! end
24427
24428 !! test
24429 HTML5 data attributes
24430 !! wikitext
24431 <span data-foo="bar">Baz</span>
24432 <p data-abc-def_hij="">Quuz</p>
24433 !! html/php
24434 <p><span data-foo="bar">Baz</span>
24435 </p>
24436 <p data-abc-def_hij="">Quuz</p>
24437
24438 !! html/parsoid
24439 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24440 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24441 !! end
24442
24443 !! test
24444 Strip reserved data attributes
24445 !! wikitext
24446 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
24447 !! html/php
24448 <div data-ok="fred">d</div>
24449
24450 !! html/parsoid
24451 <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>
24452 !! end
24453
24454 !! test
24455 percent-encoding and + signs in internal links (T28410)
24456 !! wikitext
24457 [[User:+%]] [[Page+title%]]
24458 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24459 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24460 [[%33%45]] [[%33%45+]]
24461 !! html/php
24462 <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>
24463 <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>
24464 <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>
24465 <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>
24466 </p>
24467 !! html/parsoid
24468 <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>
24469 <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>
24470 <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>
24471 <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>
24472 !! end
24473
24474 !! test
24475 Special characters in embedded file links (T29679)
24476 !! wikitext
24477 [[File:Contains & ampersand.jpg]]
24478 [[File:Does not exist.jpg|Title with & ampersand]]
24479 !! html/php
24480 <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>
24481 <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>
24482 </p>
24483 !! html/parsoid
24484 <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>
24485 <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>
24486 !! end
24487
24488 !! test
24489 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24490 !! wikitext
24491 Text&apos;s been normalized?
24492 !! html
24493 <p>Text&#39;s been normalized?
24494 </p>
24495 !! end
24496
24497 !! test
24498 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24499 !! wikitext
24500 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24501 !! html
24502 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24503 </p>
24504 !! end
24505
24506 !! test
24507 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24508 !! wikitext
24509 [http://www.example.org/ ideograms]
24510 !! html
24511 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24512 </p>
24513 !! end
24514
24515 !! test
24516 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24517 !! wikitext
24518 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24519 !! html
24520 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24521 </p>
24522 !! end
24523
24524 !! article
24525 Mediawiki:loop1
24526 !! text
24527 {{Identical|A}}
24528 !! endarticle
24529
24530 !! article
24531 Mediawiki:loop2
24532 !! text
24533 {{Identical|B}}
24534 !! endarticle
24535
24536 !! article
24537 Template:Identical
24538 !! text
24539 {{int:loop1}}
24540 {{int:loop2}}
24541 !! endarticle
24542
24543 !! test
24544 T33098 Template which includes system messages which includes the template
24545 !! wikitext
24546 {{Identical}}
24547 !! html
24548 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24549 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24550 </p>
24551 !! end
24552
24553 !! test
24554 T33490 Turkish: ucfirst 'blah'
24555 !! options
24556 language=tr
24557 !! wikitext
24558 {{ucfirst:blah}}
24559 !! html
24560 <p>Blah
24561 </p>
24562 !! end
24563
24564 !! test
24565 T33490 Turkish: ucfirst 'ix'
24566 !! options
24567 language=tr
24568 !! wikitext
24569 {{ucfirst:ix}}
24570 !! html
24571 <p>İx
24572 </p>
24573 !! end
24574
24575 !! test
24576 T33490 Turkish: lcfirst 'BLAH'
24577 !! options
24578 language=tr
24579 !! wikitext
24580 {{lcfirst:BLAH}}
24581 !! html
24582 <p>bLAH
24583 </p>
24584 !! end
24585
24586 !! test
24587 T33490 Turkish: ucfırst (with a dotless i)
24588 !! options
24589 language=tr
24590 !! wikitext
24591 {{ucfırst:blah}}
24592 !! html
24593 <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>
24594 </p>
24595 !! end
24596
24597 !! test
24598 T33490 ucfırst (with a dotless i) with English language
24599 !! options
24600 language=en
24601 !! wikitext
24602 {{ucfırst:blah}}
24603 !! html
24604 <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>
24605 </p>
24606 !! end
24607
24608 # Note that Parsoid doesn't emit an explicit TOC.
24609 # Note also that the html2wt direction tends to emit an extra newline
24610 # between the __TOC__ magicword and the first heading unless *both*
24611 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24612 # it's "{}").
24613
24614 !! test
24615 T28375: TOC with italics
24616 !! options
24617 title=[[Main Page]]
24618 !! wikitext
24619 __TOC__
24620 ==''Lost'' episodes==
24621 !! html/php
24622 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24623 <ul>
24624 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
24625 </ul>
24626 </div>
24627
24628 <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>
24629
24630 !! html/parsoid
24631 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24632 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24633 !! end
24634
24635 !! test
24636 T28375: TOC with bold
24637 !! options
24638 title=[[Main Page]]
24639 !! wikitext
24640 __TOC__
24641 =='''should be bold''' then normal text==
24642 !! html/php
24643 <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>
24644 <ul>
24645 <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>
24646 </ul>
24647 </div>
24648
24649 <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>
24650
24651 !! html/parsoid
24652 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24653 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24654 !! end
24655
24656 !! test
24657 T35845: Headings become cursive in TOC when they contain an image
24658 !! options
24659 title=[[Main Page]]
24660 !! wikitext
24661 __TOC__
24662 ==Image [[Image:foobar.jpg]]==
24663 !! html/php
24664 <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>
24665 <ul>
24666 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24667 </ul>
24668 </div>
24669
24670 <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>
24671
24672 !! html/parsoid
24673 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24674 <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>
24675 !! end
24676
24677 !! test
24678 T35845 (2): Headings become bold in TOC when they contain a blockquote
24679 !! options
24680 title=[[Main Page]]
24681 !! wikitext
24682 __TOC__
24683 ==<blockquote>Quote</blockquote>==
24684 !! html/php
24685 <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>
24686 <ul>
24687 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24688 </ul>
24689 </div>
24690
24691 <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>
24692
24693 !! html/php+tidy
24694 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24695 <ul>
24696 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24697 </ul>
24698 </div>
24699
24700 <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>
24701 !! html/parsoid
24702 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24703 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
24704 !! end
24705
24706 !! test
24707 Unclosed tags in TOC
24708 !! config
24709 wgFragmentMode=[ 'html5', 'legacy' ]
24710 !! options
24711 title=[[Main Page]]
24712 !! wikitext
24713 __TOC__
24714 ==Proof: 2 < 3==
24715 <small>Hanc marginis exiguitas non caperet.</small>
24716 QED
24717 !! html/php
24718 <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>
24719 <ul>
24720 <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>
24721 </ul>
24722 </div>
24723
24724 <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>
24725 <p><small>Hanc marginis exiguitas non caperet.</small>
24726 QED
24727 </p>
24728 !! html/parsoid
24729 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24730 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24731 <p><small>Hanc marginis exiguitas non caperet.</small>
24732 QED</p>
24733 !! end
24734
24735 !! test
24736 Multiple tags in TOC
24737 !! wikitext
24738 __TOC__
24739 ==<i>Foo</i> <b>Bar</b>==
24740
24741 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24742 !! html/php
24743 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
24744 <ul>
24745 <li class="toclevel-1 tocsection-1"><a href="#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>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>
24752
24753 !! html/php+tidy
24754 <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>
24755 <ul>
24756 <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>
24757 <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>
24758 </ul>
24759 </div>
24760
24761 <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>
24762 <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>
24763 !! html/parsoid
24764 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24765 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24766
24767 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
24768 !! end
24769
24770 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24771 # html5 tag parsing.
24772 !! test
24773 Tags with parameters in TOC
24774 !! options
24775 parsoid=wt2html
24776 !! wikitext
24777 __TOC__
24778 ==<sup class="in-h2">Hello</sup>==
24779
24780 ==<sup class="a > b">Evilbye</sup>==
24781 !! html/php
24782 <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>
24783 <ul>
24784 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24785 <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>
24786 </ul>
24787 </div>
24788
24789 <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>
24790 <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>
24791
24792 !! html/parsoid
24793 <meta property="mw:PageProp/toc" />
24794 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24795
24796 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24797 !! end
24798
24799 !! test
24800 span tags with directionality in TOC
24801 !! wikitext
24802 __TOC__
24803 ==<span dir="ltr">C++</span>==
24804
24805 ==<span dir="rtl">זבנג!</span>==
24806
24807 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24808
24809 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24810
24811 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24812 !! html/php
24813 <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>
24814 <ul>
24815 <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>
24816 <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>
24817 <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>
24818 <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>
24819 <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>
24820 </ul>
24821 </div>
24822
24823 <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>
24824 <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>
24825 <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>
24826 <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>
24827 <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>
24828
24829 !! html/parsoid
24830 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24831 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24832 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24833 <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>
24834 <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>
24835 <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>
24836 !! end
24837
24838 !! test
24839 T74884: bdi element in ToC
24840 !! wikitext
24841 __TOC__
24842 ==<bdi>test</bdi>==
24843 !! html/php
24844 <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>
24845 <ul>
24846 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24847 </ul>
24848 </div>
24849
24850 <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>
24851
24852 !! html/parsoid
24853 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24854 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24855 !! end
24856
24857 !! test
24858 T35715: s/strike element in ToC
24859 !! wikitext
24860 __TOC__
24861 ==<s>test</s> test <strike>test</strike>==
24862 !! html/php
24863 <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>
24864 <ul>
24865 <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>
24866 </ul>
24867 </div>
24868
24869 <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>
24870
24871 !! html/parsoid
24872 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24873 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24874 !! end
24875
24876 !! test
24877 T198618: style element in ToC
24878 !! options
24879 styletag=1
24880 !! wikitext
24881 __TOC__
24882 ==<style>.foo {}</style>Style<style>.bar {}</style>==
24883 !! html/php
24884 <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>
24885 <ul>
24886 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
24887 </ul>
24888 </div>
24889
24890 <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>
24891
24892 !! html/parsoid
24893 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24894 <h2 id="Style" data-parsoid='{}'><style>.foo {}</style>Style<style>.bar {}</style></h2>
24895 !! end
24896
24897 !! test
24898 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24899 !! wikitext
24900 __TOC__
24901 ==x==
24902 !! html/php
24903 <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>
24904 <ul>
24905 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24906 </ul>
24907 </div>
24908
24909 <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>
24910
24911 !! html/parsoid
24912 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24913 <h2 id="x" data-parsoid='{}'>x</h2>
24914 !! end
24915
24916 !! article
24917 MediaWiki:T34057
24918 !! text
24919 == {{int:headline_sample}} ==
24920 !! endarticle
24921
24922 !! test
24923 T34057: Title needed when expanding <h> nodes.
24924 !! options
24925 title=[[Main Page]]
24926 !! wikitext
24927 {{int:T34057}}
24928 !! html
24929 <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>
24930
24931 !! end
24932
24933 !! test
24934 Strip marker in urlencode
24935 !! wikitext
24936 {{urlencode:x<nowiki/>y}}
24937 {{urlencode:x<nowiki/>y|wiki}}
24938 {{urlencode:x<nowiki/>y|path}}
24939 {{urlencode:x<pre id="one">two</pre>y}}
24940 !! html/php
24941 <p>xy
24942 xy
24943 xy
24944 xy
24945 </p>
24946 !! end
24947
24948 !! test
24949 Strip marker in lc
24950 !! wikitext
24951 {{lc:x<nowiki/>y}}
24952 !! html
24953 <p>xy
24954 </p>
24955 !! end
24956
24957 !! test
24958 Strip marker in uc
24959 !! wikitext
24960 {{uc:x<nowiki/>y}}
24961 !! html
24962 <p>XY
24963 </p>
24964 !! end
24965
24966 !! test
24967 Strip marker in formatNum
24968 !! wikitext
24969 {{formatnum:1<nowiki/>2}}
24970 {{formatnum:1<nowiki/>2|R}}
24971 !! html
24972 <p>12
24973 12
24974 </p>
24975 !! end
24976
24977 !! test
24978 Check noCommafy in formatNum
24979 !! options
24980 language=be-tarask
24981 !! wikitext
24982 {{formatnum:123456.78}}
24983 {{formatnum:123456.78|NOSEP}}
24984 !! html
24985 <p>123 456,78
24986 123456.78
24987 </p>
24988 !! end
24989
24990 !! test
24991 Wrong option for formatNum (T58199)
24992 !! wikitext
24993 {{formatnum:1,234.56|Random}}
24994 {{formatnum:1,234.56|EVERYTHING}}
24995 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24996 !! html
24997 <p>1,234.56
24998 1,234.56
24999 1,234.56
25000 </p>
25001 !! end
25002
25003 !! test
25004 Strip marker in grammar
25005 !! options
25006 language=fi
25007 !! wikitext
25008 {{grammar:elative|foo<nowiki/>bar}}
25009 !! html
25010 <p>foobarista
25011 </p>
25012 !! end
25013
25014 !! test
25015 Strip marker in padleft
25016 !! wikitext
25017 {{padleft:|2|x<nowiki/>y}}
25018 !! html
25019 <p>xy
25020 </p>
25021 !! end
25022
25023 !! test
25024 Strip marker in padright
25025 !! wikitext
25026 {{padright:|2|x<nowiki/>y}}
25027 !! html
25028 <p>xy
25029 </p>
25030 !! end
25031
25032 !! test
25033 Strip marker in anchorencode
25034 !! wikitext
25035 {{anchorencode:x<nowiki/>y}}
25036 !! html/php
25037 <p>xy
25038 </p>
25039 !! html/parsoid
25040 <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>
25041 !! end
25042
25043 !! test
25044 nowiki inside link inside heading (T20295)
25045 !! wikitext
25046 ==[[foo|x<nowiki>y</nowiki>z]]==
25047 !! html
25048 <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>
25049
25050 !! end
25051
25052 !! test
25053 new support for bdi element (T33817)
25054 !! wikitext
25055 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25056 !! html
25057 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25058
25059 !!end
25060
25061 !! test
25062 Ignore pipe between table row attributes
25063 !! wikitext
25064 {|
25065 |quux
25066 |- id=foo | style='color: red'
25067 |bar
25068 |}
25069 !! html
25070 <table>
25071 <tr>
25072 <td>quux
25073 </td></tr>
25074 <tr id="foo" style="color: red">
25075 <td>bar
25076 </td></tr></table>
25077
25078 !! end
25079
25080 !!test
25081 Language parser function
25082 !! wikitext
25083 {{#language:ar}}
25084 !! html
25085 <p>العربية
25086 </p>
25087 !! end
25088
25089 !!test
25090 Padleft and padright (default 0-padding)
25091 !! wikitext
25092 {{padleft:xyz|5}}
25093 {{padright:xyz|5}}
25094 !! html/php
25095 <p>00xyz
25096 xyz00
25097 </p>
25098 !! html/parsoid
25099 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25100 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25101 !! end
25102
25103 !!test
25104 Padleft and padright (partial fill)
25105 !! wikitext
25106 {{padleft:xyz|6|ab}}
25107 {{padright:xyz|6|ab}}
25108 !! html/php
25109 <p>abaxyz
25110 xyzaba
25111 </p>
25112 !! html/parsoid
25113 <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>
25114 <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>
25115 !! end
25116
25117 !!test
25118 Padleft and padright as substr
25119 !! wikitext
25120 {{padleft:|3|abcde}}
25121 {{padright:|3|abcde}}
25122 !! html/php
25123 <p>abc
25124 abc
25125 </p>
25126 !! html/parsoid
25127 <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>
25128 <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>
25129 !! end
25130
25131 !! test
25132 Padleft and padright with non-numerical length (T180403)
25133 !! wikitext
25134 {{padleft:abcdef|junk}}
25135 {{padright:abcdef|junk}}
25136 !! html/php
25137 <p>abcdef
25138 abcdef
25139 </p>
25140 !! end
25141
25142 !!test
25143 Special parser function
25144 !! wikitext
25145 {{#special:RandomPage}}
25146 {{#special:BaDtItLe}}
25147 {{#special:Foobar}}
25148 !! html
25149 <p>Special:Random
25150 Special:Badtitle
25151 Special:Foobar
25152 </p>
25153 !! end
25154
25155 !!test
25156 T36939 - Case insensitive link parsing ([HttP://])
25157 !! wikitext
25158 [HttP://MediaWiki.Org/]
25159 !! html/php
25160 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25161 </p>
25162 !! html/parsoid
25163 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25164 !! end
25165
25166 !!test
25167 T36939 - Case insensitive link parsing ([HttP:// title])
25168 !! wikitext
25169 [HttP://MediaWiki.Org/ MediaWiki]
25170 !! html
25171 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25172 </p>
25173 !! end
25174
25175 !!test
25176 T36939 - Case insensitive link parsing (HttP://)
25177 !! wikitext
25178 HttP://MediaWiki.Org/
25179 !! html/php
25180 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25181 </p>
25182 !! html/parsoid
25183 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25184 !! end
25185
25186 !!test
25187 Disable TOC
25188 !! options
25189 notoc
25190 !! wikitext
25191 Lead
25192 ==Section 1==
25193 ==Section 2==
25194 ==Section 3==
25195 ==Section 4==
25196 ==Section 5==
25197 !! html
25198 <p>Lead
25199 </p>
25200
25201 <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>
25202 <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>
25203 <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>
25204 <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>
25205 <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>
25206
25207 !! end
25208
25209
25210 ###
25211 ### Parsoid-specific tests
25212 ### Parsoid-PHP parser incompatibilities
25213 ###
25214 !!test
25215 1. SOL-sensitive wikitext tokens as template-args
25216 !!options
25217 parsoid=wt2html,wt2wt
25218 !! wikitext
25219 {{echo|*a}}
25220 {{echo|#a}}
25221 {{echo|:a}}
25222 !! html
25223 <span about="#mwt1" typeof="mw:Transclusion">
25224 </span><ul about="#mwt1"><li>a</li>
25225 </ul>
25226 <span about="#mwt2" typeof="mw:Transclusion">
25227 </span><ol about="#mwt2"><li>a</li>
25228 </ol>
25229 <span about="#mwt3" typeof="mw:Transclusion">
25230 </span><dl about="#mwt3"><dd>a</dd>
25231 </dl>
25232 !!end
25233
25234 #### -----------------------------------------------------------------
25235 #### Parsoid-specific functionality tests
25236 #### -----------------------------------------------------------------
25237
25238 # T65642/T68749: Formatting elt fixup around images.
25239 # We know wt2wt will fail, but we expect selser to pass.
25240 # Due to the nature of our testing, wt2wt and selser tests will enter the
25241 # blacklist and we'll catch selser regressions based on changes to the
25242 # blacklist entries for selser tests.
25243 !! test
25244 1. Treebuilder fixup of formatting elt
25245 !! options
25246 parsoid=wt2html,wt2wt
25247 !! wikitext
25248 {|
25249 |
25250 <small>
25251 [[Image:Foobar.jpg|right|Test]]
25252 </small>
25253 |}
25254 !! html/php+tidy
25255 <table>
25256 <tbody><tr>
25257 <td>
25258 <p><small>
25259 </small></p><small>
25260 <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>
25261 </small><p><small></small>
25262 </p>
25263 </td></tr></tbody></table>
25264 !! html/parsoid
25265 <table>
25266 <tbody><tr><td>
25267 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25268 <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>
25269 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25270 </tbody></table>
25271 !! end
25272
25273 !! test
25274 2. Treebuilder fixup of formatting elt
25275 !! options
25276 parsoid=wt2html,wt2wt
25277 !! wikitext
25278 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25279
25280 <small>[[Image:Foobar.jpg|right|300px]]</small>
25281 !! html/php+tidy
25282 <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>
25283 </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>
25284 !! html/parsoid
25285 <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>
25286
25287 <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>
25288 !! end
25289
25290 !! test
25291 3. Treebuilder fixup of formatting elt
25292 !! options
25293 parsoid=wt2html,wt2wt
25294 !! wikitext
25295 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25296 !! html/php+tidy
25297 <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>
25298 </p>
25299 !! html/parsoid
25300 <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>
25301 !! end
25302
25303 !! test
25304 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25305 !! options
25306 parsoid=wt2html,wt2wt
25307 !! wikitext
25308 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25309 !! html/php+tidy
25310 <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>
25311 !! html/parsoid
25312 <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>
25313 !! end
25314
25315 #### ----------------------------------------------------------------
25316 #### Parsoid-only testing of Parsoid's impl of LST
25317 #### Not implemented yet, see
25318 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25319 #### ----------------------------------------------------------------
25320
25321 ## We still need to support serializing the older format while content is stored.
25322 !! test
25323 LST Sections: Backwards compatibility
25324 !! options
25325 parsoid={
25326 "suppressErrors": true,
25327 "modes": ["html2wt"]
25328 }
25329 !! wikitext
25330 <section begin="2011-05-16" />
25331 <section end="2014-04-10 (MW 1.23wmf22)" />
25332 !! html/parsoid
25333 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25334 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25335 !! end
25336
25337 !! test
25338 LST Sections: Newfangled approach
25339 !! wikitext
25340 <section begin="2011-05-16" />
25341 <section end="2014-04-10 (MW 1.23wmf22)" />
25342 !! html/parsoid
25343 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25344 </span>
25345 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25346 </span></p>
25347 !! end
25348
25349 #--------- Test stripping of empty nodes in template content ----------
25350
25351 !! test
25352 Empty LI and TR nodes should be stripped from template content
25353 !! wikitext
25354 {{EmptyLITest}}
25355 {{EmptyTRTest}}
25356 !! html/parsoid
25357 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25358 <li>a</li>
25359 <li>b</li>
25360 </ul>
25361 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25362 <tbody>
25363 <tr>
25364 <td>foo</td>
25365 </tr>
25366 <tr>
25367 <td>bar</td>
25368 </tr>
25369 </tbody>
25370 </table>
25371 !! end
25372
25373 !! test
25374 Empty LI and TR nodes should not be stripped from top-level content
25375 !! wikitext
25376 *a
25377 *
25378 *b
25379
25380 {|
25381 |-
25382 |-
25383 |foo
25384 |}
25385 !! html/parsoid
25386 <ul>
25387 <li>a</li>
25388 <li class='mw-empty-elt'></li>
25389 <li>b</li>
25390 </ul>
25391 <table>
25392 <tbody>
25393 <tr class='mw-empty-elt'></tr>
25394 <tr>
25395 <td>foo</td>
25396 </tr>
25397 </tbody>
25398 </table>
25399 !! end
25400
25401 !! test
25402 Empty TR nodes should not be stripped if they have any attributes set
25403 !! wikitext
25404 {{EmptyTRWithHTMLAttrTest}}
25405 !! html/parsoid
25406 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25407 <tr align='center'></tr>
25408 <tr><td>foo</td></tr>
25409 <tr align='center'></tr>
25410 <tr><td>bar</td></tr>
25411 </table>
25412 !! end
25413
25414 #### ----------------------------------------------------------------
25415 #### The following section of tests are primarily to test
25416 #### wikitext escaping capabilities of Parsoid. Given that
25417 #### escaping can be done any number of ways, the wikitext (input)
25418 #### is always adjusted to reflect how Parsoid adds nowiki
25419 #### escape tags.
25420 ####
25421 #### We are marking several tests as parsoid-only since the
25422 #### HTML in the result section is different from what the
25423 #### PHP parser generates for it.
25424 #### ----------------------------------------------------------------
25425
25426
25427 #### --------------- Headings ---------------
25428 #### 0. Unnested
25429 #### 1. Nested inside html <h1>=foo=</h1>
25430 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25431 #### 3. Nested inside html with wikitext split by html tags
25432 #### 4. No escape needed
25433 #### 5. Empty headings <h1></h1>
25434 #### 6. Heading chars in SOL context
25435 #### ----------------------------------------
25436 !! test
25437 Headings: 0. Unnested
25438 !! options
25439 parsoid=html2wt
25440 !! html/parsoid
25441 <p>=foo=</p>
25442
25443 <p> =foo=
25444 <!--cmt-->
25445 =foo=</p>
25446
25447 <p>=foo<i>a</i>=</p>
25448 !! wikitext
25449 <nowiki>=foo=</nowiki>
25450
25451 <nowiki> </nowiki>=foo=
25452 <!--cmt-->
25453 <nowiki>=foo=</nowiki>
25454
25455 =foo''a''<nowiki>=</nowiki>
25456 !!end
25457
25458 # New headings and existing headings are handled differently
25459 !! test
25460 Headings: 1. Nested inside html
25461 !! options
25462 parsoid=html2wt
25463 !! html/parsoid
25464 <h1>=foo=</h1>
25465 <h2>=foo=</h2>
25466 <h3>=foo=</h3>
25467
25468 <h1 data-parsoid=''>=foo=</h1>
25469 <h2 data-parsoid=''>=foo=</h2>
25470 <h3 data-parsoid=''>=foo=</h3>
25471 <h4 data-parsoid=''>=foo=</h4>
25472 <h5 data-parsoid=''>=foo=</h5>
25473 <h6 data-parsoid=''>=foo=</h6>
25474 !! wikitext
25475 = =foo= =
25476
25477 == =foo= ==
25478
25479 === =foo= ===
25480
25481 =<nowiki>=foo=</nowiki>=
25482 ==<nowiki>=foo=</nowiki>==
25483 ===<nowiki>=foo=</nowiki>===
25484 ====<nowiki>=foo=</nowiki>====
25485 =====<nowiki>=foo=</nowiki>=====
25486 ======<nowiki>=foo=</nowiki>======
25487
25488 !!end
25489
25490 !! test
25491 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25492 !! options
25493 parsoid=html2wt
25494 !! html/parsoid
25495 <h1>foo</h1>*bar
25496 <h1>foo</h1>=bar
25497 <h1>foo</h1>=bar=
25498 !! wikitext
25499 = foo =
25500 <nowiki>*</nowiki>bar
25501
25502 = foo =
25503 =bar
25504
25505 = foo =
25506 <nowiki>=bar=</nowiki>
25507 !!end
25508
25509 !! test
25510 Headings: 3. Nested inside html with wikitext split by html tags
25511 !! options
25512 parsoid=html2wt
25513 !! html/parsoid
25514 <h1>=<b>bold</b>foo=</h1>
25515 !! wikitext
25516 = ='''bold'''foo= =
25517 !!end
25518
25519 !! test
25520 Headings: 4a. No escaping needed (testing just h1 and h2)
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <h1>=foo</h1>
25525 <h1>foo=</h1>
25526 <h1> =foo= </h1>
25527 <h1>=foo= bar</h1>
25528 <h2>=foo</h2>
25529 <h2>foo=</h2>
25530 <h1>=</h1>
25531 <h1><i>=</i>foo=</h1>
25532 !! wikitext
25533 = =foo =
25534
25535 = foo= =
25536
25537 = =foo= =
25538
25539 = =foo= bar =
25540
25541 == =foo ==
25542
25543 == foo= ==
25544
25545 = = =
25546
25547 = ''=''foo= =
25548 !!end
25549
25550 !! test
25551 Headings: 4b. No escaping needed (inside p-tags)
25552 !! options
25553 parsoid=html2wt
25554 !! html/parsoid
25555 <p>=foo= x
25556 =foo= <s></s>
25557 </p>
25558 !! wikitext
25559 =foo= x
25560 =foo= <s></s>
25561 !! html/php
25562 <p>=foo= x
25563 =foo= <s></s>
25564 </p>
25565 !!end
25566
25567 !! test
25568 Headings: 4c. Short headings (1)
25569 !! options
25570 parsoid=html2wt
25571 !! html/parsoid
25572 <p>===
25573 </p>
25574 !! wikitext
25575 <nowiki>===</nowiki>
25576 !! html/php
25577 <p>===
25578 </p>
25579 !! end
25580
25581 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25582 !! test
25583 Headings: 4d. Short headings (2)
25584 !! options
25585 parsoid=wt2html,html2html
25586 !! wikitext
25587 =
25588 ==
25589 ===
25590 ====
25591 =====
25592 !! html/php
25593 <p>=
25594 ==
25595 </p>
25596 <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>
25597 <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>
25598 <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>
25599
25600 !! html/parsoid
25601 <p>=
25602 ==</p>
25603 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25604 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25605 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25606 !! end
25607
25608 !! test
25609 Headings: 5. Empty headings
25610 !! options
25611 parsoid=html2wt
25612 !! html/parsoid
25613 <h1 data-parsoid='{}'></h1>
25614
25615 <h2 data-parsoid='{}'></h2>
25616
25617 <h3 data-parsoid='{}'></h3>
25618
25619 <h4 data-parsoid='{}'></h4>
25620
25621 <h5 data-parsoid='{}'></h5>
25622
25623 <h6 data-parsoid='{}'></h6>
25624 !! wikitext
25625 =<nowiki/>=
25626
25627 ==<nowiki/>==
25628
25629 ===<nowiki/>===
25630
25631 ====<nowiki/>====
25632
25633 =====<nowiki/>=====
25634
25635 ======<nowiki/>======
25636 !!end
25637
25638 !! test
25639 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25640 !! options
25641 parsoid=html2wt
25642 !! html/parsoid
25643 <p>=a=</p>
25644
25645 <p>=a=</p>
25646
25647 <p>=a=</p>
25648 !! wikitext
25649 <nowiki>=a=</nowiki>
25650
25651 <nowiki>=a=</nowiki>
25652
25653 <nowiki>=a=</nowiki>
25654 !!end
25655
25656 !! test
25657 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25658 !! options
25659 parsoid=html2wt
25660 !! html/parsoid
25661 <p>=a=
25662 b</p>
25663
25664 <p>=a=
25665 b</p>
25666
25667 <p>=a=
25668 b</p>
25669 !! wikitext
25670 <nowiki>=a=</nowiki>
25671 b
25672
25673 <nowiki>=a=</nowiki>
25674 b
25675
25676 <nowiki>=a=</nowiki>
25677 b
25678 !!end
25679
25680 !! test
25681 Headings: 6c. Heading chars in SOL context (leading newline break)
25682 !! options
25683 parsoid=html2wt
25684 !! html/parsoid
25685 <p>a
25686 =b=</p>
25687 !! wikitext
25688 a
25689 <nowiki>=b=</nowiki>
25690 !!end
25691
25692 !! test
25693 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <!--c0--><p>=a=</p>
25698
25699 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25700 !! wikitext
25701 <!--c0--><nowiki>=a=</nowiki>
25702
25703 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25704 !!end
25705
25706 !! test
25707 Headings: 6d. Heading chars in SOL context (No escaping needed)
25708 !! options
25709 parsoid=html2wt
25710 !! html/parsoid
25711 =a=<div>b</div>
25712 !! wikitext
25713 =a=<div>b</div>
25714 !!end
25715
25716 !! test
25717 Headings: 7. Insert a newline between new content and headings
25718 !! options
25719 parsoid=html2wt
25720 !! html/parsoid
25721 <h2>NEW</h2>
25722 <p>new</p>
25723 <h2 data-parsoid='{}'>A</h2>
25724 <p data-parsoid='{}'>a</p>
25725 !! wikitext
25726 == NEW ==
25727 new
25728
25729 ==A==
25730 a
25731
25732 !! end
25733
25734 !! test
25735 Headings: Used as horizontal rule
25736 !! config
25737 wgFragmentMode=[ 'html5', 'legacy' ]
25738 !! options
25739 parsoid=wt2html
25740 !! wikitext
25741 ===============
25742 !! html/php
25743 <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>
25744
25745 !! html/parsoid
25746 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25747 !! end
25748
25749 #### --------------- Lists ---------------
25750 #### 0. Outside nests (*foo, etc.)
25751 #### 1. Nested inside html <ul><li>*foo</li></ul>
25752 #### 2. Inside definition lists
25753 #### 3. Only bullets at start should be escaped
25754 #### 4. No escapes needed
25755 #### 5. No unnecessary escapes
25756 #### 6. Escape bullets in SOL position
25757 #### 7. Escape bullets in a multi-line context
25758 #### ----------------------------------------
25759
25760 !! test
25761 Lists: 0. Outside nests
25762 !! options
25763 parsoid=html2wt
25764 !! html/parsoid
25765 <p>*foo</p>
25766
25767 <p>#foo</p>
25768
25769 <p>;Foo:bar</p>
25770 !! wikitext
25771 <nowiki>*</nowiki>foo
25772
25773 <nowiki>#</nowiki>foo
25774
25775 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25776 !!end
25777
25778 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25779 ## to test wikitext escaping, and insignificant whitespace diffs
25780 ## cause PHP parser tests to barf
25781 !! test
25782 Lists: 1. Nested inside html (No unnecessary escapes)
25783 !! options
25784 parsoid=html2wt
25785 !! html/parsoid
25786 <ul>
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 </ul>
25796
25797 <ol>
25798 <li>*foo</li>
25799 <li>#foo</li>
25800 <li>:foo</li>
25801 <li>;foo</li>
25802 <li data-parsoid='{}'>*foo</li>
25803 <li data-parsoid='{}'>#foo</li>
25804 <li data-parsoid='{}'>:foo</li>
25805 <li data-parsoid='{}'>;foo</li>
25806 </ol>
25807 !! wikitext
25808 * *foo
25809 * #foo
25810 * :foo
25811 * ;foo
25812 *<nowiki>*foo</nowiki>
25813 *<nowiki>#foo</nowiki>
25814 *<nowiki>:foo</nowiki>
25815 *<nowiki>;foo</nowiki>
25816
25817 # *foo
25818 # #foo
25819 # :foo
25820 # ;foo
25821 #<nowiki>*foo</nowiki>
25822 #<nowiki>#foo</nowiki>
25823 #<nowiki>:foo</nowiki>
25824 #<nowiki>;foo</nowiki>
25825 !!end
25826
25827 !! test
25828 Lists: 2. Inside definition lists
25829 !! options
25830 parsoid=html2wt
25831 !! html/parsoid
25832 <dl><dt>;foo</dt></dl>
25833 <dl><dt>:foo</dt></dl>
25834 <dl><dt>:foo</dt>
25835 <dd>bar</dd></dl>
25836 <dl><dd>:foo</dd></dl>
25837 !! wikitext
25838 ; ;foo
25839
25840 ; <nowiki>:foo</nowiki>
25841
25842 ; <nowiki>:foo</nowiki>
25843 : bar
25844
25845 : :foo
25846 !!end
25847
25848 !! test
25849 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25850 !! options
25851 parsoid=html2wt
25852 !! html/parsoid
25853 <ul>
25854 <li>*foo*bar</li>
25855 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25856 </ul>
25857 !! wikitext
25858 * *foo*bar
25859 *<nowiki>*foo</nowiki>''it''*bar
25860 !!end
25861
25862 !! test
25863 Lists: 4. No escapes needed
25864 !! options
25865 parsoid=html2wt
25866 !! html/parsoid
25867 <ul>
25868 <li>foo*bar
25869 </li>
25870 </ul>
25871 <ul>
25872 <li><i>foo</i>*bar
25873 </li>
25874 </ul>
25875 <ul>
25876 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25877 </li>
25878 </ul>
25879 <ul>
25880 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25881 </li>
25882 </ul>
25883 !! wikitext
25884 *foo*bar
25885
25886 *''foo''*bar
25887
25888 *[[Foo]]: bar
25889
25890 *[[Foo]]*bar
25891 !!end
25892
25893 !! test
25894 Lists: 5. No unnecessary escapes
25895 !! options
25896 parsoid=html2wt
25897 !! html/parsoid
25898 <ul><li> bar <span>[[foo]]</span></li></ul>
25899 <ul><li> =bar <span>[[foo]]</span></li></ul>
25900 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25901 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25902 <ul><li> =bar <span>foo]]</span>=</li></ul>
25903 <ul><li> <s></s>: a</li></ul>
25904 <ul><li> <i>* foo</i></li></ul>
25905
25906 !! wikitext
25907 * bar <span><nowiki>[[foo]]</nowiki></span>
25908
25909 * =bar <span><nowiki>[[foo]]</nowiki></span>
25910
25911 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25912
25913 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25914
25915 * =bar <span>foo]]</span>=
25916
25917 * <s></s>: a
25918
25919 * ''* foo''
25920 !!end
25921
25922 !! test
25923 Lists: 6. Escape bullets in SOL position
25924 !! options
25925 parsoid=html2wt
25926 !! html/parsoid
25927 <p><!--cmt-->*foo</p>
25928 !! wikitext
25929 <!--cmt--><nowiki>*</nowiki>foo
25930 !!end
25931
25932 !! test
25933 Lists: 7. Escape bullets in a multi-line context
25934 !! options
25935 parsoid=html2wt
25936 !! html/parsoid
25937 <p>a
25938 *b
25939 </p>
25940 !! wikitext
25941 a
25942 <nowiki>*</nowiki>b
25943 !!end
25944
25945 !! test
25946 Lists: 8. Escape colons only if not present in tags
25947 !! options
25948 parsoid=html2wt
25949 !! html/parsoid
25950 <dl><dt>a:b<i>c:d</i></dt></dl>
25951 !! wikitext
25952 ; <nowiki>a:b</nowiki>''c:d''
25953 !! end
25954
25955 #### --------------- HRs ---------------
25956 #### 1. Single line
25957 #### -----------------------------------
25958
25959 !! test
25960 HRs: 1. Single line
25961 !! options
25962 parsoid=html2wt
25963 !! html/parsoid
25964 <hr />----
25965 <hr />=foo=
25966 <hr />*foo
25967 !! wikitext
25968 ----<nowiki>----</nowiki>
25969 ----=foo=
25970 ----*foo
25971 !! end
25972
25973 #### --------------- Tables ---------------
25974 #### 1a. Simple example
25975 #### 1b. No escaping needed (!foo)
25976 #### 1c. No escaping needed (|foo)
25977 #### 1d. No escaping needed (|}foo)
25978 ####
25979 #### 2a. Nested in td (<td>foo|bar</td>)
25980 #### 2b. Nested in td (<td>foo||bar</td>)
25981 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25982 ####
25983 #### 3a. Nested in th (<th>foo!bar</th>)
25984 #### 3b. Nested in th (<th>foo!!bar</th>)
25985 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25986 ####
25987 #### 4a. Escape -
25988 #### 4b. Escape +
25989 #### 4c. No escaping needed
25990 #### --------------------------------------
25991
25992 !! test
25993 Tables: 1a. Simple example
25994 !! options
25995 parsoid=html2wt
25996 !! html/parsoid
25997 <p>{|
25998 |}
25999 </p>
26000 !! wikitext
26001 <nowiki>{|</nowiki>
26002 |}
26003 !! end
26004
26005 !! test
26006 Tables: 1b. 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: 1c. 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: 1d. No escaping needed
26029 !! options
26030 parsoid=html2wt
26031 !! html/parsoid
26032 <p>|}foo
26033 </p>
26034 !! wikitext
26035 |}foo
26036 !! end
26037
26038 !! test
26039 Tables: 2a. Nested in td
26040 !! options
26041 parsoid=html2wt
26042 !! html/parsoid
26043 <table><tbody><tr>
26044 <td>foo|bar</td></tr>
26045 <tr><td>x<div>a|b</div></td>
26046 </tbody></table>
26047 !! wikitext
26048 {|
26049 |<nowiki>foo|bar</nowiki>
26050 |-
26051 |x<div><nowiki>a|b</nowiki></div>
26052 |}
26053 !! html/php+tidy
26054 <table>
26055 <tbody><tr>
26056 <td>foo|bar
26057 </td></tr>
26058 <tr>
26059 <td>x<div>a|b</div>
26060 </td></tr></tbody></table>
26061 !! end
26062
26063 !! test
26064 Tables: 2b. Nested in td
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <table><tbody><tr>
26069 <td>foo||bar</td>
26070 <td>a<i>b||c</i></td>
26071 <td>a<i><div>b||c</div></i></td>
26072 </tr></tbody></table>
26073 !! wikitext
26074 {|
26075 |<nowiki>foo||bar</nowiki>
26076 |a''<nowiki>b||c</nowiki>''
26077 |a''<div><nowiki>b||c</nowiki></div>''
26078 |}
26079 !! html/php
26080 <table>
26081 <tr>
26082 <td>foo||bar
26083 </td>
26084 <td>a<i>b||c</i>
26085 </td>
26086 <td>a<i><div>b||c</div></i>
26087 </td></tr></table>
26088
26089 !! end
26090
26091 !! test
26092 Tables: 2c. Nested in td -- no escaping needed
26093 !! options
26094 parsoid=html2wt
26095 !! html/*
26096 <table>
26097 <tr>
26098 <td>foo!!bar
26099 </td></tr></table>
26100
26101 !! wikitext
26102 {|
26103 |foo!!bar
26104 |}
26105 !! end
26106
26107 !! test
26108 Tables: 3a. Nested in th
26109 !! options
26110 parsoid=html2wt
26111 !! html/*
26112 <table>
26113 <tr>
26114 <th>foo!bar
26115 </th></tr></table>
26116
26117 !! wikitext
26118 {|
26119 !foo!bar
26120 |}
26121 !! end
26122
26123 !! test
26124 Tables: 3b. Nested in th
26125 !! options
26126 parsoid=html2wt
26127 !! html/parsoid
26128 <table><tbody>
26129 <tr><th>foo!!bar</th>
26130 <th><i>foo|bar</i></th>
26131 <th><i>foo!!bar</i></th>
26132 <th><i><span>foo!!bar</span></i></th>
26133 </tr></tbody></table>
26134 !! wikitext
26135 {|
26136 !<nowiki>foo!!bar</nowiki>
26137 !''<nowiki>foo|bar</nowiki>''
26138 !''<nowiki>foo!!bar</nowiki>''
26139 !''<span><nowiki>foo!!bar</nowiki></span>''
26140 |}
26141 !! html/php
26142 <table>
26143 <tr>
26144 <th>foo!!bar
26145 </th>
26146 <th><i>foo|bar</i>
26147 </th>
26148 <th><i>foo!!bar</i>
26149 </th>
26150 <th><i><span>foo!!bar</span></i>
26151 </th></tr></table>
26152
26153 !! end
26154
26155 !! test
26156 Tables: 3c. Nested in th
26157 !! options
26158 parsoid=html2wt
26159 !! html/parsoid
26160 <table><tbody>
26161 <tr><th>foo||bar</th>
26162 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26163 </tr></tbody></table>
26164 !! wikitext
26165 {|
26166 !<nowiki>foo||bar</nowiki>
26167 !<nowiki>foo||bar</nowiki>
26168 |}
26169 !! html/php
26170 <table>
26171 <tr>
26172 <th>foo||bar
26173 </th>
26174 <th>foo||bar
26175 </th></tr></table>
26176
26177 !! end
26178
26179 !! test
26180 Tables: 4a. Escape -
26181 !! options
26182 parsoid=html2wt
26183 !! html/*
26184 <table>
26185 <tr>
26186 <th>-bar
26187 </th></tr>
26188 <tr>
26189 <td>-bar
26190 </td></tr></table>
26191
26192 !! wikitext
26193 {|
26194 !-bar
26195 |-
26196 |<nowiki>-bar</nowiki>
26197 |}
26198 !! end
26199
26200 !! test
26201 Tables: 4b. Escape +
26202 !! options
26203 parsoid=html2wt
26204 !! html/*
26205 <table>
26206 <tr>
26207 <th>+bar
26208 </th></tr>
26209 <tr>
26210 <td>+bar
26211 </td></tr></table>
26212
26213 !! wikitext
26214 {|
26215 !+bar
26216 |-
26217 |<nowiki>+bar</nowiki>
26218 |}
26219 !! end
26220
26221 !! test
26222 Tables: 4c. No escaping needed
26223 !! options
26224 parsoid=html2wt
26225 !! html/parsoid
26226 <table><tbody>
26227 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26228 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26229 <tr><td>foo
26230 <p>bar|baz
26231 +bar
26232 -bar</p></td></tr>
26233 <tr><td>x
26234 <div>a|b</div></td>
26235 </tbody></table>
26236 !! wikitext
26237 {|
26238 |foo-bar
26239 |foo+bar
26240 |-
26241 |''foo''-bar
26242 |''foo''+bar
26243 |-
26244 |foo
26245 bar|baz
26246 +bar
26247 -bar
26248 |-
26249 |x
26250 <div>a|b</div>
26251 |}
26252 !! html/php
26253 <table>
26254 <tr>
26255 <td>foo-bar
26256 </td>
26257 <td>foo+bar
26258 </td></tr>
26259 <tr>
26260 <td><i>foo</i>-bar
26261 </td>
26262 <td><i>foo</i>+bar
26263 </td></tr>
26264 <tr>
26265 <td>foo
26266 <p>bar|baz
26267 +bar
26268 -bar
26269 </p>
26270 </td></tr>
26271 <tr>
26272 <td>x
26273 <div>a|b</div>
26274 </td></tr></table>
26275
26276 !! end
26277
26278 !! test
26279 Tables: 4d. No escaping needed
26280 !! options
26281 parsoid=html2wt
26282 !! html/parsoid
26283 <table>
26284 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26285 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26286 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26287 </tbody></table>
26288 !! wikitext
26289 {|
26290 |[[Foo]]-bar
26291 ||+1
26292 ||-2
26293 |}
26294 !! html/php
26295 <table>
26296 <tr>
26297 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26298 </td>
26299 <td>+1
26300 </td>
26301 <td>-2
26302 </td></tr></table>
26303
26304 !! end
26305
26306 !! test
26307 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26308 !! options
26309 parsoid=html2wt
26310 !! html/parsoid
26311 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26312
26313 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26314
26315 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26316
26317 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26318 !! wikitext
26319 {|
26320 | || align="center" | ||
26321 |}
26322
26323 {|
26324 |
26325 | align="center" |
26326 |
26327 |}
26328
26329 {|
26330 | {{!}}{{!}} align="center" | ||
26331 |}
26332
26333 {|
26334 ! !! align="center" | !!
26335 |}
26336 !! html/php+tidy
26337 <table>
26338 <tbody><tr>
26339 <td></td>
26340 <td align="center"></td>
26341 <td>
26342 </td></tr></tbody></table>
26343 <table>
26344 <tbody><tr>
26345 <td>
26346 </td>
26347 <td align="center">
26348 </td>
26349 <td>
26350 </td></tr></tbody></table>
26351 <table>
26352 <tbody><tr>
26353 <td></td>
26354 <td align="center"></td>
26355 <td>
26356 </td></tr></tbody></table>
26357 <table>
26358 <tbody><tr>
26359 <th></th>
26360 <th align="center"></th>
26361 <th>
26362 </th></tr></tbody></table>
26363 !! end
26364
26365 !! test
26366 T97430: Don't emit empty nowiki pairs around marker meta tags
26367 !! options
26368 parsoid=html2wt
26369 !! html/parsoid
26370 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26371 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26372 !! wikitext
26373 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26374 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26375 !! end
26376
26377 !! test
26378 Unclosed xmlish element in table line shouldn't eat end delimiters
26379 !! options
26380 parsoid=html2wt
26381 !! html/parsoid
26382 <table>
26383 <tbody><tr><td> &lt;foo</td>
26384 <td> bar></td></tr>
26385 </tbody></table>
26386 !! wikitext
26387 {|
26388 | <foo
26389 | bar>
26390 |}
26391 !! html/php
26392 <table>
26393 <tr>
26394 <td>&lt;foo
26395 </td>
26396 <td>bar&gt;
26397 </td></tr></table>
26398
26399 !! end
26400
26401 #### --------------- Links ----------------
26402 #### 1. Quote marks in link text
26403 #### 2. Wikilinks: Escapes needed
26404 #### 3. Wikilinks: No escapes needed
26405 #### 4. Extlinks: Escapes needed
26406 #### 5. Extlinks: No escapes needed
26407 #### --------------------------------------
26408 !! test
26409 Links 1. WikiLinks: No escapes needed
26410 !! options
26411 parsoid=html2wt
26412 !! html/parsoid
26413 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26414 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26415 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26416 !! wikitext
26417 [[Foo|Foo''boo'']]
26418 [[Foo|[Foobar]]]
26419 [[Foo|x [Foobar] x]]
26420 !! html/php
26421 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26422 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26423 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26424 </p>
26425 !! end
26426
26427 !! test
26428 Links 2. WikiLinks: Escapes needed
26429 !! options
26430 parsoid=html2wt
26431 !! html/parsoid
26432 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26433 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26434 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26435 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26436 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26437 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26438 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26439 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26440 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26441 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26442 !! wikitext
26443 [[Foo|<nowiki>Foobar]</nowiki>]]
26444 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26445 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26446 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26447 [[Foo|<nowiki>|Bar</nowiki>]]
26448 [[Foo|<nowiki>]]bar</nowiki>]]
26449 [[Foo|<nowiki>[[bar</nowiki>]]
26450 [[Foo|<nowiki>x [[ y</nowiki>]]
26451 [[Foo|<nowiki>x ]] y</nowiki>]]
26452 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26453 !! html/php
26454 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26455 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26456 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26457 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26458 <a href="/wiki/Foo" title="Foo">|Bar</a>
26459 <a href="/wiki/Foo" title="Foo">]]bar</a>
26460 <a href="/wiki/Foo" title="Foo">[[bar</a>
26461 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26462 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26463 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26464 </p>
26465 !! end
26466
26467 !! test
26468 Links 3. WikiLinks: No escapes needed
26469 !! options
26470 parsoid=html2wt
26471 !! html/parsoid
26472 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26473 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26474 !! wikitext
26475 [[Foo|[Foobar]]
26476 [[Foo|foo|bar]]
26477 !! html/php
26478 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26479 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26480 </p>
26481 !! end
26482
26483 !! test
26484 Links 4. ExtLinks: Escapes needed
26485 !! options
26486 parsoid=html2wt
26487 !! html/parsoid
26488 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26489 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26490 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26491 <p>[http://google.com]</p>
26492 <p>[http://google.com google]</p>
26493 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26494 <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>
26495 !! wikitext
26496 [http://google.com <nowiki>[google]</nowiki>]
26497 [http://google.com <nowiki>google]</nowiki>]
26498 [http://google.com <nowiki>goog] le</nowiki>]
26499
26500 <nowiki>[http://google.com]</nowiki>
26501
26502 <nowiki>[http://google.com google]</nowiki>
26503
26504 [http://google.com<nowiki>]</nowiki>
26505
26506 [{{echo|http://google.com}}<nowiki>]</nowiki>
26507 !! html/php
26508 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26509 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26510 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26511 </p><p>[http://google.com]
26512 </p><p>[http://google.com google]
26513 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26514 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26515 </p>
26516 !! end
26517
26518 !! test
26519 Links 5. ExtLinks: No escapes needed
26520 !! options
26521 parsoid=html2wt
26522 !! html/parsoid
26523 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26524 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26525 !! wikitext
26526 [http://google.com [google]
26527
26528 [[http://google.com]]
26529 !! html/php
26530 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26531 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
26532 </p>
26533 !! end
26534
26535 !! test
26536 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
26537 !! options
26538 parsoid=html2wt
26539 !! html/parsoid
26540 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
26541 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
26542 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
26543 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
26544 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
26545 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
26546 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26547 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
26548 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
26549 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
26550 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
26551 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
26552 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
26553 </p>
26554 !! wikitext
26555 x<nowiki/>http://example.com<nowiki/>y
26556 http://example.com<nowiki/>?x
26557 http://example.com<nowiki/>&x
26558 http://example.com<nowiki/>'x
26559 http://example.com<nowiki/>,x
26560 http://example.com<nowiki/>.x
26561 http://example.com<nowiki/>;x
26562 http://example.com<nowiki/>:x
26563 http://example.com<nowiki/>;x
26564 http://example.com<nowiki/>!x
26565 http://example.com<nowiki/>=x
26566 http://example.com<nowiki/>(x)
26567 http://example.com(x<nowiki/>)
26568 !! end
26569
26570 !! test
26571 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26572 !! options
26573 parsoid=html2wt
26574 !! html/parsoid
26575 <p>x
26576 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
26577 y
26578 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
26579 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
26580 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
26581 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
26582 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
26583 </p>
26584 !! wikitext
26585 x
26586 http://example.com
26587 y
26588 "http://example.com"
26589 (http://example.com)
26590 (http://example.com) foo
26591 http://example.com,
26592 http://example.com, foo
26593 !! html/php
26594 <p>x
26595 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
26596 y
26597 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
26598 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
26599 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
26600 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
26601 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
26602 </p>
26603 !! end
26604
26605 !! test
26606 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
26607 !! options
26608 parsoid=html2wt
26609 !! html/parsoid
26610 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
26611 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
26612 !! wikitext
26613 http://example.com.,;:!?\
26614 -http://example.com:
26615 !! html/php
26616 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26617 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26618 </p>
26619 !! end
26620
26621 !! test
26622 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26623 !! options
26624 parsoid=html2wt
26625 !! html/parsoid
26626 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26627 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26628 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26629 !! wikitext
26630 RFC 123<nowiki/>4
26631 RFC 123<nowiki/>y
26632 X<nowiki/>RFC 123<nowiki/>y
26633 !! end
26634
26635 !! test
26636 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26637 !! options
26638 parsoid=html2wt
26639 !! html/parsoid
26640 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26641 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26642 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26643 </p>
26644 !! wikitext
26645 RFC 123?foo
26646 RFC 123&foo
26647 -RFC 123-
26648 !! html/php
26649 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26650 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26651 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26652 </p>
26653 !! end
26654
26655 !! test
26656 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26657 !! options
26658 parsoid=html2wt
26659 !! html/parsoid
26660 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26661 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26662 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26663 !! wikitext
26664 PMID 123<nowiki/>4
26665 PMID 123<nowiki/>y
26666 X<nowiki/>PMID 123<nowiki/>y
26667 !! end
26668
26669 !! test
26670 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26671 !! options
26672 parsoid=html2wt
26673 !! html/parsoid
26674 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26675 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26676 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26677 </p>
26678 !! wikitext
26679 PMID 123?foo
26680 PMID 123&foo
26681 -PMID 123-
26682 !! html/php
26683 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26684 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26685 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26686 </p>
26687 !! end
26688
26689 !! test
26690 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26691 !! options
26692 parsoid=html2wt
26693 !! html/parsoid
26694 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26695 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26696 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26697 </p>
26698 !! wikitext
26699 ISBN 1234567890<nowiki/>1
26700 ISBN 1234567890<nowiki/>x
26701 a<nowiki/>ISBN 1234567890<nowiki/>b
26702 !! end
26703
26704 !! test
26705 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26706 !! options
26707 parsoid=html2wt
26708 !! html/parsoid
26709 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26710 !! wikitext
26711 -ISBN 1234567890's
26712 !! html/php
26713 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26714 </p>
26715 !! end
26716
26717 !! test
26718 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26719 !! options
26720 parsoid=html2wt
26721 !! html/*
26722 <p>this is not a link: http://example.com
26723 </p>
26724 !! wikitext
26725 this is not a link: <nowiki>http://example.com</nowiki>
26726 !! end
26727
26728 !! test
26729 Links 15. Link trails can't become link prefixes.
26730 !! options
26731 language=is
26732 parsoid=html2wt
26733 !! html/parsoid
26734 <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>
26735 !! wikitext
26736 [[Söfnuður]]-[[00]]
26737 !! html/php
26738 <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>
26739 </p>
26740 !! end
26741
26742 #### --------------- Quotes ---------------
26743 #### 1. Quotes inside <b> and <i>
26744 #### 2. Link fragments separated by <i> and <b> tags
26745 #### 3. Link fragments inside <i> and <b>
26746 #### 4. No escaping needed
26747 #### --------------------------------------
26748 !! test
26749 1a. Quotes inside <b> and <i>
26750 !! options
26751 parsoid=html2wt
26752 !! html/*
26753 <p><i>'foo'</i>
26754 <i>''foo''</i>
26755 <i>'''foo'''</i>
26756 <i>foo</i>'s
26757 <b>'foo'</b>
26758 <b>''foo''</b>
26759 <b>'''foo'''</b>
26760 <b>foo'<i>bar'</i>baz</b>
26761 <b>foo</b>'s
26762 '<i>foo</i>
26763 <i>foo</i>'
26764 <i>foo'</i>'
26765 '<i>foo</i>'
26766 '<b>foo</b>
26767 <b>foo</b>'
26768 '<b>foo</b>'
26769 <i>fools'<span> errand</span></i>
26770 <i><span>fool</span>'s errand</i>
26771 '<i>foo</i> bar '<i>baz</i>
26772 a|!*#-:;+-~[]{}b'<i>x</i>
26773 </p>
26774 !! wikitext
26775 ''<nowiki/>'foo'''
26776 ''<nowiki>''foo''</nowiki>''
26777 ''<nowiki>'''foo'''</nowiki>''
26778 ''foo''<nowiki/>'s
26779 '''<nowiki/>'foo''''
26780 '''<nowiki>''foo''</nowiki>'''
26781 '''<nowiki>'''foo'''</nowiki>'''
26782 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26783 '''foo'''<nowiki/>'s
26784 '''foo''
26785 ''foo''<nowiki/>'
26786 ''foo'''<nowiki/>'
26787 '''foo''<nowiki/>'
26788 ''''foo'''
26789 '''foo'''<nowiki/>'
26790 ''''foo'''<nowiki/>'
26791 ''fools'<span> errand</span>''
26792 ''<span>fool</span>'s errand''
26793 '<nowiki/>''foo'' bar '''baz''
26794 a|!*#-:;+-~[]{}b'''x''
26795 !! end
26796
26797 !! test
26798 1b. Quotes inside <b> and <i> with other tags on same line
26799 !! options
26800 parsoid=html2wt
26801 !! html/parsoid
26802 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26803 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26804 <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>
26805 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26806 '<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>
26807 '<i>foo</i> <div title="name">test</div>
26808 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26809 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26810 <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>
26811 </ol>
26812 !! wikitext
26813 '''a'' foo ''[[bar]]''
26814 ''a''' foo ''[[bar]]''
26815 ''a''' foo '''{{echo|[[bar]]}}'''
26816 [[foo]] x'''[[bar]]''
26817 '''foo'' <ref>test</ref>
26818 '''foo'' <div title="name">test</div>
26819 '''foo'' and <br> bar
26820 <references />
26821 !! end
26822
26823 !! test
26824 2. Link fragments separated by <i> and <b> tags
26825 !! options
26826 parsoid=html2wt
26827 !! html/parsoid
26828 <p>[[<i>foo</i>hello]]</p>
26829 <p>[[<b>foo</b>hello]]</p>
26830 !! wikitext
26831 [[''foo''<nowiki>hello]]</nowiki>
26832
26833 [['''foo'''<nowiki>hello]]</nowiki>
26834 !! end
26835
26836 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26837 # this is one of the shortcomings of this format
26838 !! test
26839 3. Link fragments inside <i> and <b>
26840 !! options
26841 parsoid=html2wt
26842 !! html/parsoid
26843 <p><i>[[foo</i>]]</p>
26844 <p><b>[[foo</b>]]</p>
26845 !! wikitext
26846 ''[[foo''<nowiki>]]</nowiki>
26847
26848 '''[[foo'''<nowiki>]]</nowiki>
26849 !! end
26850
26851 !! test
26852 4. No escaping needed
26853 !! options
26854 parsoid=html2wt
26855 !! html/parsoid
26856 <p>'<span><i>bar</i></span>'
26857 '<span><b>bar</b></span>'
26858 'a:b'foo
26859 </p>
26860 !! wikitext
26861 '<span>''bar''</span>'
26862 '<span>'''bar'''</span>'
26863 'a:b'foo
26864 !! end
26865
26866 #### ----------- Paragraphs ---------------
26867 #### 1. No unnecessary escapes
26868 #### --------------------------------------
26869
26870 !! test
26871 1. No unnecessary escapes
26872 !! options
26873 parsoid=html2wt
26874 !! html/parsoid
26875 <p>bar <span>[[foo]]</span>
26876 </p><p>=bar <span>[[foo]]</span>
26877 </p><p>[[bar <span>[[foo]]</span>
26878 </p><p>]]bar <span>[[foo]]</span>
26879 </p><p>=bar <span>foo]]</span>=
26880 </p>
26881 !! wikitext
26882 bar <span><nowiki>[[foo]]</nowiki></span>
26883
26884 =bar <span><nowiki>[[foo]]</nowiki></span>
26885
26886 [[bar <span><nowiki>[[foo]]</nowiki></span>
26887
26888 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26889
26890 =bar <span>foo]]</span><nowiki>=</nowiki>
26891 !!end
26892
26893 #### ----------------------- PRE --------------------------
26894 !! test
26895 1. Leading whitespace in SOL context should be escaped
26896 !! options
26897 parsoid=html2wt
26898 !! html/parsoid
26899 <p> a</p>
26900
26901 <p> a</p>
26902
26903 <p> a(tab)</p>
26904
26905 <p> a
26906 <!--cmt-->
26907 a</p>
26908
26909 <p>a
26910 b</p>
26911
26912 <p>a
26913 b</p>
26914
26915 <p>a
26916 b</p>
26917 !! wikitext
26918 <nowiki> </nowiki>a
26919
26920 <nowiki> </nowiki> a
26921
26922 a(tab)
26923
26924 <nowiki> </nowiki> a
26925 <!--cmt-->
26926 <nowiki> </nowiki>a
26927
26928 a
26929 <nowiki> </nowiki>b
26930
26931 a
26932 b
26933
26934 a
26935 b
26936 !! html/php
26937 <p> a
26938 </p><p> a
26939 </p><p> a(tab)
26940 </p><p> a
26941 a
26942 </p><p>a
26943 b
26944 </p><p>a
26945 b
26946 </p><p>a
26947 b
26948 </p>
26949 !! end
26950
26951 !! test
26952 2. Leading whitespace in non-indent-pre contexts should not be escaped
26953 !! options
26954 parsoid=html2wt
26955 !! html/parsoid
26956 <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>
26957 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26958 <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>
26959 b</span></li>
26960 </ol>
26961 !! wikitext
26962 foo <ref>''a''
26963 b</ref>
26964 <references />
26965 !! end
26966
26967 !! test
26968 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26969 !! options
26970 parsoid=html2wt
26971 !! html/parsoid
26972 <blockquote>
26973 <p>
26974 a
26975 <span>b</span>
26976 c</p>
26977 </blockquote>
26978 !! wikitext
26979 <blockquote>
26980 a
26981 <span>b</span>
26982 c
26983 </blockquote>
26984 !! end
26985
26986 !! test
26987 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26988 !! options
26989 parsoid=html2wt
26990 !! html/parsoid
26991 <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>
26992 !! wikitext
26993 [[File:Foobar.jpg|thumb|caption]]
26994 !! end
26995
26996 !! test
26997 5. Nowiki escaping should account for indent-pres
26998 !! options
26999 parsoid=html2wt
27000 !! html/parsoid
27001 <pre>==foo==</pre>
27002 !! wikitext
27003 ==foo==
27004 !! end
27005
27006 !! test
27007 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27008 !! options
27009 parsoid=html2wt
27010 !! html/parsoid
27011 <pre>
27012 * foo
27013 * bar
27014 </pre>
27015 !! wikitext
27016 * foo
27017 * bar
27018 !! end
27019
27020 !! test
27021 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27022 !! options
27023 parsoid = {
27024 "modes": ["html2wt"],
27025 "scrubWikitext": true
27026 }
27027 !! html/parsoid
27028 <p> foo</p>
27029 <p> %foo</p>
27030 <p> *foo</p>
27031 <p> #foo</p>
27032 <p> =foo=</p>
27033 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27034 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27035 <p> <!--boo-->*foo</p>
27036 <p><!--boo--> *foo</p>
27037 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27038 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27039 !! wikitext
27040 foo
27041
27042 %foo
27043
27044 <nowiki/>*foo
27045
27046 <nowiki/>#foo
27047
27048 <nowiki/>=foo=
27049
27050 [[Category:Foo]]
27051 <nowiki/>*foo
27052
27053 [[Category:Foo]]
27054 <nowiki>*</nowiki>foo
27055
27056 <nowiki/><!--boo-->*foo
27057
27058 <!--boo--><nowiki/>*foo
27059
27060 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27061
27062 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27063 !! end
27064
27065 #### --------------- Behavior Switches --------------------
27066
27067 !! test
27068 1. Valid behavior switches should be escaped
27069 !! options
27070 parsoid=html2wt
27071 !! html/parsoid
27072 __TOC__
27073 <i>__TOC__</i>
27074 !! wikitext
27075 <nowiki>__TOC__</nowiki>
27076 ''<nowiki>__TOC__</nowiki>''
27077 !! end
27078
27079 !! test
27080 2. Invalid behavior switches should not be escaped
27081 !! options
27082 parsoid=html2wt
27083 !! html/parsoid
27084 __TOO__
27085 __|__
27086 !! wikitext
27087 __TOO__
27088 __|__
27089 !! end
27090
27091 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27092 !! test
27093 Behavior switches should be SOL-transparent
27094 !! options
27095 parsoid=html2wt
27096 !! html/parsoid
27097 <meta property="mw:PageProp/toc" />
27098
27099 <!-- this one's bogus -->
27100 <pre>__TOO__</pre>
27101
27102 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27103
27104 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27105 !! wikitext
27106 __TOC__
27107
27108 <!-- this one's bogus -->
27109 __TOO__
27110
27111 __TOC__ foo
27112
27113 __TOC__
27114 bar
27115 !! end
27116
27117 #### --------------- HTML tags ---------------
27118 #### 1. a tags
27119 #### 2. other tags
27120 #### 3. multi-line html tag
27121 #### 4. extension tags
27122 #### -----------------------------------------
27123 !! test
27124 1. a tags
27125 !! options
27126 parsoid=html2wt
27127 !! html/parsoid
27128 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27129 !! wikitext
27130 <a href="http://google.com">google</a>
27131 !! end
27132
27133 !! test
27134 2. other tags
27135 !! options
27136 parsoid=html2wt
27137 !! html/parsoid
27138 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27139 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27140 <li> &lt;td&gt;</li></ul>
27141
27142 !! wikitext
27143 * <nowiki><div>foo</div></nowiki>
27144 * <nowiki><div style="color:red">foo</div></nowiki>
27145 * <nowiki><td></nowiki>
27146 !! end
27147
27148 !! test
27149 3. multi-line html tag
27150 !! options
27151 parsoid=html2wt
27152 !! html/parsoid
27153 <p>&lt;div
27154 &gt;foo&lt;/div
27155 &gt;
27156 </p>
27157 !! wikitext
27158 <nowiki><div
27159 >foo</div
27160 ></nowiki>
27161 !! end
27162
27163 !! test
27164 4. extension tags
27165 !! options
27166 parsoid=html2wt
27167 !! html/parsoid
27168 <p>&lt;ref&gt;foo&lt;/ref&gt;
27169 </p><p>&lt;ref&gt;bar
27170 </p><p>baz&lt;/ref&gt;
27171 </p>
27172 !! wikitext
27173 <nowiki><ref>foo</ref></nowiki>
27174
27175 <nowiki><ref>bar</nowiki>
27176
27177 baz<nowiki></ref></nowiki>
27178 !! end
27179
27180 !! test
27181 Parsoid: newline inducing block nodes don't suppress <nowiki>
27182 !! options
27183 parsoid=html2wt
27184 !! html/parsoid
27185 a<h1>foo</h1>
27186 !! wikitext
27187 <nowiki> </nowiki>a
27188
27189 = foo =
27190 !! end
27191
27192 #### --------------- Others ---------------
27193 !! test
27194 Escaping nowikis
27195 !! options
27196 parsoid=html2wt
27197 !! html/parsoid
27198 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27199 </p>
27200 !! wikitext
27201 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27202 !! end
27203
27204 ## The quote-char in the input is necessary for triggering the bug
27205 !! test
27206 (T54035) Nowiki-escaping should not get tripped by " :" in text
27207 !! options
27208 parsoid=html2wt
27209 !! html/parsoid
27210 <p>foo's bar :</p>
27211 !! wikitext
27212 foo's bar :
27213 !! end
27214
27215 #----------- End of wikitext escaping tests --------------
27216
27217 !! test
27218
27219 Tag-like HTML structures are passed through as text
27220 !! wikitext
27221 <x y>
27222
27223 <x.y>
27224
27225 <x-y>
27226
27227 1>2
27228
27229 x<y
27230
27231 a>b
27232
27233 1<d e>f
27234 !! html
27235 <p>&lt;x y&gt;
27236 </p><p>&lt;x.y&gt;
27237 </p><p>&lt;x-y&gt;
27238 </p><p>1&gt;2
27239 </p><p>x&lt;y
27240 </p><p>a&gt;b
27241 </p><p>1&lt;d e&gt;f
27242 </p>
27243 !! end
27244
27245 !! test
27246 HTML tag with necessary entities in attributes
27247 !! wikitext
27248 <span title="&amp;amp;">foo</span>
27249 !! html
27250 <p><span title="&amp;amp;">foo</span>
27251 </p>
27252 !! end
27253
27254 !! test
27255 HTML tag with 'unnecessary' entity encoding in attributes
27256 !! wikitext
27257 <span title="&amp;">foo</span>
27258 !! html
27259 <p><span title="&amp;">foo</span>
27260 </p>
27261 !! end
27262
27263 !! test
27264 HTML tag with broken attribute value quoting
27265 !! options
27266 parsoid=wt2html,html2html
27267 !! wikitext
27268 <span title="Hello world>Foo</span>
27269 !! html/php
27270 <p><span title="Hello world">Foo</span>
27271 </p>
27272 !! html/parsoid
27273 <p><span title="Hello world">Foo</span></p>
27274 !! end
27275
27276 !! test
27277 Self-closed tag with broken attribute value quoting
27278 !! options
27279 parsoid=wt2html,html2html
27280 !! wikitext
27281 <div title="Hello world />Foo
27282 !! html/php+tidy
27283 <div title="Hello world"></div><p>Foo
27284 </p>
27285 !! html/parsoid
27286 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27287 !! end
27288
27289 !! test
27290 Table with broken attribute value quoting
27291 !! options
27292 parsoid=wt2html,html2html
27293 !! wikitext
27294 {|
27295 | title="Hello world|Foo
27296 |}
27297 !! html/php
27298 <table>
27299 <tr>
27300 <td title="Hello world">Foo
27301 </td></tr></table>
27302
27303 !! html/parsoid
27304 <table>
27305 <tr>
27306 <td title="Hello world">Foo
27307 </td></tr></table>
27308
27309 !! end
27310
27311 !! test
27312 Table with broken attribute value quoting on consecutive lines
27313 !! options
27314 parsoid=wt2html,html2html
27315 !! wikitext
27316 {|
27317 | title="Hello world|Foo
27318 | style="color:red|Bar
27319 |}
27320 !! html/php
27321 <table>
27322 <tr>
27323 <td title="Hello world">Foo
27324 </td>
27325 <td style="color:red">Bar
27326 </td></tr></table>
27327
27328 !! html/parsoid
27329 <table><tbody>
27330 <tr>
27331 <td title="Hello world">Foo
27332 </td><td style="color: red">Bar
27333 </td></tr></tbody></table>
27334
27335 !! end
27336
27337 !!test
27338 Accept empty td cell attribute
27339 !! wikitext
27340 {|
27341 | align="center" |foo|| |
27342 |}
27343 !! html
27344 <table>
27345 <tr>
27346 <td align="center">foo</td>
27347 <td>
27348 </td></tr></table>
27349
27350 !!end
27351
27352 !!test
27353 Non-empty attributes in th-cells
27354 !! wikitext
27355 {|
27356 !Foo!! style="color: red" |Bar
27357 |}
27358 !! html
27359 <table>
27360 <tr>
27361 <th>Foo</th>
27362 <th style="color: red">Bar
27363 </th></tr></table>
27364
27365 !!end
27366
27367 !!test
27368 Accept empty attributes in th-cells
27369 !! wikitext
27370 {|
27371 !|foo!!|bar
27372 |}
27373 !! html
27374 <table>
27375 <tr>
27376 <th>foo</th>
27377 <th>bar
27378 </th></tr></table>
27379
27380 !!end
27381
27382 !!test
27383 Empty table rows go away
27384 !! wikitext
27385 {|
27386 |Hello
27387 |there
27388 |- class="foo"
27389 |-
27390 |}
27391 !! html
27392 <table>
27393 <tr>
27394 <td>Hello
27395 </td>
27396 <td>there
27397 </td></tr>
27398
27399 </table>
27400
27401 !! end
27402
27403 ###
27404 ### Parsoid-centric tests for testing RTing of inter-element separators
27405 ### Edge cases not tested by existing parser tests and specific to
27406 ### Parsoid-specific serialization strategies.
27407 ###
27408
27409 !!test
27410 RT-ed inter-element separators should be valid separators
27411 !! wikitext
27412 {|
27413 |- [[foo]]
27414 |}
27415 !! html/php
27416 <table>
27417
27418 </table>
27419
27420 !! html/parsoid
27421 <table>
27422 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27423 </tbody></table>
27424 !!end
27425
27426 # Parsoid-only test of a DOM pass
27427 !!test
27428 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27429 !! wikitext
27430 {|
27431 |<small>foo
27432 bar
27433 |}
27434
27435 {|
27436 |<small>foo<small>
27437 |}
27438 !! html/parsoid
27439 <table>
27440 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27441 <p>bar</p></small></td></tr>
27442 </tbody></table>
27443
27444 <table>
27445 <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>
27446 </tbody></table>
27447 !!end
27448
27449 # Note that the "style" attribute is really a template parameter here.
27450 # The = would have to be {{=}} if you wanted the literal.
27451 !!test
27452 Empty TD followed by TD with tpl-generated attribute
27453 !! wikitext
27454 {|
27455 |-
27456 |
27457 |{{echo|style='color:red'}}|foo
27458 |}
27459 !! html
27460 <table>
27461
27462 <tr>
27463 <td>
27464 </td>
27465 <td>foo
27466 </td></tr></table>
27467
27468 !!end
27469
27470 !!test
27471 Indented table with an empty td
27472 !! wikitext
27473 {|
27474 |-
27475 |
27476 |foo
27477 |}
27478 !! html
27479 <table>
27480
27481 <tr>
27482 <td>
27483 </td>
27484 <td>foo
27485 </td></tr></table>
27486
27487 !!end
27488
27489 !! test
27490 Indented table with blank lines in between (T85627)
27491 !! wikitext
27492 {|
27493 |foo
27494
27495
27496 |}
27497 !! html/php
27498 <table>
27499 <tr>
27500 <td>foo
27501 <p><br />
27502 </p>
27503 </td></tr></table>
27504
27505 !! html/parsoid
27506 <table>
27507 <tbody><tr><td>foo
27508 <p>
27509 <br /></p></td></tr>
27510 </tbody></table>
27511 !! end
27512
27513 !!test
27514 Indented block & table
27515 !! wikitext
27516 <div>foo</div>
27517 {|
27518 |foo
27519 |}
27520 !! html/php
27521 <div>foo</div>
27522 <table>
27523 <tr>
27524 <td>foo
27525 </td></tr></table>
27526
27527 !! html/parsoid
27528 <div data-parsoid='{"stx":"html"}'>foo</div>
27529 <table><tbody>
27530 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27531 </tbody></table>
27532 !!end
27533
27534 !! test
27535 Indent and comment before table row
27536 !! wikitext
27537 {|
27538 <!--hi-->|-
27539 |there
27540 |}
27541 !! html/php
27542 <table>
27543
27544 <tr>
27545 <td>there
27546 </td></tr></table>
27547
27548 !! html/parsoid
27549 <table>
27550 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
27551 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
27552 </tbody></table>
27553 !! end
27554
27555 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
27556 !!test
27557 Empty TR followed by a template-generated TR
27558 !!options
27559 parsoid
27560 !! wikitext
27561 {|
27562 |-
27563 {{echo|<tr><td>foo</td></tr>}}
27564 |}
27565 !! html
27566 <table>
27567 <tbody>
27568 <tr class='mw-empty-elt'></tr>
27569 <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}}]}'>
27570 <td>foo</td></tr>
27571 </tbody></table>
27572 !!end
27573
27574 ## PHP and parsoid output differ for this, and since this is primarily
27575 ## for testing Parsoid's serializer, marking this Parsoid only
27576 !!test
27577 Empty TR followed by mixed-ws-comment line should RT correctly
27578 !!options
27579 parsoid
27580 !! wikitext
27581 {|
27582 |-
27583 <!--c-->
27584 |-
27585 <!--c--> <!--d-->
27586 |}
27587 !! html
27588 <table>
27589 <tbody>
27590 <tr class='mw-empty-elt'></tr>
27591 <!--c-->
27592 <tr>
27593 <!--c--> </tr><!--d-->
27594 </tbody></table>
27595
27596 !!end
27597
27598 !!test
27599 Multi-line image caption generated by templates with/without trailing newlines
27600 !! wikitext
27601 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
27602 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
27603 !! html/parsoid
27604 <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>
27605 <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>
27606 !!end
27607
27608 !! test
27609 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
27610 !! options
27611 parsoid=html2wt
27612 !! html/parsoid
27613 <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>
27614
27615 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
27616 !! wikitext
27617 <includeonly>foo</includeonly>
27618 new para
27619
27620 [[Category:Foo]]
27621
27622 = new heading =
27623 !! end
27624
27625 ## PHP emits broken html for this, and since this is primarily
27626 ## a Parsoid serializer test, marking this Parsoid only
27627 !!test
27628 Improperly nested inline or quotes tags with whitespace in between
27629 !! wikitext
27630 <span> <s>x</span> </s>
27631 ''' ''x''' ''
27632 !! html/parsoid
27633 <p><span> <s>x</s></span><s> </s>
27634 <b> <i>x</i></b><i> </i>
27635 </p>
27636 !!end
27637
27638 !!test
27639 Encapsulate protected attributes from wt
27640 !! wikitext
27641 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
27642
27643 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
27644 |ok
27645 |}
27646 !! html/parsoid
27647 <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>
27648
27649 <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">
27650 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
27651 </tbody></table>
27652 !!end
27653
27654 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
27655 ## Having nested or stray pre tags results in the attempt to add duplicates,
27656 ## causing an assertion fail. This test tries to prevent that situation.
27657 !! test
27658 Ensure ParagraphWrapper can deal with stray closing pre tags
27659 !! options
27660 parsoid=wt2html
27661 !! wikitext
27662 plain text</pre>
27663 !! html/parsoid
27664 <p>plain text</p>
27665 !! end
27666
27667 ## Remex doesn't account for fostered content.
27668 !! test
27669 1. Ensure fostered text content is wrapped in element nodes
27670 !! options
27671 parsoid=wt2html
27672 !! wikitext
27673 <table>hi</table><table>ho</table>
27674 !! html/php+tidy
27675 hi<table></table>ho<table></table>
27676 !! html/parsoid
27677 <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>
27678 !! end
27679
27680 ## Remex doesn't account for fostered content.
27681 !! test
27682 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27683 !! options
27684 parsoid=wt2html,wt2wt
27685 !! wikitext
27686 <table>
27687 <tr> || ||
27688 <td> a
27689 </table>
27690 !! html/php+tidy
27691 || ||
27692 <table>
27693 <tbody><tr><td> a
27694 </td></tr></tbody></table>
27695 !! html/parsoid
27696 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
27697 <table data-parsoid='{"stx":"html"}'>
27698 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
27699 </td></tr></tbody></table>
27700 !! end
27701
27702 ## Remex doesn't account for fostered content.
27703 !! test
27704 Encapsulation properly handles null DSR information from foster box
27705 !! options
27706 parsoid=wt2html,wt2wt
27707 !! wikitext
27708 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27709 !! html/parsoid
27710 <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>
27711 !! end
27712
27713 ## Remex doesn't account for fostered content.
27714 !! test
27715 1. Encapsulate foster-parented transclusion content
27716 !! options
27717 parsoid=wt2wt,wt2html
27718 !! wikitext
27719 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27720 !! html/php+tidy
27721 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
27722 !! html/parsoid
27723 <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>
27724 !! end
27725
27726 !! test
27727 2. Encapsulate foster-parented transclusion content
27728 !! options
27729 parsoid=wt2wt,wt2html
27730 !! wikitext
27731 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27732 !! html/parsoid
27733 <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>
27734 <table>
27735 <tbody>
27736 <tr>
27737 <td>bar</td>
27738 </tr>
27739 </tbody>
27740 </table>
27741 !! end
27742
27743 !! test
27744 3. Encapsulate foster-parented transclusion content
27745 !! options
27746 parsoid=wt2wt,wt2html
27747 !! wikitext
27748 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27749 !! html/parsoid
27750 <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;]}">
27751 <p>foo</p>
27752 </div>
27753 <table>
27754 <tbody>
27755 <tr>
27756 <td>bar</td>
27757 </tr>
27758 </tbody>
27759 </table>
27760 !! end
27761
27762 !! test
27763 4. Encapsulate foster-parented transclusion content
27764 !! options
27765 parsoid=wt2wt,wt2html
27766 !! wikitext
27767 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27768 !! html/parsoid
27769 <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;]}">
27770 <p>foo</p>
27771 </div>
27772 <table>
27773 <tbody>
27774 <tr>
27775 <td>bar</td>
27776 </tr>
27777 </tbody>
27778 </table>
27779 !! end
27780
27781 ## Remex doesn't account for fostered content.
27782 !! test
27783 5. Encapsulate foster-parented transclusion content
27784 !!options
27785 parsoid=wt2wt,wt2html
27786 !! wikitext
27787 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27788 !! html/php+tidy
27789 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
27790 !! html/parsoid
27791 <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>
27792 !! end
27793
27794 ## Remex doesn't account for fostered content.
27795 !! test
27796 6. Encapsulate foster-parented transclusion content
27797 !! options
27798 parsoid=wt2wt,wt2html
27799 !! wikitext
27800 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27801 !! html/php+tidy
27802 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
27803 !! html/parsoid
27804 <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>
27805 !! end
27806
27807 !! test
27808 7. Encapsulate foster-parented transclusion content
27809 !!options
27810 parsoid=wt2wt,wt2html
27811 !! wikitext
27812 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27813 !! html/parsoid
27814 <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>
27815 <table>
27816 <tbody>
27817 <tr>
27818 <td>bar</td>
27819 </tr>
27820 </tbody>
27821 </table>
27822 !! end
27823
27824 ## Remex doesn't account for fostered content.
27825 # Note that the wt is broken on purpose: the = should be {{=}} if you
27826 # don't want it to be a template parameter key.
27827 !! test
27828 8. Encapsulate foster-parented transclusion content
27829 !! options
27830 parsoid=wt2wt,wt2html
27831 !! wikitext
27832 {{echo|a
27833 }}{|{{echo|style='color:red'}}
27834 |-
27835 |b
27836 |}
27837 !! html/php+tidy
27838 <p>a
27839 </p>
27840 <table>
27841
27842 <tbody><tr>
27843 <td>b
27844 </td></tr></tbody></table>
27845 !! html/parsoid
27846 <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">
27847 </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">
27848 <tbody><tr>
27849 <td>b
27850 </td></tr></tbody></table>
27851 !! end
27852
27853 ## Remex doesn't account for fostered content.
27854 !! test
27855 9. Encapsulate foster-parented transclusion content
27856 !!options
27857 parsoid=wt2wt,wt2html
27858 !! wikitext
27859 <table>{{echo|hi</table>hello}}
27860 !! html/php+tidy
27861 hi<table></table><p>hello
27862 </p>
27863 !! html/parsoid
27864 <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>
27865 !! end
27866
27867 !! test
27868 Table in fosterable position
27869 !!options
27870 parsoid=wt2html
27871 !! wikitext
27872 {{OpenTable}}
27873 <div>
27874 {|
27875 |}
27876 </div>
27877 |}
27878 !! html/parsoid
27879 <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">
27880 </span>
27881 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27882
27883 <table>
27884 </table>
27885 !! end
27886
27887 # Parsoid only for T66747
27888 !! test
27889 Properly encapsulate empty-content transclusions in fosterable positions
27890 !! wikitext
27891 <table>
27892 {{#if:|
27893 <td>foo</td>
27894 }}
27895 </table>
27896 !! html/parsoid
27897 <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"}]]}'>
27898
27899 </table>
27900 !! end
27901
27902 ## No longer captures its original intention
27903 !! test
27904 Always encapsulate foster box when template range is expanded to table
27905 !! options
27906 disabled
27907 parsoid=wt2wt
27908 !! wikitext
27909 {|
27910 hello
27911 {{OpenTable}}
27912 |}
27913 !! html/parsoid
27914
27915 !! end
27916
27917 !! test
27918 T115289: Unclosed table
27919 !! wikitext
27920 {{echo|<table>}}<!--c-->[[Category:Two]]
27921 !! html/parsoid
27922 <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>
27923 !! end
27924
27925 !! test
27926 T115289: Don't migrate newlines out of tables with fostered content
27927 !! wikitext
27928 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27929 !! html/parsoid
27930 <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>
27931 !! end
27932
27933 !! test
27934 T73074: More fostering fun
27935 !! wikitext
27936 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27937 !! html/parsoid
27938 <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>
27939 !! end
27940
27941 !!test
27942 Support <object> element with .data attribute
27943 !!options
27944 parsoid=html2wt
27945 !! html/parsoid
27946 <object data="test.swf"></object>
27947 !! wikitext
27948 <object data="test.swf"></object>
27949 !!end
27950
27951 !! test
27952 Don't block XML namespace declaration
27953 !! wikitext
27954 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27955 !! html/php
27956 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27957 </p>
27958 !! html/parsoid
27959 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27960 !! end
27961
27962 # -----------------------------------------------------------------
27963 # The following section of tests are primarily to spec requirements
27964 # around Parsoid's serialization (old, new, edited content)
27965 #
27966 # All these tests are marked Parsoid html2wt and html2html only
27967 # ----------------------------------------------------------------
27968
27969 !! test
27970 Ignore rel attribute in a-tags during serialization to url-links
27971 !! options
27972 parsoid=html2wt
27973 !! html/parsoid
27974 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27975 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27976 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27977 !! wikitext
27978 http://en.wikipedia.org/wiki/Foobar
27979 http://en.wikipedia.org/wiki/Foobar
27980 http://en.wikipedia.org/wiki/Foobar
27981 !! end
27982
27983 # 'mi' is a localinterwiki prefix as well as a language
27984 !! test
27985 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27986 !! options
27987 parsoid=html2wt
27988 !! html/parsoid
27989 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27990 !! wikitext
27991 [[Foo]]
27992 !! end
27993
27994 !! test
27995 Parsoid should accept interwiki shortcuts
27996 !! options
27997 parsoid=html2wt
27998 !! html/parsoid
27999 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28000 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28001 <a href='./fr:Foo'>Foo</a></p>
28002 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28003 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28004 <a href='fr%3AFoo'>Foo</a></p>
28005 <p><a href='FR%3AFoo'>Foo</a>
28006 <a href='./FR:Foo'>Foo</a></p>
28007 !! wikitext
28008 [[:fr:Foo|Foo]]
28009 [[:fr:Foo|Foo]]
28010 [[:fr:Foo|Foo]]
28011
28012 [[:fr:Foo|Foo]]
28013 [[:fr:Foo|Foo]]
28014 [[:fr:Foo|Foo]]
28015
28016 [[:fr:Foo|Foo]]
28017 [[:fr:Foo|Foo]]
28018 !! end
28019
28020 !! test
28021 Parsoid should not accept invalid interwiki shortcuts
28022 !! options
28023 parsoid=html2wt
28024 !! html/parsoid
28025 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28026 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28027 <a href='news:Foo'>Foo</a></p>
28028 !! wikitext
28029 [news:Foo Foo]
28030 [news:Foo Foo]
28031 [news:Foo Foo]
28032 !! end
28033
28034 # See T93839
28035 !! test
28036 New wikilinks should be serialized properly
28037 !! options
28038 parsoid=html2wt
28039 !! html/parsoid
28040 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28041 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28042 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28043 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28044 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28045 !! wikitext
28046 [[Foo]]
28047 [[Foo]]
28048 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28049 http://en.wikipedia.org/wiki/Foo
28050 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28051 !! end
28052
28053 !! test
28054 New wiki links (href variations)
28055 !! options
28056 parsoid=html2wt
28057 !! html/parsoid
28058 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28059 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28060 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28061 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28062 !! wikitext
28063 [[Foo_bar]]
28064 [[Foo_bar]]
28065 [[Foo_bar]]
28066 [[Toxine bactérienne]]
28067 !! end
28068
28069 !! test
28070 New wiki links (content string variations)
28071 !! options
28072 parsoid=html2wt
28073 !! html/parsoid
28074 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28075 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28076 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28077 !! wikitext
28078 [[Foo_bar]]
28079 [[Foo bar]]
28080 [[Foo_bar|./Foo_bar]]
28081 !! end
28082
28083 !! test
28084 New category links (href variations)
28085 !! options
28086 parsoid=html2wt
28087 !! html/parsoid
28088 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28089 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28090 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28091 !! wikitext
28092 [[Category:Toxine bactérienne]]
28093 [[Category:Toxine bactérienne]]
28094 [[Category:Toxine bactérienne]]
28095 !! end
28096
28097 !! test
28098 New sol transparent links don't need indent-pre nowiki protection
28099 !! options
28100 parsoid=html2wt
28101 language=de
28102 !! html/parsoid
28103 <link rel="mw:PageProp/redirect" href="./Main_Page">
28104 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28105 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28106 !! wikitext
28107 #WEITERLEITUNG [[Main Page]]
28108 <!-- this is good --> [[Category:Good]]
28109 <!-- this is great --> [[Kategorie:Great]]
28110 !! end
28111
28112 !! test
28113 New interlanguage links (href variations)
28114 !! options
28115 parsoid=html2wt
28116 !! html/parsoid
28117 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28118 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28119 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28120 !! wikitext
28121 [[es:Toxine bactérienne]]
28122 [[es:Toxine_bactérienne]]
28123 [[es:Toxine_bactérienne]]
28124 !! end
28125
28126 !! test
28127 Image: Modifying size of an image (1)
28128 !! options
28129 parsoid={
28130 "modes": ["wt2wt"],
28131 "changes": [
28132 ["img[height]", "attr", "height", "22"],
28133 ["img[width]", "attr", "width", "200"]
28134 ]
28135 }
28136 !! wikitext
28137 [[Image:Foobar.jpg|230x230px]]
28138 !! wikitext/edited
28139 [[Image:Foobar.jpg|200x200px]]
28140 !!end
28141
28142 !! test
28143 Image: Modifying size of an image (2)
28144 !! options
28145 parsoid={
28146 "modes": ["wt2wt"],
28147 "changes": [
28148 ["img[height]", "attr", "height", "100"],
28149 ["img[width]", "attr", "width", "500"]
28150 ]
28151 }
28152 !! wikitext
28153 [[Image:Foobar.jpg|230x230px]]
28154 !! wikitext/edited
28155 [[Image:Foobar.jpg|500x500px]]
28156 !!end
28157
28158 # Change in size is ignored so long as class='mw-default-size'
28159 !! test
28160 Image: Modifying size of an image (3)
28161 !! options
28162 parsoid={
28163 "modes": ["wt2wt"],
28164 "changes": [
28165 ["figure[class]", "removeClass", "mw-default-size"],
28166 ["figure img", "attr", "height", "19"],
28167 ["figure img", "attr", "width", "170"]
28168 ]
28169 }
28170 !! wikitext
28171 [[Image:Foobar.jpg|thumb]]
28172 !! wikitext/edited
28173 [[Image:Foobar.jpg|thumb|170x170px]]
28174 !!end
28175
28176 !! test
28177 Image: Modifying alignment of an image (T50665)
28178 !! options
28179 parsoid={
28180 "modes": ["wt2wt"],
28181 "changes": [
28182 ["figure[class]", "removeClass", "mw-halign-right"],
28183 ["figure[class]", "addClass", "mw-halign-left"]
28184 ]
28185 }
28186 !! wikitext
28187 [[Image:Foobar.jpg|thumb|caption|right]]
28188 !! wikitext/edited
28189 [[Image:Foobar.jpg|thumb|caption|left]]
28190 !! end
28191
28192 !! test
28193 Image: Modifying mw-default-size of an frameless image (T64805)
28194 !! options
28195 parsoid={
28196 "modes": ["wt2wt"],
28197 "changes": [
28198 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28199 ]
28200 }
28201 !! wikitext
28202 [[Image:Foobar.jpg|frameless|right]]
28203 !! wikitext/edited
28204 [[Image:Foobar.jpg|frameless|right|220x220px]]
28205 !! end
28206
28207 !! test
28208 Image: Modifying valign of an image (T51221)
28209 !! options
28210 parsoid={
28211 "modes": ["wt2wt"],
28212 "changes": [
28213 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28214 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28215 ]
28216 }
28217 !! wikitext
28218 [[File:Foobar.jpg|20px|middle]]
28219 !! wikitext/edited
28220 [[File:Foobar.jpg|20px|text-top]]
28221 !! end
28222
28223 !! test
28224 Image: Modifying alt attribute of an image (T58400)
28225 !! options
28226 parsoid={
28227 "modes": ["wt2wt"],
28228 "changes": [
28229 ["img[alt]", "attr", "alt", "some alternate edited text"]
28230 ]
28231 }
28232 !! wikitext
28233 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28234 !! wikitext/edited
28235 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28236 !!end
28237
28238 !! test
28239 Image: Modifying caption of an image
28240 !! options
28241 parsoid={
28242 "modes": ["wt2wt"],
28243 "changes": [
28244 ["figcaption", "text", "new caption"]
28245 ]
28246 }
28247 !! wikitext
28248 [[Image:Foobar.jpg|thumb|original caption]]
28249 !! wikitext/edited
28250 [[Image:Foobar.jpg|thumb|new caption]]
28251 !!end
28252
28253 !! test
28254 Image: empty alt attribute (T50924)
28255 !! options
28256 parsoid
28257 !! wikitext
28258 [[File:Foobar.jpg|thumb|alt=|bar]]
28259 !! html
28260 <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>
28261 !! end
28262
28263 !! test
28264 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28265 !! options
28266 parsoid=html2wt
28267 language=ar
28268 disabled
28269 !! html/parsoid
28270 <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>
28271 !! wikitext
28272 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28273 !! end
28274
28275 !! test
28276 Image: Block level image should have \n before and after
28277 !! wikitext
28278 123
28279 [[File:Foobar.jpg|right|thumb|150x150px]]
28280 456
28281 !! html/parsoid
28282 <p>123</p>
28283 <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>
28284 <p>456</p>
28285 !! end
28286
28287 !! test
28288 Image: New block level image should have \n before and after (existing content)
28289 !! wikitext
28290 123
28291 [[File:Foobar.jpg|right|thumb|150x150px]]
28292 456
28293 !! html/parsoid
28294 <p>123</p>
28295 <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>
28296 <p>456</p>
28297 !! end
28298
28299 !! test
28300 Image: upright option (parsoid)
28301 !! wikitext
28302 [[File:Foobar.jpg|thumb|upright|caption]]
28303 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28304 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28305 !! html/parsoid
28306 <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>
28307 <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>
28308 <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>
28309 !! end
28310
28311 !! test
28312 Image: upright option is ignored on inline and frame images (parsoid)
28313 !! wikitext
28314 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28315 !! html/parsoid
28316 <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>
28317 !! end
28318
28319 !! test
28320 Image: in template parameter with empty parameter
28321 !! wikitext
28322 {{echo|[[File:Foobar.jpg|link=]]}}
28323 !! html/parsoid
28324 <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>
28325 !! end
28326
28327 !! test
28328 Image: from basic HTML (1)
28329 !! options
28330 parsoid=html2wt
28331 !! html/parsoid
28332 <span typeof="mw:Image">
28333 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28334 </span>
28335 !! wikitext
28336 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28337 !! end
28338
28339 !! test
28340 Image: from basic HTML (2)
28341 !! options
28342 parsoid=html2wt
28343 !! html/parsoid
28344 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28345 !! wikitext
28346 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28347 !! end
28348
28349 !! test
28350 Image: from basic HTML (3)
28351 !! options
28352 parsoid=html2wt
28353 !! html/parsoid
28354 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28355 !! wikitext
28356 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28357 !! end
28358
28359 !! test
28360 Image: from basic HTML (4)
28361 !! options
28362 parsoid=html2wt
28363 !! html/parsoid
28364 <img src="./File:Foobar.jpg">
28365 !! wikitext
28366 [[File:Foobar.jpg|link=]]
28367 !! end
28368
28369 !! test
28370 Image: Invalid title as link
28371 !! wikitext
28372 [[File:Foobar.jpg|link=<]]
28373 !! html/php
28374 <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>
28375 </p>
28376 !! html/parsoid
28377 <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>
28378 !! end
28379
28380 !! test
28381 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28382 !! options
28383 parsoid=html2wt
28384 !! html/parsoid
28385 <ul>
28386 <li><p>foo</p></li>
28387 </ul>
28388 !! wikitext
28389 * foo
28390 !! end
28391
28392 !! test
28393 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28394 !! options
28395 parsoid=html2wt
28396 !! html/parsoid
28397 <ul> <li>foo</li></ul>
28398 !! wikitext
28399 * foo
28400 !! end
28401
28402 !! test
28403 Don't strip leading whitespace when handling indent-pre suppressing tags
28404 !! options
28405 parsoid=html2wt
28406 !! html/parsoid
28407 <table>
28408 <tr><td> indented row</td></tr>
28409 </table>
28410 <blockquote><p>
28411 <b>This is very bold of you!</b>
28412 </p>
28413 <table><tr><td>
28414 indented cell (no pre-wrapping!)
28415 </td></tr></table>
28416 </blockquote>
28417 <p>foo</p>
28418 <div>bar</div>
28419 !! wikitext
28420 {|
28421 | indented row
28422 |}
28423 <blockquote>
28424 '''This is very bold of you!'''
28425
28426 {|
28427 |
28428 indented cell (no pre-wrapping!)
28429 |}
28430 </blockquote>
28431 foo
28432 <div>bar</div>
28433 !! end
28434
28435 !! test
28436 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28437 !! options
28438 parsoid=html2wt
28439 !! html/parsoid
28440 <p>foo</p>
28441 <span>bar</span>
28442
28443 <span>foo2
28444 </span>bar2
28445
28446 <div>foo</div>
28447 <span>bar</span>
28448
28449 <div>
28450 <span>foo</span>
28451 </div>
28452 !! wikitext
28453 foo
28454
28455 <span>bar</span>
28456
28457 <span>foo2
28458 <nowiki> </nowiki></span>bar2
28459
28460 <div>foo</div>
28461 <nowiki> </nowiki><span>bar</span>
28462
28463 <div>
28464 <nowiki> </nowiki><span>foo</span>
28465 </div>
28466 !! end
28467
28468 !! test
28469 Lists: Dont insert newlines in a serialized list item.
28470 !! options
28471 parsoid=html2wt
28472 !! html/parsoid
28473 <ul><li>a<br>b</li><li>c</li></ul>
28474 !! wikitext
28475 * a<br />b
28476 * c
28477 !! end
28478
28479 !! test
28480 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28481 !! options
28482 parsoid={
28483 "modes": ["html2wt"],
28484 "scrubWikitext": false
28485 }
28486 !! html/parsoid
28487 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28488 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28489
28490 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28491 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28492
28493 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28494
28495 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28496 !! wikitext
28497 == hello there [[Category:A1]] ==
28498
28499 == [[Category:A2]] hi pal ==
28500
28501 == <!--foo--> [[Category:A3]] how goes it ==
28502
28503 == it goes well [[Category:A4]] <!--bar--> ==
28504
28505 ==howdy [[Category:A5]]==
28506
28507 == __TOC__ ok ==
28508 !! end
28509
28510 !! test
28511 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28512 !! options
28513 parsoid={
28514 "modes": ["html2wt"],
28515 "scrubWikitext": true
28516 }
28517 !! html/parsoid
28518 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28519 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28520
28521 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28522 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28523
28524 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28525 !! wikitext
28526 == hello there ==
28527 [[Category:A1]]
28528 [[Category:A2]]
28529
28530 == hi pal ==
28531
28532 <!--foo-->[[Category:A3]]
28533
28534 == how goes it ==
28535
28536 == it goes well ==
28537 [[Category:A4]] <!--bar-->
28538
28539 __TOC__
28540
28541 == ok ==
28542 !! end
28543
28544 !! test
28545 Headings: Don't hoist metas that come from templates
28546 !! options
28547 parsoid={
28548 "modes": ["html2wt"],
28549 "scrubWikitext": true
28550 }
28551 !! html/parsoid
28552 <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>
28553 !! wikitext
28554 == {{echo|foo [[Category:Foo]]}} ==
28555 !! end
28556
28557 !! test
28558 Headings: Category in ref isn't hoisted
28559 !! options
28560 parsoid={
28561 "modes": ["html2wt"],
28562 "scrubWikitext": true
28563 }
28564 !! html/parsoid
28565 <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>
28566
28567 <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>
28568 !! wikitext
28569 == foo <ref>bar
28570 [[Category:Baz]] </ref> ==
28571
28572 <references />
28573 !! end
28574
28575 !! test
28576 Parsoid: Serialize positional parameters with = in them as named parameter
28577 !! options
28578 parsoid=html2wt
28579 !! html/parsoid
28580 <p about="#mwt1" typeof="mw:Transclusion"
28581 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
28582
28583 <p about="#mwt1" typeof="mw:Transclusion"
28584 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
28585
28586 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28587 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28588 <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>
28589 !! wikitext
28590 {{echo|1=f=oo}}
28591
28592 {{echo|1=f=oo|2=bar}}
28593
28594 <!--Orig params with data-parsoid has heuristics for handling = chars-->
28595 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
28596 {{echo|<nowiki>f=oo</nowiki>|bar}}
28597 !! end
28598
28599 !! test
28600 Parsoid: Serialize positional parameters with = in extlink as named parameter
28601 !! options
28602 parsoid=html2wt
28603 !! html/parsoid
28604 <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>
28605 !! wikitext
28606 {{echo|1=http://stuff?is=ok}}
28607 !! end
28608
28609 !! test
28610 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
28611 !! options
28612 parsoid=html2wt
28613 !! html/parsoid
28614 <div>a<p>b</p></div>
28615 <div>a
28616 <p>b</p></div>
28617 <div>
28618 a
28619 <p>b</p></div>
28620 !! wikitext
28621 <div>a
28622 b
28623 </div>
28624 <div>a
28625 b
28626 </div>
28627 <div>
28628 a
28629
28630 b
28631 </div>
28632 !! end
28633
28634 !! test
28635 Substrings resembling wikitext in hrefs should not get nowiki escapes
28636 !! options
28637 parsoid=html2wt
28638 !! html/parsoid
28639 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
28640 !! wikitext
28641 [[Foo''bar''baz]]
28642 !! end
28643
28644 !! test
28645 Enforce single-line context in the serializer
28646 !! options
28647 parsoid=html2wt
28648 !! html/parsoid
28649 <h2>testing
28650 123</h2>
28651
28652 <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">
28653 </span><span about="#mwt1">you</span> </h2>
28654
28655 <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>
28656
28657 <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
28658 there</span></li></ol>
28659
28660 <ul><li>asd
28661 sdf</li></ul>
28662
28663 <ul><li>foo
28664 bar
28665 baz</li>
28666 <li>foo <b>bar</b>
28667 baz</li></ul>
28668
28669 <dl><dt>hi
28670 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28671 ho</dd></dl>
28672
28673 <dl><dd> <table>
28674 <tbody><tr><td> ha
28675 ha
28676 ha</td></tr>
28677 </tbody></table></dd></dl>
28678 !! wikitext
28679 == testing 123 ==
28680
28681 == hi {{bogus|there
28682 you}} ==
28683
28684 == foo <ref>hello
28685 there</ref> ==
28686
28687 <references />
28688
28689 * asd sdf
28690
28691 * foo bar baz
28692 * foo '''bar''' baz
28693
28694 ; hi ho : hi ho
28695
28696 : {|
28697 | ha
28698 ha
28699 ha
28700 |}
28701 !! end
28702
28703 !! test
28704 Serialize new placeholder space without spans
28705 !! options
28706 parsoid=html2wt
28707 !! html/parsoid
28708 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28709
28710 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28711
28712 <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>
28713 !! wikitext
28714 foo : bar
28715
28716 foo : bar
28717
28718 <ref>foo : bar</ref>ok
28719 !! end
28720
28721
28722 #-----------------------
28723 # Tag minimization tests
28724 #-----------------------
28725
28726 !! test
28727 1. I/B quote minimization: wikitext-only tags should be combined
28728 !! options
28729 parsoid=html2wt
28730 !! html/parsoid
28731 <p><i>A</i><i>B</i></p>
28732 <p><b>A</b><b>B</b></p>
28733 <p><i>A</i><b><i>B</i></b></p>
28734 <p><b>A</b><i><b>B</b></i></p>
28735 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28736 <p><i><b>A</b></i><i><b>B</b></i></p>
28737 <p><i><b>A</b></i><b><i>B</i></b></p>
28738 <p><b><i>A</i></b><i><b>B</b></i></p>
28739 !! wikitext
28740 ''AB''
28741
28742 '''AB'''
28743
28744 ''A'''B'''''
28745
28746 '''A''B'''''
28747
28748 '''A''BC''D'''
28749
28750 '''''AB'''''
28751
28752 '''''AB'''''
28753
28754 '''''AB'''''
28755 !! end
28756
28757 !! test
28758 2. I/B quote minimization: wikitext and html tags should not be combined
28759 !! options
28760 parsoid=html2wt
28761 !! html/parsoid
28762 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28763 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28764 !! wikitext
28765 ''A''<i>B</i>
28766
28767 ''A''<nowiki/>'''<i>B</i>'''
28768 !! end
28769
28770 !! test
28771 3. I/B quote minimization: templated content stops minimization
28772 !! options
28773 parsoid=html2wt
28774 !! html/parsoid
28775 <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>
28776 <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>
28777 !! wikitext
28778 ''A''{{echo|''B''}}
28779
28780 ''A''{{echo|'''''B'''''}}
28781 !! end
28782
28783 !! test
28784 4. I/B quote minimization: new content should be mimimized with adjacent old content
28785 !! options
28786 parsoid=html2wt
28787 !! html/parsoid
28788 <p><i>A</i><i>B</i></p>
28789 <p><b>A</b><b>B</b></p>
28790 <p><i>A</i><b><i>B</i></b></p>
28791 !! wikitext
28792 ''AB''
28793
28794 '''AB'''
28795
28796 ''A'''B'''''
28797 !! end
28798
28799 !! test
28800 5a. Merge adjacent quote nodes if they've been edited
28801 !! options
28802 parsoid={
28803 "modes": ["wt2wt", "selser"],
28804 "changes": [
28805 ["p", "contents", "remove", ":contains('b')"]
28806 ]
28807 }
28808 !! wikitext
28809 ''a''b''c''
28810 !! wikitext/edited
28811 ''ac''
28812 !! end
28813
28814 !! test
28815 5b. Merge adjacent quote nodes if they've been edited
28816 !! options
28817 parsoid={
28818 "modes": ["wt2wt", "selser"],
28819 "changes": [
28820 ["#x", "remove"]
28821 ]
28822 }
28823 !! wikitext
28824 ''a''<span id="x">b</span>''c''
28825 !! wikitext/edited
28826 ''ac''
28827 !! end
28828
28829 !! test
28830 1. Merge adjacent link nodes as long as at least one element is new
28831 !! options
28832 parsoid={
28833 "modes": ["html2wt"],
28834 "scrubWikitext": true
28835 }
28836 !! html/parsoid
28837 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28838 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28839 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28840 !! wikitext
28841 [[Football]]
28842 [[Football]]
28843 [[Football|Foot]][[Football|ball]]
28844 !! end
28845
28846 !! test
28847 2. Merge adjacent link nodes and enable additional normalizations
28848 !! options
28849 parsoid={
28850 "modes": ["html2wt"],
28851 "scrubWikitext": true
28852 }
28853 !! html/parsoid
28854 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28855 !! wikitext
28856 ''[[Football]]''
28857 !! end
28858
28859 !! test
28860 3. Don't merge adjacent link nodes if scrubWikitext is false
28861 !! options
28862 parsoid={
28863 "modes": ["html2wt"],
28864 "scrubWikitext": false
28865 }
28866 !! html/parsoid
28867 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28868 !! wikitext
28869 [[Football|Foot]][[Football|ball]]
28870 !! end
28871
28872 !! test
28873 1. Move format tags outside of WikiLink
28874 !! options
28875 parsoid={
28876 "modes": ["html2wt"],
28877 "scrubWikitext": true
28878 }
28879 !! html/parsoid
28880 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
28881 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
28882 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
28883 !! wikitext
28884 ''[[Football]]''
28885 '''''[[Football]]'''''
28886 <u>'''''[[Football]]'''''</u>
28887 !! end
28888
28889 !! test
28890 2. Move format tags outside of WikiLink with mergable A tags
28891 !! options
28892 parsoid={
28893 "modes": ["html2wt"],
28894 "scrubWikitext": true
28895 }
28896 !! html/parsoid
28897 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
28898 !! wikitext
28899 '''''[[Football]]'''''
28900 !! end
28901
28902 !! test
28903 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
28904 !! options
28905 parsoid={
28906 "modes": ["html2wt"],
28907 "scrubWikitext": true
28908 }
28909 !! html/parsoid
28910 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
28911 !! wikitext
28912 <font color="red"><u>'''[[Foo]]'''</u></font>
28913 !! end
28914
28915 !! test
28916 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
28917 !! options
28918 parsoid={
28919 "modes": ["html2wt"],
28920 "scrubWikitext": true
28921 }
28922 !! html/parsoid
28923 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
28924 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
28925 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
28926 !! wikitext
28927 [[Foo|<font color="red">Foo</font>]]
28928 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
28929 [[Foo|<span class="Bar">Foo</span>]]
28930 !! end
28931
28932 !! test
28933 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
28934 !! options
28935 parsoid={
28936 "modes": ["selser"],
28937 "scrubWikitext": true,
28938 "changes": [
28939 ["a", "html", "<i>Foo</i>"]
28940 ]
28941 }
28942 !! wikitext
28943 [[Foo]]
28944 !! wikitext/edited
28945 ''[[Foo]]''
28946 !! end
28947
28948 !! test
28949 6. Regression test: Manual edit test to ensure diff markers are not lost
28950 !! options
28951 parsoid={
28952 "modes": ["selser"],
28953 "scrubWikitext": true,
28954 "changes": [
28955 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
28956 ]
28957 }
28958 !! wikitext
28959 ''Foo''
28960 !! wikitext/edited
28961 ''[[Foo]]''
28962 !! end
28963
28964 !! test
28965 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
28966 !! options
28967 parsoid={
28968 "modes": ["selser"],
28969 "scrubWikitext": true,
28970 "changes": [
28971 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
28972 ]
28973 }
28974 !! wikitext
28975 <div>placeholder</div>
28976 !! wikitext/edited
28977 <div>placeholder</div>
28978 [[Foo]] , placeholder
28979 !! end
28980
28981 #------------------------------
28982 # End of tag minimization tests
28983 #------------------------------
28984
28985 !!test
28986 T56262: New entities
28987 !! options
28988 parsoid=html2wt
28989 !! html/parsoid
28990 <span typeof="mw:Entity">&nbsp;</span>
28991 !! wikitext
28992 &nbsp;
28993 !! end
28994
28995 ## Note that there is no wikitext output for 'unknownproperty' ##
28996 ## Unknown magic words are silently dropped ##
28997
28998 !! test
28999 Magic words
29000 !! options
29001 parsoid=html2wt
29002 !! html/parsoid
29003 <meta property='mw:PageProp/toc' />
29004 <meta property='mw:PageProp/notoc' />
29005 <meta property='mw:PageProp/forcetoc' />
29006 <meta property='mw:PageProp/index' />
29007 <meta property='mw:PageProp/noindex' />
29008 <meta property='mw:PageProp/nogallery' />
29009 <meta property='mw:PageProp/noeditsection' />
29010 <meta property='mw:PageProp/notitleconvert' />
29011 <meta property='mw:PageProp/nocontentconvert' />
29012 <meta property='mw:PageProp/unknownproperty' />
29013 !! wikitext
29014 __TOC__
29015 __NOTOC__
29016 __FORCETOC__
29017 __INDEX__
29018 __NOINDEX__
29019 __NOGALLERY__
29020 __NOEDITSECTION__
29021 __NOTITLECONVERT__
29022 __NOCONTENTCONVERT__
29023 !! end
29024
29025 !! test
29026 Consecutive <pre>s should not get merged
29027 !! options
29028 parsoid=html2wt,html2html
29029 !! html/parsoid
29030 <pre>a</pre><pre>b</pre>
29031
29032 <pre>c
29033 </pre><pre>
29034 d</pre>
29035
29036 <pre>e
29037
29038 </pre><pre>
29039
29040 f</pre>
29041 !! wikitext
29042 a
29043
29044 b
29045
29046 c
29047
29048 d
29049
29050 e
29051
29052
29053
29054 f
29055 !! end
29056
29057 !! test
29058 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29059 !! options
29060 parsoid=html2wt
29061 !! html/parsoid
29062 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29063 !! wikitext
29064 [[Special:BookSources/1234567890|ISBN 1234567895]]
29065 !! end
29066
29067 !! test
29068 Edited RFC links not serializable as RFC links should serialize as extlinks
29069 !! options
29070 parsoid=html2wt
29071 !! html/parsoid
29072 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29073 !! wikitext
29074 [https://tools.ietf.org/html/rfc123 New RFC]
29075 !! end
29076
29077 !! test
29078 Edited PMID links not serializable as PMID links should serialize as extlinks
29079 !! options
29080 parsoid=html2wt
29081 !! html/parsoid
29082 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29083 !! wikitext
29084 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29085 !! end
29086
29087 !! test
29088 WTS of autolinks with trailing/surrounding context
29089 !! options
29090 parsoid=html2wt
29091 !! html/parsoid
29092 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29093 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29094 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29095 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29096 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29097 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29098 !! wikitext
29099 http://cscott.net'''foo'''
29100
29101 http://cscott.net<b>foo</b>
29102
29103 '''http://cscott.net'''
29104
29105 '''http://cscott.net '''
29106
29107 '''http://cscott.net<nowiki/>x'''
29108
29109 http://cscott.net<nowiki/>x
29110 !! end
29111
29112 !! test
29113 WTS of autolinks with nowikis (round-trip)
29114 !! wikitext
29115 x<nowiki/>http://cscott.net<nowiki/>x
29116 !! html/parsoid
29117 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29118 !! end
29119
29120 # this is the "easy" test because it leaves in place all the
29121 # data-parsoid information indicating this is an autolink
29122 !! test
29123 WTS of autolinks with escapes (editing)
29124 !! options
29125 parsoid={
29126 "modes": ["wt2wt"],
29127 "changes": [
29128 [ "span", "remove" ]
29129 ]
29130 }
29131 !! wikitext
29132 x<nowiki/>http://cscott.net<nowiki/>x
29133 !! wikitext/edited
29134 x<nowiki/>http://cscott.net<nowiki/>x
29135 !! end
29136
29137 !! test
29138 WTS of edited autolink-like text (T103364)
29139 !! options
29140 parsoid={
29141 "modes": ["wt2wt"],
29142 "changes": [
29143 [ "span[typeof]", "removeAttr", "typeof" ]
29144 ]
29145 }
29146 !! wikitext
29147 Not a link: <nowiki>http://example.com</nowiki>.
29148 !! wikitext/edited
29149 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29150 !! end
29151
29152 !! test
29153 WTS of newly-authored autolink-like text (T103364)
29154 !! options
29155 parsoid=html2wt
29156 !! html/parsoid
29157 <p>http://example.com is not a link.</p>
29158 !! wikitext
29159 <nowiki>http://example.com</nowiki> is not a link.
29160 !! end
29161
29162 !! test
29163 WTS of autolink-like text after an autolink (T108563)
29164 !! options
29165 parsoid=html2wt
29166 !! html/parsoid
29167 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29168 !! wikitext
29169 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29170 !! end
29171
29172 !! test
29173 Magic links inside links (not autolinked)
29174 !! wikitext
29175 [[Foo|http://example.com]]
29176 [[Foo|RFC 1234]]
29177 [[Foo|PMID 1234]]
29178 [[Foo|ISBN 123456789x]]
29179
29180 [http://foo.com http://example.com]
29181 [http://foo.com RFC 1234]
29182 [http://foo.com PMID 1234]
29183 [http://foo.com ISBN 123456789x]
29184 !! html+tidy
29185 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29186 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29187 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29188 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29189 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29190 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29191 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29192 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29193 </p>
29194 !! html/parsoid
29195 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29196 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29197 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29198 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29199
29200 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29201 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29202 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29203 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29204 !! end
29205
29206 !! test
29207 Magic links inside image captions (autolinked)
29208 !! wikitext
29209 [[File:Foobar.jpg|thumb|http://example.com]]
29210 [[File:Foobar.jpg|thumb|RFC 1234]]
29211 [[File:Foobar.jpg|thumb|PMID 1234]]
29212 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29213 !! html+tidy
29214 <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>
29215 <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>
29216 <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>
29217 <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>
29218 !! html/parsoid
29219 <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>
29220 <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>
29221 <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>
29222 <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>
29223 !! end
29224
29225 !! test
29226 WTS of magic word text (T109371)
29227 !! options
29228 parsoid=html2wt
29229 !! html/parsoid
29230 <p>RFC 1234</p>
29231 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29232 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29233 !! wikitext
29234 <nowiki>RFC 1234</nowiki>
29235
29236 [http://foo.com RFC 1234]
29237
29238 [[Foo|RFC 1234]]
29239 !! end
29240
29241 !! test
29242 Edited Redirect link should emit a non-piped wikitext link
29243 !! options
29244 parsoid=html2wt
29245 !! html/parsoid
29246 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29247 !! wikitext
29248 #REDIRECT [[Bar]]
29249 !! end
29250
29251 !! test
29252 T75121: Infer extension name from typeOf if data-mw is not present
29253 !! options
29254 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29255 !! html/parsoid
29256 <div typeOf="mw:Extension/foo"></div>
29257 !! wikitext
29258 <foo />
29259 !! end
29260
29261 # Note that the <p> wrapping isn't present in PHP parser output
29262 # The important thing for this test is that P-wrapping doesn't
29263 # interfere with the <nowiki> protection for leading - in <td>
29264 # (which isn't necessary for <th>).
29265 !! test
29266 T88318: p-wrapped dash in table.
29267 !! options
29268 parsoid=html2wt,wt2wt
29269 !! html/parsoid
29270 <table><tbody>
29271 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29272 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29273 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29274 </tbody></table>
29275 !! wikitext
29276 {|
29277 !-
29278 !-
29279 |-
29280 |<nowiki>-</nowiki>
29281 |<nowiki>- </nowiki>
29282 |-
29283 |<small>-</small>
29284 |<br />
29285 -
29286 |<br />-
29287 |}
29288 !! html/php+tidy
29289 <table>
29290 <tbody><tr>
29291 <th>-
29292 </th>
29293 <th>-
29294 </th></tr>
29295 <tr>
29296 <td>-
29297 </td>
29298 <td>-
29299 </td></tr>
29300 <tr>
29301 <td><small>-</small>
29302 </td>
29303 <td><br />
29304 <p>-
29305 </p>
29306 </td>
29307 <td><br />-
29308 </td></tr></tbody></table>
29309 !! end
29310
29311 !! test
29312 T149209: WTS: Handle newlines in table cells properly
29313 !! options
29314 parsoid=html2wt
29315 !! html/parsoid
29316 <table>
29317 <tbody>
29318 <tr><td>a
29319 b
29320 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29321 <tr><td><p>x</p>
29322 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29323 </tbody></table>
29324 <table>
29325 <tbody>
29326 <tr><th>a
29327 b
29328 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29329 <tr><th><p>x</h>
29330 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29331 </tbody></table>
29332 !! wikitext
29333 {|
29334 |a
29335 b
29336 |c
29337 |-
29338 |x
29339 {{!}}y
29340 |}
29341 {|
29342 !a
29343 b
29344 !c
29345 |-
29346 !x
29347 !y
29348 |}
29349 !! end
29350
29351 !! test
29352 T149209: Selser: Handle newlines in table cells properly
29353 !! options
29354 parsoid={
29355 "modes": ["selser"],
29356 "changes": [
29357 [ "#h1", "html", "a\nb\n" ],
29358 [ "#h2", "html", "a\nb\n" ],
29359 [ "#c1", "html", "a\nb\n" ],
29360 [ "#c2", "html", "<p>a</p>" ],
29361 [ "#c3", "html", "<p>a</p>" ],
29362 [ "#c4", "html", "edit-me<p>a</p>" ]
29363 ]
29364 }
29365 !! wikitext
29366 {|
29367 ! id="h1" |edit-me!!1
29368 |-
29369 ! id="h2" |edit-me||2
29370 |-
29371 | id="c1" |edit-me||3
29372 |-
29373 | id="c2" |edit-me||4
29374 |-
29375 | id="c3" |edit-me||p||q||r
29376 |-
29377 | id="c4" |edit-me||p||q||r
29378 |}
29379 !! wikitext/edited
29380 {|
29381 ! id="h1" |a
29382 b
29383 !1
29384 |-
29385 ! id="h2" |a
29386 b
29387 !2
29388 |-
29389 | id="c1" |a
29390 b
29391 |3
29392 |-
29393 | id="c2" |a
29394 |4
29395 |-
29396 | id="c3" |a
29397 |p||q||r
29398 |-
29399 | id="c4" |edit-me
29400 a
29401 |p||q||r
29402 |}
29403 !! end
29404
29405 !! test
29406 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29407 !! options
29408 parsoid=html2wt
29409 !! html/parsoid
29410 <table id='mwAb'>
29411 <td id='mwAc'>foo</td>
29412 <td id='serialize-this'>bar</td>
29413 </table>
29414 !! wikitext
29415 {|
29416 |foo
29417 | id="serialize-this" |bar
29418 |}
29419 !! end
29420
29421 !! test
29422 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29423 !! options
29424 parsoid=html2wt
29425 !! html/parsoid
29426 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29427 !! wikitext
29428 <div id="hello">ok</div>
29429 !! end
29430
29431 !! test
29432 Testing serialization after deletion in references
29433 !! options
29434 parsoid={
29435 "modes": ["wt2wt"],
29436 "changes": [
29437 ["#x", "remove"]
29438 ]
29439 }
29440 !! wikitext
29441 hi <ref><div id="x">ho</div></ref>
29442
29443 <references />
29444 !! wikitext/edited
29445 hi <ref></ref>
29446
29447 <references />
29448 !! end
29449
29450 !!test
29451 Testing serialization after deletion of table cells
29452 !!options
29453 parsoid={
29454 "modes": ["wt2wt", "selser"],
29455 "changes": [
29456 ["#x", "remove"]
29457 ]
29458 }
29459 !!wikitext
29460 {|
29461 !h1 !!h2 !!h3
29462 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29463 |}
29464 !! wikitext/edited
29465 {|
29466 !h1!!h2!!h3
29467 |c2|||c3
29468 |}
29469 !!end
29470
29471 !! test
29472 Testing selser after addition of new row before first row (T125419)
29473 !! options
29474 parsoid={
29475 "modes": ["wt2wt", "selser"],
29476 "changes": [
29477 [ "tr", "before", "<tr><td>X</td></tr>" ]
29478 ]
29479 }
29480 !! wikitext
29481 {|
29482 |a
29483 |}
29484 !! wikitext/edited
29485 {|
29486 |X
29487 |-
29488 |a
29489 |}
29490 !! end
29491
29492 !! test
29493 Serialize new table rows in a HTML table using HTML tags
29494 !! options
29495 parsoid={
29496 "modes": ["wt2wt", "selser"],
29497 "changes": [
29498 [ "tr", "before", "<tr><td>X</td></tr>" ]
29499 ]
29500 }
29501 !! wikitext
29502 <table><tr><td>a</td></tr></table>
29503 !! wikitext/edited
29504 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29505 !! end
29506
29507 !! test
29508 Serialize new table cells in a HTML row using HTML tags
29509 !! options
29510 parsoid={
29511 "modes": ["wt2wt", "selser"],
29512 "changes": [
29513 [ "td", "before", "<td>X</td>" ]
29514 ]
29515 }
29516 !! wikitext
29517 <table><tr><td>a</td></tr></table>
29518 !! wikitext/edited
29519 <table><tr><td>X</td><td>a</td></tr></table>
29520 !! end
29521
29522 !! test
29523 Serialize wikitext list items as HTML list items when embedded in a HTML list
29524 !! options
29525 parsoid=html2wt
29526 !! html
29527 <ul data-parsoid='{"stx": "html"}'>
29528 <li data-parsoid='{}'>a</li>
29529 <li>b</li>
29530 </ul>
29531 !! wikitext
29532 <ul>
29533 <li>a</li>
29534 <li>b</li>
29535 </ul>
29536 !! end
29537
29538 # SSS FIXME: Is this actually a good thing given the
29539 # odd nested list output that is generated by MW?
29540 # <ul><li>foo<ul>..</ul></li></ul> instead of
29541 # <ul><li>foo</li><ul>..</ul></ul>
29542 !! test
29543 Wikitext lists can be nested inside HTML lists
29544 !! options
29545 parsoid=html2wt
29546 !! html
29547 <ul data-parsoid='{"stx": "html"}'>
29548 <li data-parsoid='{"stx": "html"}'>a
29549 <ul><li>b</li></ul>
29550 </li>
29551 </ul>
29552
29553 <ul data-parsoid='{"stx": "html"}'>
29554 <li>x
29555 <ul><li>y</li></ul>
29556 </li>
29557 </ul>
29558 !! wikitext
29559 <ul>
29560 <li>a
29561 * b
29562 </li>
29563 </ul>
29564
29565 <ul>
29566 <li>x
29567 * y
29568 </li>
29569 </ul>
29570 !! end
29571
29572 !! test
29573 WTS change modes
29574 !! options
29575 parsoid={
29576 "modes": ["wt2wt"],
29577 "changes": [
29578 [ "#xyz", "before", "<b>before</b> stuff " ],
29579 [ "#xyz", "after", " stuff <i>after</i>" ],
29580 [ "#xyz", "html", "x <b>y</b> z" ]
29581 ]
29582 }
29583 !! wikitext
29584 <span id="xyz">hello</span>
29585 !! wikitext/edited
29586 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
29587 !! end
29588
29589 !! test
29590 Never serialize a-tag as html, regardless of what data-parsoid has to say
29591 !! options
29592 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29593 !! html/parsoid
29594 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
29595 !! wikitext
29596 [[Foo]]
29597 !! end
29598
29599 ## SSS FIXME: This is broken output nevertheless.
29600 ## What might be a reasonable non-broken output for this?
29601 ## This is an edge case unlikely to be seen in production
29602 ## that I am not wasting more time on this right now.
29603 !! test
29604 Never serialize a-tag as html, no matter what attributes it has
29605 !! options
29606 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29607 !! html/parsoid
29608 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
29609 !! wikitext
29610 [http://boo.org http://boohoo.org]
29611 !! end
29612
29613 # Misnested is an indication that selser can reuse the source but these have
29614 # shown to sneak through on occasion. See T101768.
29615 # The original wikitext here is: [http://test.com [[one]] two three]
29616 !! test
29617 Strip span tags added to mark misnested links
29618 !! options
29619 parsoid=html2wt
29620 !! html/parsoid
29621 <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>
29622 !! wikitext
29623 [http://test.com][[one]] two three
29624 !! end
29625
29626 !! test
29627 Catch regression when unpacking misnested links
29628 !! options
29629 parsoid=wt2html
29630 !! wikitext
29631 {{echo|hi}}[http://example.com [[ho]]]
29632 !! html/parsoid
29633 <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>
29634 !! end
29635
29636 !! test
29637 Catch regression when unpacking with trailing content
29638 !! wikitext
29639 {{echo|Foo <references/> bar}}
29640 !! html/parsoid
29641 <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>
29642 !! end
29643
29644 !! test
29645 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
29646 !! options
29647 parsoid=html2wt
29648 !! html/parsoid
29649 <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|}"]}'>
29650 <tbody><tr><td>d
29651 </td></tr>
29652 </tbody></table>
29653 !! wikitext
29654 {{echo|a}}
29655 {|{{echo|c
29656 {{!}}d
29657 }}
29658 |}
29659 !! end
29660
29661 ## This test verifies the presence and computation of this attribute indirectly
29662 ## by making an edit and ensuring that the serialization is correct (which it would be
29663 ## only if firstWikitextNode is properly set).
29664 !! test
29665 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
29666 !! options
29667 parsoid= {
29668 "modes": ["wt2wt"],
29669 "changes": [
29670 [ "div#x", "remove" ],
29671 [ "div", "before", "<div>new</div>" ]
29672 ]
29673 }
29674 !! wikitext
29675 <div id="x">foo</div>
29676 {|
29677 {{echo|<div>boo</div>
29678 {{!}}b}}
29679 |c
29680 |}
29681 !! wikitext/edited
29682
29683 <div>new</div>
29684 {|
29685 {{echo|<div>boo</div>
29686 {{!}}b}}
29687 |c
29688 |}
29689 !! end
29690
29691 # --------------------------------------------
29692 # Tests spec'ing wikitext serialization norms |
29693 # --------------------------------------------
29694
29695 !! test
29696 Serialize multi-line indent-pre starting with wikitext syntax
29697 !! options
29698 parsoid=html2wt
29699 !! html/parsoid
29700 <pre>* 1
29701 ** 2
29702 * 3</pre>
29703 !! wikitext
29704 * 1
29705 ** 2
29706 * 3
29707 !! end
29708
29709 !! test
29710 1. Categories should always be serialized on their own line
29711 !! options
29712 parsoid=html2wt
29713 !! html/parsoid
29714 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
29715 !! wikitext
29716 foo
29717 [[Category:Foo]]
29718 bar
29719 !! end
29720
29721 !! test
29722 2. Categories that are part of templates should not introduce a line break
29723 !! wikitext
29724 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
29725 !! html/parsoid
29726 <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>
29727 !! end
29728
29729 # Careful while editing these next 2 tests. There are \u200f characters
29730 # before and after the <link> tags in the HTML and following some
29731 # of the categories in wikitext
29732 # Do not remove these characters in edits.
29733 #
29734 # As part of the serialization, these bidi characters will get stripped.
29735 !! test
29736 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
29737 !! options
29738 parsoid={
29739 "modes": ["html2wt"],
29740 "scrubWikitext": true
29741 }
29742 !! html/parsoid
29743 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
29744 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
29745 !! wikitext
29746 [[קטגוריה:טקסים]]
29747 [[קטגוריה: שיטות משפט]]
29748 !! end
29749
29750 !! test
29751 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
29752 !! options
29753 parsoid={
29754 "modes": ["html2wt"],
29755 "scrubWikitext": true
29756 }
29757 !! html/parsoid
29758 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
29759 !! wikitext
29760 [[קטגוריה:טקסים]]
29761 ‏y
29762 !! end
29763
29764 !! test
29765 Lists: Add space after bullets
29766 !! options
29767 parsoid=html2wt
29768 !! html/parsoid
29769 <ul>
29770 <li>foo</li>
29771 <li> bar</li>
29772 <li><span> baz</span></li>
29773 </ul>
29774 !! wikitext
29775 * foo
29776 * bar
29777 * <span> baz</span>
29778 !! end
29779
29780 !! test
29781 1. Headings: Add space before/after == (T53744)
29782 !! options
29783 parsoid=html2wt
29784 !! html/parsoid
29785 <h2>foo</h2>
29786 <h2> bar</h2>
29787 <h2>baz </h2>
29788 <h2><span> baz</span></h2>
29789 !! wikitext
29790 == foo ==
29791
29792 == bar ==
29793
29794 == baz ==
29795
29796 == <span> baz</span> ==
29797 !! end
29798
29799 !! test
29800 2. Headings: Add space before/after == even after hoisted content
29801 !! options
29802 parsoid={
29803 "modes": ["html2wt"],
29804 "scrubWikitext": true
29805 }
29806 !! html/parsoid
29807 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
29808 !! wikitext
29809 [[Category:A2]]
29810
29811 == ok ==
29812 !! end
29813
29814 !! test
29815 1. Headings: suppress newly created empty headings
29816 !! options
29817 parsoid={
29818 "modes": ["html2wt"],
29819 "scrubWikitext": true
29820 }
29821 !! html/parsoid
29822 <h2></h2>
29823 !! wikitext
29824 !! end
29825
29826 !! test
29827 2. Headings: don't suppress empty headings if scrubWikitext is false
29828 !! options
29829 parsoid=html2wt
29830 !! html/parsoid
29831 <h2></h2>
29832 !! wikitext
29833 ==<nowiki/>==
29834 !! end
29835
29836 !! test
29837 3. Headings: suppress empty headings on edits
29838 !! options
29839 parsoid={
29840 "modes": ["selser"],
29841 "scrubWikitext": true,
29842 "changes": [
29843 [ "#x", "remove"]
29844 ]
29845 }
29846 !! wikitext
29847 ==<span id="x">foo</span>==
29848 !! wikitext/edited
29849 !! end
29850
29851 !! test
29852 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
29853 !! options
29854 parsoid={
29855 "modes": ["html2wt"],
29856 "scrubWikitext": true
29857 }
29858 !! html/parsoid
29859 <h2>foo<br/>bar</h2>
29860 <h2>foo <span><br/>bar</span> baz</h2>
29861 !! wikitext
29862 == foo bar ==
29863
29864 == foo <span> bar</span> baz ==
29865 !! end
29866
29867 !! test
29868 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
29869 !! options
29870 parsoid={
29871 "modes": ["html2wt"],
29872 "scrubWikitext": false
29873 }
29874 !! html/parsoid
29875 <h2>foo<br/>bar</h2>
29876 !! wikitext
29877 == foo<br />bar ==
29878 !! end
29879
29880 !! test
29881 1. WT Quote Tags: suppress newly created empty style tags
29882 !! options
29883 parsoid={
29884 "modes": ["html2wt"],
29885 "scrubWikitext": true
29886 }
29887 !! html/parsoid
29888 <i></i><b></b>
29889 !! wikitext
29890 !! end
29891
29892 !! test
29893 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
29894 !! options
29895 parsoid=html2wt
29896 !! html/parsoid
29897 <i></i><b></b>
29898 !! wikitext
29899 ''<nowiki/>'''''<nowiki/>'''
29900 !! end
29901
29902 !! test
29903 3. WT Quote Tags: suppress empty style tags on edits
29904 !! options
29905 parsoid={
29906 "modes": ["selser"],
29907 "scrubWikitext": true,
29908 "changes": [
29909 [ "#x", "remove"]
29910 ]
29911 }
29912 !! wikitext
29913 '''<span id="x">foo</span>'''
29914 !! wikitext/edited
29915 !! end
29916
29917 !! test
29918 1. Anchors: suppress newly created empty anchors
29919 !! options
29920 parsoid={
29921 "modes": ["html2wt"],
29922 "scrubWikitext": true
29923 }
29924 !! html/parsoid
29925 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29926 !! wikitext
29927 !! end
29928
29929 !! test
29930 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29931 !! options
29932 parsoid={
29933 "modes": ["html2wt"],
29934 "scrubWikitext": false
29935 }
29936 !! html/parsoid
29937 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29938 !! wikitext
29939 [[Test|<nowiki/>]]
29940 !! end
29941
29942 !! test
29943 3. Anchors: suppress empty anchors on edits
29944 !! options
29945 parsoid={
29946 "modes": ["selser"],
29947 "scrubWikitext": true,
29948 "changes": [
29949 [ "#x", "remove"]
29950 ]
29951 }
29952 !! wikitext
29953 [[Test|<span id="x">foo</span>]]
29954 !! wikitext/edited
29955 !! end
29956
29957 !! test
29958 3a. Anchors: do not suppress numbered extlinks
29959 !! options
29960 parsoid={
29961 "modes": ["wt2wt"],
29962 "scrubWikitext": true
29963 }
29964 !! wikitext
29965 [http://foo.com]
29966 !! html/parsoid
29967 <a rel="mw:ExtLink" href="http://foo.com"></a>
29968 !! end
29969
29970 !! test
29971 3b. Anchors: do not suppress numbered extlinks
29972 !! options
29973 parsoid={
29974 "modes": ["wt2wt"],
29975 "scrubWikitext": true,
29976 "changes": [
29977 [ "#x", "remove"]
29978 ]
29979 }
29980 !! wikitext
29981 [http://foo.com <span id="x">foo</span>]
29982 !! wikitext/edited
29983 [http://foo.com]
29984 !! end
29985
29986 !!test
29987 Normalizations should be restricted to edited content
29988 !!options
29989 parsoid={
29990 "modes": ["selser"],
29991 "scrubWikitext": true,
29992 "changes": [
29993 [ "h1", "before", "<i></i>"]
29994 ]
29995 }
29996 !!wikitext
29997 a
29998 = =
29999 b
30000 !!wikitext/edited
30001 a
30002 = =
30003 b
30004 !!end
30005
30006 !! test
30007 1. Multiple normalizations (html2wt)
30008 !! options
30009 parsoid={
30010 "modes": ["html2wt"],
30011 "scrubWikitext": true
30012 }
30013 !! html
30014 <h2><i></i></h2>
30015 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30016 </a><b><i></i></b>x</p>
30017 !! wikitext
30018
30019 [[foo]]
30020 x
30021
30022 !! end
30023
30024 !! test
30025 2. Multiple normalizations (selser)
30026 !! options
30027 parsoid={
30028 "modes": ["selser"],
30029 "scrubWikitext": true,
30030 "changes": [
30031 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
30032 ]
30033 }
30034 !! wikitext
30035 <span id="x">foo</span>
30036 !! wikitext/edited
30037 <span id="x">foo</span>
30038
30039 x
30040 !! end
30041
30042 !! test
30043 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30044 !! options
30045 parsoid={
30046 "modes": ["html2wt"],
30047 "scrubWikitext": true
30048 }
30049 !! html/parsoid
30050 <p> hi</p>
30051 <p> hello</p>
30052 !! wikitext
30053 hi
30054
30055 hello
30056 !! end
30057
30058 !! test
30059 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30060 !! options
30061 parsoid=html2wt
30062 !! html/parsoid
30063 <p> hi</p>
30064 <p> hello</p>
30065 !! wikitext
30066 <nowiki> </nowiki>hi
30067
30068 <nowiki> </nowiki> hello
30069 !! end
30070
30071 !! test
30072 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30073 !! options
30074 parsoid={
30075 "modes": ["html2wt"],
30076 "scrubWikitext": true
30077 }
30078 !! html/parsoid
30079 <p>Foo
30080 bar
30081 baz</p>
30082
30083 <table><tr><td>Foo
30084 bar
30085 baz bang</td></tr></table>
30086
30087 <p><!--boo--> foo
30088 bar</p>
30089
30090 <p> foo
30091 bar<span>boo</span></p>
30092 !! wikitext
30093 Foo
30094 bar
30095 baz
30096
30097 {|
30098 |Foo
30099 bar
30100 baz bang
30101 |}
30102
30103 <!--boo-->foo
30104 bar
30105
30106 foo
30107 bar<span>boo</span>
30108 !! end
30109
30110 !! test
30111 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30112 !! options
30113 parsoid={
30114 "modes": ["selser"],
30115 "scrubWikitext": true,
30116 "changes": [
30117 [ "p", "html", " a\n b" ]
30118 ]
30119 }
30120 !! wikitext
30121 xyz
30122 !! wikitext/edited
30123 a
30124 b
30125 !! end
30126
30127 !! test
30128 1. New links that end in spaces
30129 !! options
30130 parsoid={
30131 "modes": ["html2wt"],
30132 "scrubWikitext": false
30133 }
30134 !! html/parsoid
30135 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30136 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30137 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30138 !! wikitext
30139 [[Berlin ]]<nowiki/>is the capital of Germany.
30140
30141 [[Foo ]]'''bar'''
30142
30143 [[Boston ]] is a city.
30144 !! end
30145
30146 !! test
30147 2. New links that end in spaces
30148 !! options
30149 parsoid={
30150 "modes": ["html2wt"],
30151 "scrubWikitext": true
30152 }
30153 !! html/parsoid
30154 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30155 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30156 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30157 !! wikitext
30158 [[Berlin]] is the capital of Germany.
30159
30160 [[Foo]] '''bar'''
30161
30162 [[Boston]] is a city.
30163 !! end
30164
30165 !! test
30166 1. Table cells with escapable prefixes
30167 !! options
30168 parsoid={
30169 "modes": ["html2wt"],
30170 "scrubWikitext": false
30171 }
30172 !! html
30173 <table>
30174 <tr><td>a</td></tr>
30175 <tr><td>-</td></tr>
30176 <tr><td>+</td></tr>
30177 </table>
30178 !! wikitext
30179 {|
30180 |a
30181 |-
30182 |<nowiki>-</nowiki>
30183 |-
30184 |<nowiki>+</nowiki>
30185 |}
30186 !! end
30187
30188 !! test
30189 2. Table cells with escapable prefixes
30190 !! options
30191 parsoid={
30192 "modes": ["html2wt"],
30193 "scrubWikitext": true
30194 }
30195 !! html
30196 <table>
30197 <tr><td>a</td></tr>
30198 <tr><td>-</td></tr>
30199 <tr><td>+</td></tr>
30200 </table>
30201 !! wikitext
30202 {|
30203 |a
30204 |-
30205 | -
30206 |-
30207 | +
30208 |}
30209 !! end
30210
30211 !! test
30212 3a. Table cells with escapable prefixes after edits
30213 !! options
30214 parsoid={
30215 "modes": ["selser"],
30216 "scrubWikitext": true,
30217 "changes": [
30218 [ "table tbody tr:first-child td:first-child", "remove"]
30219 ]
30220 }
30221 !! wikitext
30222 {|
30223 |a||-
30224 |}
30225 !! wikitext/edited
30226 {|
30227 | -
30228 |}
30229 !! end
30230
30231 !! test
30232 3b. Table cells with escapable prefixes after edits
30233 !! options
30234 parsoid={
30235 "modes": ["selser"],
30236 "scrubWikitext": true,
30237 "changes": [
30238 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30239 [ "#x", "remove" ]
30240 ]
30241 }
30242 !! wikitext
30243 {|
30244 |pqr
30245 |<span id="x">foo</span>+
30246 |}
30247 !! wikitext/edited
30248 {|
30249 | -
30250 | +
30251 |}
30252 !! end
30253
30254 # FIXME: This test will fail because
30255 # normalization doesn't realize that the id attribute
30256 # will eliminate the escapable scenario
30257 !! test
30258 4a. Table cells without escapable prefixes after edits
30259 !! options
30260 parsoid={
30261 "modes": ["selser"],
30262 "scrubWikitext": true,
30263 "changes": [
30264 [ "#x", "html", "-" ]
30265 ]
30266 }
30267 !! wikitext
30268 {|
30269 | id="x" |abcd
30270 |}
30271 !! wikitext/edited
30272 {|
30273 | id="x" |-
30274 |}
30275 !! end
30276
30277 ## This tests normalizer's ability to discriminate between
30278 ## cells having identical content.
30279 !! test
30280 4b. Table cells without escapable prefixes after edits
30281 !! options
30282 parsoid={
30283 "modes": ["selser"],
30284 "scrubWikitext": true,
30285 "changes": [
30286 [ "td", "html", "-" ]
30287 ]
30288 }
30289 !! wikitext
30290 {|
30291 |a||b
30292 |}
30293 !! wikitext/edited
30294 {|
30295 | -||-
30296 |}
30297 !! end
30298
30299 ## This tests normalizer's ability to not be tripped by
30300 ## comments (and whitespace)
30301 !! test
30302 4c. Table cells without escapable prefixes after edits
30303 !! options
30304 parsoid={
30305 "modes": ["selser"],
30306 "scrubWikitext": true,
30307 "changes": [
30308 [ "table tbody tr td:first-child", "remove" ]
30309 ]
30310 }
30311 !! wikitext
30312 {|
30313 |-
30314 <!--foo--> |a||-
30315 |}
30316 !! wikitext/edited
30317 {|
30318 |-
30319 <!--foo--> | -
30320 |}
30321 !! end
30322
30323 ## This tests normalizer's ability to handle HTML cells
30324 !! test
30325 4d. Table cells without escapable prefixes after edits
30326 !! options
30327 parsoid={
30328 "modes": ["selser"],
30329 "scrubWikitext": true,
30330 "changes": [
30331 [ "td", "html", "-" ]
30332 ]
30333 }
30334 !! wikitext
30335 <table>
30336 <tr><td>a</td></tr>
30337 </table>
30338 !! wikitext/edited
30339 <table>
30340 <tr><td>-</td></tr>
30341 </table>
30342 !! end
30343
30344 ## T111151 Remove font elements without attributes
30345 !! test
30346 5a. font tags without attributes should be dropped in scrubWikitext mode
30347 !! options
30348 parsoid={
30349 "modes": ["html2wt"],
30350 "scrubWikitext": true
30351 }
30352 !! html
30353 <font>foo</font>
30354 <font><font>bar</font></font>
30355 <font class="x">boo</font>
30356 !! wikitext
30357 foo
30358 bar
30359 <font class="x">boo</font>
30360 !! end
30361
30362 !! test
30363 5b. font tags should not be dropped without scrubWikitext being enabled
30364 !! options
30365 parsoid={
30366 "modes": ["html2wt"],
30367 "scrubWikitext": false
30368 }
30369 !! html
30370 <font>foo</font>
30371 !! wikitext
30372 <font>foo</font>
30373 !! end
30374
30375 !! test
30376 Escape nowiki DOM elements
30377 !! options
30378 parsoid=html2wt
30379 !! html/parsoid
30380 <nowiki><i>foo</i></nowiki>
30381 !! wikitext
30382 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
30383 !! end
30384
30385 # This is meant to be an interim fix while we go about figuring out
30386 # how to not introduce these trailing <nowiki/>s in the first place.
30387 !! test
30388 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
30389 !! options
30390 parsoid=html2wt
30391 !! html/parsoid
30392 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
30393 y</p>
30394 <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>
30395 <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>
30396 !! wikitext
30397 x
30398 y
30399
30400 {{echo|
30401 1 = <nowiki/>}}
30402
30403 {{echo|
30404 1 = <nowiki/>
30405 }}
30406 !! end
30407
30408 !! test
30409 New list is serialized on newlines
30410 !! options
30411 parsoid=html2wt
30412 !! html/parsoid
30413 <p>The quick brown fox jumps over the lazy dog.</p><ul>
30414 <li>Yesterday</li>
30415 <li>Today</li>
30416 <li>Tomorrow</li>
30417 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
30418 !! wikitext
30419 The quick brown fox jumps over the lazy dog.
30420
30421 * Yesterday
30422 * Today
30423 * Tomorrow
30424
30425 The quick onyx goblin jumps over the lazy dwarf.
30426 !! end
30427
30428 !! test
30429 New lists in formatting elements serialized w/o newlines
30430 !! options
30431 parsoid=html2wt
30432 !! html/parsoid
30433 <small>
30434
30435 <ul>
30436 <li>123</li>
30437 </ul>
30438
30439 </small>
30440
30441 <small><ul><li>hi</li></ul></small>
30442 !! wikitext
30443 <small>
30444 * 123
30445 </small>
30446
30447 <small>
30448 * hi
30449 </small>
30450 !! end
30451
30452 !! test
30453 New list in table doesn't need newlines
30454 !! options
30455 parsoid=html2wt
30456 !! html/parsoid
30457 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
30458 !! wikitext
30459 {|
30460 |
30461 * test
30462 * 123
30463 |}
30464 !! end
30465
30466 # ---------------------------------------------------
30467 # End of tests spec'ing wikitext serialization norms |
30468 # ---------------------------------------------------
30469
30470 # T104032
30471 !! test
30472 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
30473 !! options
30474 parsoid=html2wt
30475 !! html/parsoid
30476 a<p>b</p>
30477 <b>c</b><p>d</p>
30478 <table><tr>
30479 <td>a<p>b</p></td>
30480 <td><b>c</b><p>d</p></td>
30481 </tr></table>
30482 !! wikitext
30483 a
30484
30485 b
30486
30487 '''c'''
30488
30489 d
30490 {|
30491 |a
30492 b
30493 |'''c'''
30494 d
30495 |}
30496 !! end
30497
30498 !! test
30499 Anchor without href scenarios
30500 !! options
30501 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30502 !! html/parsoid
30503 <a class="bc"></a>
30504 <a class="no">dice</a>
30505 <a name="foo"></a>
30506 !! wikitext
30507
30508 dice
30509 <span name="foo"></span>
30510 !! end
30511
30512 !! test
30513 New transclusion added after a list should be serialized after the list
30514 !! options
30515 parsoid=html2wt
30516 !! html/parsoid
30517 <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>
30518 !! wikitext
30519 * a
30520 {{echo|foo}}
30521 !! end
30522
30523 # -----------------------------------------------------------------
30524 # End of section for Parsoid-only html2wt tests for serialization
30525 # of new content
30526 # -----------------------------------------------------------------
30527
30528 # -----------------------------------------------------------------
30529 # The following section of tests are primarily to spec behavior of
30530 # the selective serializer. All these tests have manual selser
30531 # changes. The automated selser changes for all tests handle the
30532 # wide variation of changes, but these tests here capture specs
30533 # deterministically.
30534 # ----------------------------------------------------------------
30535
30536 ## T90517
30537 !! test
30538 Selser: New comments should not be lost
30539 !! options
30540 parsoid={
30541 "modes": ["selser"],
30542 "changes": [
30543 [ "#a", "after", "<!--c1-->" ],
30544 [ "#b", "before", "<!--c2-->" ]
30545 ]
30546 }
30547 !! wikitext
30548 <span id="a">a</span>
30549
30550 <span id="b">b</span>
30551 !! wikitext/edited
30552 <span id="a">a</span><!--c1-->
30553
30554 <!--c2--><span id="b">b</span>
30555 !! end
30556
30557 ## T89383
30558 !! test
30559 Selser: Check for validity of DSR before using it
30560 !! options
30561 parsoid={
30562 "modes": ["selser"],
30563 "changes": [
30564 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
30565 ]
30566 }
30567 !! wikitext
30568 <span id="a">a</span>
30569 !! wikitext/edited
30570 {{DISPLAYTITLE:foo}}
30571 <span id="a">a</span>
30572 !! end
30573
30574 !! test
30575 1. DOMDiff: Changes to <ref> content should be looked up using id
30576 !! options
30577 parsoid={
30578 "modes": ["selser"],
30579 "changes": [
30580 ["#X", "after", "bar"],
30581 ["#Y", "after", "baz"]
30582 ]
30583 }
30584 !! wikitext
30585 X <ref><span id="X">foo</span></ref>
30586 Y <ref name="a" />
30587 <references>
30588 <ref name="a"><span id="Y">foo</span></ref>
30589 </references>
30590 !! wikitext/edited
30591 X <ref><span id="X">foo</span>bar</ref>
30592 Y <ref name="a" />
30593 <references>
30594 <ref name="a"><span id="Y">foo</span>baz</ref>
30595 </references>
30596 !! end
30597
30598 !! test
30599 2. DOMDiff: Changes to <ref> content should be looked up using id
30600 !! options
30601 parsoid={
30602 "modes": ["selser"],
30603 "changes": [
30604 ["#Z", "after", "bar"]
30605 ]
30606 }
30607 !! wikitext
30608 A <ref>foo bar for a</ref>
30609 B <ref group="X" name="b" />
30610
30611 <references />
30612
30613 <references group="X">
30614 <ref name="b"><span id="Z">foo</span></ref>
30615 </references>
30616 !! wikitext/edited
30617 A <ref>foo bar for a</ref>
30618 B <ref group="X" name="b" />
30619
30620 <references />
30621
30622 <references group="X">
30623 <ref name="b"><span id="Z">foo</span>bar</ref>
30624 </references>
30625 !! end
30626
30627 !! test
30628 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
30629 !! options
30630 parsoid={
30631 "modes": ["selser"],
30632 "changes": [
30633 [ "div:first-child", "text", "bar" ]
30634 ]
30635 }
30636 !! wikitext
30637 <div style="{{1x|color:red;}}%">foo</div>
30638 !! wikitext/edited
30639 <div style="{{1x|color:red;}}%">bar</div>
30640 !! end
30641
30642 !! test
30643 Empty LI (T49673)
30644 !! wikitext
30645 *a
30646 *
30647 *
30648 *b
30649 !! html+tidy
30650 <ul><li>a</li>
30651 <li class="mw-empty-elt"></li>
30652 <li class="mw-empty-elt"></li>
30653 <li>b</li></ul>
30654 !! end
30655
30656 !! test
30657 Thumbnail output
30658 !! wikitext
30659 [[File:Thumb.png|thumb]]
30660 !! html/php+tidy
30661 <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>
30662 !! html/parsoid
30663 <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>
30664 !! end
30665
30666 !! test
30667 unclosed internal link XSS (T137264)
30668 !! wikitext
30669 [[#%3Cscript%3Ealert(1)%3C/script%3E|
30670 !! html/php
30671 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
30672 </p>
30673 !! html/parsoid
30674 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
30675 !! end
30676
30677 !! test
30678 Validating that <style> isn't eaten by tidy (T167349)
30679 !! options
30680 styletag=1
30681 !! wikitext
30682 <div class="foo">
30683 <style>.foo::before { content: "<foo>"; }</style>
30684 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30685 </div>
30686 !! html/php+tidy
30687 <div class="foo">
30688 <style>.foo::before { content: "<foo>"; }</style>
30689 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
30690 </div>
30691 !! end
30692
30693 !! test
30694 Validating that <style> isn't wrapped in a paragraph (T186965)
30695 !! options
30696 styletag=1
30697 !! wikitext
30698 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30699
30700 <style>.foo::before { content: "<foo>"; }</style>
30701
30702 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30703
30704 But if it's on a line with other content, let it be wrapped.
30705
30706 <style>.foo::before { content: "<foo>"; }</style> bar
30707
30708 foo <style>.foo::before { content: "<foo>"; }</style>
30709
30710 foo <style>.foo::before { content: "<foo>"; }</style> bar
30711
30712 And the same if we have non-paragraph-breaking whitespace
30713
30714 foo
30715 <style>.foo::before { content: "<foo>"; }</style>
30716 bar
30717 !! html/php
30718 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30719 </p>
30720 <style>.foo::before { content: "<foo>"; }</style>
30721 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
30722 <p>But if it's on a line with other content, let it be wrapped.
30723 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
30724 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
30725 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
30726 </p><p>And the same if we have non-paragraph-breaking whitespace
30727 </p><p>foo
30728 <style>.foo::before { content: "<foo>"; }</style>
30729 bar
30730 </p>
30731 !! end
30732
30733 !! test
30734 Validating that <link> isn't wrapped in a paragraph (T186965)
30735 !! options
30736 styletag=1
30737 !! wikitext
30738 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30739
30740 <link rel="foo" href="bar"/>
30741
30742 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30743
30744 But if it's on a line with other content, let it be wrapped.
30745
30746 <link rel="foo" href="bar"/> bar
30747
30748 foo <link rel="foo" href="bar"/>
30749
30750 foo <link rel="foo" href="bar"/> bar
30751
30752 And the same if we have non-paragraph-breaking whitespace
30753
30754 foo
30755 <link rel="foo" href="bar"/>
30756 bar
30757 !! html/php
30758 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
30759 </p>
30760 <link rel="foo" href="bar"/>
30761 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
30762 <p>But if it's on a line with other content, let it be wrapped.
30763 </p><p><link rel="foo" href="bar"/> bar
30764 </p><p>foo <link rel="foo" href="bar"/>
30765 </p><p>foo <link rel="foo" href="bar"/> bar
30766 </p><p>And the same if we have non-paragraph-breaking whitespace
30767 </p><p>foo
30768 <link rel="foo" href="bar"/>
30769 bar
30770 </p>
30771 !! end
30772
30773 !! test
30774 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
30775 !! config
30776 wgFragmentMode=[ 'html5', 'legacy' ]
30777 !! wikitext
30778 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30779 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30780 !! html/php
30781 <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>
30782 <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>
30783 </p>
30784 !! html/parsoid
30785 <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>
30786 <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>
30787 !! end
30788
30789 !! test
30790 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
30791 !! config
30792 wgFragmentMode=[ 'legacy' ]
30793 !! wikitext
30794 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
30795 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
30796 !! html/php
30797 <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>
30798 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
30799 </p>
30800 !! end
30801
30802 !! test
30803 Decoding of HTML entities in embedded HTML tags
30804 !! wikitext
30805 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30806 !! html/php
30807 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
30808
30809 !! html/parsoid
30810 <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>
30811 !! end
30812
30813 !! test
30814 Decoding of HTML entities in indicator names for IDs (T104196)
30815 !! options
30816 parsoid=wt2html,html2html
30817 showindicators
30818 !! wikitext
30819 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30820 !! html/php
30821 1&2&3&amp;4&amp;amp;5=Indicator
30822
30823 !! html/parsoid
30824 <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>
30825 !! end
30826
30827 # this version of the test strips out the ambiguity so Parsoid rts cleanly
30828 !! test
30829 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
30830 !! options
30831 showindicators
30832 !! wikitext
30833 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
30834 !! html/php
30835 1&2&3&amp;4&amp;amp;5=Indicator
30836
30837 !! html/parsoid
30838 <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>
30839 !! end
30840
30841 # This fragment mode is what Parsoid supports.
30842 !! test
30843 HTML5 ids: fallback to legacy
30844 !! config
30845 wgFragmentMode=[ 'html5', 'legacy' ]
30846 !! wikitext
30847 ==Foo bar==
30848
30849 ==foo Bar==
30850
30851 ==Тест==
30852
30853 ==Тест==
30854
30855 ==тест==
30856
30857 ==Hey < # " > % : '==
30858 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30859
30860 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30861
30862 <!-- These two links should produce identical HTML -->
30863 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30864
30865 !! html/php
30866 <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>
30867 <ul>
30868 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30869 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30870 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30871 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30872 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30873 <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>
30874 </ul>
30875 </div>
30876
30877 <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>
30878 <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>
30879 <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>
30880 <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>
30881 <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>
30882 <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>
30883 <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>
30884 </p><p>💩 <span id="💩"></span>
30885 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30886 </p>
30887 !! html/parsoid
30888 <h2 id="Foo_bar">Foo bar</h2>
30889
30890 <h2 id="foo_Bar_2">foo Bar</h2>
30891
30892 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
30893
30894 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
30895
30896 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
30897
30898 <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>
30899 <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>
30900
30901 <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>
30902
30903 <!-- These two links should produce identical HTML -->
30904 <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>
30905 !! end
30906
30907 # Parsoid doesn't support this mode
30908 !! test
30909 HTML5 ids: legacy with a fallback to modern
30910 !! config
30911 wgFragmentMode=[ 'legacy', 'html5' ]
30912 !! wikitext
30913 ==Foo bar==
30914
30915 ==foo Bar==
30916
30917 ==Тест==
30918
30919 ==Тест==
30920
30921 ==тест==
30922
30923 ==Hey < # " > % : '==
30924 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30925
30926 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30927
30928 <!-- These two links should produce identical HTML -->
30929 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30930
30931 !! html/php
30932 <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>
30933 <ul>
30934 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30935 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30936 <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>
30937 <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>
30938 <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>
30939 <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>
30940 </ul>
30941 </div>
30942
30943 <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>
30944 <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>
30945 <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>
30946 <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>
30947 <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>
30948 <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>
30949 <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>
30950 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30951 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30952 </p>
30953 !! end
30954
30955 # Parsoid doesn't support this mode.
30956 !! test
30957 HTML5 ids: no legacy
30958 !! config
30959 wgFragmentMode=[ 'html5' ]
30960 !! wikitext
30961 ==Foo bar==
30962
30963 ==foo Bar==
30964
30965 ==Тест==
30966
30967 ==Тест==
30968
30969 ==тест==
30970
30971 ==Hey < # " > % : '==
30972 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30973
30974 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30975
30976 <!-- These two links should produce identical HTML -->
30977 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30978
30979 !! html/php
30980 <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>
30981 <ul>
30982 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30983 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30984 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30985 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30986 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30987 <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>
30988 </ul>
30989 </div>
30990
30991 <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>
30992 <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>
30993 <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>
30994 <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>
30995 <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>
30996 <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>
30997 <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>
30998 </p><p>💩 <span id="💩"></span>
30999 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31000 </p>
31001 !! end
31002
31003 !! test
31004 T90902: Normalize weird characters in section IDs
31005 !! config
31006 wgFragmentMode=[ 'html5', 'legacy' ]
31007 !! wikitext
31008 ==Foo&nbsp;bar==
31009 [[#Foo&nbsp;bar]]
31010
31011 !! html/php
31012 <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>
31013 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31014 </p>
31015 !! html/parsoid
31016 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31017 <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>
31018 !! end
31019
31020 !! test
31021 T51672: Test for brackets in attributes of elements in external link texts
31022 !! wikitext
31023 [http://example.com/ link <span title="title with [brackets]">span</span>]
31024 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31025
31026 !! html/php
31027 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31028 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31029 </p>
31030 !! html/parsoid
31031 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31032 <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>
31033 !! end
31034
31035 !! test
31036 T72875: Test for brackets in attributes of elements in internal link texts
31037 !! wikitext
31038 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31039 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31040
31041 !! html/php
31042 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31043 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31044 </p>
31045 !! html/parsoid
31046 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31047 <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>
31048 !! end
31049
31050 !! test
31051 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31052 !! options
31053 parsoid={
31054 "modes": ["html2wt"]
31055 }
31056 !! html/parsoid
31057 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31058 <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>
31059 !! wikitext
31060 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31061 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31062 !! end
31063
31064 !! test
31065 T179544: {{anchorencode:}} output should be always usable in links
31066 !! config
31067 wgFragmentMode=[ 'html5' ]
31068 !! wikitext
31069 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31070 !! html/php
31071 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31072 </p>
31073 !! html/parsoid
31074 <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>
31075 !! end
31076
31077 ## ------------------------------
31078 ## Parsoid section-wrapping tests
31079 ## ------------------------------
31080 !! test
31081 Section wrapping for well-nested sections (no leading content)
31082 !! options
31083 parsoid={
31084 "wrapSections": true
31085 }
31086 !! wikitext
31087 =1=
31088 a
31089
31090 =2=
31091 b
31092
31093 ==2.1==
31094 c
31095
31096 ==2.2==
31097 d
31098
31099 ===2.2.1===
31100 e
31101
31102 =3=
31103 f
31104 !! html/parsoid
31105 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31106 <p>a</p>
31107
31108 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31109 <p>b</p>
31110
31111 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31112 <p>c</p>
31113
31114 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
31115 <p>d</p>
31116
31117 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
31118 <p>e</p>
31119
31120 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
31121 <p>f</p>
31122
31123 </section>
31124 !! end
31125
31126 !! test
31127 Section wrapping for well-nested sections (with leading content)
31128 !! options
31129 parsoid={
31130 "wrapSections": true
31131 }
31132 !! wikitext
31133 Para 1.
31134
31135 Para 2 with a <div>nested in it</div>
31136
31137 Para 3.
31138
31139 =1=
31140 a
31141
31142 =2=
31143 b
31144
31145 ==2.1==
31146 c
31147 !! html/parsoid
31148 <section data-mw-section-id="0"><p>Para 1.</p>
31149
31150 <p>Para 2 with a </p><div>nested in it</div>
31151
31152 <p>Para 3.</p>
31153
31154 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31155 <p>a</p>
31156
31157 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31158 <p>b</p>
31159
31160 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
31161 <p>c</p>
31162
31163 </section></section>
31164 !! end
31165
31166 !! test
31167 Section wrapping with template-generated sections (good nesting 1)
31168 !! options
31169 parsoid={
31170 "wrapSections": true
31171 }
31172 !! wikitext
31173 =1=
31174 a
31175
31176 {{echo|1=
31177 ==1.1==
31178 b
31179 }}
31180
31181 ==1.2==
31182 c
31183
31184 =2=
31185 d
31186 !! html/parsoid
31187 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31188 <p>a</p>
31189
31190 <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">
31191 </span><p about="#mwt1">b</p>
31192 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
31193 <p>c</p>
31194
31195 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
31196 <p>d</p></section>
31197 !! end
31198
31199 # In this example, the template scope is mildly expanded to incorporate the
31200 # trailing newline after the transclusion since that is part of section 1.1.1
31201 !! test
31202 Section wrapping with template-generated sections (good nesting 2)
31203 !! options
31204 parsoid={
31205 "wrapSections": true,
31206 "modes": ["wt2html", "wt2wt"]
31207 }
31208 !! wikitext
31209 =1=
31210 a
31211
31212 {{echo|1=
31213 ==1.1==
31214 b
31215 ===1.1.1===
31216 d
31217 }}
31218 =2=
31219 e
31220 !! html/parsoid
31221 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31222 <p>a</p>
31223
31224 <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">
31225 </span><p about="#mwt1">b</p><span about="#mwt1">
31226 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
31227 </span><p about="#mwt1">d</p><span about="#mwt1">
31228 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
31229 <p>e</p></section>
31230 !! end
31231
31232 # In this example, the template scope is mildly expanded to incorporate the
31233 # trailing newline after the transclusion since that is part of section 1.2.1
31234 !! test
31235 Section wrapping with template-generated sections (good nesting 3)
31236 !! options
31237 parsoid={
31238 "wrapSections": true,
31239 "modes": ["wt2html", "wt2wt"]
31240 }
31241 !! wikitext
31242 =1=
31243 a
31244
31245 {{echo|1=
31246 x
31247 ==1.1==
31248 b
31249 ==1.2==
31250 c
31251 ===1.2.1===
31252 d
31253 }}
31254 =2=
31255 e
31256 !! html/parsoid
31257 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
31258 <p>a</p>
31259
31260 <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">
31261 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
31262 </span><p about="#mwt1">b</p><span about="#mwt1">
31263 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
31264 </span><p about="#mwt1">c</p><span about="#mwt1">
31265 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
31266 </span><p about="#mwt1">d</p><span about="#mwt1">
31267 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
31268 <p>e</p></section>
31269 !! end
31270
31271 # Because of section-wrapping and template-wrapping interactions,
31272 # the scope of the template is expanded so that the template markup
31273 # is valid in the presence of <section> tags.
31274 # This exercises the s1 is null scenario in the wrapSections code
31275 !! test
31276 Section wrapping with template-generated sections (bad nesting 1)
31277 !! options
31278 parsoid={
31279 "wrapSections": true
31280 }
31281 !! wikitext
31282 <div>
31283 a
31284
31285 {{echo|
31286 =1=
31287 b
31288 }}
31289
31290 c
31291 </div>
31292 !! html/parsoid
31293 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
31294 <p>a</p>
31295
31296 <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"]}'>
31297 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
31298 </span><p about="#mwt1">b
31299 </p><span about="#mwt1">
31300
31301 </span><p about="#mwt1">c</p><span about="#mwt1">
31302 </span></section></div></section>
31303 !! end
31304
31305 # Because of section-wrapping and template-wrapping interactions,
31306 # the scope of the template is expanded so that the template markup
31307 # is valid in the presence of <section> tags.
31308 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
31309 !! test
31310 Section wrapping with template-generated sections (bad nesting 2)
31311 !! options
31312 parsoid={
31313 "wrapSections": true
31314 }
31315 !! wikitext
31316 =1=
31317 a
31318
31319 {{echo|1=
31320 =2=
31321 b
31322 ==2.1==
31323 c
31324 }}
31325
31326 d
31327
31328 =3=
31329 e
31330 !! html/parsoid
31331 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
31332 <p>a</p>
31333
31334 </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">
31335 </span><p about="#mwt1">b</p><span about="#mwt1">
31336 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
31337 </span><p about="#mwt1">c</p><span about="#mwt1">
31338
31339 </span><p about="#mwt1">d</p><span about="#mwt1">
31340
31341 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
31342 <p>e</p></section>
31343 !! end
31344
31345 # Because of section-wrapping and template-wrapping interactions,
31346 # additional template wrappers are added to <section> tags
31347 # so that template wrapping semantics are valid whether section
31348 # tags are retained or stripped. But, the template scope can expand
31349 # greatly when accounting for section tags.
31350 # This exercises the s1 and s2 are in different subtrees scenario
31351 !! test
31352 Section wrapping with template-generated sections (bad nesting 3)
31353 !! options
31354 parsoid={
31355 "wrapSections": true,
31356 "modes": ["wt2html", "wt2wt"]
31357 }
31358 !! wikitext
31359 =1=
31360 a
31361
31362 {{echo|1=
31363 ==1.2==
31364 b
31365 =2=
31366 c
31367 }}
31368
31369 d
31370
31371 =3=
31372 e
31373 !! html/parsoid
31374 <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>
31375 <p>a</p>
31376
31377 <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">
31378 </span><p about="#mwt1">b</p><span about="#mwt1">
31379 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
31380 </span><p about="#mwt1">c</p>
31381
31382 <p>d</p>
31383 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
31384 <p>e</p></section>
31385 !! end
31386
31387 !! test
31388 Section wrapping with uneditable lead section + div wrapping multiple sections
31389 !! options
31390 parsoid={
31391 "wrapSections": true
31392 }
31393 !! wikitext
31394 foo
31395
31396 <div style="border:1px solid red;">
31397 =1=
31398 a
31399
31400 ==1.1==
31401 b
31402
31403 =2=
31404 c
31405 </div>
31406
31407 =3=
31408 d
31409
31410 ==3.1==
31411 e
31412 !! html/parsoid
31413 <section data-mw-section-id="-1"><p>foo</p>
31414
31415 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31416 <section data-mw-section-id="1"><h1 id="1">1</h1>
31417 <p>a</p>
31418
31419 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31420 <p>b</p>
31421
31422 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31423 <p>c</p>
31424 </section></div>
31425
31426 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31427 <p>d</p>
31428
31429 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31430 <p>e</p>
31431 </section></section>
31432 !! end
31433
31434 !! test
31435 Section wrapping with editable lead section + div overlapping multiple sections
31436 !! options
31437 parsoid={
31438 "wrapSections": true
31439 }
31440 !! wikitext
31441 foo
31442
31443 =1=
31444 a
31445 <div style="border:1px solid red;">
31446 b
31447
31448 ==1.1==
31449 c
31450
31451 =2=
31452 d
31453 </div>
31454 e
31455
31456 =3=
31457 f
31458
31459 ==3.1==
31460 g
31461 !! html/parsoid
31462 <section data-mw-section-id="0"><p>foo</p>
31463
31464 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
31465 <p>a</p>
31466 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
31467 <p>b</p>
31468
31469 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
31470 <p>c</p>
31471
31472 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
31473 <p>d</p>
31474 </section></div>
31475 <p>e</p>
31476
31477 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
31478 <p>f</p>
31479
31480 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
31481 <p>g</p>
31482 </section></section>
31483 !! end
31484
31485 !! test
31486 HTML header tags should not be wrapped in section tags
31487 !! options
31488 parsoid={
31489 "wrapSections": true
31490 }
31491 !! wikitext
31492 foo
31493
31494 <h1>a</h1>
31495
31496 =b=
31497
31498 <h1>c</h1>
31499
31500 =d=
31501 !! html/parsoid
31502 <section data-mw-section-id="0"><p>foo</p>
31503
31504 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
31505
31506 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
31507
31508 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
31509
31510 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
31511 !! end
31512
31513 !! test
31514 Lead section containing only whitespace and comments.
31515 !! options
31516 parsoid={
31517 "wrapSections": true
31518 }
31519 !! wikitext
31520
31521 <!-- this is a comment, presumably significant to editors -->
31522 =1=
31523 a
31524
31525 =2=
31526 b
31527 !! html/parsoid
31528 <section data-mw-section-id="0" data-parsoid="{}">
31529 <!-- this is a comment, presumably significant to editors -->
31530 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
31531 <p>a</p>
31532
31533 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
31534 <p>b</p></section>
31535 !! end
31536
31537 !! test
31538 Pseudo-sections emitted by templates should have id -2
31539 !! options
31540 parsoid={
31541 "wrapSections": true
31542 }
31543 !! wikitext
31544 foo
31545 {{echo|<div>
31546 ==a==
31547 ==b==
31548 </div>
31549 }}
31550 !! html/parsoid
31551 <section data-mw-section-id="-1"><p>foo</p>
31552 </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}}]}'>
31553 <section data-mw-section-id="-1"><h2 id="a">a</h2>
31554 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
31555 </section></div><span about="#mwt1">
31556 </span></section>
31557 !! end
31558
31559 ##########################################################################
31560 Tests demonstrating white-space insensitivity in input wikitext
31561 for wikitext headings, wikitext list items, and wikitext table captions,
31562 headings, and cells. HTML versions of the same should preserve whitespace.
31563 ##########################################################################
31564 !! test
31565 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
31566 !! options
31567 parsoid={
31568 "modes": ["wt2html"],
31569 "preserveIEW": true
31570 }
31571 !! wikitext
31572 __NOTOC__
31573 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
31574 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
31575 == <!--Headings with fallback ids--> Личная жизнь ==
31576 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
31577 ; <!--term to define--> term : <!--term's definition--> definition
31578 {|
31579 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
31580 |-
31581 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
31582 |-
31583 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31584 |-
31585 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
31586 |-
31587 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
31588 |}
31589 : {|
31590 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
31591 |} foo <!--c1-->
31592 !! html/php+tidy
31593 <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>
31594 <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>
31595 <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>
31596 <ul><li>List item</li></ul>
31597 <dl><dt>term&#160;</dt>
31598 <dd>definition</dd></dl>
31599 <table>
31600 <caption>Table Caption
31601 </caption>
31602 <tbody><tr>
31603 <th>Table Heading 1</th>
31604 <th>Table Heading 2
31605 </th></tr>
31606 <tr>
31607 <td>Table Cell 1</td>
31608 <td>Table Cell 2
31609 </td></tr>
31610 <tr>
31611 <td>class="foo"</td>
31612 <td>Table Cell 3
31613 </td></tr>
31614 <tr>
31615 <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
31616 </td></tr></tbody></table>
31617 <dl><dd><table>
31618 <tbody><tr>
31619 <td>Table Cell 1</td>
31620 <td>Table Cell 2
31621 </td></tr></tbody></table> foo</dd></dl>
31622 !! html/parsoid
31623 <meta property="mw:PageProp/notoc">
31624 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
31625 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
31626 <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>
31627 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
31628 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
31629 <table>
31630 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
31631 <tbody><tr>
31632 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
31633 <tr>
31634 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31635 <tr>
31636 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
31637 <tr>
31638 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
31639 </tbody></table>
31640 <dl><dd><table>
31641 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
31642 </tbody></table> foo<!--c1--></dd></dl>
31643 !! end
31644
31645 # Looks like <caption> is not accepted in HTML
31646 !! test
31647 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
31648 !! options
31649 parsoid={
31650 "modes": ["wt2html"],
31651 "preserveIEW": true
31652 }
31653 !! wikitext
31654 __NOTOC__
31655 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31656 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31657 <table>
31658 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
31659 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
31660 </table>
31661 !! html/php+tidy
31662 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
31663 <ul><li> List item </li></ul>
31664 <table>
31665 <tbody><tr><th> Table Heading </th><th></th></tr>
31666 <tr><td> Table Cell </td><th></th></tr>
31667 </tbody></table>
31668 !! html/parsoid
31669 <meta property="mw:PageProp/notoc"/>
31670 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
31671 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
31672 <table>
31673 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
31674 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
31675 </tbody></table>
31676 !! end
31677
31678 !! test
31679 Do not trim whitespace in links and quotes
31680 !! options
31681 parsoid={
31682 "modes": ["wt2html"],
31683 "preserveIEW": true
31684 }
31685 !! wikitext
31686 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
31687 [[Foo| some text ]]
31688 !! html/php+tidy
31689 <p>foo <i> italic </i> and <b> bold </b>
31690 <a href="/wiki/Foo" title="Foo"> some text </a>
31691 </p>
31692 !! html/parsoid
31693 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
31694 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
31695 !! end
31696
31697 !! test
31698 Remove p tags surrounding a single element in a figcaption
31699 !! options
31700 parsoid=html2wt
31701 !! wikitext
31702 [[File:Foobar.jpg|right|200x200px|Caption]]
31703 !! html/parsoid
31704 <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>
31705 !! end
31706
31707 !! test
31708 Selser preserves lack of newline before list and allows newline after the list
31709 !! options
31710 parsoid={
31711 "modes": ["selser"],
31712 "scrubWikitext": true,
31713 "changes": [
31714 [ "ul", "after", "<p>footer</p>" ]
31715 ]
31716 }
31717 !! wikitext
31718 header
31719 *foo
31720 *bar
31721 !! wikitext/edited
31722 header
31723 *foo
31724 *bar
31725
31726 footer
31727 !! end
31728
31729
31730 !! test
31731 Selser does not introduce newlines between unedited paragraph preceding the list
31732 !! options
31733 parsoid={
31734 "modes": ["selser"],
31735 "changes": [
31736 [ "table tbody tr td p:last-child", "empty" ]
31737 ]
31738 }
31739 !! wikitext
31740 {|
31741 |
31742 header
31743 *foo
31744 *bar
31745 footer
31746 |}
31747 !! wikitext/edited
31748 {|
31749 |
31750 header
31751 *foo
31752 *bar
31753
31754 |}
31755 !! end
31756
31757 !! test
31758 Selser does not introduce newlines between unedited paragraph following the list
31759 !! options
31760 parsoid={
31761 "modes": ["selser"],
31762 "changes": [
31763 [ "table tbody tr td p:first-child", "empty" ]
31764 ]
31765 }
31766 !! wikitext
31767 {|
31768 |
31769 header
31770 *foo
31771 *bar
31772 footer
31773 |}
31774 !! wikitext/edited
31775 {|
31776 |
31777
31778 *foo
31779 *bar
31780 footer
31781 |}
31782 !! end
31783
31784 !! test
31785 Remove a list item but do not insert newline above list
31786 !! options
31787 parsoid={
31788 "modes": ["selser"],
31789 "changes": [
31790 [ "ul li:last-child", "remove" ]
31791 ]
31792 }
31793 !! wikitext
31794 header
31795 *foo
31796 *bar
31797 footer
31798 !! wikitext/edited
31799 header
31800 *foo
31801 footer
31802 !! end