parser: Validate $length in padleft/padright parser functions
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Template:Foo
61 !!text
62 FOO
63 !!endarticle
64
65 !! article
66 Template:Blank
67 !! text
68 !! endarticle
69
70 !! article
71 Template:pipe
72 !! text
73 |
74 !! endarticle
75
76 !! article
77 Template:=
78 !! text
79 <nowiki>=</nowiki>
80 !! endarticle
81
82 !!article
83 MediaWiki:bad image list
84 !!text
85 * [[File:Bad.jpg]] except [[Nasty page]]
86 !!endarticle
87
88 !! article
89 Template:inner list
90 !! text
91 * item 1
92 !! endarticle
93
94 !! article
95 Template:tbl-start
96 !! text
97 {|
98 !! endarticle
99
100 !! article
101 Template:tbl-end
102 !! text
103 |}
104 !! endarticle
105
106 !! article
107 Template:echo
108 !! text
109 {{{1}}}
110 !! endarticle
111
112 // For Serbian; localize Template namespace
113 !! article
114 Шаблон:Echo
115 !! text
116 {{{1}}}
117 !! endarticle
118
119 !! article
120 Template:echo_with_span
121 !! text
122 <span>{{{1}}}</span>
123 !! endarticle
124
125 !! article
126 Template:echo_with_div
127 !! text
128 <div>{{{1}}}</div>
129 !! endarticle
130
131 !! article
132 Template:blank_param
133 !! text
134 {{{1}}}
135 {{{}}}
136 !! endarticle
137
138 !! article
139 Template:table_attribs
140 !! text
141 <noinclude>
142 |</noinclude>style="color:red;"|Foo
143 !! endarticle
144
145 !! article
146 Template:table_attribs_2
147 !! text
148 <noinclude>
149 |</noinclude>style="color:red;"|Foo
150 |Bar||Baz
151 !! endarticle
152
153 !! article
154 Template:table_attribs_3
155 !! text
156 <noinclude>
157 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
158 !! endarticle
159
160 !! article
161 Template:table_attribs_4
162 !! text
163 | style="background-color:#DC241f;" width="10px" |
164 !! endarticle
165
166 !! article
167 Template:table_attribs_5
168 !! text
169 <noinclude>
170 |</noinclude>style="color:red;"||Bar
171 !! endarticle
172
173 !! article
174 Template:table_attribs_6
175 !! text
176 style="background: <nowiki>
177
178
179 red;</nowiki>" |
180 !! endarticle
181
182 !! article
183 Template:table_attribs_7
184 !! text
185 <noinclude>
186 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
187 !! endarticle
188
189 !! article
190 Template:table_header_cells
191 !! text
192 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
193 !! endarticle
194
195 !! article
196 Template:table_cells
197 !! text
198 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
199 !! endarticle
200
201 !! article
202 Template:PartialTable
203 !! text
204 {|
205 |-
206 !! endarticle
207
208 !! article
209 Template:image_attribs
210 !! text
211 <noinclude>
212 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
213 !! endarticle
214
215 ## See T48811 for details
216 !! article
217 Template:mixed_attr_content_template
218 !! text
219 style="color:red;" title="T48811"
220 |-
221 |foo
222 !! endarticle
223
224 !! article
225 Template:definition_list
226 !! text
227 one
228 ::two
229 !! endarticle
230
231 !! article
232 A?b
233 !! text
234 Weirdo titles!
235 !! endarticle
236
237 !!article
238 Template:Bullet
239 !!text
240 * Bar
241 !!endarticle
242
243 !!article
244 Template:OpenTable
245 !!text
246 {|
247 !!endarticle
248
249 !!article
250 Template:EmptyLITest
251 !!text
252 *a
253 *
254 *
255 *b
256 !!endarticle
257
258 !!article
259 Template:EmptyTRTest
260 !!text
261 {|
262 |-
263 |-
264 |foo
265 |-
266 |-
267 |bar
268 |}
269 !!endarticle
270
271 !!article
272 Template:EmptyTRWithHTMLAttrTest
273 !!text
274 <table>
275 <tr align="center"></tr>
276 <tr><td>foo</td></tr>
277 <tr align="center"></tr>
278 <tr><td>bar</td></tr>
279 </table>
280 !!endarticle
281
282 !! article
283 Template:With: Colon
284 !! text
285 Template with colon
286 !! endarticle
287
288 ###
289 ### Basic tests
290 ###
291
292 !! test
293 Blank input
294 !! wikitext
295 !! html
296 !! end
297
298 !! test
299 Simple paragraph
300 !! wikitext
301 This is a simple paragraph.
302 !! html
303 <p>This is a simple paragraph.
304 </p>
305 !! end
306
307 !! test
308 Paragraphs with extra newline spacing
309 !! wikitext
310 foo
311
312 bar
313
314
315 baz
316
317
318
319 booz
320 !! html
321 <p>foo
322 </p><p>bar
323 </p><p><br />
324 baz
325 </p><p><br />
326 </p><p>booz
327 </p>
328 !! end
329
330 !! test
331 Paragraphs with newline spacing with comment lines in between
332 !! wikitext
333 ----
334 a
335 <!--foo-->
336 b
337 ----
338 a
339 <!--foo--><!--More than 1 comment, still stripped-->
340 b
341 ----
342 a
343 <!--foo--> <!----> <!-- bar -->
344 b
345 ----
346 a
347 <!--foo-->
348
349 b
350 ----
351 a
352
353 <!--foo-->
354 b
355 ----
356 a
357 <!--foo-->
358
359
360 b
361 ----
362 a
363
364
365 <!--foo-->
366 b
367 ----
368 !! html
369 <hr />
370 <p>a
371 b
372 </p>
373 <hr />
374 <p>a
375 b
376 </p>
377 <hr />
378 <p>a
379 b
380 </p>
381 <hr />
382 <p>a
383 </p><p>b
384 </p>
385 <hr />
386 <p>a
387 </p><p>b
388 </p>
389 <hr />
390 <p>a
391 </p><p><br />
392 b
393 </p>
394 <hr />
395 <p>a
396 </p><p><br />
397 b
398 </p>
399 <hr />
400
401 !! end
402
403 !! test
404 Paragraphs with newline spacing with non-empty white-space lines in between
405 !! wikitext
406 ----
407 a
408
409 b
410 ----
411 a
412
413
414 b
415 ----
416 !! html
417 <hr />
418 <p>a
419 </p><p>b
420 </p>
421 <hr />
422 <p>a
423 </p><p><br />
424 b
425 </p>
426 <hr />
427
428 !! end
429
430 !! test
431 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
432 !! wikitext
433 ----
434 a
435 <!--foo-->
436 b
437 ----
438 a
439 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
440 b
441 ----
442 a
443
444 <!--foo-->
445 <!--bar-->
446 b
447 ----
448 a
449
450 <!--foo-->
451 <!--bar-->
452
453 b
454 ----
455 !! html
456 <hr />
457 <p>a
458 b
459 </p>
460 <hr />
461 <p>a
462 b
463 </p>
464 <hr />
465 <p>a
466 </p><p>b
467 </p>
468 <hr />
469 <p>a
470 </p><p><br />
471 b
472 </p>
473 <hr />
474
475 !! end
476
477 !! test
478 Extra newlines: More paragraphs with indented comment
479 !! wikitext
480 a
481
482 <!--boo-->
483
484 b
485 !! html
486 <p>a
487 </p><p><br />
488 b
489 </p>
490 !!end
491
492 !! test
493 Extra newlines followed by heading
494 !! wikitext
495 a
496
497
498
499 =b=
500 [[a]]
501
502
503 =b=
504 !! html
505 <p>a
506 </p><p><br />
507 </p>
508 <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>
509 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
510 </p><p><br />
511 </p>
512 <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>
513
514 !! end
515
516 !! test
517 Extra newlines between heading and content are swallowed
518 !! wikitext
519 =b=
520
521
522
523 [[a]]
524 !! html
525 <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>
526 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
527 </p>
528 !! end
529
530 !! test
531 Heading with line break in nowiki
532 !! options
533 parsoid=wt2html
534 !! config
535 wgFragmentMode=[ 'html5', 'legacy' ]
536 !! wikitext
537 ==A <nowiki>B
538 C</nowiki>==
539 !! html/php
540 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
541 C">A B
542 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>
543
544 !! html/parsoid
545 <h2 id="A_B
546 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
547 C</span></h2>
548 !! end
549
550 !! test
551 Parsing an URL
552 !! wikitext
553 http://fr.wikipedia.org/wiki/🍺
554 <!-- EasterEgg we love beer, better be able be able to link to it -->
555 !! html
556 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
557 </p>
558 !! end
559
560 !! test
561 Simple list
562 !! wikitext
563 *Item 1
564 *Item 2
565 !! html
566 <ul><li>Item 1</li>
567 <li>Item 2</li></ul>
568
569 !! end
570
571 !! test
572 Italics and bold
573 !! wikitext
574 *plain
575 *plain''italic''plain
576 *plain''italic''plain''italic''plain
577 *plain'''bold'''plain
578 *plain'''bold'''plain'''bold'''plain
579 *plain''italic''plain'''bold'''plain
580 *plain'''bold'''plain''italic''plain
581 *plain''italic'''bold-italic'''italic''plain
582 *plain'''bold''bold-italic''bold'''plain
583 *plain'''''bold-italic'''italic''plain
584 *plain'''''bold-italic''bold'''plain
585 *plain''italic'''bold-italic'''''plain
586 *plain'''bold''bold-italic'''''plain
587 *plain l'''italic''plain
588 *plain l''''bold''' plain
589 !! html
590 <ul><li>plain</li>
591 <li>plain<i>italic</i>plain</li>
592 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
593 <li>plain<b>bold</b>plain</li>
594 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
595 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
596 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
597 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
598 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
599 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
600 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
601 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
602 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
603 <li>plain l'<i>italic</i>plain</li>
604 <li>plain l'<b>bold</b> plain</li></ul>
605
606 !! end
607
608 # this example taken from the [[simple:Moon]] article (T49326)
609 !! test
610 Italics and possessives (1)
611 !! wikitext
612 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
613 !! html
614 <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
615 </p>
616 !! end
617
618 # this example taken from [[en:Flaming Pie]] (T51926)
619 !! test
620 Italics and possessives (2)
621 !! wikitext
622 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
623 !! html
624 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
625 </p>
626 !! end
627
628 # this example taken from [[en:Dictionary]] (T51926)
629 !! test
630 Italics and possessives (3)
631 !! wikitext
632 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''.
633 !! html
634 <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>.
635 </p>
636 !! end
637
638
639 ###
640 ### 2-quote opening sequence tests
641 ###
642 !! test
643 Italics and bold: 2-quote opening sequence: (2,2)
644 !! wikitext
645 ''foo''
646 !! html
647 <p><i>foo</i>
648 </p>
649 !!end
650
651 !! test
652 Italics and bold: 2-quote opening sequence: (2,3)
653 !! wikitext
654 ''foo'''
655 !! html/*
656 <p><i>foo'</i>
657 </p>
658 !!end
659
660 !! test
661 Italics and bold: 2-quote opening sequence: (2,4)
662 !! options
663 parsoid=wt2html
664 !! wikitext
665 ''foo''''
666 !! html/*
667 <p><i>foo''</i>
668 </p>
669 !!end
670
671 # same html as previous, but wikitext adjusted to match parsoid html2wt
672 !! test
673 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
674 !! wikitext
675 ''foo<nowiki>''</nowiki>''
676 !! html
677 <p><i>foo''</i>
678 </p>
679 !! end
680
681 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
682 !! test
683 Italics and bold: 2-quote opening sequence: (2,5)
684 !! options
685 parsoid=wt2html
686 !! wikitext
687 ''foo'''''
688 !! html/php
689 <p><i>foo</i>
690 </p>
691 !! html/parsoid
692 <p><i>foo</i><b></b>
693 </p>
694 !!end
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
699 !! wikitext
700 ''foo'''''<nowiki/>'''
701 !! html/php
702 <p><i>foo</i>
703 </p>
704 !! html/parsoid
705 <p><i>foo</i><b></b>
706 </p>
707 !! end
708
709
710 ###
711 ### 3-quote opening sequence tests
712 ###
713
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,2)
716 !! wikitext
717 '''foo''
718 !! html/*
719 <p>'<i>foo</i>
720 </p>
721 !!end
722
723 !! test
724 Italics and bold: 3-quote opening sequence: (3,3)
725 !! wikitext
726 '''foo'''
727 !! html
728 <p><b>foo</b>
729 </p>
730 !!end
731
732 !! test
733 Italics and bold: 3-quote opening sequence: (3,4)
734 !! wikitext
735 '''foo''''
736 !! html/*
737 <p><b>foo'</b>
738 </p>
739 !!end
740
741 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
742 !! test
743 Italics and bold: 3-quote opening sequence: (3,5)
744 !! options
745 parsoid=wt2html
746 !! wikitext
747 '''foo'''''
748 !! html/php
749 <p><b>foo</b>
750 </p>
751 !! html/parsoid
752 <p><b>foo</b><i></i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
759 !! wikitext
760 '''foo'''''<nowiki/>''
761 !! html/php
762 <p><b>foo</b>
763 </p>
764 !! html/parsoid
765 <p><b>foo</b><i></i>
766 </p>
767 !! end
768
769
770 ###
771 ### 4-quote opening sequence tests
772 ###
773
774 !! test
775 Italics and bold: 4-quote opening sequence: (4,2)
776 !! options
777 parsoid=wt2html
778 !! wikitext
779 ''''foo''
780 !! html/*
781 <p>''<i>foo</i>
782 </p>
783 !!end
784
785 # same html as previous, but wikitext adjusted to match parsoid html2wt
786 !! test
787 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
788 !! wikitext
789 <nowiki>''</nowiki>''foo''
790 !! html
791 <p>''<i>foo</i>
792 </p>
793 !! end
794
795 !! test
796 Italics and bold: 4-quote opening sequence: (4,3)
797 !! wikitext
798 ''''foo'''
799 !! html/*
800 <p>'<b>foo</b>
801 </p>
802 !!end
803
804 !! test
805 Italics and bold: 4-quote opening sequence: (4,4)
806 !! options
807 parsoid=wt2html
808 !! wikitext
809 ''''foo''''
810 !! html/*
811 <p>'<b>foo'</b>
812 </p>
813 !!end
814
815 # same html as previous, but wikitext adjusted to match parsoid html2wt
816 !! test
817 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
818 !! wikitext
819 '<nowiki/>'''foo''''
820 !! html
821 <p>'<b>foo'</b>
822 </p>
823 !! end
824
825 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
826 !! test
827 Italics and bold: 4-quote opening sequence: (4,5)
828 !! options
829 parsoid=wt2html
830 !! wikitext
831 ''''foo'''''
832 !! html/php
833 <p>'<b>foo</b>
834 </p>
835 !! html/parsoid
836 <p>'<b>foo</b><i></i>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
843 !! wikitext
844 '<nowiki/>'''foo'''''<nowiki/>''
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
854 ###
855 ### 5-quote opening sequence tests
856 ###
857
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,2)
860 !! options
861 parsoid=wt2html
862 !! wikitext
863 '''''foo''
864 !! html/*
865 <p><b><i>foo</i></b>
866 </p>
867 !!end
868
869 # same html as previous, but wikitext adjusted to match parsoid html2wt
870 !! test
871 Italics and bold: 5-quote opening sequence: (5,2+3)
872 !! wikitext
873 '''''foo'''''
874 !! html/*
875 <p><i><b>foo</b></i>
876 </p>
877 !! end
878
879 !! test
880 Italics and bold: 5-quote opening sequence: (5,3)
881 !! options
882 parsoid=wt2html
883 !! wikitext
884 '''''foo'''
885 !! html/*
886 <p><i><b>foo</b></i>
887 </p>
888 !!end
889
890 # same html as previous, but wikitext adjusted to match parsoid html2wt
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,3+2)
893 !! wikitext
894 '''''foo'''''
895 !! html
896 <p><i><b>foo</b></i>
897 </p>
898 !! end
899
900 !! test
901 Italics and bold: 5-quote opening sequence: (5,4)
902 !! options
903 parsoid=wt2html
904 !! wikitext
905 '''''foo''''
906 !! html/*
907 <p><i><b>foo'</b></i>
908 </p>
909 !!end
910
911 !! test
912 Italics and bold: 5-quote opening sequence: (5,5)
913 !! wikitext
914 '''''foo'''''
915 !! html
916 <p><i><b>foo</b></i>
917 </p>
918 !!end
919
920 !! test
921 Italics and bold: 5-quote opening sequence: (5,6)
922 !! wikitext
923 '''''foo''''''
924 !! html/*
925 <p><i><b>foo'</b></i>
926 </p>
927 !! end
928
929 ###
930 ### multiple quote sequences in a line
931 ###
932
933 !! test
934 Italics and bold: multiple quote sequences: (2,4,2)
935 !! options
936 parsoid=wt2html
937 !! wikitext
938 ''foo''''bar''
939 !! html/*
940 <p><i>foo'<b>bar</b></i>
941 </p>
942 !! end
943
944 # same html as previous, but wikitext adjusted to match parsoid html2wt
945 !! test
946 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
947 !! wikitext
948 ''foo'<nowiki/>'''bar'''''
949 !! html
950 <p><i>foo'<b>bar</b></i>
951 </p>
952 !! end
953
954 !! test
955 Italics and bold: multiple quote sequences: (2,4,3)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 ''foo''''bar'''
960 !! html/*
961 <p><i>foo'<b>bar</b></i>
962 </p>
963 !! end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
968 !! wikitext
969 ''foo'<nowiki/>'''bar'''''
970 !! html
971 <p><i>foo'<b>bar</b></i>
972 </p>
973 !! end
974
975 !! test
976 Italics and bold: multiple quote sequences: (2,4,4)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 ''foo''''bar''''
981 !! html/*
982 <p><i>foo'<b>bar'</b></i>
983 </p>
984 !! end
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 !! test
988 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
989 !! wikitext
990 ''foo'<nowiki/>'''bar'<nowiki/>'''''
991 !! html
992 <p><i>foo'<b>bar'</b></i>
993 </p>
994 !! end
995
996 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
997 !! test
998 Italics and bold: multiple quote sequences: (3,4,2)
999 !! options
1000 parsoid=wt2html
1001 !! wikitext
1002 '''foo''''bar''
1003 !! html/php
1004 <p><b>foo'</b>bar
1005 </p>
1006 !! html/parsoid
1007 <p><b>foo'</b>bar<i></i>
1008 </p>
1009 !! end
1010
1011 # same html as previous, but wikitext adjusted to match parsoid html2wt
1012 !! test
1013 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1014 !! wikitext
1015 '''foo''''bar''<nowiki/>''
1016 !! html/php
1017 <p><b>foo'</b>bar
1018 </p>
1019 !! html/parsoid
1020 <p><b>foo'</b>bar<i></i>
1021 </p>
1022 !! end
1023
1024 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1025 !! test
1026 Italics and bold: multiple quote sequences: (3,4,3)
1027 !! options
1028 parsoid=wt2html
1029 !! wikitext
1030 '''foo''''bar'''
1031 !! html/php
1032 <p><b>foo'</b>bar
1033 </p>
1034 !! html/parsoid
1035 <p><b>foo'</b>bar<b></b>
1036 </p>
1037 !! end
1038
1039 # same html as previous, but wikitext adjusted to match parsoid html2wt
1040 !! test
1041 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1042 !! wikitext
1043 '''foo''''bar'''<nowiki/>'''
1044 !! html/php
1045 <p><b>foo'</b>bar
1046 </p>
1047 !! html/parsoid
1048 <p><b>foo'</b>bar<b></b>
1049 </p>
1050 !! end
1051
1052 ###
1053 ### other quote tests
1054 ###
1055 !! test
1056 Italics and bold: other quote tests: (2,3,5)
1057 !! wikitext
1058 ''this is about '''foo's family'''''
1059 !! html
1060 <p><i>this is about <b>foo's family</b></i>
1061 </p>
1062 !!end
1063
1064
1065 !! test
1066 Italics and bold: other quote tests: (2,(3,3),2)
1067 !! wikitext
1068 ''this is about '''foo's''' family''
1069 !! html
1070 <p><i>this is about <b>foo's</b> family</i>
1071 </p>
1072 !!end
1073
1074
1075 !! test
1076 Italics and bold: other quote tests: (3,2,3,2)
1077 !! options
1078 parsoid=wt2html
1079 !! wikitext
1080 '''this is about ''foo'''s family''
1081 !! html/*
1082 <p><b>this is about <i>foo</i></b><i>s family</i>
1083 </p>
1084 !!end
1085
1086
1087 # same html as previous, but wikitext adjusted to match parsoid html2wt
1088 !! test
1089 Italics and bold: other quote tests: (3,2,3+2+2,2)
1090 !! wikitext
1091 '''this is about ''foo'''''<nowiki/>''s family''
1092 !! html
1093 <p><b>this is about <i>foo</i></b><i>s family</i>
1094 </p>
1095 !! end
1096
1097
1098 !! test
1099 Italics and bold: other quote tests: (3,2,3,3)
1100 !! wikitext
1101 '''this is about ''foo'''s family'''
1102 !! html/*
1103 <p>'<i>this is about </i>foo<b>s family</b>
1104 </p>
1105 !!end
1106
1107
1108 !! test
1109 Italics and bold: other quote tests: (3,(2,2),3)
1110 !! wikitext
1111 '''this is about ''foo's'' family'''
1112 !! html
1113 <p><b>this is about <i>foo's</i> family</b>
1114 </p>
1115 !!end
1116
1117
1118 !! test
1119 Italicized possessive
1120 !! wikitext
1121 The ''[[Main Page]]'''s talk page.
1122 !! html/php
1123 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1124 </p>
1125 !! html/parsoid
1126 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1127 !! end
1128
1129 !! test
1130 Quote balancing context should be restricted to td/th cells on the same wikitext line
1131 !! options
1132 parsoid=wt2html,wt2wt
1133 !! wikitext
1134 {|
1135 !''a!!''b
1136 |''a||''b
1137 |}
1138 !! html+tidy
1139 <table>
1140 <tbody><tr>
1141 <th><i>a</i></th>
1142 <th><i>b</i>
1143 </th>
1144 <td><i>a</i></td>
1145 <td><i>b</i>
1146 </td></tr></tbody></table>
1147 !! end
1148
1149 ###
1150 ### Non-html5 tags
1151 ###
1152
1153 !! test
1154 Non-html5 tags should be accepted
1155 !! wikitext
1156 <center>''foo''</center>
1157 <big>''foo''</big>
1158 <font>''foo''</font>
1159 <strike>''foo''</strike>
1160 <tt>''foo''</tt>
1161 !! html
1162 <center><i>foo</i></center>
1163 <p><big><i>foo</i></big>
1164 <font><i>foo</i></font>
1165 <strike><i>foo</i></strike>
1166 <tt><i>foo</i></tt>
1167 </p>
1168 !! end
1169
1170 !! test
1171 <wbr> is valid wikitext (T54468)
1172 !! wikitext
1173 <wbr>
1174 !! html
1175 <p><wbr />
1176 </p>
1177 !! end
1178
1179 # <strike> is HTML4, <s> is HTML4/5.
1180 !! test
1181 <s> or <strike> for strikethrough
1182 !! wikitext
1183 <strike>strike</strike>
1184
1185 <s>s</s>
1186 !! html
1187 <p><strike>strike</strike>
1188 </p><p><s>s</s>
1189 </p>
1190 !! end
1191
1192 ## a not permitted
1193 ## i,b,br omitted
1194 !! test
1195 Text-level semantic html elements in wikitext
1196 !! wikitext
1197 <em>text</em>
1198 <strong>text</strong>
1199 <small>text</small>
1200 <s>text</s>
1201 <cite>text</cite>
1202 <q>text</q>
1203 <dfn>text</dfn>
1204 <abbr>text</abbr>
1205 <data>text</data>
1206 <time>text</time>
1207 <code>text</code>
1208 <var>text</var>
1209 <samp>text</samp>
1210 <kbd>text</kbd>
1211 <sub>text</sub>
1212 <u>text</u>
1213 <mark>text</mark>
1214 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1215 <bdi>text</bdi>
1216 <bdo>text</bdo>
1217 <span>text</span>
1218 <wbr />
1219 !! html
1220 <p><em>text</em>
1221 <strong>text</strong>
1222 <small>text</small>
1223 <s>text</s>
1224 <cite>text</cite>
1225 <q>text</q>
1226 <dfn>text</dfn>
1227 <abbr>text</abbr>
1228 <data>text</data>
1229 <time>text</time>
1230 <code>text</code>
1231 <var>text</var>
1232 <samp>text</samp>
1233 <kbd>text</kbd>
1234 <sub>text</sub>
1235 <u>text</u>
1236 <mark>text</mark>
1237 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1238 <bdi>text</bdi>
1239 <bdo>text</bdo>
1240 <span>text</span>
1241 <wbr />
1242 </p>
1243 !! end
1244
1245 # test cases taken from
1246 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1247 !! test
1248 Ruby markup (W3C-style)
1249 !! wikitext
1250 ;Mono-ruby for individual base characters
1251 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1252 ;Group ruby
1253 :<ruby>今日<rt>きょう</rt></ruby>
1254 ;Jukugo ruby
1255 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1256 ;Inline ruby
1257 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1258 ;Double-sided ruby
1259 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1260
1261 <ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 !! html
1267 <dl><dt>Mono-ruby for individual base characters</dt>
1268 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1269 <dt>Group ruby</dt>
1270 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1271 <dt>Jukugo ruby</dt>
1272 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1273 <dt>Inline ruby</dt>
1274 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1275 <dt>Double-sided ruby</dt>
1276 <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>
1277 <p><ruby>
1278 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1279 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1280 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1281 </ruby>
1282 </p>
1283 !! end
1284
1285 # The next two test different paths in the sanitizer.
1286 !! test
1287 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1288 !! wikitext
1289 <blockquote|>a</blockquote>
1290
1291 <b→> doesn't terminate </b→>
1292
1293 <bä> doesn't terminate </bä>
1294
1295 <boo> doesn't terminate </boo>
1296
1297 <s.foo> doesn't terminate </s.foo>
1298
1299 <sub-ID#1>
1300 !! html
1301 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1302 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1303 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1304 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1305 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1306 </p><p>&lt;sub-ID#1&gt;
1307 </p>
1308 !! end
1309
1310 !! test
1311 Non-word characters don't terminate tag names
1312 !! wikitext
1313 <blockquote|>a</blockquote>
1314
1315 <b→> doesn't terminate </b→>
1316
1317 <bä> doesn't terminate </bä>
1318
1319 <boo> doesn't terminate </boo>
1320
1321 <s.foo> doesn't terminate </s.foo>
1322
1323 <sub-ID#1>
1324 !! html+tidy
1325 <p>&lt;blockquote|&gt;a
1326 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1327 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1328 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1329 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1330 </p><p>&lt;sub-ID#1&gt;
1331 </p>
1332 !! end
1333
1334 ###
1335 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1336 ### This checks that HTML5 tags (with non-word characters in the tag
1337 ### name) make it safely through the parser -- the Sanitizer will
1338 ### munge them later, as it should.
1339 ###
1340 !! test
1341 Non-word characters are valid in extension tags (T19663)
1342 !! wikitext
1343 <tåg>tåg</tåg>
1344 !! html/php
1345 <pre>
1346 'tåg'
1347 array (
1348 )
1349 </pre>
1350
1351 !! html/parsoid
1352 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1353 !! end
1354
1355 !! test
1356 Isolated close tags should be treated as literal text (T54760)
1357 !! options
1358 parsoid=wt2html
1359 !! wikitext
1360 </b>
1361
1362 <s.foo>s</s>
1363 !! html/php+tidy
1364 <p class="mw-empty-elt">
1365 </p><p>&lt;s.foo&gt;s
1366 </p>
1367 !! html/parsoid
1368 <p>&lt;s.foo&gt;s</p>
1369 !! end
1370
1371 ###
1372 ### Special characters
1373 ###
1374
1375 !! test
1376 Bare pipe character (T54363)
1377 !! wikitext
1378 |
1379 !! html
1380 <p>|
1381 </p>
1382 !! end
1383
1384 !! test
1385 Bare pipe character from a template (T54363)
1386 !! wikitext
1387 {{pipe}}
1388 !! html
1389 <p>|
1390 </p>
1391 !! end
1392
1393 ###
1394 ### <nowiki> test cases
1395 ###
1396
1397 !! test
1398 <nowiki> unordered list
1399 !! wikitext
1400 <nowiki>* This is not an unordered list item.</nowiki>
1401 !! html/php
1402 <p>* This is not an unordered list item.
1403 </p>
1404 !! html/parsoid
1405 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1406 !! end
1407
1408 !! test
1409 <nowiki> spacing
1410 !! wikitext
1411 <nowiki>Lorem ipsum dolor
1412
1413 sed abit.
1414 sed nullum.
1415
1416 :and a colon
1417 </nowiki>
1418 !! html/php
1419 <p>Lorem ipsum dolor
1420
1421 sed abit.
1422 sed nullum.
1423
1424 :and a colon
1425
1426 </p>
1427 !! html/parsoid
1428 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1429
1430 sed abit.
1431 sed nullum.
1432
1433 :and a colon
1434 </span></p>
1435 !! end
1436
1437 !! test
1438 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1439 !! wikitext
1440 <nowiki><span class="error"></nowiki>
1441 !! html/php
1442 <p>&lt;span class="error"&gt;
1443 </p>
1444 !! html/parsoid
1445 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1446 !! end
1447
1448 !! test
1449 nowiki 3
1450 !! wikitext
1451 :There is not nowiki.
1452 :There is <nowiki>nowiki</nowiki>.
1453
1454 #There is not nowiki.
1455 #There is <nowiki>nowiki</nowiki>.
1456
1457 *There is not nowiki.
1458 *There is <nowiki>nowiki</nowiki>.
1459 !! html/php
1460 <dl><dd>There is not nowiki.</dd>
1461 <dd>There is nowiki.</dd></dl>
1462 <ol><li>There is not nowiki.</li>
1463 <li>There is nowiki.</li></ol>
1464 <ul><li>There is not nowiki.</li>
1465 <li>There is nowiki.</li></ul>
1466
1467 !! html/parsoid
1468 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1469 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1470
1471 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1472 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1473
1474 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1475 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1476 !! end
1477
1478 !! test
1479 Entities inside <nowiki>
1480 !! wikitext
1481 <nowiki>&lt;</nowiki>
1482 !! html/php
1483 <p>&lt;
1484 </p>
1485 !! html/parsoid
1486 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1487 !! end
1488
1489 !! test
1490 Entities inside template parameters
1491 !! wikitext
1492 {{echo|&ndash;}}
1493 !! html/php+tidy
1494 <p>&#8211;
1495 </p>
1496 !! html/parsoid
1497 <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>
1498 !! end
1499
1500 !! test
1501 Properly escape nowiki when combined with other wiki markup
1502 !! options
1503 parsoid=html2wt
1504 !! html/parsoid
1505 <p>* &lt;/nowiki&gt; tag</p>
1506 !! wikitext
1507 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1508 !! end
1509
1510 !! test
1511 T93824: Put escaped HTML tags inside nowiki
1512 !! options
1513 parsoid=html2wt
1514 !! html/parsoid
1515 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1516 !! wikitext
1517 <nowiki><h2>foo</h2></nowiki>
1518 !! end
1519
1520 !! test
1521 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1526 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1527 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1528 !! wikitext
1529 This text: L'[[Foo]]
1530 This text: L<nowiki>''</nowiki>[[Foo]]
1531 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1532 !! end
1533
1534 # This test fails because wikitext whitespace is not normalized before comparing.
1535 !! test
1536 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1537 !! options
1538 parsoid=html2wt
1539 !! html/parsoid
1540 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1541 </p>
1542 !! wikitext
1543 This text : L<nowiki>''</nowiki>[[Foo]]
1544 !! end
1545
1546 # This test and the next one are html2wt only as they test that incorrect wikitext
1547 # passed in template arguments gets escaped or wrapped in nowikis where required.
1548 !! test
1549 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1550 !! options
1551 parsoid=html2wt
1552 !! html/parsoid
1553 <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>
1554 <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>
1555 !! wikitext
1556 {{echo|foo{{!}}bar}}
1557 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1558 !! end
1559
1560 !! test
1561 T53961: Output correct nowikis in template arguments
1562 !! options
1563 parsoid=html2wt
1564 !! html/parsoid
1565 <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>
1566 <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>
1567 <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>
1568 <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>
1569 <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>
1570 !! wikitext
1571 {{echo|a [ b}}
1572 {{echo|<nowiki>a }} b</nowiki>}}
1573 {{echo|<nowiki>a [[ b</nowiki>}}
1574 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1575 {{echo|a <nowiki>}</nowiki>}}
1576 !! end
1577
1578 !! test
1579 Cases where "!!" needs nowiki protection
1580 !! options
1581 parsoid=html2wt
1582 !! html/parsoid
1583 <table>
1584 <tr><th>this needs protection !! here</th></tr>
1585 </table>
1586
1587 <table>
1588 <tr><th>this does not need
1589 protection !! here</th></tr>
1590 </table>
1591 !! wikitext
1592 {|
1593 !<nowiki>this needs protection !! here</nowiki>
1594 |}
1595
1596 {|
1597 !this does not need
1598 protection !! here
1599 |}
1600 !! end
1601
1602 ###
1603 ### Comments
1604 ###
1605 !! test
1606 Comments and Indent-Pre
1607 !! wikitext
1608 <!-- comment 1 --> asdf
1609
1610 <!-- comment 1 --> asdf
1611 <!-- comment 2 -->
1612
1613 <!-- comment 1 --> asdf
1614 <!-- comment 2 -->xyz
1615
1616 <!-- comment 1 --> asdf
1617 <!-- comment 2 --> xyz
1618 !! html
1619 <pre>asdf
1620 </pre>
1621 <pre>asdf
1622 </pre>
1623 <pre>asdf
1624 </pre>
1625 <p>xyz
1626 </p>
1627 <pre>asdf
1628 xyz
1629 </pre>
1630 !! end
1631
1632 !! test
1633 Comment test 2a
1634 !! wikitext
1635 asdf
1636 <!-- comment 1 -->
1637 jkl
1638 !! html
1639 <p>asdf
1640 jkl
1641 </p>
1642 !! end
1643
1644 !! test
1645 Comment test 2b
1646 !! wikitext
1647 asdf
1648 <!-- comment 1 -->
1649
1650 jkl
1651 !! html
1652 <p>asdf
1653 </p><p>jkl
1654 </p>
1655 !! end
1656
1657 !! test
1658 Comment test 3
1659 !! wikitext
1660 asdf
1661 <!-- comment 1 -->
1662 <!-- comment 2 -->
1663 jkl
1664 !! html
1665 <p>asdf
1666 jkl
1667 </p>
1668 !! end
1669
1670 !! test
1671 Comment test 4
1672 !! wikitext
1673 asdf<!-- comment 1 -->jkl
1674 !! html
1675 <p>asdfjkl
1676 </p>
1677 !! end
1678
1679 !! test
1680 Comment spacing
1681 !! wikitext
1682 a
1683 <!-- foo --> b <!-- bar -->
1684 c
1685 !! html
1686 <p>a
1687 </p>
1688 <pre> b
1689 </pre>
1690 <p>c
1691 </p>
1692 !! end
1693
1694 !! test
1695 Comment whitespace
1696 !! wikitext
1697 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1698 !! html
1699
1700 !! end
1701
1702 !! test
1703 Comment semantics and delimiters
1704 !! wikitext
1705 <!-- --><!----><!-----><!------>
1706 !! html/php
1707
1708 !! html/parsoid
1709 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1710 !! end
1711
1712 !! test
1713 Comment semantics and delimiters, redux
1714 !! wikitext
1715 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1716 -- foo -- funky huh? ... -->
1717 !! html/php
1718
1719 !! html/parsoid
1720 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1721 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1722 !! end
1723
1724 !! test
1725 Comment semantics and delimiters: directors cut
1726 !! wikitext
1727 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1728 everything starting with < followed by !-- until the first -- and > we see,
1729 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1730 -->-->
1731 !! html/php
1732 <p>--&gt;
1733 </p>
1734 !! html/parsoid
1735 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1736 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1737 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1738 --><p>--></p>
1739 !! end
1740
1741 !! test
1742 Comment semantics: nesting
1743 !! wikitext
1744 <!--<!-- no, we're not going to do anything fancy here -->-->
1745 !! html/php
1746 <p>--&gt;
1747 </p>
1748 !! html/parsoid
1749 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1750 !! end
1751
1752 # Parsoid closes the unclosed comment, even if it means a slight
1753 # round-trip diff.
1754 !! test
1755 Comment semantics: unclosed comment at end
1756 !! options
1757 parsoid=wt2html,html2html
1758 !! wikitext
1759 <!--This comment will run out to the end of the document
1760 !! html/php
1761
1762 !! html/parsoid
1763 <!--This comment will run out to the end of the document-->
1764 !! end
1765
1766 !! test
1767 Comment semantics: normalize comments to play nice with XML and browsers
1768 !! wikitext
1769 <!-- Browsers --!> think this is closed -->
1770 <!--> This would normally be text -->
1771 <!---> As would this -->
1772 <!-- XML doesn't like trailing dashes -------->
1773 <!-- Nor doubled hyphens -- anywhere in the data -->
1774 But this is not a comment.
1775 !! html/php
1776 <p>But this is not a comment.
1777 </p>
1778 !! html/parsoid
1779 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1780 <!--&#x3E; This would normally be text -->
1781 <!--&#x2D;&#x3E; As would this -->
1782 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1783 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1784 <p>But this is not a comment.</p>
1785 !! end
1786
1787 !! test
1788 Comment semantics: round-trip even text which contains encoded -->
1789 !! wikitext
1790 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1791 !! html/parsoid
1792 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1793 !! end
1794
1795 !! test
1796 Comment in template title
1797 !! wikitext
1798 {{f<!---->oo}}
1799 !! html
1800 <p>FOO
1801 </p>
1802 !! end
1803
1804 !! test
1805 Comment on its own line post-expand
1806 !! wikitext
1807 a
1808 {{blank}}<!---->
1809 b
1810 !! html
1811 <p>a
1812 </p><p>b
1813 </p>
1814 !! end
1815
1816 !! test
1817 Comment on its own line post-expand with non-significant whitespace
1818 !! wikitext
1819 a
1820 {{blank}} <!---->
1821 b
1822 !! html
1823 <p>a
1824 </p><p>b
1825 </p>
1826 !! end
1827
1828 !! test
1829 Multiple comments should still parse as SOL-transparent
1830 !! options
1831 parsoid=wt2html,wt2wt
1832 !! wikitext
1833 <!--c1-->*a
1834 <!--c2--><!--c3--><!--c4-->*b
1835 !! html/php
1836 <ul><li>a</li>
1837 <li>b</li></ul>
1838
1839 !! html/parsoid
1840 <!--c1--><ul>
1841 <li>a
1842 </li>
1843 <!--c2--><!--c3--><!--c4-->
1844 <li>b
1845 </li>
1846 </ul>
1847 !! end
1848
1849 ## Make sure ">" gets escaped in comments to avoid XSS
1850 !! test
1851 IE conditional comments
1852 !! wikitext
1853 <!--[if lt IE 9]>
1854 <script>alert('hi');</script>
1855 <![endif]-->
1856 !! html/parsoid
1857 <!--[if lt IE 9]&#x3E;
1858 <script&#x3E;alert('hi');</script&#x3E;
1859 <![endif]-->
1860 !! end
1861
1862 ###
1863 ### paragraph wrapping tests
1864 ###
1865
1866 !! test
1867 No block tags
1868 !! wikitext
1869 a
1870
1871 b
1872 !! html
1873 <p>a
1874 </p><p>b
1875 </p>
1876 !! end
1877
1878 !! test
1879 Block tag on one line (<div>)
1880 !! wikitext
1881 a <div>foo</div>
1882
1883 b
1884 !! html
1885 a <div>foo</div>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a </p><div>foo</div>
1890 <p>b
1891 </p>
1892 !! end
1893
1894 # Remex wraps empty tag runs with p-tags.
1895 # Parsoid strips them out during p-wrapping.
1896 !! test
1897 No p-wrappable content
1898 !! wikitext
1899 <span><div>x</div></span>
1900 <span><s><div>x</div></s></span>
1901 <small><em></em></small><span><s><div>x</div></s></span>
1902 !! html/php+tidy
1903 <span><div>x</div></span>
1904 <span><s><div>x</div></s></span>
1905 <p><small><em></em></small></p><span><s><div>x</div></s></span>
1906 !! html/parsoid
1907 <span><div>x</div></span>
1908 <span><s><div>x</div></s></span>
1909 <small><em></em></small><span><s><div>x</div></s></span>
1910 !! end
1911
1912 # T177612: Parsoid-only test
1913 !! test
1914 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
1915 !! wikitext
1916 {{echo|<span><div>x</div></span>}}
1917 x
1918 !! html/parsoid
1919 <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>
1920 <p>x</p>
1921 !! end
1922
1923 !! test
1924 Block tag on one line (<blockquote>)
1925 !! wikitext
1926 a <blockquote>foo</blockquote>
1927
1928 b
1929 !! html
1930 a <blockquote>foo</blockquote>
1931 <p>b
1932 </p>
1933 !! html+tidy
1934 <p>a </p><blockquote><p>foo</p></blockquote>
1935 <p>b
1936 </p>
1937 !! end
1938
1939 !! test
1940 Block tag on both lines (<div>)
1941 !! wikitext
1942 a <div>foo</div>
1943
1944 b <div>foo</div>
1945 !! html
1946 a <div>foo</div>
1947 b <div>foo</div>
1948
1949 !! html+tidy
1950 <p>a </p><div>foo</div><p>
1951 b </p><div>foo</div>
1952 !! end
1953
1954 !! test
1955 Block tag on both lines (<blockquote>)
1956 !! wikitext
1957 a <blockquote>foo</blockquote>
1958
1959 b <blockquote>foo</blockquote>
1960 !! html
1961 a <blockquote>foo</blockquote>
1962 b <blockquote>foo</blockquote>
1963
1964 !! html+tidy
1965 <p>a </p><blockquote><p>foo</p></blockquote><p>
1966 b </p><blockquote><p>foo</p></blockquote>
1967 !! end
1968
1969 !! test
1970 Multiple lines without block tags
1971 !! wikitext
1972 <div>foo</div> a
1973 b
1974 c
1975 d<!--foo--> e
1976 x <div>foo</div> z
1977 !! html
1978 <div>foo</div> a
1979 <p>b
1980 c
1981 d e
1982 </p>
1983 x <div>foo</div> z
1984
1985 !! html+tidy
1986 <div>foo</div><p> a
1987 </p><p>b
1988 c
1989 d e
1990 </p><p>
1991 x </p><div>foo</div><p> z
1992 </p>
1993 !! end
1994
1995 # The difference between Parsoid & Remex here
1996 # is because of Parsoid's Tidy-emulation code
1997 # for p-wrapping. We'll start work to remove this
1998 # emulation code in Parsoid sooner than later.
1999 # Remex wraps empty tag runs with p-tags.
2000 # Parsoid strips them out in a separate pass.
2001 !! test
2002 Empty lines between lines with block tags
2003 !! wikitext
2004 <div></div>
2005
2006
2007 <div></div>a
2008
2009 b
2010 <div>a</div>b
2011
2012 <div>b</div>d
2013
2014
2015 <div>e</div>
2016 !! html
2017 <div></div>
2018 <p><br />
2019 </p>
2020 <div></div>a
2021 <p>b
2022 </p>
2023 <div>a</div>b
2024 <div>b</div>d
2025 <p><br />
2026 </p>
2027 <div>e</div>
2028
2029 !! html+tidy
2030 <div></div>
2031 <p><br />
2032 </p>
2033 <div></div><p>a
2034 </p><p>b
2035 </p>
2036 <div>a</div><p>b
2037 </p><div>b</div><p>d
2038 </p><p><br />
2039 </p>
2040 <div>e</div>
2041 !! html/parsoid
2042 <div data-parsoid='{"stx":"html"}'></div>
2043
2044 <p><br /></p>
2045 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2046
2047 <p>b</p>
2048 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2049
2050 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2051
2052 <p><br /></p>
2053 <div data-parsoid='{"stx":"html"}'>e</div>
2054 !! end
2055
2056 !! test
2057 Unclosed HTML p-tags should be handled properly
2058 !! wikitext
2059 <div><p>foo</div>
2060 a
2061
2062 b
2063 !! html/php+tidy
2064 <div><p>foo</p></div>
2065 <p>a
2066 </p><p>b
2067 </p>
2068 !! html/parsoid
2069 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2070 <p>a</p>
2071 <p>b</p>
2072 !! end
2073
2074 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2075 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2076 ## them for now.
2077 !! test
2078 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2079 !! options
2080 parsoid=wt2html
2081 !! wikitext
2082 a [[Category:A1]] [[Category:A2]]
2083 [[Category:A3]]
2084 [[Category:A4]]
2085 !! html/parsoid
2086 <p>a</p>
2087 <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"/>
2088 !! end
2089
2090 !! test
2091 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2092 !! options
2093 parsoid=wt2html
2094 !! wikitext
2095 [[Category:A1]]a
2096 !! html/parsoid
2097 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2098 !! end
2099
2100 !! test
2101 No paragraph necessary for SOL transparent template
2102 !! wikitext
2103 <span><div>foo</div></span>
2104 [[Category:Foo]]
2105
2106 <span><div>foo</div></span>
2107 {{echo|[[Category:Foo]]}}
2108 !! html/php
2109 <span><div>foo</div></span>
2110 <span><div>foo</div></span>
2111
2112 !! html/parsoid
2113 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2114 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2115
2116 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2117 <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}}]}'/>
2118 !! end
2119
2120 !! test
2121 Avoid expanding multiline sol transparent template ranges unnecessarily
2122 !! wikitext
2123 hi
2124
2125
2126 {{echo|<br/>
2127 }}
2128
2129 [[Category:Ho]]
2130 !! html/php
2131 <p>hi
2132 </p><p><br />
2133 <br />
2134 </p>
2135 !! html/parsoid
2136 <p>hi</p>
2137
2138 <p><br />
2139 <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">
2140 </span></p>
2141
2142 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2143 !! end
2144
2145 ###
2146 ### Preformatted text
2147 ###
2148
2149 !! test
2150 Preformatted text
2151 !! wikitext
2152 This is some
2153 Preformatted text
2154 With ''italic''
2155 And '''bold'''
2156 And a [[Main Page|link]]
2157 !! html
2158 <pre>This is some
2159 Preformatted text
2160 With <i>italic</i>
2161 And <b>bold</b>
2162 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2163 </pre>
2164 !! end
2165
2166 !! test
2167 Tabs don't trigger preformatted text
2168 !! wikitext
2169 This is not
2170 preformatted text.
2171 This is preformatted text.
2172 So is this.
2173 !! html/php
2174 <p> This is not
2175 preformatted text.
2176 </p>
2177 <pre>This is preformatted text.
2178 So is this.
2179 </pre>
2180 !! html/parsoid
2181 <p> This is not
2182 preformatted text.</p>
2183 <pre>This is preformatted text.
2184 So is this.</pre>
2185 !! end
2186
2187 !! test
2188 Space before tab needs nowiki pre protection
2189 !! options
2190 parsoid=html2wt
2191 !! html/parsoid
2192 <p> a</p>
2193 !! wikitext
2194 <nowiki> </nowiki> a
2195 !! end
2196
2197 !! test
2198 Ident preformatting with inline content
2199 !! wikitext
2200 a
2201 ''b''
2202 !! html
2203 <pre>a
2204 <i>b</i>
2205 </pre>
2206 !! end
2207
2208 !! test
2209 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2210 !! wikitext
2211 <pre><nowiki>
2212 <b>
2213 <cite>
2214 <em>
2215 </nowiki></pre>
2216 !! html
2217 <pre>
2218 &lt;b&gt;
2219 &lt;cite&gt;
2220 &lt;em&gt;
2221 </pre>
2222
2223 !! end
2224
2225 !! test
2226 Regression with preformatted in <center>
2227 !! wikitext
2228 <center>
2229 Blah
2230 </center>
2231 !! html
2232 <center>
2233 <pre>Blah
2234 </pre>
2235 </center>
2236
2237 !! end
2238
2239 !! test
2240 T54763: Preformatted in <blockquote>
2241 !! wikitext
2242 <blockquote>
2243 Blah
2244 {|
2245 |
2246 indented cell (no pre-wrapping!)
2247 |}
2248 </blockquote>
2249 !! html
2250 <blockquote>
2251 <p> Blah
2252 </p>
2253 <table>
2254 <tr>
2255 <td>
2256 <p> indented cell (no pre-wrapping!)
2257 </p>
2258 </td></tr></table>
2259 </blockquote>
2260
2261 !! end
2262
2263 !! test
2264 T53086: Double newlines in blockquotes should be turned into paragraphs
2265 !! wikitext
2266 <blockquote>
2267 Foo
2268
2269 Bar
2270 </blockquote>
2271 !! html
2272 <blockquote>
2273 <p>Foo
2274 </p><p>Bar
2275 </p>
2276 </blockquote>
2277
2278 !! end
2279
2280 !! test
2281 T17491: <ins>/<del> in blockquote
2282 !! wikitext
2283 <blockquote>
2284 Foo <del>bar</del> <ins>baz</ins> quux
2285 </blockquote>
2286 !! html
2287 <blockquote>
2288 <p>Foo <del>bar</del> <ins>baz</ins> quux
2289 </p>
2290 </blockquote>
2291
2292 !! end
2293
2294 !! test
2295 T17491: <ins>/<del> in blockquote (2)
2296 !! wikitext
2297 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2298 </blockquote>
2299 !! html
2300 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2301 </blockquote>
2302
2303 !! html+tidy
2304 <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
2305 </p></blockquote>
2306 !! end
2307
2308 !! test
2309 <pre> with attributes (T5202)
2310 !! wikitext
2311 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2312 !! html
2313 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2314
2315 !! end
2316
2317 !! test
2318 <pre> with width attribute (T5202)
2319 !! wikitext
2320 <pre width="8">Narrow screen goodies</pre>
2321 !! html
2322 <pre width="8">Narrow screen goodies</pre>
2323
2324 !! end
2325
2326 !! test
2327 <pre> with forbidden attribute (T5202)
2328 !! wikitext
2329 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2330 !! html
2331 <pre width="8">Narrow screen goodies</pre>
2332
2333 !! end
2334
2335 !! test
2336 Entities inside <pre>
2337 !! wikitext
2338 <pre>&lt;</pre>
2339 !! html
2340 <pre>&lt;</pre>
2341
2342 !! end
2343
2344 !! test
2345 <pre> with forbidden attribute values (T5202)
2346 !! wikitext
2347 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2348 !! html
2349 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2350
2351 !! end
2352
2353 !! test
2354 <nowiki> inside <pre> (T15238)
2355 !! wikitext
2356 <pre>
2357 <nowiki>
2358 </pre>
2359 <pre>
2360 <nowiki></nowiki>
2361 </pre>
2362 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2363 !! html
2364 <pre>
2365 &lt;nowiki&gt;
2366 </pre>
2367 <pre>
2368
2369 </pre>
2370 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2371
2372 !! end
2373
2374 !! test
2375 <nowiki> inside of #tag:pre
2376 !! wikitext
2377 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2378 !! html/php
2379 <pre>Foo &#8594;bar</pre>
2380
2381 !! html/parsoid
2382 <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>
2383 !! end
2384
2385 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2386 ## aren't enclosed in nowikis.
2387 !! test
2388 <nowiki> and <pre> preference (first one wins)
2389 !! options
2390 parsoid=wt2html
2391 !! wikitext
2392 <pre>
2393 <nowiki>
2394 </pre>
2395 </nowiki>
2396 </pre>
2397
2398 <nowiki>
2399 <pre>
2400 <nowiki>
2401 </pre>
2402 </nowiki>
2403 </pre>
2404
2405 !! html/php
2406 <pre>
2407 &lt;nowiki&gt;
2408 </pre>
2409 <p>&lt;/nowiki&gt;
2410 &lt;/pre&gt;
2411 </p><p>
2412 &lt;pre&gt;
2413 &lt;nowiki&gt;
2414 &lt;/pre&gt;
2415
2416 &lt;/pre&gt;
2417 </p>
2418 !! html/parsoid
2419 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2420 </pre>
2421 <p>&lt;/nowiki></p>
2422
2423
2424 <p><span typeof="mw:Nowiki">
2425 &lt;pre>
2426 &lt;nowiki>
2427 &lt;/pre>
2428 </span></p>
2429 !! end
2430
2431 !! test
2432 </pre> inside nowiki
2433 !! wikitext
2434 <nowiki></pre></nowiki>
2435 !! html
2436 <p>&lt;/pre&gt;
2437 </p>
2438 !! end
2439
2440 !! test
2441 Empty pre; pre inside other HTML tags (T56946)
2442 !! wikitext
2443 a
2444
2445 <div><pre>
2446 foo
2447 </pre></div>
2448 <pre></pre>
2449 !! html/php+tidy
2450 <p>a
2451 </p>
2452 <div><pre>foo
2453 </pre></div>
2454 <pre></pre>
2455 !! html/parsoid
2456 <p>a</p>
2457
2458 <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
2459 </pre></div>
2460 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2461 !! end
2462
2463 !! test
2464 HTML pre followed by indent-pre
2465 !! wikitext
2466 <pre>foo</pre>
2467 bar
2468 !! html
2469 <pre>foo</pre>
2470 <pre>bar
2471 </pre>
2472 !! end
2473
2474 !! test
2475 Block tag pre
2476 !! wikitext
2477 <p><pre>foo</pre></p>
2478 !! html/php+tidy
2479 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2480 !! html/parsoid
2481 <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>
2482 !! end
2483
2484 !!test
2485 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2486 !! wikitext
2487 {{echo|}}
2488 !! html
2489
2490 !!end
2491
2492 !!test
2493 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2494 !! wikitext
2495 {{echo|
2496 foo}}
2497 !! html
2498 <p>foo
2499 </p>
2500 !!end
2501
2502 !! test
2503 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2504 !! wikitext
2505 {{echo|a
2506 b}}
2507 !! html
2508 <pre>a
2509 </pre>
2510 <p>b
2511 </p>
2512 !!end
2513
2514 !! test
2515 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2516 !! wikitext
2517 {{echo|a
2518 b
2519 c
2520 d
2521 e
2522 }}
2523 !! html
2524 <pre>a
2525 </pre>
2526 <p>b
2527 c
2528 </p>
2529 <pre>d
2530 </pre>
2531 <p>e
2532 </p>
2533 !!end
2534
2535 !!test
2536 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2537 !! wikitext
2538 {{echo| foo}}
2539
2540 {{echo| foo}}{{echo| bar}}
2541
2542 {{echo| foo}}
2543 {{echo| bar}}
2544
2545 {{echo|<!--cmt--> foo}}
2546
2547 <!--cmt-->{{echo| foo}}
2548
2549 {{echo|{{echo| }}bar}}
2550 !! html
2551 <pre>foo
2552 </pre>
2553 <pre>foo bar
2554 </pre>
2555 <pre>foo
2556 bar
2557 </pre>
2558 <pre>foo
2559 </pre>
2560 <pre>foo
2561 </pre>
2562 <pre>bar
2563 </pre>
2564 !!end
2565
2566 !! test
2567 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2568 !! wikitext
2569 {{echo| }}a
2570
2571 {{echo|
2572 }}a
2573
2574 {{echo|
2575 b}}
2576
2577 {{echo|a
2578 }}b
2579
2580 {{echo|a
2581 }} b
2582 !! html
2583 <pre>a
2584 </pre>
2585 <p><br />
2586 </p>
2587 <pre>a
2588 </pre>
2589 <p><br />
2590 </p>
2591 <pre>b
2592 </pre>
2593 <p>a
2594 </p>
2595 <pre>b
2596 </pre>
2597 <p>a
2598 </p>
2599 <pre>b
2600 </pre>
2601 !!end
2602
2603 ## Hmm, should Parsoid rt this?
2604 !! test
2605 Pres with newline attributes
2606 !! options
2607 parsoid=wt2html,html2html
2608 !! wikitext
2609 <pre class="one
2610 two">hi</pre>
2611 !! html/php
2612 <pre class="one two">hi</pre>
2613
2614 !! html/parsoid
2615 <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2616 !! end
2617
2618 !! test
2619 Things that look like <pre> tags aren't treated as such
2620 !! wikitext
2621 Barack Obama <President> of the United States
2622 <President></President>
2623 !! html
2624 <p>Barack Obama &lt;President&gt; of the United States
2625 &lt;President&gt;&lt;/President&gt;
2626 </p>
2627 !! end
2628
2629 !! test
2630 Handle broken pre-like tags (T66025)
2631 !! options
2632 parsoid=wt2html
2633 !! wikitext
2634 {{echo|<pre <pre>x</pre>}}
2635
2636 <table><pre </table>
2637 !! html/php
2638 <pre>x</pre>
2639 <table>&lt;pre </table>
2640
2641 !! html/php+tidy
2642 <pre>x</pre>
2643 &lt;pre <table></table>
2644 !! html/parsoid
2645 <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","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>
2646
2647
2648 <p>&lt;pre </p>
2649
2650 <table></table>
2651 !! end
2652
2653 !! test
2654 Parsoid: handle pre with space after attribute
2655 !! options
2656 parsoid=wt2html
2657 !! wikitext
2658 <pre style="width:50%;" >{{echo|foo}}</pre>
2659 !! html/php
2660 <pre style="width:50%;">{{echo|foo}}</pre>
2661
2662 !! html/parsoid
2663 <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>
2664 !! end
2665
2666 # TODO / maybe: fix wt2wt for this
2667 !! test
2668 Parsoid: Don't paragraph-wrap fosterable content
2669 !! options
2670 parsoid=wt2html
2671 !! wikitext
2672 {|
2673 <td></td>
2674 <td></td>
2675
2676
2677
2678 |}
2679 !! html
2680 <table>
2681
2682 <tbody>
2683 <tr>
2684 <td></td>
2685
2686 <td></td></tr>
2687
2688
2689
2690 </tbody></table>
2691 !! end
2692
2693 !! test
2694 Self-closed pre
2695 !! wikitext
2696 <pre />
2697 !! html/php
2698 <pre></pre>
2699
2700 !! html/parsoid
2701 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
2702 !! end
2703
2704 !! test
2705 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2706 !! options
2707 parsoid=wt2html
2708 !! wikitext
2709 {|
2710 <td>
2711 <td>
2712 </td>
2713
2714
2715
2716 |}
2717 !! html
2718 <table>
2719
2720 <tbody>
2721 <tr>
2722 <td></td>
2723
2724 <td>
2725 </td></tr>
2726
2727
2728
2729 </tbody></table>
2730 !! end
2731
2732
2733 #--------------------------------------------------------------------
2734 # Transclusion parameter whitespace stripping tests
2735 # Behavior is different for positional and named parameters
2736 #--------------------------------------------------------------------
2737 !! test
2738 Templates: Strip leading and trailing whitespace from named-param values
2739 !! wikitext
2740 {{echo|1= a }}
2741
2742 {{echo|1= {{echo|b}} }}
2743
2744 {{echo| 1 =
2745 c }}
2746
2747 {{echo| 1 =
2748 * d
2749 }}
2750 !! html
2751 <p>a
2752 </p><p>b
2753 </p><p>c
2754 </p>
2755 <ul><li>d</li></ul>
2756
2757 !! end
2758
2759 !! test
2760 Templates: Don't strip whitespace from positional-param values
2761 !! wikitext
2762 {{echo|a }}
2763
2764 {{echo|{{echo|b}} }}
2765
2766 {{echo| c
2767 }}
2768
2769 {{echo| {{echo|d}}
2770 }}
2771
2772 {{echo|
2773 e}}
2774
2775 {{echo|
2776 *f}}
2777
2778 {{echo|
2779 }}g
2780 !! html
2781 <p>a
2782 </p><p>b
2783 </p>
2784 <pre>c
2785 </pre>
2786 <p><br />
2787 </p>
2788 <pre>d
2789 </pre>
2790 <p><br />
2791 </p>
2792 <pre>e
2793 </pre>
2794 <p><br />
2795 </p>
2796 <ul><li>f</li></ul>
2797 <p><br />
2798 </p>
2799 <pre>g
2800 </pre>
2801 !! end
2802
2803 !! test
2804 Templates: Don't recognize targets split by newlines
2805 !! options
2806 parsoid=wt2html
2807 !! wikitext
2808 {{ech
2809 o|foo}}
2810 !! html/php
2811 <p>{{ech
2812 o|foo}}
2813 </p>
2814 !! html/parsoid
2815 <p>{{ech
2816 o|foo}}</p>
2817 !! end
2818
2819 !! test
2820 Templates: Recognize targets when newlines and comments don't split the target
2821 !! options
2822 parsoid=wt2html
2823 !! wikitext
2824 {{
2825 <!--X--> ech<!--X-->o<!--X-->
2826 <!--X--> <!--X-->
2827
2828 |foo}}
2829 !! html/php
2830 <p>foo
2831 </p>
2832 !! html/parsoid
2833 <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>
2834 !! end
2835
2836 !! test
2837 Templates: Handle empty comment-and-ws-only lines correctly
2838 !! wikitext
2839 {{echo|foo
2840 <!--should be ignored-->
2841 <!--should be ignored as well-->
2842 bar}}
2843 !! html/php
2844 <p>foo
2845 bar
2846 </p>
2847 !! html/parsoid
2848 <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>
2849 !! end
2850
2851 !! test
2852 Templates: Handle comments in the target
2853 !! wikitext
2854 {{echo
2855 <!-- should be ignored -->
2856 |foo}}
2857
2858 {{echo
2859 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2860 |foo}}
2861
2862 {{echo<!-- should be ignored -->
2863 |foo}}
2864
2865 {{echo<!-- should be ignored -->|foo}}
2866
2867 {{<!-- should be ignored -->echo|foo}}
2868 !! html/php
2869 <p>foo
2870 </p><p>foo
2871 </p><p>foo
2872 </p><p>foo
2873 </p><p>foo
2874 </p>
2875 !! html/parsoid
2876 <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>
2877
2878 <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>
2879
2880 <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>
2881
2882 <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>
2883
2884 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2885 !! end
2886
2887 !! test
2888 Templates: Handle comments in parameter names (T69657)
2889 !! wikitext
2890 {{echo|1
2891 <!-- should be ignored -->
2892 =foo}}
2893
2894 {{echo|
2895 <!-- should be ignored -->
2896 1 = foo}}
2897
2898 {{echo|1<!-- should be ignored -->=foo}}
2899
2900 {{echo|<!-- should be ignored -->1=foo}}
2901 !! html/php
2902 <p>foo
2903 </p><p>foo
2904 </p><p>foo
2905 </p><p>foo
2906 </p>
2907 !! html/parsoid
2908 <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>
2909
2910 <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>
2911
2912 <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>
2913
2914 <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>
2915 !! end
2916
2917 !! test
2918 Templates: Other wikitext in parameter names (T69657)
2919 !! wikitext
2920 {{echo|''1''=foo}}
2921 !! html/php
2922 <p>{{{1}}}
2923 </p>
2924 !! html/parsoid
2925 <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>
2926 !! end
2927
2928 !! test
2929 Templates: With colons
2930 !! wikitext
2931 {{With: Colon}}
2932 !! html/php
2933 <p>Template with colon
2934 </p>
2935 !! html/parsoid
2936 <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>
2937 !! end
2938
2939 #--------------------------------------------------------------------
2940 # Transclusion parameter escaping tests
2941 #--------------------------------------------------------------------
2942
2943 !! test
2944 Templates: Parsoid parameter escaping test 1
2945 !! wikitext
2946 {{echo|[foo]|{{echo|[bar]}}}}
2947 !! html/php+tidy
2948 <p>[foo]
2949 </p>
2950 !! html/parsoid
2951 <p about="#mwt1" typeof="mw:Transclusion"
2952 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2953 !! end
2954
2955 !! test
2956 Parsoid: Pipes in external links in template parameter
2957 !! wikitext
2958 {{echo|[{{echo|http://example.com}} link]}}
2959 !! html/php+tidy
2960 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
2961 </p>
2962 !! html/parsoid
2963 <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>
2964 !! end
2965
2966 !! test
2967 Parsoid: pipe in transclusion parameter
2968 !! wikitext
2969 {{echo|http://foo.com/a&#124;b}}
2970 !! html/php+tidy
2971 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
2972 </p>
2973 !! html/parsoid
2974 <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>
2975 !! end
2976
2977 !! test
2978 Parsoid: Pipe in external link target and content in template parameter
2979 !! options
2980 parsoid=html2wt,wt2wt
2981 !! wikitext
2982 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2983 !! html/php+tidy
2984 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
2985 </p>
2986 !! html/parsoid
2987 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2988 typeof="mw:Transclusion"
2989 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2990 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2991 !! end
2992
2993 !! test
2994 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2995 !! options
2996 parsoid
2997 !! wikitext
2998 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2999 !! html
3000 <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>
3001 !! end
3002
3003 !! test
3004 Templates: Don't escape already nowiki-escaped text in template parameters
3005 !! options
3006 parsoid=html2wt,wt2wt
3007 !! wikitext
3008 {{echo|foo<nowiki>|</nowiki>bar}}
3009 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3010 {{echo|<nowiki></nowiki>}}
3011 !! html/php+tidy
3012 <p>foo|bar
3013 &lt;div&gt;
3014
3015 </p>
3016 !! html/parsoid
3017 <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>
3018 <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>
3019 <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>
3020 </p>
3021 !! end
3022
3023 ## T54824
3024 !! test
3025 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3026 !! options
3027 parsoid=html2wt,wt2wt
3028 !! wikitext
3029 {{echo|{{echo|1=bar}}}}
3030 !! html/php+tidy
3031 <p>bar
3032 </p>
3033 !! html/parsoid
3034 <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>
3035 !! end
3036
3037 ## T58733
3038 !! test
3039 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3040 !! wikitext
3041 {{echo|a : b}}
3042 !! html/php+tidy
3043 <p>a&#160;: b
3044 </p>
3045 !! html/parsoid
3046 <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>
3047 !! end
3048
3049 ## T73412
3050 !! test
3051 Templates: Preserve blank parameter names
3052 !! wikitext
3053 {{echo|=foo}}
3054 !! html/php+tidy
3055 <p>{{{1}}}
3056 </p>
3057 !! html/parsoid
3058 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3059 !! end
3060
3061 !! test
3062 Templates: Preserve blank parameter names in other positions
3063 !! wikitext
3064 {{blank_param|bar|=foo}}
3065 !! html/php+tidy
3066 <p>bar
3067 foo
3068 </p>
3069 !! html/parsoid
3070 <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
3071 foo</p>
3072 !! end
3073
3074 ###
3075 ### Parsoid-centric tests for testing RT edge cases for pre
3076 ###
3077
3078 !!test
3079 1a. Indent-Pre and Comments
3080 !! wikitext
3081 a
3082 <!--a-->
3083 c
3084 !! html
3085 <pre>a
3086 </pre>
3087 <p>c
3088 </p>
3089 !!end
3090
3091 !!test
3092 1b. Indent-Pre and Comments
3093 !! wikitext
3094 a
3095 <!--a-->
3096 c
3097 !! html
3098 <pre>a
3099 </pre>
3100 <p>c
3101 </p>
3102 !!end
3103
3104 !!test
3105 1c. Indent-Pre and Comments
3106 !! wikitext
3107 <!--a--> a
3108
3109 <!--a--> a
3110 !! html
3111 <pre> a
3112 </pre>
3113 <pre> a
3114 </pre>
3115 !!end
3116
3117 !!test
3118 1d. Indent-Pre and Comments
3119 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3120 !! wikitext
3121 <!--a--> a
3122
3123 <!--b-->b
3124 !! html
3125 <pre>a
3126 </pre>
3127 <pre>b
3128 </pre>
3129 !!end
3130
3131 !!test
3132 2a. Indent-Pre and tables
3133 !! wikitext
3134 {|
3135 |-
3136 !h1!!h2
3137 |foo||bar
3138 |}
3139 !! html
3140 <table>
3141
3142 <tr>
3143 <th>h1</th>
3144 <th>h2
3145 </th>
3146 <td>foo</td>
3147 <td>bar
3148 </td></tr></table>
3149
3150 !!end
3151
3152 !!test
3153 2b. Indent-Pre and tables
3154 !! wikitext
3155 {|
3156 |-
3157 |foo
3158 |}
3159 !! html
3160 <table>
3161
3162 <tr>
3163 <td>foo
3164 </td></tr></table>
3165
3166 !!end
3167
3168 !!test
3169 2c. Indent-Pre and tables (T44252)
3170 !! wikitext
3171 {|
3172 |+foo
3173 ! |bar
3174 |}
3175 !! html
3176 <table>
3177 <caption>foo
3178 </caption>
3179 <tr>
3180 <th>bar
3181 </th></tr></table>
3182
3183 !!end
3184
3185 !!test
3186 2d. Indent-Pre and tables
3187 !! wikitext
3188 a
3189 {|
3190 |b
3191 |}
3192 !! html/php
3193 <pre>a
3194 </pre>
3195 <table>
3196 <tr>
3197 <td>b
3198 </td></tr></table>
3199
3200 !! html/parsoid
3201 <pre>a</pre>
3202 <table>
3203 <tbody><tr><td> b</td></tr>
3204 </tbody></table>
3205 !!end
3206
3207 !!test
3208 2e. Indent-Pre and table-line syntax
3209 !! wikitext
3210 a
3211 | b
3212 | c
3213 !! html/php
3214 <pre>a
3215 | b
3216 | c
3217 </pre>
3218 !!end
3219
3220 !!test
3221 2f. Indent-pre started by table-line syntax
3222 !! wikitext
3223 a
3224 | b
3225 | c
3226 !! html/php
3227 <p>a
3228 </p>
3229 <pre>| b
3230 | c
3231 </pre>
3232 !! html/parsoid
3233 <p>a</p>
3234 <pre>
3235 | b
3236 | c</pre>
3237 !!end
3238
3239 !! test
3240 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3241 !! wikitext
3242 <table>
3243 <tr>
3244 <td>
3245 Text that should be rendered preformatted
3246 </td>
3247 </tr>
3248 </table>
3249 !! html
3250 <table>
3251 <tr>
3252 <td>
3253 <pre>Text that should be rendered preformatted
3254 </pre>
3255 </td>
3256 </tr>
3257 </table>
3258
3259 !! end
3260
3261 !!test
3262 3a. Indent-Pre and block tags (single-line html)
3263 !! wikitext
3264 a <p> foo </p>
3265 b <div> foo </div>
3266 c <blockquote> foo </blockquote>
3267 <span> foo </span>
3268 !! html
3269 a <p> foo </p>
3270 b <div> foo </div>
3271 c <blockquote> foo </blockquote>
3272 <pre><span> foo </span>
3273 </pre>
3274 !! html/parsoid
3275 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3276 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3277 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3278 <pre><span> foo </span>
3279 </pre>
3280 !! html/php+tidy
3281 <p> a </p><p> foo </p><p>
3282 b </p><div> foo </div><p>
3283 c </p><blockquote><p> foo </p></blockquote>
3284 <pre><span> foo </span>
3285 </pre>
3286 !! end
3287
3288 !!test
3289 3b. Indent-Pre and block tags (multi-line html)
3290 !! wikitext
3291 a <span>foo</span>
3292 b <div> foo </div>
3293 !! html
3294 <pre>a <span>foo</span>
3295 </pre>
3296 b <div> foo </div>
3297
3298 !! html/parsoid
3299 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3300 b <div data-parsoid='{"stx":"html"}'> foo </div>
3301 !! html/php+tidy
3302 <pre>a <span>foo</span>
3303 </pre><p>
3304 b </p><div> foo </div>
3305 !!end
3306
3307 !!test
3308 3c. Indent-Pre and block tags (pre-content on separate line)
3309 !! wikitext
3310 <p>
3311 foo
3312 </p>
3313
3314 <div>
3315 foo
3316 </div>
3317
3318 <center>
3319 foo
3320 </center>
3321
3322 <blockquote>
3323 foo
3324 </blockquote>
3325
3326 <blockquote>
3327 <pre>
3328 foo
3329 </pre>
3330 </blockquote>
3331
3332 <table><tr><td>
3333 foo
3334 </td></tr></table>
3335
3336 <ul><li>
3337 foo
3338 </li></ul>
3339
3340 !! html
3341 <p>
3342 foo
3343 </p>
3344 <div>
3345 <pre>foo
3346 </pre>
3347 </div>
3348 <center>
3349 <pre>foo
3350 </pre>
3351 </center>
3352 <blockquote>
3353 <p> foo
3354 </p>
3355 </blockquote>
3356 <blockquote>
3357 <pre>
3358 foo
3359 </pre>
3360 </blockquote>
3361 <table><tr><td>
3362 <pre>foo
3363 </pre>
3364 </td></tr></table>
3365 <ul><li>
3366 foo
3367 </li></ul>
3368
3369 !!end
3370
3371 !! test
3372 4. Indent-Pre and extension tags
3373 !! wikitext
3374 a <tag />
3375 !! html/php
3376 a <pre>
3377 NULL
3378 array (
3379 )
3380 </pre>
3381
3382 !! html/parsoid
3383 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3384 !! end
3385
3386 !! test
3387 5. Indent-Pre and html pre
3388 !! wikitext
3389 <pre class="123">hi</pre>
3390 !! html/php
3391 <pre class="123">hi</pre>
3392
3393 !! html/parsoid
3394 <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3395 !! end
3396
3397 !!test
3398 Render paragraphs when indent-pre is suppressed in blocklevels
3399 !! wikitext
3400 <blockquote>
3401 foo
3402
3403 bar
3404 </blockquote>
3405 !! html
3406 <blockquote>
3407 <p> foo
3408 </p><p> bar
3409 </p>
3410 </blockquote>
3411
3412 !!end
3413
3414 !!test
3415 4. Multiple spaces at start-of-line
3416 !! wikitext
3417 <p> foo </p>
3418 foo
3419 {|
3420 |foo
3421 |}
3422 !! html
3423 <p> foo </p>
3424 <pre> foo
3425 </pre>
3426 <table>
3427 <tr>
3428 <td>foo
3429 </td></tr></table>
3430
3431 !!end
3432
3433 ## NOTE: the leading white-space chars on empty line are significant
3434 !! test
3435 5a. White-space in indent-pre
3436 !! wikitext
3437 a<br />
3438
3439 b
3440 !! html
3441 <pre>a<br />
3442
3443 b
3444 </pre>
3445 !! end
3446
3447 ## NOTE: the leading white-space chars on empty line are significant
3448 !! test
3449 5b. White-space in indent-pre
3450 !! wikitext
3451 a
3452
3453 b
3454
3455
3456 c
3457 !! html
3458 <pre>a
3459
3460 b
3461
3462
3463 c
3464 </pre>
3465 !! end
3466
3467 !! test
3468 5c. White-space in indent-pre
3469 !! wikitext
3470 ''a''
3471 ''b''
3472 ''c''
3473 !! html
3474 <pre><i>a</i>
3475 <i>b</i>
3476 <i>c</i>
3477 </pre>
3478 !! end
3479
3480 !! test
3481 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3482 !! wikitext
3483 a
3484
3485 <!-- continue -->
3486 b
3487
3488 c
3489
3490 d
3491 !! html
3492 <pre>a
3493
3494 b
3495 </pre>
3496 <pre>c
3497
3498 </pre>
3499 <p>d
3500 </p>
3501 !! end
3502
3503 !! test
3504 7a. Indent-pre and category links
3505 !! options
3506 parsoid=wt2html,wt2wt
3507 !! wikitext
3508 [[Category:foo]] <!-- No pre-wrapping -->
3509 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3510 !! html/php+tidy
3511 !! html/parsoid
3512 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3513 <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 -->
3514 !! end
3515
3516 ## We used to, but no longer wt2wt this test since the default serializer
3517 ## will normalize all categories to serialize on their own line.
3518 ## This wikitext usage is going to be fairly uncommon in production and
3519 ## selser will take care of preserving formatting in those scenarios.
3520 !! test
3521 7b. Indent-pre and category links
3522 !! options
3523 parsoid=wt2html
3524 !! wikitext
3525 [[Category:foo]] a
3526 [[Category:foo]] {{echo|b}}
3527 !! html/parsoid
3528 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3529 <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>
3530 !! end
3531
3532 !! test
3533 Indent-Pre: Newlines in comments shouldn't affect sol state
3534 !! wikitext
3535 a <!--
3536 foo
3537 --> b
3538 !! html/php+tidy
3539 <p>a b
3540 </p>
3541 !! html/parsoid
3542 <p>a <!--
3543 foo
3544 --> b</p>
3545 !! end
3546
3547 ###
3548 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3549 ###
3550
3551 !!test
3552 HTML-pre: 1. embedded newlines
3553 !! wikitext
3554 <pre>foo</pre>
3555
3556 <pre>
3557 foo
3558 </pre>
3559
3560 <pre>
3561
3562 foo
3563 </pre>
3564
3565 <pre>
3566
3567
3568 foo
3569 </pre>
3570 !! html/php+tidy
3571 <pre>foo</pre>
3572 <pre>foo
3573 </pre>
3574 <pre>
3575
3576 foo
3577 </pre>
3578 <pre>
3579
3580
3581 foo
3582 </pre>
3583 !! html/parsoid
3584 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3585
3586 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3587 </pre>
3588
3589 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3590
3591 foo
3592 </pre>
3593
3594 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3595
3596
3597 foo
3598 </pre>
3599 !!end
3600
3601 !! test
3602 HTML-pre: big spaces
3603 !! wikitext
3604 <pre>
3605
3606
3607
3608
3609 haha
3610
3611
3612
3613
3614 haha
3615
3616
3617
3618
3619 </pre>
3620 !! html/php+tidy
3621 <pre>
3622
3623
3624
3625
3626 haha
3627
3628
3629
3630
3631 haha
3632
3633
3634
3635
3636 </pre>
3637 !! html/parsoid
3638 <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"}}'>
3639
3640
3641
3642
3643 haha
3644
3645
3646
3647
3648 haha
3649
3650
3651
3652
3653 </pre>
3654 !! end
3655
3656 !!test
3657 HTML-pre: 2: indented text
3658 !! wikitext
3659 <pre>
3660 foo
3661 </pre>
3662 !! html
3663 <pre>
3664 foo
3665 </pre>
3666
3667 !!end
3668
3669 !!test
3670 HTML-pre: 3: other wikitext
3671 !! wikitext
3672 <pre>
3673 * foo
3674 # bar
3675 = no-h =
3676 '' no-italic ''
3677 [[ NoLink ]]
3678 </pre>
3679 !! html/php
3680 <pre>
3681 * foo
3682 # bar
3683 = no-h =
3684 '' no-italic ''
3685 [[ NoLink ]]
3686 </pre>
3687
3688 !! html/parsoid
3689 <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
3690 # bar
3691 = no-h =
3692 '' no-italic ''
3693 [[ NoLink ]]
3694 </pre>
3695 !!end
3696
3697 ###
3698 ### Definition lists
3699 ###
3700 !! test
3701 Simple definition
3702 !! wikitext
3703 ;name :Definition
3704 !! html
3705 <dl><dt>name&#160;</dt>
3706 <dd>Definition</dd></dl>
3707
3708 !! end
3709
3710 !! test
3711 Definition list for indentation only
3712 !! wikitext
3713 :Indented text
3714 !! html
3715 <dl><dd>Indented text</dd></dl>
3716
3717 !! end
3718
3719 !! test
3720 Definition list with no space
3721 !! wikitext
3722 ;name:Definition
3723 !! html
3724 <dl><dt>name</dt>
3725 <dd>Definition</dd></dl>
3726
3727 !!end
3728
3729 !! test
3730 Definition list with URL link
3731 !! wikitext
3732 ;http://example.com/ :definition
3733 !! html
3734 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3735 <dd>definition</dd></dl>
3736
3737 !! end
3738
3739 !! test
3740 Definition list with bracketed URL link
3741 !! wikitext
3742 ;[http://www.example.com/ Example]:Something about it
3743 !! html
3744 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3745 <dd>Something about it</dd></dl>
3746
3747 !! end
3748
3749 !! test
3750 Definition list with wikilink containing colon
3751 !! wikitext
3752 ; [[Help:FAQ]]:The least-read page on Wikipedia
3753 !! html
3754 <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>
3755 <dd>The least-read page on Wikipedia</dd></dl>
3756
3757 !! end
3758
3759 # At Brion's and JeLuF's insistence... :)
3760 !! test
3761 Definition list with news link containing colon
3762 !! wikitext
3763 ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
3764 !! html/php
3765 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3766 <dd>This isn't even a real newsgroup!</dd></dl>
3767
3768 !! html/parsoid
3769 <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>
3770 !! end
3771
3772 !! test
3773 Malformed definition list with colon
3774 !! wikitext
3775 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3776 !! html
3777 <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>
3778
3779 !! end
3780
3781 !! test
3782 Definition lists: colon in external link text
3783 !! wikitext
3784 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
3785 !! html
3786 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
3787 <dd>OK, I made that up</dd></dl>
3788
3789 !! end
3790
3791 !! test
3792 Definition lists: colon in HTML attribute
3793 !! wikitext
3794 ;<b style="display: inline">bold</b>
3795 !! html
3796 <dl><dt><b style="display: inline">bold</b></dt></dl>
3797
3798 !! end
3799
3800 !! test
3801 Definition lists: self-closed tag
3802 !! wikitext
3803 ;one<br/>two :two-line fun
3804 !! html
3805 <dl><dt>one<br />two&#160;</dt>
3806 <dd>two-line fun</dd></dl>
3807
3808 !! end
3809
3810 !! test
3811 Definition lists: ignore colons inside tags
3812 !! wikitext
3813 ;one <b>two : tag <i>fun:</i>:</b>:def
3814 !! html
3815 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
3816 <dd>def</dd></dl>
3817
3818 !! end
3819
3820 !! test
3821 Definition lists: excess closed tags
3822 !! wikitext
3823 ;one</b>two :bad tag fun
3824 !! html/php+tidy
3825 <dl><dt>onetwo&#160;</dt>
3826 <dd>bad tag fun</dd></dl>
3827 !! html/parsoid
3828 <dl>
3829 <dt>onetwo</dt>
3830 <dd>bad tag fun</dd>
3831 </dl>
3832 !! end
3833
3834 !! test
3835 T13748: Literal closing tags
3836 !! wikitext
3837 <dl>
3838 <dt>test 1</dt>
3839 <dd>test test test test test</dd>
3840 <dt>test 2</dt>
3841 <dd>test test test test test</dd>
3842 </dl>
3843 !! html
3844 <dl>
3845 <dt>test 1</dt>
3846 <dd>test test test test test</dd>
3847 <dt>test 2</dt>
3848 <dd>test test test test test</dd>
3849 </dl>
3850
3851 !! end
3852
3853 !! test
3854 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3855 !! wikitext
3856 <ul><li>
3857 ;term :description
3858 *unordered
3859 </li></ul>
3860 !! html
3861 <ul><li>
3862 <dl><dt>term&#160;</dt>
3863 <dd>description</dd></dl>
3864 <ul><li>unordered</li></ul>
3865 </li></ul>
3866
3867 !! end
3868
3869 !! test
3870 Definition list with empty definition and following paragraph
3871 !! wikitext
3872 ;term:
3873
3874 Paragraph text
3875 !! html
3876 <dl><dt>term</dt>
3877 <dd></dd></dl>
3878 <p>Paragraph text
3879 </p>
3880 !! end
3881
3882 !! test
3883 Nested definition lists using html syntax
3884 !! wikitext
3885 <dl><dt>x</dt>
3886 <dd>a</dd>
3887 <dd>b</dd></dl>
3888 !! html
3889 <dl><dt>x</dt>
3890 <dd>a</dd>
3891 <dd>b</dd></dl>
3892
3893 !! end
3894
3895 !! test
3896 Definition Lists: No nesting: Multiple dd's
3897 !! wikitext
3898 ;x
3899 :a
3900 :b
3901 !! html
3902 <dl><dt>x</dt>
3903 <dd>a</dd>
3904 <dd>b</dd></dl>
3905
3906 !! end
3907
3908 !! test
3909 Definition Lists: Indentation: Regular
3910 !! wikitext
3911 :i1
3912 ::i2
3913 :::i3
3914 !! html
3915 <dl><dd>i1
3916 <dl><dd>i2
3917 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3918
3919 !! end
3920
3921 !! test
3922 Definition Lists: Indentation: Missing 1st level
3923 !! wikitext
3924 ::i2
3925 :::i3
3926 !! html
3927 <dl><dd><dl><dd>i2
3928 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3929
3930 !! end
3931
3932 !! test
3933 Definition Lists: Indentation: Multi-level indent
3934 !! wikitext
3935 :::i3
3936 !! html
3937 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3938
3939 !! end
3940
3941 !! test
3942 Definition Lists: Hacky use to indent tables
3943 !! wikitext
3944 ::{|
3945 |foo
3946 |bar
3947 |}
3948 this text
3949 should be left alone
3950 !! html
3951 <dl><dd><dl><dd><table>
3952 <tr>
3953 <td>foo
3954 </td>
3955 <td>bar
3956 </td></tr></table></dd></dl></dd></dl>
3957 <p>this text
3958 should be left alone
3959 </p>
3960 !! end
3961
3962 !! test
3963 Definition Lists: Hacky use to indent tables (with content following table)
3964 !! wikitext
3965 :{|
3966 |foo
3967 |bar
3968 |} <!--c1--> this text should be part of the dl
3969 !! html/php+tidy
3970 <dl><dd><table>
3971 <tbody><tr>
3972 <td>foo
3973 </td>
3974 <td>bar
3975 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
3976 !! html/parsoid
3977 <dl><dd><table>
3978 <tbody><tr>
3979 <td>foo
3980 </td>
3981 <td>bar
3982 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
3983 !! end
3984
3985 !! test
3986 Definition Lists: Hacky use to indent tables, with comments (T65979)
3987 !! wikitext
3988 <!-- foo -->
3989 ::{|
3990 |foo
3991 |bar
3992 |}<!-- bar -->
3993 this text
3994 should be left alone
3995 !! html/parsoid
3996 <!-- foo -->
3997 <dl><dd><dl><dd><table><tr>
3998 <td>foo</td>
3999 <td>bar</td>
4000 </tr></table><!-- bar --></dd></dl></dd></dl>
4001 <p>this text
4002 should be left alone</p>
4003 !! end
4004
4005 !! test
4006 Definition Lists: Hacky use to indent tables, with comment before table
4007 !! wikitext
4008 ::<!-- foo -->{|
4009 |foo
4010 |}
4011 !! html/parsoid
4012 <dl><dd><dl><dd><!-- foo --><table><tr>
4013 <td>foo</td>
4014 </tr></table></dd></dl></dd></dl>
4015 !! end
4016
4017 # The trailing whitespace in this test is to catch a regression in
4018 # Parsoid after T54473.
4019 !! test
4020 Definition Lists: Hacky use to indent tables (WS-insensitive)
4021 !! wikitext
4022 : {|
4023 |a
4024 |}
4025 !! html/php
4026 <dl><dd><table>
4027 <tr>
4028 <td>a
4029 </td></tr></table></dd></dl>
4030
4031 !! html/parsoid
4032 <dl><dd> <table>
4033 <tbody><tr><td>a</td></tr>
4034 </tbody></table> </dd></dl>
4035 !! end
4036
4037 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4038 ## as an empty dt item. It also ignores all but the last ";" when followed
4039 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4040 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4041 ## ";"s.
4042 ##
4043 ## Ex: ";;t2 ::d2" is transformed into:
4044 ##
4045 ## <dl>
4046 ## <dt>t2 </dt>
4047 ## <dd>
4048 ## <dl>
4049 ## <dt></dt>
4050 ## <dd>d2</dd>
4051 ## </dl>
4052 ## </dd>
4053 ## </dl>
4054 ##
4055 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4056 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4057 ##
4058 ## <dl>
4059 ## <dt>
4060 ## <dl>
4061 ## <dt>t2 </dt>
4062 ## <dd>:d2</dd>
4063 ## </dl>
4064 ## </dt>
4065 ## </dl>
4066 ##
4067 ## All Parsoid only definition list tests have this difference.
4068 ##
4069 ## See also: https://phabricator.wikimedia.org/T8569
4070 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4071
4072 !! test
4073 Table / list interaction: indented table with lists in table contents
4074 !! wikitext
4075 :{|
4076 |-
4077 |a
4078
4079 *b
4080 |-
4081 |c
4082
4083 *d
4084 |}
4085 !! html
4086 <dl><dd><table>
4087
4088 <tr>
4089 <td>a
4090 <ul><li>b</li></ul>
4091 </td></tr>
4092 <tr>
4093 <td>c
4094 <ul><li>d</li></ul>
4095 </td></tr></table></dd></dl>
4096
4097 !! end
4098
4099 !!test
4100 Table / list interaction: lists nested in tables nested in indented lists
4101 !! wikitext
4102 :{|
4103 |
4104 :a
4105 :b
4106 |
4107 *c
4108 *d
4109 |}
4110
4111 *e
4112 *f
4113 !! html
4114 <dl><dd><table>
4115 <tr>
4116 <td>
4117 <dl><dd>a</dd>
4118 <dd>b</dd></dl>
4119 </td>
4120 <td>
4121 <ul><li>c</li>
4122 <li>d</li></ul>
4123 </td></tr></table></dd></dl>
4124 <ul><li>e</li>
4125 <li>f</li></ul>
4126
4127 !!end
4128
4129 !! test
4130 Definition Lists: Nesting: Multi-level (Parsoid only)
4131 !! wikitext
4132 ;t1 :d1
4133 ;;t2 ::d2
4134 ;;;t3 :::d3
4135 !! html/parsoid
4136 <dl>
4137 <dt>t1 </dt>
4138 <dd>d1</dd>
4139 <dt>
4140 <dl>
4141 <dt>t2 </dt>
4142 <dd>:d2</dd>
4143 <dt>
4144 <dl>
4145 <dt>t3 </dt>
4146 <dd>::d3</dd>
4147 </dl>
4148 </dt>
4149 </dl>
4150 </dt>
4151 </dl>
4152
4153
4154 !! end
4155
4156
4157 !! test
4158 Definition Lists: Nesting: Test 2
4159 !! wikitext
4160 ;t1
4161 ::d2
4162 !! html+tidy
4163 <dl><dt>t1</dt>
4164 <dd>
4165 <dl><dd>d2</dd></dl></dd></dl>
4166 !! end
4167
4168
4169 !! test
4170 Definition Lists: Nesting: Test 3
4171 !! wikitext
4172 :;t1
4173 ::::d2
4174 !! html+tidy
4175 <dl><dd><dl><dt>t1</dt>
4176 <dd>
4177 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4178 !! end
4179
4180
4181 !! test
4182 Definition Lists: Nesting: Test 4
4183 !! wikitext
4184 ::;t3
4185 :::d3
4186 !! html
4187 <dl><dd><dl><dd><dl><dt>t3</dt>
4188 <dd>d3</dd></dl></dd></dl></dd></dl>
4189
4190 !! end
4191
4192
4193 ## The Parsoid team believes the following three test exposes a
4194 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4195 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4196 ## It also exposes a "misfeature" in tidy, which doesn't like
4197 ## <dl> tags with a single <dt> child; it converts the <dt> into
4198 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4199 !! test
4200 Definition Lists: Mixed Lists: Test 1
4201 !! wikitext
4202 :;*foo
4203 ::*bar
4204 :;baz
4205 !! html/php
4206 <dl><dd><dl><dt><ul><li>foo</li>
4207 <li>bar</li></ul></dt></dl>
4208 <dl><dt>baz</dt></dl></dd></dl>
4209
4210 !! html/php+tidy
4211 <dl><dd><dl><dt><ul><li>foo</li>
4212 <li>bar</li></ul></dt></dl>
4213 <dl><dt>baz</dt></dl></dd></dl>
4214 !! html/parsoid
4215 <dl>
4216 <dd><dl>
4217 <dt><ul>
4218 <li>foo
4219 </li>
4220 </ul></dt>
4221 <dd><ul>
4222 <li>bar
4223 </li>
4224 </ul></dd>
4225 <dt>baz</dt>
4226 </dl></dd>
4227 </dl>
4228 !! end
4229
4230 !! test
4231 Definition Lists: Mixed Lists: Test 2
4232 !! wikitext
4233 *:d1
4234 *:d2
4235 !! html
4236 <ul><li><dl><dd>d1</dd>
4237 <dd>d2</dd></dl></li></ul>
4238
4239 !! end
4240
4241
4242 !! test
4243 Definition Lists: Mixed Lists: Test 3
4244 !! wikitext
4245 *:::d1
4246 *:::d2
4247 !! html
4248 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4249 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4250
4251 !! end
4252
4253
4254 !! test
4255 Definition Lists: Mixed Lists: Test 4
4256 !! wikitext
4257 *;d1 :d2
4258 *;d3 :d4
4259 !! html
4260 <ul><li><dl><dt>d1&#160;</dt>
4261 <dd>d2</dd>
4262 <dt>d3&#160;</dt>
4263 <dd>d4</dd></dl></li></ul>
4264
4265 !! end
4266
4267
4268 !! test
4269 Definition Lists: Mixed Lists: Test 5
4270 !! wikitext
4271 *:d1
4272 *::d2
4273 !! html
4274 <ul><li><dl><dd>d1
4275 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4276
4277 !! end
4278
4279
4280 !! test
4281 Definition Lists: Mixed Lists: Test 6
4282 !! wikitext
4283 #*:d1
4284 #*:::d3
4285 !! html
4286 <ol><li><ul><li><dl><dd>d1
4287 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4288
4289 !! end
4290
4291
4292 !! test
4293 Definition Lists: Mixed Lists: Test 7
4294 !! wikitext
4295 :*d1
4296 :*d2
4297 !! html
4298 <dl><dd><ul><li>d1</li>
4299 <li>d2</li></ul></dd></dl>
4300
4301 !! end
4302
4303
4304 !! test
4305 Definition Lists: Mixed Lists: Test 8
4306 !! wikitext
4307 :*d1
4308 ::*d2
4309 !! html
4310 <dl><dd><ul><li>d1</li></ul>
4311 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4312
4313 !! end
4314
4315
4316 !! test
4317 Definition Lists: Mixed Lists: Test 9
4318 !! wikitext
4319 *;foo :bar
4320 !! html
4321 <ul><li><dl><dt>foo&#160;</dt>
4322 <dd>bar</dd></dl></li></ul>
4323
4324 !! end
4325
4326
4327 !! test
4328 Definition Lists: Mixed Lists: Test 10
4329 !! wikitext
4330 *#;foo :bar
4331 !! html
4332 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4333 <dd>bar</dd></dl></li></ol></li></ul>
4334
4335 !! end
4336
4337 # The Parsoid team disagrees with the PHP parser's seemingly-random
4338 # rules regarding dd/dt on the next few tests. Parsoid is more
4339 # consistent, and recognizes the shared nesting and keeps the
4340 # still-open tags around until the nesting is complete.
4341
4342 # This is a regression test for T175099
4343 !! test
4344 Definition Lists: Mixed Lists: Test 11
4345 !! wikitext
4346 ;a
4347 :*b
4348 !! html/php
4349 <dl><dt>a</dt>
4350 <dd>
4351 <ul><li>b</li></ul></dd></dl>
4352
4353 !! html/parsoid
4354 <dl><dt>a
4355 <dd><ul><li>b</li></ul></dd></dl>
4356 !! end
4357
4358 # FIXME: Maybe get rid of this test?
4359 !! test
4360 Definition Lists: Mixed Lists: Test 12
4361 !! wikitext
4362 *#*#;*;;foo :bar
4363 *#*#;boo :baz
4364 !! html/php
4365 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4366 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4367 <dl><dt>boo&#160;</dt>
4368 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4369
4370 !! html/php+tidy
4371 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4372 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4373 <dl><dt>boo&#160;</dt>
4374 <dd>baz</dd></dl></li></ol></li></ul>
4375 !! html/parsoid
4376 <ul>
4377 <li>
4378 <ol>
4379 <li>
4380 <ul>
4381 <li>
4382 <ol>
4383 <li>
4384 <dl>
4385 <dt>
4386 <ul>
4387 <li>
4388 <dl>
4389 <dt>
4390 <dl>
4391 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4392 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4393 </dl></dt>
4394 </dl></li>
4395 </ul></dt>
4396 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4397 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4398 </dl></li>
4399 </ol></li>
4400 </ul></li>
4401 </ol></li>
4402 </ul>
4403 !! end
4404
4405 # FIXME: Maybe get rid of this test?
4406 # From whitelist:
4407 # * The test is wrong, there are two colons where there should be :;
4408 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4409 !! test
4410 Definition Lists: Weird Ones: Test 1
4411 !! wikitext
4412 *#;*::;;foo :bar (who uses this?)
4413 !! html/php+tidy
4414 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4415 <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>
4416 !! html/parsoid
4417 <ul>
4418 <li>
4419 <ol>
4420 <li>
4421 <dl>
4422 <dt>
4423 <ul>
4424 <li>
4425 <dl>
4426 <dd>
4427 <dl>
4428 <dd>
4429 <dl>
4430 <dt>
4431 <dl>
4432 <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4433 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4434 </dl></dt>
4435 </dl></dd>
4436 </dl></dd>
4437 </dl></li>
4438 </ul></dt>
4439 </dl></li>
4440 </ol></li>
4441 </ul>
4442 !! end
4443
4444 !! test
4445 Definition Lists: colons occurring in tags
4446 !! wikitext
4447 ;a:b
4448 ;'''a:b'''
4449 ;<i>a:b</i>
4450 ;<span>a:b</span>
4451 ;<div>a:b</div>
4452 ;<div>a
4453 :b</div>
4454 ;{{echo|a:b}}
4455 ;{{echo|''a:b''}}
4456 ;;;''a:b''
4457 !! html+tidy
4458 <dl><dt>a</dt>
4459 <dd>b</dd>
4460 <dt><b>a:b</b></dt>
4461 <dt><i>a:b</i></dt>
4462 <dt><span>a:b</span></dt>
4463 <dt><div>a:b</div></dt>
4464 <dt><div>a</div></dt>
4465 <dd>b</dd>
4466 <dt>a</dt>
4467 <dd>b</dd>
4468 <dt><i>a:b</i></dt></dl>
4469 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4470 !! html/parsoid
4471 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4472 <dt><b>a:b</b></dt>
4473 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4474 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4475 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4476 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4477 <dd>b</dd>
4478 <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>
4479 <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>
4480 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4481 !! end
4482
4483 # Parsoid's output differs here again because it shares
4484 # nesting between the two lists unlike the PHP parser.
4485 # Unsure which is more desirable.
4486 !! test
4487 Definition Lists: colons and tables 1
4488 !! wikitext
4489 :{|
4490 |x
4491 |}
4492 :{|
4493 |y
4494 |}
4495 !! html/php
4496 <dl><dd><table>
4497 <tr>
4498 <td>x
4499 </td></tr></table></dd></dl>
4500 <dl><dd><table>
4501 <tr>
4502 <td>y
4503 </td></tr></table></dd></dl>
4504
4505 !! html/parsoid
4506 <dl><dd><table>
4507 <tr>
4508 <td>x
4509 </td></tr></table></dd>
4510 <dd><table>
4511 <tr>
4512 <td>y
4513 </td></tr></table></dd></dl>
4514 !! end
4515
4516 # FIXME: Does this need a html/php section?
4517 !! test
4518 Definition Lists: template interaction
4519 !! wikitext
4520 ::{{definition_list}}
4521
4522 :one
4523 ::{{definition_list}}
4524 :::two
4525 :::three
4526 ::four
4527 !! html/parsoid
4528 <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">
4529 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4530
4531 <dl><dd data-parsoid='{}'>one
4532 <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">
4533 </span><dd about="#mwt2">two
4534 <dl><dd>two</dd>
4535 <dd>three</dd></dl></dd>
4536 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4537 !! end
4538
4539
4540 ###
4541 ### External links
4542 ###
4543 !! test
4544 External links: non-bracketed
4545 !! wikitext
4546 Non-bracketed: http://example.com
4547 !! html
4548 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4549 </p>
4550 !! end
4551
4552 # parsoid doesn't explicitly mark autonumbered links, see T55505
4553 !! test
4554 External links: numbered
4555 !! wikitext
4556 Numbered: [http://example.com]
4557 Numbered: [http://example.net]
4558 Numbered: [http://example.com]
4559 !! html/php
4560 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4561 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4562 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4563 </p>
4564 !! html/parsoid
4565 <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
4566 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4567 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
4568 !!end
4569
4570 !! test
4571 External links: specified text
4572 !! wikitext
4573 Specified text: [http://example.com link]
4574 !! html
4575 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4576 </p>
4577 !!end
4578
4579 !! test
4580 External links: trail
4581 !! wikitext
4582 Linktrails should not work for external links: [http://example.com link]s
4583 !! html
4584 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4585 </p>
4586 !! end
4587
4588 !! test
4589 External links: dollar sign in URL
4590 !! wikitext
4591 http://example.com/1$2345
4592 !! html
4593 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4594 </p>
4595 !! end
4596
4597 # parsoid doesn't explicitly mark autonumbered links, see T55505
4598 !! test
4599 External links: dollar sign in URL (autonumber)
4600 !! wikitext
4601 [http://example.com/1$2345]
4602 !! html/php
4603 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4604 </p>
4605 !! html/parsoid
4606 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
4607 !!end
4608
4609 !! test
4610 External links: open square bracket forbidden in URL (T6377)
4611 !! options
4612 parsoid=wt2html,wt2wt,html2html
4613 !! wikitext
4614 http://example.com/1[2345
4615 !! html/php
4616 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4617 </p>
4618 !! html/parsoid
4619 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
4620 !! end
4621
4622 !! test
4623 External links: open square bracket forbidden in URL (named) (T6377)
4624 !! options
4625 parsoid=wt2html,html2html
4626 !! wikitext
4627 [http://example.com/1[2345]
4628 !! html/php
4629 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4630 </p>
4631 !! html/parsoid
4632 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
4633 !!end
4634
4635 # parsoid adds a space before the link name
4636 !! test
4637 External links: open square bracket forbidden in URL (named) (T6377)
4638 Parsoid variant.
4639 !! wikitext
4640 [http://example.com/1 [2345]
4641 !! html
4642 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4643 </p>
4644 !!end
4645
4646 !! test
4647 External links: nowiki in URL link text (T8230)
4648 !! wikitext
4649 [http://example.com/ <nowiki>''example site''</nowiki>]
4650 !! html
4651 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4652 </p>
4653 !! end
4654
4655 !! test
4656 External links: newline forbidden in text (T8230 regression check)
4657 !! wikitext
4658 [http://example.com/ first
4659 second]
4660 !! html
4661 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4662 second]
4663 </p>
4664 !!end
4665
4666 !! test
4667 External links: Pipe char between url and text
4668 !! wikitext
4669 [http://example.com | link]
4670 !! html
4671 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4672 </p>
4673 !!end
4674
4675 !! test
4676 External links: protocol-relative URL in brackets
4677 !! wikitext
4678 [//example.com/ Test]
4679 !! html
4680 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4681 </p>
4682 !! end
4683
4684 # parsoid doesn't explicitly mark autonumbered links, see T55505
4685 !! test
4686 External links: protocol-relative URL in brackets without text
4687 !! wikitext
4688 [//example.com]
4689 !! html/php
4690 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4691 </p>
4692 !! html/parsoid
4693 <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
4694 !! end
4695
4696 !! test
4697 External links: protocol-relative URL in free text is left alone
4698 !! wikitext
4699 //example.com/Foo
4700 !! html
4701 <p>//example.com/Foo
4702 </p>
4703 !!end
4704
4705 !! test
4706 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4707 !! wikitext
4708 foo//example.com/Foo
4709 !! html
4710 <p>foo//example.com/Foo
4711 </p>
4712 !! end
4713
4714 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4715 !! test
4716 External links: with no contents
4717 !! options
4718 parsoid=wt2html,wt2wt
4719 !! wikitext
4720 [http://en.wikipedia.org/wiki/Foo]
4721
4722 [[wikipedia:Foo|Bar]]
4723
4724 [[wikipedia:Foo|<span>Bar</span>]]
4725 !! html/php
4726 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4727 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4728 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4729 </p>
4730 !! html/parsoid
4731 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4732 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4733 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4734 !! end
4735
4736 !! test
4737 External links: Free with trailing punctuation
4738 !! wikitext
4739 http://example.com,
4740 http://example.com;
4741 http://example.com\
4742 http://example.com.
4743 http://example.com:
4744 http://example.com!
4745 http://example.com?
4746 http://example.com)
4747 http://example.com/url_with_(brackets)
4748 (http://example.com/url_without_brackets)
4749 http://example.com/url_with_entity&amp;
4750 http://example.com/url_with_entity&#x26;
4751 http://example.com/url_with_entity&#038;
4752 http://example.com/url_with_entity&nbsp;
4753 http://example.com/url_with_entity&#xA0;
4754 http://example.com/url_with_entity&#160;
4755 http://example.com/url_with_entity&lt;
4756 http://example.com/url_with_entity&#x3C;
4757 http://example.com/url_with_entity&#60;
4758 !! html/php
4759 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4760 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4761 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4762 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4763 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4764 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4765 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4766 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4767 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4768 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4769 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4770 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4771 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4772 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4773 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4774 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4775 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4776 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4777 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4778 </p>
4779 !! html/parsoid
4780 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
4781 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
4782 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
4783 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
4784 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
4785 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
4786 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
4787 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
4788 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4789 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4790 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4791 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4792 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4793 <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>
4794 <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>
4795 <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>
4796 <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>
4797 <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>
4798 <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>
4799 !! end
4800
4801 !! test
4802 External links: tricky Parsoid html2html case
4803 !! options
4804 parsoid=wt2html,wt2wt,html2html
4805 !! wikitext
4806 http://example.com/url_with_entity&amp;amp;
4807 !! html/php
4808 <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>;
4809 </p>
4810 !! html/parsoid
4811 <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>
4812 !! end
4813
4814 !! test
4815 External links: Free with trailing quotes (T113666)
4816 !! wikitext
4817 '''News:''' Stuff here
4818
4819 news:'a'b''c''d e
4820 !! html/php
4821 <p><b>News:</b> Stuff here
4822 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
4823 </p>
4824 !! html/parsoid
4825 <p><b>News:</b> Stuff here</p>
4826 <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4827 !! end
4828
4829 !! test
4830 External links: with entity
4831 !! wikitext
4832 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
4833 !! html/php
4834 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
4835 </p>
4836 !! html/parsoid
4837 <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>
4838 !! end
4839
4840 !! test
4841 External links: Lone protocols are never linked (T105697)
4842 !! wikitext
4843 http://
4844 http://;
4845 (http://)
4846 bitcoin:
4847 bitcoin:;
4848 (bitcoin:)
4849 !! html
4850 <p>http://
4851 http://;
4852 (http://)
4853 bitcoin:
4854 bitcoin:;
4855 (bitcoin:)
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: No preceding word characters allowed (T67278)
4861 !! wikitext
4862 NOPEhttp://example.com
4863 N0http://example.com
4864 ok:http://example.com
4865 ok-http://example.com
4866 !! html
4867 <p>NOPEhttp://example.com
4868 N0http://example.com
4869 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4870 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External links: nofollow domain exception
4876 !! wikitext
4877 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4878 !! html
4879 <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>.
4880 </p>
4881 !!end
4882
4883 !! test
4884 External image
4885 !! wikitext
4886 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4887 !! html
4888 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4889 </p>
4890 !! end
4891
4892 !! test
4893 External image from https
4894 !! wikitext
4895 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4896 !! html
4897 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4898 </p>
4899 !! end
4900
4901 !! test
4902 External image (when not allowed)
4903 !! options
4904 wgAllowExternalImages=0
4905 !! wikitext
4906 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4907 !! html
4908 <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>
4909 </p>
4910 !! end
4911
4912 !! test
4913 Link to non-http image, no img tag
4914 !! wikitext
4915 Link to non-http image, no img tag: ftp://example.com/test.jpg
4916 !! html
4917 <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>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: terminating separator
4923 !! wikitext
4924 Terminating separator: http://example.com/thing,
4925 !! html
4926 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4927 </p>
4928 !! end
4929
4930 !! test
4931 External links: intervening separator
4932 !! wikitext
4933 Intervening separator: http://example.com/1,2,3
4934 !! html
4935 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4936 </p>
4937 !! end
4938
4939 !! test
4940 External links: old bug with URL in query
4941 !! wikitext
4942 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4943 !! html
4944 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4945 </p>
4946 !! end
4947
4948 !! test
4949 External links: old URL-in-URL bug, mixed protocols
4950 !! wikitext
4951 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4952 !! html
4953 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4954 </p>
4955 !!end
4956
4957 # Since Parsoid is starting to emit canonical wikitext for links,
4958 # [http://example.com http://example.com] will not RT back to that
4959 # form anymore.
4960 !! test
4961 External links: URL in text
4962 !! options
4963 parsoid=wt2html
4964 !! wikitext
4965 URL in text: [http://example.com http://example.com]
4966 !! html/php
4967 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
4968 </p>
4969 !! html/parsoid
4970 <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
4971 !! end
4972
4973 !! test
4974 External links: Clickable images
4975 !! wikitext
4976 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4977 !! html/php
4978 <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>
4979 </p>
4980 !! html/parsoid
4981 <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>
4982 !! end
4983
4984 !! test
4985 External links: raw ampersand
4986 !! wikitext
4987 Old &amp; use: http://x&y
4988 !! html
4989 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4990 </p>
4991 !! end
4992
4993 !! test
4994 External links: encoded ampersand
4995 !! wikitext
4996 Old &amp; use: http://x&amp;y
4997 !! html/php
4998 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4999 </p>
5000 !! html/parsoid
5001 <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>
5002 !! end
5003
5004 !! test
5005 External links: encoded equals (T8102)
5006 !! wikitext
5007 http://example.com/?foo&#61;bar
5008 !! html/php
5009 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5010 </p>
5011 !! html/parsoid
5012 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
5013 !! end
5014
5015 ##
5016 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5017 ## does it number them. As discussed in T55505, we can identify
5018 ## autonumbered links via CSS.
5019 ##
5020
5021 !! test
5022 External links: [raw ampersand]
5023 !! wikitext
5024 Old &amp; use: [http://x&y]
5025 !! html/php
5026 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5027 </p>
5028 !! html/parsoid
5029 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5030 !! end
5031
5032 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5033 # mode will return the [raw ampersand] wikitext
5034 !! test
5035 External links: [encoded ampersand]
5036 !! options
5037 parsoid=wt2html,wt2wt,html2html
5038 !! wikitext
5039 Old &amp; use: [http://x&amp;y]
5040 !! html/php
5041 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5042 </p>
5043 !! html/parsoid
5044 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
5045 !! end
5046
5047 !! test
5048 External links: [raw equals]
5049 !! wikitext
5050 [http://example.com/?foo=bar]
5051 !! html/php
5052 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5053 </p>
5054 !! html/parsoid
5055 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5056 !! end
5057
5058 # note that parsoid html is identical to [raw equals] case; so html2wt
5059 # mode will return the [raw equals] wikitext
5060 !! test
5061 External links: [encoded equals] (T8102)
5062 !! options
5063 parsoid=wt2html,wt2wt,html2html
5064 !! wikitext
5065 [http://example.com/?foo&#61;bar]
5066 !! html/php
5067 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5068 </p>
5069 !! html/parsoid
5070 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
5071 !! end
5072
5073 # xxx parsoid strips the IDN character, so the round-trip tests will
5074 # obviously fail and are disabled. --cscott
5075 !! test
5076 External links: [IDN ignored character reference in hostname; strip it right off]
5077 !! options
5078 parsoid=wt2html,wt2wt,html2html
5079 !! wikitext
5080 [http://e&zwnj;xample.com/]
5081 !! html/php
5082 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5083 </p>
5084 !! html/parsoid
5085 <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
5086 !! end
5087
5088 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5089 # Where an external link could easily circumvent the sanitization of the text of
5090 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5091 # test demands a higher standard. That's a bit strange.
5092 #
5093 # Example:
5094 #
5095 # http://e‌xample.com -> [http://example.com|http://example.com]
5096 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5097 #
5098 # The first example is sanitized, but the second is not. Any security benefits
5099 # from this production are trivial to circumvent. Either remove this test and
5100 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5101 # the test accordingly.
5102 #
5103 # All our love,
5104 # The Parsoid team.
5105 # xxx parsoid strips the IDN character, so the round-trip tests will
5106 # obviously fail and are disabled. --cscott
5107 !! test
5108 External links: IDN ignored character reference in hostname; strip it right off
5109 !! options
5110 parsoid=wt2html,html2html
5111 !! wikitext
5112 http://e&zwnj;xample.com/
5113 !! html/php
5114 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5115 </p>
5116 !! html/parsoid
5117 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
5118 !! end
5119
5120 !! test
5121 External links: www.jpeg.org (T2554)
5122 !! wikitext
5123 http://www.jpeg.org
5124 !! html
5125 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5126 </p>
5127 !! end
5128
5129 # parsoid doesn't explicitly mark autonumbered links, see T55505
5130 !! test
5131 External links: URL within URL (T2002)
5132 !! wikitext
5133 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5134 !! html/php
5135 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5136 </p>
5137 !! html/parsoid
5138 <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>
5139 !! end
5140
5141 !! test
5142 T2361: URL inside bracketed URL
5143 !! wikitext
5144 [http://www.example.com/foo http://www.example.com/bar]
5145 !! html
5146 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5147 </p>
5148 !! end
5149
5150 !! test
5151 T2361: URL within URL, not bracketed
5152 !! wikitext
5153 http://www.example.com/foo?=http://www.example.com/bar
5154 !! html
5155 <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>
5156 </p>
5157 !! end
5158
5159 !! test
5160 T2289: ">"-token in URL-tail
5161 !! wikitext
5162 http://www.example.com/<hello>
5163 !! html
5164 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5165 </p>
5166 !!end
5167
5168 !! test
5169 T2289: literal ">"-token in URL-tail
5170 !! wikitext
5171 http://www.example.com/<b>html</b>
5172 !! html/php
5173 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5174 </p>
5175 !! html/parsoid
5176 <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>
5177 !! end
5178
5179 !! test
5180 T2289: ">"-token in bracketed URL
5181 !! wikitext
5182 [http://www.example.com/<hello> stuff]
5183 !! html
5184 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5185 </p>
5186 !!end
5187
5188 !! test
5189 T2289: literal ">"-token in bracketed URL
5190 !! wikitext
5191 [http://www.example.com/<b>html</b> stuff]
5192 !! html
5193 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5194 </p>
5195 !!end
5196
5197 !! test
5198 T2289: literal double quote at end of URL
5199 !! wikitext
5200 http://www.example.com/"hello"
5201 !! html
5202 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5203 </p>
5204 !!end
5205
5206 !! test
5207 T2289: literal double quote in bracketed URL
5208 !! wikitext
5209 [http://www.example.com/"hello" stuff]
5210 !! html
5211 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5212 </p>
5213 !!end
5214
5215 !! test
5216 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5217 !! wikitext
5218 [http://www.example.com test]
5219 !! html
5220 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5221 </p>
5222 !! end
5223
5224 !! test
5225 External links: link text with spaces
5226 !! wikitext
5227 [http://www.example.com a b c]
5228 [http://www.example.com ''a'' ''b'']
5229 !! html
5230 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5231 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5232 </p>
5233 !! end
5234
5235 # Note edge case difference between PHP and Parsoid here.
5236 !! test
5237 External links: wiki links within external link (T5695)
5238 !! options
5239 parsoid=wt2html,html2html
5240 !! wikitext
5241 [http://example.com [[wikilink]] embedded in ext link]
5242
5243 [http://example.com test [[wikilink]] embedded in ext link]
5244 !! html/php
5245 <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>
5246 </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>
5247 </p>
5248 !! html/parsoid
5249 <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>
5250 <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>
5251 !! end
5252
5253 !! test
5254 T2787: Links with one slash after the url protocol are invalid
5255 !! wikitext
5256 http:/example.com
5257
5258 [http:/example.com title]
5259 !! html
5260 <p>http:/example.com
5261 </p><p>[http:/example.com title]
5262 </p>
5263 !! end
5264
5265 !! test
5266 Bracketed external links with template-generated invalid target
5267 !! wikitext
5268 [{{echo|http:/example.com}} title]
5269 !! html
5270 <p>[http:/example.com title]
5271 </p>
5272 !! end
5273
5274 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5275 !! test
5276 Broken wikilinks (but not external links) prevent templates from closing
5277 !! options
5278 parsoid=wt2html
5279 !! wikitext
5280 [http://example.com x
5281
5282 {{echo|[http://example.com x}}
5283
5284 [[Foo
5285
5286 {{echo|[[Foo}}
5287 !! html/php
5288 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5289 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5290 </p><p>[[Foo
5291 </p><p>{{echo|[[Foo}}
5292 </p>
5293 !! html/parsoid
5294 <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
5295 <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>
5296 <p>[[Foo</p>
5297 <p>{{echo|[[Foo}}</p>
5298 !! end
5299
5300 !! test
5301 Wikilinks with embedded newlines are not broken
5302 !! wikitext
5303 {{echo|[[ Foo
5304 B
5305 C]]}}
5306 !! html/php
5307 <p>[[ Foo
5308 B
5309 C]]
5310 </p>
5311 !! html/parsoid
5312 <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>
5313 !! end
5314
5315 !! test
5316 Broken templates
5317 !! options
5318 parsoid=wt2html
5319 !! wikitext
5320 {{echo|[[Foo|}}]]
5321
5322 [[Foo|{{echo|]]}}
5323 !! html/php
5324 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5325 </p><p>[[Foo|]]
5326 </p>
5327 !! html/parsoid
5328 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5329 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5330 !! end
5331
5332 !! test
5333 T4702: Mismatched <i>, <b> and <a> tags are invalid
5334 !! wikitext
5335 ''[http://example.com text'']
5336 [http://example.com '''text]'''
5337 ''Something [http://example.com in italic'']
5338 ''Something [http://example.com mixed''''', even bold]'''
5339 '''''Now [http://example.com both''''']
5340 !! html
5341 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5342 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5343 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5344 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5345 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5346 </p>
5347 !! end
5348
5349
5350 !! test
5351 T6781: %26 in URL
5352 !! wikitext
5353 http://www.example.com/?title=AT%26T
5354 !! html/php
5355 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5356 </p>
5357 !! html/parsoid
5358 <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>
5359 !! end
5360
5361 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5362 # % is actually legal in HTML5. Any change in output would need testing though.
5363 !! test
5364 T6781, T7267: %25 in URL
5365 !! wikitext
5366 http://www.example.com/?title=100%25_Bran
5367 !! html/php
5368 <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>
5369 </p>
5370 !! html/parsoid
5371 <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>
5372 !! end
5373
5374 !! test
5375 T6781, T7267: %28, %29 in URL
5376 !! wikitext
5377 http://www.example.com/?title=Ben-Hur_%281959_film%29
5378 !! html/php
5379 <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>
5380 </p>
5381 !! html/parsoid
5382 <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>
5383 !! end
5384
5385
5386 !! test
5387 T6781: %26 in autonumber URL
5388 !! wikitext
5389 [http://www.example.com/?title=AT%26T]
5390 !! html/php
5391 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5392 </p>
5393 !! html/parsoid
5394 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5395 !! end
5396
5397 !! test
5398 T6781, T7267: %26 in autonumber URL
5399 !! wikitext
5400 [http://www.example.com/?title=100%25_Bran]
5401 !! html/php
5402 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5406 !! end
5407
5408 !! test
5409 T6781, T7267: %28, %29 in autonumber URL
5410 !! wikitext
5411 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5412 !! html/php
5413 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5414 </p>
5415 !! html/parsoid
5416 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5417 !! end
5418
5419
5420 !! test
5421 T6781: %26 in bracketed URL
5422 !! wikitext
5423 [http://www.example.com/?title=AT%26T link]
5424 !! html/php
5425 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5426 </p>
5427 !! html/parsoid
5428 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5429 !! end
5430
5431 !! test
5432 T6781, T7267: %25 in bracketed URL
5433 !! wikitext
5434 [http://www.example.com/?title=100%25_Bran link]
5435 !! html
5436 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5437 </p>
5438 !! end
5439
5440 !! test
5441 T6781, T7267: %28, %29 in bracketed URL
5442 !! wikitext
5443 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5444 !! html/php
5445 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5446 </p>
5447 !! html/parsoid
5448 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5449 !! end
5450
5451 !! test
5452 External link containing a period in the anchor. (T65947)
5453 !! wikitext
5454 [//foo.org/bar#baz. bang]
5455
5456 [//foo.org/bar. bang]
5457 !! html/php
5458 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5459 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5460 </p>
5461 !! html/parsoid
5462 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5463 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5464 !! end
5465
5466 !! test
5467 External link containing a single quote. (T65947)
5468 !! wikitext
5469 [//foo.org/bar'baz]
5470
5471 [//foo.org/bar'baz bang]
5472 !! html/php
5473 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5474 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5475 </p>
5476 !! html/parsoid
5477 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5478 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5479 !! end
5480
5481 !! test
5482 External link containing double-single-quotes in text '' (T6598 sanity check)
5483 !! wikitext
5484 Some [http://example.com/ pretty ''italics'' and stuff]!
5485 !! html
5486 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5487 </p>
5488 !! end
5489
5490 !! test
5491 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5492 !! wikitext
5493 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5494 !! html
5495 <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>
5496 </p>
5497 !! end
5498
5499 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5500 !! test
5501 External link containing double-single-quotes with no space separating the url from text in italics
5502 !! wikitext
5503 [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]].]
5504 !! html/php+tidy
5505 <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>.
5506 </p>
5507 !! html/parsoid
5508 <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>
5509 !! end
5510
5511 !! test
5512 External link with comments in link text
5513 !! wikitext
5514 [http://www.google.com Google <!-- comment -->]
5515 !! html/php
5516 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5517 </p>
5518 !! html/parsoid
5519 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5520 !! end
5521
5522 !! test
5523 External link to bare IPv4 address
5524 !! wikitext
5525 [http://192.168.0.1 Link]
5526 !! html/php
5527 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5528 </p>
5529 !! html/parsoid
5530 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5531 !! end
5532
5533 !! test
5534 URL-encoding in URL functions (single parameter)
5535 !! wikitext
5536 {{localurl:Some page|amp=&}}
5537 !! html
5538 <p>/index.php?title=Some_page&amp;amp=&amp;
5539 </p>
5540 !! end
5541
5542 !! test
5543 URL-encoding in URL functions (multiple parameters)
5544 !! wikitext
5545 {{localurl:Some page|q=?&amp=&}}
5546 !! html
5547 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5548 </p>
5549 !! end
5550
5551 !! test
5552 Brackets in urls
5553 !! wikitext
5554 http://example.com/index.php?foozoid%5B%5D=bar
5555
5556 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5557 !! html/php
5558 <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>
5559 </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>
5560 </p>
5561 !! html/parsoid
5562 <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>
5563
5564 <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>
5565 !! end
5566
5567 !! test
5568 IPv6 urls, autolink format (T23261)
5569 !! wikitext
5570 http://[2404:130:0:1000::187:2]/index.php
5571
5572 Examples from RFC 2373, section 2.2:
5573
5574 *http://[1080::8:800:200C:417A]/unicast
5575 *http://[FF01::101]/multicast
5576 *http://[::1]/loopback
5577 *http://[::]/unspecified
5578 *http://[::13.1.68.3]/ipv4compat
5579 *http://[::FFFF:129.144.52.38]/ipv4compat
5580
5581 Examples from RFC 2732, section 2:
5582
5583 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5584 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5585 *http://[3ffe:2a00:100:7031::1]
5586 *http://[1080::8:800:200C:417A]/foo
5587 *http://[::192.9.5.5]/ipng
5588 *http://[::FFFF:129.144.52.38]:80/index.html
5589 *http://[2010:836B:4179::836B:4179]
5590 !! html/php
5591 <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>
5592 </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:
5593 </p>
5594 <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>
5595 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5596 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5597 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5598 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5599 <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>
5600 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5601 </p>
5602 <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>
5603 <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>
5604 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5605 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5606 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5607 <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>
5608 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5609
5610 !! html/parsoid
5611 <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>
5612
5613 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5614 <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>
5615 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5616 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5617 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5618 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5619 <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>
5620
5621 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5622 <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>
5623 <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>
5624 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5625 <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>
5626 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5627 <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>
5628 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5629 !! end
5630
5631 !! test
5632 IPv6 urls, bracketed format (T23261)
5633 !! wikitext
5634 [http://[2404:130:0:1000::187:2]/index.php test]
5635
5636 Examples from RFC 2373, section 2.2:
5637
5638 *[http://[1080::8:800:200C:417A] unicast]
5639 *[http://[FF01::101] multicast]
5640 *[http://[::1]/ loopback]
5641 *[http://[::] unspecified]
5642 *[http://[::13.1.68.3] ipv4compat]
5643 *[http://[::FFFF:129.144.52.38] ipv4compat]
5644
5645 Examples from RFC 2732, section 2:
5646
5647 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5648 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5649 *[http://[3ffe:2a00:100:7031::1] 3]
5650 *[http://[1080::8:800:200C:417A]/foo 4]
5651 *[http://[::192.9.5.5]/ipng 5]
5652 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5653 *[http://[2010:836B:4179::836B:4179] 7]
5654 !! html/php
5655 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5656 </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:
5657 </p>
5658 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5659 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5660 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5661 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5662 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5663 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5664 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5665 </p>
5666 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5667 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5668 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5669 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5670 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5671 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5672 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5673
5674 !! html/parsoid
5675 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5676
5677 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
5678 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5679 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5680 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5681 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5682 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5683 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5684
5685 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
5686 <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>
5687 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5688 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5689 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5690 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5691 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5692 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5693 !! end
5694
5695 !! test
5696 Non-extlinks in brackets
5697 !! wikitext
5698 [foo]
5699 [foo bar]
5700 [foo ''bar'']
5701 [fool's] errand
5702 [fool's errand]
5703 [{{echo|foo}}]
5704 [{{echo|foo}} bar]
5705 [{{echo|foo}} ''bar'']
5706 [{{echo|foo}}l's] errand
5707 [{{echo|foo}}l's errand]
5708 [url={{echo|foo}}]
5709 [url=http://example.com]
5710 [http:// bare protocols don't count]
5711 !! html/php
5712 <p>[foo]
5713 [foo bar]
5714 [foo <i>bar</i>]
5715 [fool's] errand
5716 [fool's errand]
5717 [foo]
5718 [foo bar]
5719 [foo <i>bar</i>]
5720 [fool's] errand
5721 [fool's errand]
5722 [url=foo]
5723 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5724 [http:// bare protocols don't count]
5725 </p>
5726 !! html/parsoid
5727 <p>[foo]
5728 [foo bar]
5729 [foo <i>bar</i>]
5730 [fool's] errand
5731 [fool's errand]
5732 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5733 [<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]
5734 [<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>]
5735 [<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
5736 [<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]
5737 [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>]
5738 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
5739 [http:// bare protocols don't count]</p>
5740 !! end
5741
5742 !! test
5743 Percent encoding in external links
5744 !! wikitext
5745 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5746 !! html/php
5747 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5748 </p>
5749 !! html/parsoid
5750 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5751 !! end
5752
5753 !! test
5754 Use url link syntax for links where the content is equal the link target
5755 !! wikitext
5756 http://example.com
5757 !! html/php
5758 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5759 </p>
5760 !! html/parsoid
5761 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
5762 !! end
5763
5764 !! test
5765 Parenthesis in external links, especially URL links
5766 !! wikitext
5767 http://example.com)
5768
5769 http://example.com/test)
5770
5771 http://example.com/(test)
5772
5773 http://example.com/((test)
5774
5775 (http://example.com/(test))
5776
5777 (http://example.com/(test)))))
5778
5779 http://example.com/a)b
5780
5781 [http://example.com) foo]
5782 !! html/php
5783 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5784 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5785 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5786 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5787 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5788 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5789 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5790 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5791 </p>
5792 !! html/parsoid
5793 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
5794 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
5795 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
5796 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
5797 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
5798 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5799 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
5800 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
5801 !! end
5802
5803 !! test
5804 Parenthesis in external links, w/ transclusion or comment
5805 !! wikitext
5806 (http://example.com/{{echo|hi}})
5807
5808 (http://example.com<!-- hi -->)
5809 !! html/php
5810 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5811 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5812 </p>
5813 !! html/parsoid
5814 <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>
5815
5816 <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>
5817 !! end
5818
5819 !! test
5820 Serialize <a> tags with invalid link targets as plain text
5821 !! options
5822 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5823 !! html/parsoid
5824 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5825 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5826 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5827 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5828 !! wikitext
5829 text
5830 <nowiki>*</nowiki>text
5831 <nowiki>[[foo]]</nowiki>
5832 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5833 !! end
5834
5835 !! test
5836 mw:ExtLink -vs- mw:WikiLink (T94723)
5837 !! options
5838 parsoid=html2wt
5839 !! html/parsoid
5840 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5841 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5842 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5843 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5844 <p>
5845 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5846 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5847 </p>
5848 !! wikitext
5849 [[Foo|Bar]]
5850 [[Foo|Bar]]
5851 [[:en:Foo|Bar]]
5852 [[:en:Foo|Bar]]
5853
5854 [[:en:European_Robin|European Robin]]
5855 [[:en:European_Robin|European Robin]]
5856 !! end
5857
5858 !! test
5859 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5860 !! options
5861 parsoid=wt2wt
5862 !! wikitext
5863 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5864 !! html/parsoid
5865 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5866 !! end
5867
5868
5869 ###
5870 ### Quotes
5871 ###
5872
5873 !! test
5874 Quotes
5875 !! wikitext
5876 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5877
5878 Normal text. '''''Bold italic text.''''' Normal text.
5879 !! html
5880 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5881 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5882 </p>
5883 !! end
5884
5885
5886 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5887 # parser strips. The wikitext contains just the first half of the bold
5888 # quote pair.
5889 !! test
5890 Unclosed and unmatched quotes
5891 !! wikitext
5892 '''''Bold italic text '''with bold deactivated''' in between.'''''
5893
5894 '''''Bold italic text ''with italic deactivated'' in between.'''''
5895
5896 '''Bold text..
5897
5898 ..spanning two paragraphs (should not work).'''
5899
5900 '''Bold tag left open
5901
5902 ''Italic tag left open
5903
5904 Normal text.
5905
5906 <!-- Unmatching number of opening, closing tags: -->
5907 '''This year''''s election ''should'' beat '''last year''''s.
5908
5909 ''Tom'''s car is bigger than ''Susan'''s.
5910
5911 Plain ''italic'''s plain
5912 !! html/php
5913 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5914 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5915 </p><p><b>Bold text..</b>
5916 </p><p>..spanning two paragraphs (should not work).
5917 </p><p><b>Bold tag left open</b>
5918 </p><p><i>Italic tag left open</i>
5919 </p><p>Normal text.
5920 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5921 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5922 </p><p>Plain <i>italic'</i>s plain
5923 </p>
5924 !! html/parsoid
5925 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5926 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5927 </p><p><b>Bold text..</b>
5928 </p><p>..spanning two paragraphs (should not work).<b></b>
5929 </p><p><b>Bold tag left open</b>
5930 </p><p><i>Italic tag left open</i>
5931 </p><p>Normal text.
5932 </p>
5933 <!-- Unmatching number of opening, closing tags: -->
5934 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5935 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5936 </p><p>Plain <i>italic'</i>s plain
5937 </p>
5938 !! end
5939
5940 ###
5941 ### Tables
5942 ###
5943 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5944 ###
5945
5946 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5947 # is the bare minimum required by the spec, see:
5948 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5949 # Parsoid team replies: empty table tags are legal in HTML5
5950 !! test
5951 A table with no data.
5952 !! options
5953 parsoid=wt2html
5954 !! wikitext
5955 {||}
5956 !! html/php
5957
5958 !! html/parsoid
5959 <table></table>
5960
5961 !! end
5962
5963 !! test
5964 A table with stray table end tags on start tag line (wt2html)
5965 !! options
5966 parsoid=wt2html
5967 !! wikitext
5968 {|style="color: red;"|}
5969
5970 {|style="color: red;" |}
5971 |foo
5972 |}
5973
5974 {|style="color: red;"|} id="foo"
5975 |foo
5976 |}
5977
5978 {|style="color: red;" |} id="foo"
5979 |foo
5980 |}
5981 !! html
5982 <table style="color: red;"></table>
5983
5984 <table style="color: red;">
5985 <tbody><tr>
5986 <td>foo</td>
5987 </tr></tbody>
5988 </table>
5989
5990 <table style="color: red;" id="foo">
5991 <tbody><tr>
5992 <td>foo</td>
5993 </tr></tbody>
5994 </table>
5995
5996 <table style="color: red;" id="foo">
5997 <tbody><tr>
5998 <td>foo</td>
5999 </tr></tbody>
6000 </table>
6001
6002 !! end
6003
6004 !! test
6005 A table with no data (take 2)
6006 !! wikitext
6007 {|
6008 |}
6009 !! html/parsoid
6010 <table></table>
6011 !! end
6012
6013 # A table with nothing but a caption is invalid XHTML, we might want to render
6014 # this as <p>caption</p>
6015 # Parsoid team replies: table with only a caption is legal in HTML5
6016 !! test
6017 A table with nothing but a caption
6018 !! wikitext
6019 {|
6020 |+caption
6021 |}
6022 !! html/php
6023 <table>
6024 <caption>caption
6025 </caption><tr><td></td></tr></table>
6026
6027 !! html/parsoid
6028 <table><caption>caption</caption></table>
6029 !! end
6030
6031 !! test
6032 A table with caption with default-spaced attributes and a table row
6033 !! wikitext
6034 {|
6035 |+ style="color: red;" | caption1
6036 |-
6037 |foo
6038 |}
6039 !! html
6040 <table>
6041 <caption style="color: red;">caption1
6042 </caption>
6043 <tr>
6044 <td>foo
6045 </td></tr></table>
6046
6047 !! end
6048
6049 !! test
6050 A table with captions with non-default spaced attributes and a table row
6051 !! wikitext
6052 {|
6053 |+style="color: red;"|caption2
6054 |+ style="color: red;"|caption3
6055 |-
6056 |foo
6057 |}
6058 !! html
6059 <table>
6060 <caption style="color: red;">caption2
6061 </caption>
6062 <caption style="color: red;">caption3
6063 </caption>
6064 <tr>
6065 <td>foo
6066 </td></tr></table>
6067
6068 !! end
6069
6070 !! test
6071 Table td-cell syntax variations
6072 !! wikitext
6073 {|
6074 |foo bar foo|baz
6075 |foo bar foo||baz
6076 |style='color:red;'|baz
6077 |style='color:red;'||baz
6078 |}
6079 !! html
6080 <table>
6081 <tr>
6082 <td>baz
6083 </td>
6084 <td>foo bar foo</td>
6085 <td>baz
6086 </td>
6087 <td style="color:red;">baz
6088 </td>
6089 <td>style='color:red;'</td>
6090 <td>baz
6091 </td></tr></table>
6092
6093 !! end
6094
6095 !! test
6096 Simple table
6097 !! wikitext
6098 {|
6099 |1||2
6100 |-
6101 |3||4
6102 |}
6103 !! html
6104 <table>
6105 <tr>
6106 <td>1</td>
6107 <td>2
6108 </td></tr>
6109 <tr>
6110 <td>3</td>
6111 <td>4
6112 </td></tr></table>
6113
6114 !! end
6115
6116 !! test
6117 Simple table but with multiple dashes for row wikitext
6118 !! wikitext
6119 {|
6120 |foo
6121 |-----
6122 |bar
6123 |}
6124 !! html
6125 <table>
6126 <tr>
6127 <td>foo
6128 </td></tr>
6129 <tr>
6130 <td>bar
6131 </td></tr></table>
6132
6133 !! end
6134
6135 !! test
6136 Multiplication table
6137 !! wikitext
6138 {| border="1" cellpadding="2"
6139 |+Multiplication table
6140 |-
6141 !&times;!!1!!2!!3
6142 |-
6143 !1
6144 |1||2||3
6145 |-
6146 !2
6147 |2||4||6
6148 |-
6149 !3
6150 |3||6||9
6151 |-
6152 !4
6153 |4||8||12
6154 |-
6155 !5
6156 |5||10||15
6157 |}
6158 !! html
6159 <table border="1" cellpadding="2">
6160 <caption>Multiplication table
6161 </caption>
6162 <tr>
6163 <th>&#215;</th>
6164 <th>1</th>
6165 <th>2</th>
6166 <th>3
6167 </th></tr>
6168 <tr>
6169 <th>1
6170 </th>
6171 <td>1</td>
6172 <td>2</td>
6173 <td>3
6174 </td></tr>
6175 <tr>
6176 <th>2
6177 </th>
6178 <td>2</td>
6179 <td>4</td>
6180 <td>6
6181 </td></tr>
6182 <tr>
6183 <th>3
6184 </th>
6185 <td>3</td>
6186 <td>6</td>
6187 <td>9
6188 </td></tr>
6189 <tr>
6190 <th>4
6191 </th>
6192 <td>4</td>
6193 <td>8</td>
6194 <td>12
6195 </td></tr>
6196 <tr>
6197 <th>5
6198 </th>
6199 <td>5</td>
6200 <td>10</td>
6201 <td>15
6202 </td></tr></table>
6203
6204 !! end
6205
6206 !! test
6207 Accept "||" in table headings
6208 !! wikitext
6209 {|
6210 !h1||h2
6211 |}
6212 !! html
6213 <table>
6214 <tr>
6215 <th>h1</th>
6216 <th>h2
6217 </th></tr></table>
6218
6219 !! end
6220
6221 !! test
6222 Accept "!!" in table data
6223 !! wikitext
6224 {|
6225 |Foo!!||
6226 |}
6227 !! html
6228 <table>
6229 <tr>
6230 <td>Foo!!</td>
6231 <td>
6232 </td></tr></table>
6233
6234 !! html/parsoid
6235 <table>
6236 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6237 </tbody></table>
6238 !! end
6239
6240 !! test
6241 Accept "||" in indented table headings
6242 !! wikitext
6243 :{|
6244 !h1||h2
6245 |}
6246 !! html
6247 <dl><dd><table>
6248 <tr>
6249 <th>h1</th>
6250 <th>h2
6251 </th></tr></table></dd></dl>
6252
6253 !! end
6254
6255 !! test
6256 Accept "!!" in templates
6257 !! wikitext
6258 {|
6259 !a {{echo|b!!c}}
6260 |}
6261 !! html/php
6262 <table>
6263 <tr>
6264 <th>a b</th>
6265 <th>c
6266 </th></tr></table>
6267
6268 !! html/parsoid
6269 <table>
6270 <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>
6271 !! end
6272
6273 !! test
6274 Accept "!!" in table headings after newline
6275 !! wikitext
6276 {|
6277 !a
6278 b!!c
6279 |}
6280 !! html/php
6281 <table>
6282 <tr>
6283 <th>a
6284 <p>b!!c
6285 </p>
6286 </th></tr></table>
6287
6288 !! html/parsoid
6289 <table>
6290 <tbody><tr><th>a
6291 <p>b!!c</p></th></tr>
6292 </tbody></table>
6293 !! end
6294
6295 !! test
6296 Accept "!!" in table data of mixed wikitext / html syntax
6297 !! wikitext
6298 {|
6299 !a
6300 <tr><td>b!!c</td></tr>
6301 |}
6302 !! html/php+tidy
6303 <table>
6304 <tbody><tr>
6305 <th>a
6306 </th></tr><tr><td>b!!c</td></tr>
6307 </tbody></table>
6308 !! html/parsoid
6309 <table>
6310 <tbody><tr><th>a</th></tr>
6311 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6312 </tbody></table>
6313 !! end
6314
6315 !! test
6316 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6317 !! wikitext
6318 {|
6319 !| h1
6320 || a
6321 |}
6322 !! html
6323 <table>
6324 <tr>
6325 <th>h1
6326 </th>
6327 <td>a
6328 </td></tr></table>
6329
6330 !! end
6331
6332 !!test
6333 Accept "| !" at start of line in tables (ignore !-attribute)
6334 !! wikitext
6335 {|
6336 |-
6337 |!style="color:red"|bar
6338 |}
6339 !! html
6340 <table>
6341
6342 <tr>
6343 <td>bar
6344 </td></tr></table>
6345
6346 !!end
6347
6348 !!test
6349 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 +/-
6350 !! wikitext
6351 {|
6352 |-
6353 |style='color:red;'|+1
6354 |style='color:blue;'|-1
6355 |-
6356 |1||2||3
6357 |1||+2||-3
6358 |-
6359 | +1
6360 | -1
6361 |}
6362 !! html
6363 <table>
6364
6365 <tr>
6366 <td style="color:red;">+1
6367 </td>
6368 <td style="color:blue;">-1
6369 </td></tr>
6370 <tr>
6371 <td>1</td>
6372 <td>2</td>
6373 <td>3
6374 </td>
6375 <td>1</td>
6376 <td>+2</td>
6377 <td>-3
6378 </td></tr>
6379 <tr>
6380 <td>+1
6381 </td>
6382 <td>-1
6383 </td></tr></table>
6384
6385 !!end
6386
6387 !! test
6388 Table rowspan
6389 !! wikitext
6390 {| border=1
6391 |Cell 1, row 1
6392 |rowspan=2|Cell 2, row 1 (and 2)
6393 |Cell 3, row 1
6394 |-
6395 |Cell 1, row 2
6396 |Cell 3, row 2
6397 |}
6398 !! html
6399 <table border="1">
6400 <tr>
6401 <td>Cell 1, row 1
6402 </td>
6403 <td rowspan="2">Cell 2, row 1 (and 2)
6404 </td>
6405 <td>Cell 3, row 1
6406 </td></tr>
6407 <tr>
6408 <td>Cell 1, row 2
6409 </td>
6410 <td>Cell 3, row 2
6411 </td></tr></table>
6412
6413 !! end
6414
6415 !! test
6416 Nested table
6417 !! wikitext
6418 {| border=1
6419 | &alpha;
6420 |
6421 {| bgcolor=#ABCDEF border=2
6422 |nested
6423 |-
6424 |table
6425 |}
6426 |the original table again
6427 |}
6428 !! html
6429 <table border="1">
6430 <tr>
6431 <td>&#945;
6432 </td>
6433 <td>
6434 <table bgcolor="#ABCDEF" border="2">
6435 <tr>
6436 <td>nested
6437 </td></tr>
6438 <tr>
6439 <td>table
6440 </td></tr></table>
6441 </td>
6442 <td>the original table again
6443 </td></tr></table>
6444
6445 !! end
6446
6447 !! test
6448 Invalid attributes in table cell (T3830)
6449 !! wikitext
6450 {|
6451 |Cell:|broken
6452 |}
6453 !! html
6454 <table>
6455 <tr>
6456 <td>broken
6457 </td></tr></table>
6458
6459 !! end
6460
6461 !! test
6462 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6463 !! wikitext
6464 {|
6465 | title="foo" |bar
6466 | title="foo<nowiki>|</nowiki>" |bar
6467 | title="foo<nowiki>|</nowiki>" bar
6468 |}
6469 !! html/php
6470 <table>
6471 <tr>
6472 <td title="foo">bar
6473 </td>
6474 <td title="foo&#124;">bar
6475 </td>
6476 <td>title="foo|" bar
6477 </td></tr></table>
6478
6479 !! html/parsoid
6480 <table>
6481 <tbody><tr><td title="foo">bar</td>
6482 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6483 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6484 </tbody></table>
6485 !! end
6486
6487 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6488 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6489 # *2wt modes will fail.
6490 !! test
6491 Table security: embedded pipes
6492 !! options
6493 parsoid=wt2html,html2html
6494 !! wikitext
6495 {|
6496 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6497 !! html/php
6498 <table>
6499 <tr>
6500 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6501 <td>]" onmouseover="alert(document.cookie)"&gt;test
6502 </td>
6503 </tr>
6504 </table>
6505
6506 !! html/parsoid
6507 <table><tbody>
6508 <tr>
6509 <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>
6510 !! end
6511
6512 !! test
6513 Element attributes with double ! should not be broken up by <th>
6514 !! wikitext
6515 {|
6516 !hi <div class="!!">ha</div> ho
6517 |}
6518 !! html/php
6519 <table>
6520 <tr>
6521 <th>hi <div class="!!">ha</div> ho
6522 </th></tr></table>
6523
6524 !! html/parsoid
6525 <table>
6526 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6527 </tbody></table>
6528 !! end
6529
6530 !! test
6531 ! and || in element attributes should not be parsed as <th>/<td>
6532 !! wikitext
6533 {|
6534 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6535 |}
6536 !! html/php
6537 <table>
6538 <tr>
6539 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6540 </td></tr></table>
6541
6542 !! html/parsoid
6543 <table>
6544 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6545 </tbody></table>
6546 !! end
6547
6548 # FIXME: The output seems broken. Filed as T110268.
6549 !! test
6550 ! and || in td attributes should not be parsed as <th>/<td>
6551 !! options
6552 parsoid=wt2html
6553 !! wikitext
6554 {|
6555 |style="color: red !important;" data-contrived="put this here ||"|foo
6556 |}
6557 !! html/php
6558 <table>
6559 <tr>
6560 <td>style="color: red !important;" data-contrived="put this here</td>
6561 <td>foo
6562 </td></tr></table>
6563
6564 !! html/parsoid
6565 <table>
6566 <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>
6567 </tbody></table>
6568 !! end
6569
6570 !! test
6571 Break on | in element attribute in template
6572 !! options
6573 parsoid=wt2html,html2html
6574 !! wikitext
6575 {{echo|1=<div class="hi|ho">ha</div>}}
6576 !! html/php
6577 <p>ho"&gt;ha&lt;/div&gt;
6578 </p>
6579 !! html/parsoid
6580 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6581 !! end
6582
6583 !! test
6584 Break on | in element attribute name in template
6585 !! wikitext
6586 {{echo|<div cla|ss="hiho">ha</div>}}
6587 !! html/parsoid
6588 <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>
6589 !! end
6590
6591 !! test
6592 Don't break on | in extension attribute in template
6593 !! wikitext
6594 {{echo|<ref name="hi|ho">ha</ref>}}
6595
6596 <references />
6597 !! html/parsoid
6598 <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>
6599
6600 <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>
6601 !! end
6602
6603 ## We don't support roundtripping of these attributes in Parsoid.
6604 ## Selective serialization takes care of preventing dirty diffs.
6605 ## But, on edits, we dirty-diff the invalid attribute text.
6606 !! test
6607 Invalid text in table attributes should be discarded
6608 !! options
6609 parsoid=wt2html
6610 !! wikitext
6611 {| <span>boo</span> style='border:1px solid black'
6612 | <span>boo</span> style='color:blue' |1
6613 |<span>boo</span> style='color:blue'|2
6614 |}
6615 !! html/php
6616 <table style="border:1px solid black">
6617 <tr>
6618 <td style="color:blue">1
6619 </td>
6620 <td style="color:blue">2
6621 </td></tr></table>
6622
6623 !! html/parsoid
6624 <table style="border:1px solid black">
6625 <tr>
6626 <td style="color:blue">1</td>
6627 <td style="color:blue">2</td>
6628 </tr>
6629 </table>
6630 !! end
6631
6632 !! test
6633 Invalid text in table attributes should be preserved by selective serializer
6634 !! options
6635 parsoid={
6636 "modes": ["selser"],
6637 "changes": [
6638 ["td:first-child", "text", "abc"],
6639 ["td + td", "text", "xyz"]
6640 ]
6641 }
6642 !! wikitext
6643 {| <span>boo</span> style='border:1px solid black'
6644 | <span>boo</span> style='color:blue' | 1
6645 |<span>boo</span> style='color:blue'| 2
6646 |}
6647 !! wikitext/edited
6648 {| <span>boo</span> style='border:1px solid black'
6649 | <span>boo</span> style='color:blue' |abc
6650 |<span>boo</span> style='color:blue'|xyz
6651 |}
6652 !! end
6653
6654 !! test
6655 1. Template-generated table cell attributes and cell content
6656 !! wikitext
6657 {|
6658 |{{table_attribs}}
6659 | {{table_attribs}}
6660 || {{table_attribs_5}}
6661 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6662 |align=center {{table_attribs}}
6663 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6664 |}
6665 !! html
6666 <table>
6667 <tr>
6668 <td style="color:red;">Foo
6669 </td>
6670 <td style="color:red;">Foo
6671 </td>
6672 <td>style="color:red;"</td>
6673 <td>Bar
6674 </td>
6675 <td style="color:red;">Foo
6676 </td>
6677 <td align="center" style="color:red;">Foo
6678 </td>
6679 <td align="center" style="color:red;">Foo
6680 </td></tr></table>
6681
6682 !! end
6683
6684 !! test
6685 2. Template-generated table cell attributes and cell content
6686 !! wikitext
6687 {|
6688 |{{table_attribs_2}}
6689 |}
6690 !! html/php
6691 <table>
6692 <tr>
6693 <td style="color:red;">Foo
6694 </td>
6695 <td>Bar</td>
6696 <td>Baz
6697 </td></tr></table>
6698
6699 !! html/parsoid
6700 <table>
6701 <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>
6702 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6703 </tbody></table>
6704 !! end
6705
6706 !! test
6707 3. Template-generated table cell attributes and cell content
6708 !! wikitext
6709 {|
6710 !align=center {{table_header_cells}}
6711 |-
6712 |align=center {{table_cells}}
6713 |}
6714 !! html/php
6715 <table>
6716 <tr>
6717 <th align="center" style="color:red;">Foo</th>
6718 <th style="color:red;"><i>Bar</i></th>
6719 <th style="color:brown;"><i>Foo</i> and Baz
6720 </th></tr>
6721 <tr>
6722 <td align="center" style="color:red;">Foo</td>
6723 <td style="color:red;"><i>Bar</i></td>
6724 <td style="color:brown;"><i>Foo</i> and Baz
6725 </td></tr></table>
6726
6727 !! html/parsoid
6728 <table>
6729 <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>
6730 <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>
6731 </tbody></table>
6732 !! end
6733
6734 !! test
6735 4. Template-generated table cell attributes and cell content inside a templated table
6736 !! wikitext
6737 {{tbl-start}}
6738 !align=center {{table_header_cells}}
6739 |-
6740 |align=center {{table_cells}}
6741 {{tbl-end}}
6742 !! html/php
6743 <table>
6744 <tr>
6745 <th align="center" style="color:red;">Foo</th>
6746 <th style="color:red;"><i>Bar</i></th>
6747 <th style="color:brown;"><i>Foo</i> and Baz
6748 </th></tr>
6749 <tr>
6750 <td align="center" style="color:red;">Foo</td>
6751 <td style="color:red;"><i>Bar</i></td>
6752 <td style="color:brown;"><i>Foo</i> and Baz
6753 </td></tr></table>
6754
6755 !! html/parsoid
6756 <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}}]}'>
6757 <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>
6758 <tr>
6759 <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>
6760 </tbody></table>
6761 !! end
6762
6763 ## Edge case fix to prevent future regressions
6764 !! test
6765 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6766 !! wikitext
6767 {|
6768 |{{table_attribs_7}}
6769 |}
6770 <references />
6771 !! html/parsoid
6772 <table>
6773 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
6774 </tbody></table>
6775 <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>
6776 !! end
6777
6778 !! test
6779 Table with row followed by newlines and table heading
6780 !! options
6781 parsoid=wt2html,html2html
6782 !! wikitext
6783 {|
6784 |-
6785
6786 !foo
6787 |}
6788 !! html/*
6789 <table>
6790
6791
6792 <tr>
6793 <th>foo
6794 </th></tr></table>
6795
6796 !! end
6797
6798 !! test
6799 Table with empty line following the start tag
6800 !! options
6801 parsoid=wt2html,html2html
6802 !! wikitext
6803 {|
6804
6805 |-
6806 |foo
6807 |}
6808 !! html/*
6809 <table>
6810
6811
6812 <tr>
6813 <td>foo
6814 </td></tr></table>
6815
6816 !! end
6817
6818 !! test
6819 Table attributes with empty value
6820 !! options
6821 parsoid=wt2html,html2html
6822 !! wikitext
6823 {|
6824 | style=|hello
6825 |}
6826 !! html/php
6827 <table>
6828 <tr>
6829 <td style="">hello
6830 </td></tr></table>
6831
6832 !! html/parsoid
6833 <table>
6834 <tbody><tr><td style="">hello</td></tr>
6835 </tbody></table>
6836 !! end
6837
6838 !! test
6839 Wikitext table with a lot of comments
6840 !! wikitext
6841 {|
6842 <!-- c0 -->
6843 |foo
6844 <!-- c1 -->
6845 |-<!-- c2 -->
6846 <!-- c3 -->
6847 |<!-- c4 -->
6848 <!-- c5 -->
6849 |}
6850 !! html
6851 <table>
6852 <tr>
6853 <td>foo
6854 </td></tr>
6855 <tr>
6856 <td>
6857 </td></tr></table>
6858
6859 !! end
6860
6861 !! test
6862 Wikitext table comments represented in parsoid dom
6863 !! wikitext
6864 {|<!--c1--><!--c2-->
6865 |-<!--c3-->
6866 |x
6867 |}
6868 !! html/php+tidy
6869 <table>
6870
6871 <tbody><tr>
6872 <td>x
6873 </td></tr></tbody></table>
6874 !! html/parsoid
6875 <table><!--c1--><!--c2-->
6876 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6877 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
6878 </tbody></table>
6879 !! end
6880
6881 !! test
6882 Wikitext table with double-line table cell
6883 !! wikitext
6884 {|
6885 |a
6886 b
6887 |}
6888 !! html
6889 <table>
6890 <tr>
6891 <td>a
6892 <p>b
6893 </p>
6894 </td></tr></table>
6895
6896 !! end
6897
6898 !! test
6899 Table cell with a single comment
6900 !! wikitext
6901 {|
6902 | <!-- c1 -->
6903 |a
6904 |}
6905 !! html
6906 <table>
6907 <tr>
6908 <td>
6909 </td>
6910 <td>a
6911 </td></tr></table>
6912
6913 !! end
6914
6915 !! test
6916 Table-cell after a comment-only-empty-line
6917 !! wikitext
6918 {|
6919 |a
6920 <!--c1-->
6921 <!--c2-->|b
6922 |}
6923 !! html
6924 <table>
6925 <tr>
6926 <td>a
6927 </td>
6928 <td>b
6929 </td></tr></table>
6930
6931 !! html/parsoid
6932 <table>
6933 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6934 <!--c1-->
6935 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
6936 </tbody></table>
6937
6938 !! end
6939
6940 !! test
6941 Build table with {{!}}
6942 !! wikitext
6943 {{{!}} class="wikitable"
6944 !header
6945 !second header
6946 {{!}}- style="color:red;"
6947 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
6948 {{!}}}
6949 !! html
6950 <table class="wikitable">
6951 <tr>
6952 <th>header
6953 </th>
6954 <th>second header
6955 </th></tr>
6956 <tr style="color:red;">
6957 <td>data</td>
6958 <td style="color:red;">second data
6959 </td></tr></table>
6960
6961 !! end
6962
6963 !! test
6964 Build table with pipe as data
6965 !! wikitext
6966 {| class="wikitable"
6967 !header
6968 !second header
6969 |- style="color:red;"
6970 |data|| style="color:red;" |second data
6971 |-
6972 | style="color:red;" |data with | || style="color:red;" | second data with |
6973 |-
6974 ||data with | |||second data with |
6975 |}
6976 !! html
6977 <table class="wikitable">
6978 <tr>
6979 <th>header
6980 </th>
6981 <th>second header
6982 </th></tr>
6983 <tr style="color:red;">
6984 <td>data</td>
6985 <td style="color:red;">second data
6986 </td></tr>
6987 <tr>
6988 <td style="color:red;">data with |</td>
6989 <td style="color:red;">second data with |
6990 </td></tr>
6991 <tr>
6992 <td>data with |</td>
6993 <td>second data with |
6994 </td></tr></table>
6995
6996 !! end
6997
6998 !! test
6999 Build table with wikilink
7000 !! wikitext
7001 {| class="wikitable"
7002 !header||second header
7003 |- style="color:red;"
7004 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7005 |-
7006 |data||second data [[Main Page|link|text with pipe]]
7007 |}
7008 !! html
7009 <table class="wikitable">
7010 <tr>
7011 <th>header</th>
7012 <th>second header
7013 </th></tr>
7014 <tr style="color:red;">
7015 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7016 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7017 </td></tr>
7018 <tr>
7019 <td>data</td>
7020 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7021 </td></tr></table>
7022
7023 !! end
7024
7025 # The expected HTML structure in this test is debatable. The PHP parser does
7026 # not parse this kind of table at all. The main focus for Parsoid is on
7027 # round-tripping, so this output is ok for now. TODO: revisit!
7028 !! test
7029 Wikitext table with html-syntax row
7030 !! wikitext
7031 {|
7032 |-
7033 <td>foo</td>
7034 |}
7035 !! html/parsoid
7036 <table>
7037 <tbody>
7038 <tr>
7039 <td>foo</td></tr></tbody></table>
7040 !! end
7041
7042 !! test
7043 Fostered content in tables: Plain text
7044 !! options
7045 parsoid=wt2html,html2html
7046 !! wikitext
7047 {|
7048 |-
7049 a
7050 |}
7051 !! html/php
7052 <table>
7053
7054 a
7055 </table>
7056
7057 !! html/php+tidy
7058
7059
7060 a
7061 <table></table>
7062 !! html/parsoid
7063 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
7064 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7065
7066 </tr></tbody></table>
7067 !! end
7068
7069 !! test
7070 Fostered content in tables: Lists
7071 !! options
7072 parsoid=wt2html,html2html
7073 !! wikitext
7074 {|
7075 |-
7076 *a
7077 |}
7078 !! html/php
7079 <table>
7080
7081 <ul><li>a</li></ul>
7082 </table>
7083
7084 !! html/php+tidy
7085 <ul><li>a</li></ul><table>
7086
7087
7088 </table>
7089 !! html/parsoid
7090 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7091 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7092
7093 </tr></tbody></table>
7094 !! end
7095
7096 !! test
7097 Template generated table cell with attributes
7098 !! wikitext
7099 {|
7100 |-
7101 {{table_attribs_4}} ||a||b
7102 |}
7103 !! html/php+tidy
7104 <table>
7105
7106 <tbody><tr>
7107 <td style="background-color:#DC241f;" width="10px"></td>
7108 <td>a</td>
7109 <td>b
7110 </td></tr></tbody></table>
7111 !! html/parsoid
7112 <table>
7113 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7114 <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>
7115 !! end
7116
7117 !! test
7118 Parsoid: Round-trip tables directly followed by content (T53219)
7119 !! options
7120 parsoid=wt2html,wt2wt
7121 !! wikitext
7122 {|
7123 |foo
7124 |} bar
7125
7126 {|
7127 |baz
7128 |}<b>quux</b>
7129 !! html+tidy
7130 <table>
7131 <tbody><tr>
7132 <td>foo
7133 </td></tr></tbody></table><p> bar
7134 </p><table>
7135 <tbody><tr>
7136 <td>baz
7137 </td></tr></tbody></table><p><b>quux</b>
7138 </p>
7139 !! end
7140
7141 !! test
7142 Parsoid: Default to a newline after tables in new content (T53219)
7143 !! options
7144 parsoid=html2wt
7145 !! html/parsoid
7146 <table><tbody>
7147 <tr><td>foo</td></tr></tbody></table> bar
7148 <table><tbody>
7149 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7150 !! wikitext
7151 {|
7152 |foo
7153 |}
7154 <nowiki> </nowiki>bar
7155 {|
7156 |baz
7157 |}
7158 '''quux'''
7159 !! end
7160
7161 !! test
7162 Parsoid: newline inducing block nodes don't suppress <nowiki>
7163 !! options
7164 parsoid=html2wt
7165 !! html/parsoid
7166 a<h1>foo</h1>
7167 !! wikitext
7168 <nowiki> </nowiki>a
7169
7170 = foo =
7171 !! end
7172
7173 !! test
7174 Parsoid: Row-syntax table headings followed by comment & table cells
7175 !! options
7176 parsoid=wt2html,wt2wt
7177 !! wikitext
7178 {|
7179 !foo||bar
7180 <!-- foo --> ||baz||quux
7181 |}
7182 !! html/php
7183 <table>
7184 <tr>
7185 <th>foo</th>
7186 <th>bar
7187 </th>
7188 <td>baz</td>
7189 <td>quux
7190 </td></tr></table>
7191
7192 !! html/parsoid
7193 <table>
7194 <tbody><tr><th> foo </th><th> bar
7195 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7196 </tbody></table>
7197 !! end
7198
7199 !!test
7200 Parsoid: Recover better from broken table attributes
7201 !!options
7202 parsoid=wt2html
7203 !!wikitext
7204 {| class="foo
7205 | class="bar" |
7206 foo
7207 |}
7208 !!html/php+tidy
7209 <table class="foo">
7210 <tbody><tr>
7211 <td class="bar">
7212 <p>foo
7213 </p>
7214 </td></tr></tbody></table>
7215 !!html/parsoid
7216 <table class="foo">
7217 <tr>
7218 <td class="bar">
7219 <p>foo</p></td></tr>
7220 </tbody></table>
7221 !!end
7222
7223 !! test
7224 Tables: Digest broken attributes on table and tr tag
7225 !! options
7226 parsoid=wt2html
7227 !! wikitext
7228 {| || |} ++
7229 |- || || ++ --
7230 |- > [
7231 |}
7232 !! html
7233 <table>
7234 <tbody>
7235 <tr class='mw-empty-elt'></tr>
7236 <tr class='mw-empty-elt'></tr>
7237 </tbody></table>
7238 !! end
7239
7240 # T137406: Whitespace in the HTML
7241 !! test
7242 1. Generate correct wikitext for tables with thead/tbody/tfoot
7243 !! options
7244 parsoid=html2wt
7245 !! html/parsoid
7246 <table>
7247 <caption>Test</caption>
7248 <thead>
7249 <tr>
7250 <th>Month</th>
7251 <th>Savings</th>
7252 </tr>
7253 </thead>
7254 <tbody>
7255 <tr>
7256 <td>January</td>
7257 <td>$100</td>
7258 </tr>
7259 <tr>
7260 <td>February</td>
7261 <td>$80</td>
7262 </tr>
7263 </tbody>
7264 <tfoot>
7265 <tr>
7266 <td>Sum</td>
7267 <td>$180</td>
7268 </tr>
7269 </tfoot>
7270 </table>
7271 !! wikitext
7272 {|
7273 |+Test
7274 !Month
7275 !Savings
7276 |-
7277 |January
7278 |$100
7279 |-
7280 |February
7281 |$80
7282 |-
7283 |Sum
7284 |$180
7285 |}
7286 !! html/php+tidy
7287 <table>
7288 <caption>Test
7289 </caption>
7290 <tbody><tr>
7291 <th>Month
7292 </th>
7293 <th>Savings
7294 </th></tr>
7295 <tr>
7296 <td>January
7297 </td>
7298 <td>$100
7299 </td></tr>
7300 <tr>
7301 <td>February
7302 </td>
7303 <td>$80
7304 </td></tr>
7305 <tr>
7306 <td>Sum
7307 </td>
7308 <td>$180
7309 </td></tr></tbody></table>
7310 !! end
7311
7312 # T137406: No whitespace in the HTML
7313 !! test
7314 2. Generate correct wikitext for tables with thead/tbody/tfoot
7315 !! options
7316 parsoid=html2wt
7317 !! html/parsoid
7318 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7319 !! wikitext
7320 {|
7321 !heading
7322 |-
7323 |foo
7324 |}
7325 !! end
7326
7327 !! test
7328 Testing serialization after deletion in references
7329 !! options
7330 parsoid={
7331 "modes": ["wt2wt"],
7332 "changes": [
7333 ["#x", "remove"]
7334 ]
7335 }
7336 !! wikitext
7337 hi <ref><div id="x">ho</div></ref>
7338
7339 <references />
7340 !! wikitext/edited
7341 hi <ref></ref>
7342
7343 <references />
7344 !! end
7345
7346 !!test
7347 Testing serialization after deletion of table cells
7348 !!options
7349 parsoid={
7350 "modes": ["wt2wt", "selser"],
7351 "changes": [
7352 ["#x", "remove"]
7353 ]
7354 }
7355 !!wikitext
7356 {|
7357 !h1 !!h2 !!h3
7358 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7359 |}
7360 !! wikitext/edited
7361 {|
7362 !h1 !!h2 !!h3
7363 |c2 |||c3
7364 |}
7365 !!end
7366
7367 !! test
7368 Testing selser after addition of new row before first row (T125419)
7369 !! options
7370 parsoid={
7371 "modes": ["wt2wt", "selser"],
7372 "changes": [
7373 [ "tr", "before", "<tr><td>X</td></tr>" ]
7374 ]
7375 }
7376 !! wikitext
7377 {|
7378 |a
7379 |}
7380 !! wikitext/edited
7381 {|
7382 |X
7383 |-
7384 |a
7385 |}
7386 !! end
7387
7388 !! test
7389 Serialize new table rows in a HTML table using HTML tags
7390 !! options
7391 parsoid={
7392 "modes": ["wt2wt", "selser"],
7393 "changes": [
7394 [ "tr", "before", "<tr><td>X</td></tr>" ]
7395 ]
7396 }
7397 !! wikitext
7398 <table><tr><td>a</td></tr></table>
7399 !! wikitext/edited
7400 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7401 !! end
7402
7403 !! test
7404 Serialize new table cells in a HTML row using HTML tags
7405 !! options
7406 parsoid={
7407 "modes": ["wt2wt", "selser"],
7408 "changes": [
7409 [ "td", "before", "<td>X</td>" ]
7410 ]
7411 }
7412 !! wikitext
7413 <table><tr><td>a</td></tr></table>
7414 !! wikitext/edited
7415 <table><tr><td>X</td><td>a</td></tr></table>
7416 !! end
7417
7418 !! test
7419 Wikitext tables can be nested inside HTML tables
7420 !! options
7421 parsoid=html2wt
7422 !! html
7423 <table data-parsoid='{"stx":"html"}'>
7424 <tr><td>
7425 <table>
7426 <tr><td>foo</td></tr>
7427 </table>
7428 </td></tr>
7429 </table>
7430 !! wikitext
7431 <table>
7432 <tr><td>
7433 {|
7434 |foo
7435 |}
7436 </td></tr>
7437 </table>
7438 !! end
7439
7440 !! test
7441 Serialize wikitext list items as HTML list items when embedded in a HTML list
7442 !! options
7443 parsoid=html2wt
7444 !! html
7445 <ul data-parsoid='{"stx": "html"}'>
7446 <li data-parsoid='{}'>a</li>
7447 <li>b</li>
7448 </ul>
7449 !! wikitext
7450 <ul>
7451 <li>a</li>
7452 <li>b</li>
7453 </ul>
7454 !! end
7455
7456 # SSS FIXME: Is this actually a good thing given the
7457 # odd nested list output that is generated by MW?
7458 # <ul><li>foo<ul>..</ul></li></ul> instead of
7459 # <ul><li>foo</li><ul>..</ul></ul>
7460 !! test
7461 Wikitext lists can be nested inside HTML lists
7462 !! options
7463 parsoid=html2wt
7464 !! html
7465 <ul data-parsoid='{"stx": "html"}'>
7466 <li data-parsoid='{"stx": "html"}'>a
7467 <ul><li>b</li></ul>
7468 </li>
7469 </ul>
7470
7471 <ul data-parsoid='{"stx": "html"}'>
7472 <li>x
7473 <ul><li>y</li></ul>
7474 </li>
7475 </ul>
7476 !! wikitext
7477 <ul>
7478 <li>a
7479 * b
7480 </li>
7481 </ul>
7482
7483 <ul>
7484 <li>x
7485 * y
7486 </li>
7487 </ul>
7488 !! end
7489
7490 ###
7491 ### Internal links
7492 ###
7493 !! test
7494 Plain link, capitalized
7495 !! wikitext
7496 [[Main Page]]
7497 !! html
7498 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7499 </p>
7500 !! end
7501
7502 !! test
7503 Plain link, uncapitalized
7504 !! wikitext
7505 [[main Page]]
7506 !! html
7507 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7508 </p>
7509 !! end
7510
7511 !! test
7512 Piped link
7513 !! wikitext
7514 [[Main Page|The Main Page]]
7515 !! html
7516 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Piped link with comment in link text
7522 !! wikitext
7523 [[Main Page|The Main<!--front--> Page]]
7524 !! html
7525 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7526 </p>
7527 !! end
7528
7529 !! test
7530 Piped link with multiple pipe characters in link text
7531 !! wikitext
7532 [[Main Page||The|Main|Page|]]
7533 !! html/php
7534 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7535 </p>
7536 !! html/parsoid
7537 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7538 !! end
7539
7540 !! test
7541 Piped link with no link text
7542 !! wikitext
7543 [[Thomas Bek (bishop of St David's)|]]
7544 !! html/php
7545 <p>[[Thomas Bek (bishop of St David's)|]]
7546 </p>
7547 !! html/parsoid
7548 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7549 !! end
7550
7551 !! test
7552 Piped link with empty link text
7553 !! wikitext
7554 [[Main Page|<nowiki/>]] - empty nowiki
7555 [[Main Page| ]] - empty space
7556 [[Main Page|&nbsp;]] - empty non breaking space
7557 !! html/php
7558 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7559 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7560 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7561 </p>
7562 !! html/parsoid
7563 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7564 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7565 <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>
7566 !! end
7567
7568 !! test
7569 Broken link
7570 !! wikitext
7571 [[Zigzagzogzagzig]]
7572 !! html
7573 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7574 </p>
7575 !! end
7576
7577 !! test
7578 Broken link with fragment
7579 !! wikitext
7580 [[Zigzagzogzagzig#zug]]
7581 !! html
7582 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7583 </p>
7584 !! end
7585
7586 !! test
7587 Special page link with fragment
7588 !! wikitext
7589 [[Special:Version#anchor]]
7590 !! html
7591 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7592 </p>
7593 !! end
7594
7595 !! test
7596 Nonexistent special page link with fragment
7597 !! wikitext
7598 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7599 !! html
7600 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7601 </p>
7602 !! end
7603
7604 !! test
7605 Link with prefix
7606 !! wikitext
7607 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7608 !! html
7609 <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>
7610 </p>
7611 !! end
7612
7613 !! test
7614 Link with suffix
7615 !! wikitext
7616 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7617 !! html
7618 <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>!!!
7619 </p>
7620 !! end
7621
7622 !! article
7623 prefixed article
7624 !! text
7625 Some text
7626 !! endarticle
7627
7628 !! test
7629 T45661: Piped links with identical prefixes
7630 !! wikitext
7631 [[prefixed article|prefixed articles with spaces]]
7632
7633 [[prefixed article|prefixed articlesaoeu]]
7634
7635 [[Main Page|Main Page test]]
7636 !! html
7637 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7638 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7639 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7640 </p>
7641 !! end
7642
7643
7644 !! test
7645 Link with HTML entity in suffix / tail
7646 !! wikitext
7647 [[Main Page]]&quot;, [[Main Page]]&#97;
7648 !! html/php
7649 <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;
7650 </p>
7651 !! html/parsoid
7652 <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>
7653 !! end
7654
7655 !! test
7656 Link with 3 brackets
7657 !! wikitext
7658 [[[Main Page]]]
7659 Foo [[[Main Page]]]
7660 !! html
7661 <p>[[[Main Page]]]
7662 Foo [[[Main Page]]]
7663 </p>
7664 !! end
7665
7666 !! test
7667 Link with 4 brackets
7668 !! wikitext
7669 [[[[Main Page]]]]
7670 !! html
7671 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7672 </p>
7673 !! end
7674
7675 !! test
7676 Piped link with 3 brackets
7677 !! wikitext
7678 [[[main page|the main page]]]
7679 !! html
7680 <p>[[[main page|the main page]]]
7681 </p>
7682 !! end
7683
7684 !! test
7685 Piped link with extlink-like text
7686 !! wikitext
7687 [[Main Page|[bar]]]
7688 [[Main Page|This is a [bar]]]
7689 [[Main Page|[bar]]
7690 !! html/php
7691 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7692 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7693 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7694 </p>
7695 !! html/parsoid
7696 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7697 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7698 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7699 !! end
7700
7701 !! test
7702 Link with multiple pipes
7703 !! wikitext
7704 [[Main Page|The|Main|Page]]
7705 !! html
7706 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7707 </p>
7708 !! end
7709
7710 !! test
7711 Anchor containing a #. (T65430)
7712 !! config
7713 wgFragmentMode=[ 'html5', 'legacy' ]
7714 !! wikitext
7715 [[Main Page#And#Link]]
7716 !! html/php
7717 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7718 </p>
7719 !! html/parsoid
7720 <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>
7721 !! end
7722
7723 !! test
7724 Link to namespaces
7725 !! wikitext
7726 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7727 !! html
7728 <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>
7729 </p>
7730 !! end
7731
7732 !! test
7733 Link with space in namespace
7734 !! wikitext
7735 [[User talk:Foo bar]]
7736 !! html
7737 <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>
7738 </p>
7739 !! end
7740
7741 !! article
7742 MemoryAlpha:AlphaTest
7743 !! text
7744 This is an article in the MemoryAlpha namespace
7745 (which shadows the memoryalpha interwiki link).
7746 !! endarticle
7747
7748 !! test
7749 Namespace takes precedence over interwiki link (T53680)
7750 !! wikitext
7751 [[MemoryAlpha:AlphaTest]]
7752 !! html
7753 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7754 </p>
7755 !! end
7756
7757 # The previous test doesn't work correctly in html2*, due to not recognizing the
7758 # link as an internal one. This one checks for the correct behavior.
7759 !! test
7760 Link to namespace preferred over interwiki with correct rel attribute
7761 !! options
7762 parsoid=html2wt,html2html
7763 !! html/parsoid
7764 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7765 !! wikitext
7766 [[MemoryAlpha:AlphaTest]]
7767 !! end
7768
7769 !! test
7770 Piped link to namespace
7771 !! wikitext
7772 [[Meta:Disclaimers|The disclaimers]]
7773 !! html
7774 <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>
7775 </p>
7776 !! end
7777
7778 !! test
7779 Link containing }
7780 !! wikitext
7781 [[Usually caused by a typo (oops}]]
7782 !! html
7783 <p>[[Usually caused by a typo (oops}]]
7784 </p>
7785 !! end
7786
7787 !! article
7788 7% Solution
7789 !! text
7790 Just a test of an article title containing a percent.
7791 !! endarticle
7792
7793 !! test
7794 Link containing % (not as a hex sequence)
7795 !! wikitext
7796 [[7% Solution]]
7797 [[7% Solution|7%25 Solution]]
7798 !! html/php
7799 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7800 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7801 </p>
7802 !! html/parsoid
7803 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7804 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7805 !! end
7806
7807 # note that the parsoid HTML is identical to the previous test output,
7808 # so the previous test ensures that the html2wt mode will generate the
7809 # "not as a hex sequence" wikitext.
7810 !! test
7811 Link containing % as a single hex sequence interpreted to char
7812 !! options
7813 parsoid=wt2wt,wt2html,html2html
7814 !! wikitext
7815 [[7%25 Solution]]
7816 [[7%25 Solution|7%25 Solution]]
7817 !! html/php
7818 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7819 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7820 </p>
7821 !! html/parsoid
7822 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7823 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7824 !!end
7825
7826 !! test
7827 Link containing % as a double hex sequence interpreted to hex sequence
7828 !! wikitext
7829 [[7%2525 Solution]]
7830 !! html
7831 <p>[[7%2525 Solution]]
7832 </p>
7833 !!end
7834
7835 ## Example for such a section: == < ==
7836 !! test
7837 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7838 !! config
7839 wgFragmentMode=[ 'html5', 'legacy' ]
7840 !! wikitext
7841 [[%23%3c]][[%23%3e]]
7842 !! html/php
7843 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7844 </p>
7845 !! html/parsoid
7846 <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>
7847 !! end
7848
7849 ## Example for such a section: == < ==
7850 !! test
7851 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7852 !! config
7853 wgFragmentMode=[ 'legacy' ]
7854 !! wikitext
7855 [[%23%3c]][[%23%3e]]
7856 !! html/php
7857 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7858 </p>
7859 !! end
7860
7861 !! test
7862 Link containing "<#" and ">#" as a hex sequences
7863 !! wikitext
7864 [[%3c%23]][[%3e%23]]
7865 !! html
7866 <p>[[%3c%23]][[%3e%23]]
7867 </p>
7868 !! end
7869
7870 !! test
7871 Link containing an equals sign
7872 !! wikitext
7873 [[Special:BookSources/isbn=4-00-026157-6]]
7874 !! html/php
7875 <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>
7876 </p>
7877 !! html/parsoid
7878 <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>
7879 !! end
7880
7881 !! article
7882 Foo~bar
7883 !! text
7884 Just a test of an article title containing a tilde.
7885 !! endarticle
7886
7887 # note that links containing signatures, like [[Foo~~~~]], are
7888 # massaged by the pre-save transform (PST) and so the tildes are never
7889 # seen by the parser.
7890 !! test
7891 Link containing a tilde
7892 !! wikitext
7893 [[Foo~bar]]
7894 !! html/php
7895 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7896 </p>
7897 !! html/parsoid
7898 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7899 !! end
7900
7901 !! test
7902 Link containing double-single-quotes '' (T6598)
7903 !! wikitext
7904 [[Lista d''e paise d''o munno]]
7905 !! html/php
7906 <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>
7907 </p>
7908 !! html/parsoid
7909 <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>
7910 !! end
7911
7912 !! test
7913 Link containing double quotes and spaces
7914 !! wikitext
7915 [[Cool "Gator"]]
7916 !! html/php
7917 <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>
7918 </p>
7919 !! html/parsoid
7920 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
7921 !! end
7922
7923 !! test
7924 File containing double quotes and spaces
7925 !! wikitext
7926 [[File:Cool "Gator".png]]
7927 !! html/parsoid
7928 <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>
7929 !! end
7930
7931 !! test
7932 Redirect containing double quotes and spaces
7933 !! wikitext
7934 #REDIRECT [[Cool "Gator"]]
7935 !! html/parsoid
7936 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
7937 !! end
7938
7939 !! test
7940 Link containing double-single-quotes '' in text (T6598 sanity check)
7941 !! wikitext
7942 Some [[Link|pretty ''italics'' and stuff]]!
7943 !! html/php
7944 <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>!
7945 </p>
7946 !! html/parsoid
7947 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7948 !! end
7949
7950 !! test
7951 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
7952 !! wikitext
7953 ''Some [[Link|pretty ''italics'' and stuff]]!''
7954 !! html
7955 <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>
7956 </p>
7957 !! end
7958
7959 !! test
7960 Link with double quotes in title part (literal) and alternate part (interpreted)
7961 !! wikitext
7962 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7963
7964 [[''Pentecoste'']]
7965
7966 [[''Pentecoste''|Pentecoste]]
7967
7968 [[''Pentecoste''|''Pentecoste'']]
7969 !! html/php
7970 <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>
7971 </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>
7972 </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>
7973 </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>
7974 </p>
7975 !! html/parsoid
7976 <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>
7977 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7978 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7979 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7980 !! end
7981
7982 !! test
7983 Broken image links with HTML captions (T41700)
7984 !! wikitext
7985 [[File:Nonexistent|<script></script>]]
7986 [[File:Nonexistent|100x100px|<script></script>]]
7987 [[File:Nonexistent|&lt;]]
7988 [[File:Nonexistent|a<i>b</i>c]]
7989 !! html/php
7990 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7991 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7992 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7993 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7994 </p>
7995 !! html/parsoid
7996 <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>
7997 <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>
7998 <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>
7999 <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>
8000 !! end
8001
8002 !! test
8003 Plain link to URL
8004 !! wikitext
8005 [[http://www.example.com]]
8006 !! html/php
8007 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8008 </p>
8009 !! html/parsoid
8010 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8011 !! end
8012
8013 !! test
8014 Plain link to URL with link text
8015 !! wikitext
8016 [[http://www.example.com Link text]]
8017 !! html
8018 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8019 </p>
8020 !! end
8021
8022 !! test
8023 Plain link to protocol-relative URL
8024 !! wikitext
8025 [[//www.example.com]]
8026 !! html/php
8027 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8028 </p>
8029 !! html/parsoid
8030 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8031 !! end
8032
8033 !! test
8034 Plain link to protocol-relative URL with link text
8035 !! wikitext
8036 [[//www.example.com Link text]]
8037 !! html
8038 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8039 </p>
8040 !! end
8041
8042 !! test
8043 Plain link to page with question mark in title
8044 !! wikitext
8045 [[A?b]]
8046
8047 [[A?b|Baz]]
8048 !! html
8049 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8050 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8051 </p>
8052 !! end
8053
8054 # I'm fairly sure the expected result here is wrong.
8055 # We want these to be URL links, not pseudo-pages with URLs for titles....
8056 # However the current output is also pretty screwy.
8057 #
8058 # ----
8059 # I'm changing it to match the current output--it arguably makes more
8060 # sense in the light of the test above. Old expected result was:
8061 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8062 #</p>
8063 # But I think this test is bordering on "garbage in, garbage out" anyway.
8064 # -- wtm
8065 !! test
8066 Piped link to URL
8067 !! wikitext
8068 Piped link to URL: [[http://www.example.com|an example URL]]
8069 !! html/php
8070 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8071 </p>
8072 !! html/parsoid
8073 <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>
8074 !! end
8075
8076 !! test
8077 Plain link in template argument
8078 !! options
8079 parsoid=wt2html
8080 !! wikitext
8081 {{echo|[http://www.example.com |123]}}
8082
8083 {{echo|[[http://www.example.com |123]]}}
8084
8085 {{echo|[[http://www.example.com |123]}}
8086
8087 {{echo|[http://www.example.com |123]]}}
8088 !! html/php
8089 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8090 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8091 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8092 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8093 </p>
8094 !! html/parsoid
8095 <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>
8096
8097 <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>
8098
8099 <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>
8100
8101 <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>
8102 !! end
8103
8104 !! test
8105 T2002: [[page|http://url/]] should link to page, not http://url/
8106 !! wikitext
8107 [[Main Page|http://url/]]
8108 !! html/php
8109 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8110 </p>
8111 !! html/parsoid
8112 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8113 !! end
8114
8115 # Parsoid does not mark self-links, by design.
8116 !! test
8117 T2337: Escaped self-links should be bold
8118 !! options
8119 title=[[Bug462]]
8120 !! wikitext
8121 [[Bu&#103;462]] [[Bug462]]
8122 !! html/php+tidy
8123 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8124 </p>
8125 !! html/parsoid
8126 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8127 !! end
8128
8129 !! test
8130 Self-link to section should not be bold
8131 !! options
8132 title=[[Main Page]]
8133 !! wikitext
8134 [[Main Page#section]]
8135 !! html
8136 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8137 </p>
8138 !! end
8139
8140 !! article
8141 00
8142 !! text
8143 This is 00.
8144 !! endarticle
8145
8146 !!test
8147 Self-link to numeric title
8148 !!options
8149 title=[[0]]
8150 !! wikitext
8151 [[0]]
8152 !! html
8153 <p><a class="mw-selflink selflink">0</a>
8154 </p>
8155 !!end
8156
8157 !!test
8158 Link to numeric-equivalent title
8159 !!options
8160 title=[[0]]
8161 !! wikitext
8162 [[00]]
8163 !! html
8164 <p><a href="/wiki/00" title="00">00</a>
8165 </p>
8166 !!end
8167
8168 !! test
8169 <nowiki> inside a link
8170 !! wikitext
8171 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8172 !! html
8173 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8174 </p>
8175 !! end
8176
8177 !! test
8178 Non-breaking spaces in title
8179 !! wikitext
8180 [[&nbsp; Main &nbsp; Page &nbsp;]]
8181 !! html
8182 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8183 </p>
8184 !!end
8185
8186 # Add new article for the test below so that it doesn't red-link
8187 !! article
8188 Foo bar baz
8189 !! text
8190 boo
8191 !! endarticle
8192
8193 !! test
8194 Multiple spaces in titles should normalize to a single underscore
8195 !! options
8196 parsoid=wt2html,wt2wt
8197 !! wikitext
8198 [[Foo bar baz|x]]
8199 [[Foo bar baz|x]]
8200 [[Foo bar baz|x]]
8201 !! html/php
8202 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8203 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8204 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8205 </p>
8206 !! html/parsoid
8207 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8208 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8209 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8210 </p>
8211 !! end
8212
8213 !! test
8214 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8215 !! options
8216 language=ca
8217 !! wikitext
8218 '''[[Main Page]]'''
8219 !! html
8220 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8221 </p>
8222 !! end
8223
8224 !! test
8225 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8226 !! options
8227 language=ca
8228 !! wikitext
8229 ''[[Main Page]]''
8230 !! html
8231 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8232 </p>
8233 !! end
8234
8235 !! test
8236 Internal link with en linktrail: no apostrophes (T29473)
8237 !! options
8238 language=en
8239 !! wikitext
8240 [[Something]]'nice
8241 !! html
8242 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8243 </p>
8244 !! end
8245
8246 !! test
8247 Internal link with ca linktrail with apostrophes (T29473)
8248 !! options
8249 language=ca
8250 !! wikitext
8251 [[Something]]'nice
8252 !! html
8253 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8254 </p>
8255 !! end
8256
8257 !! test
8258 Internal link with kaa linktrail with apostrophes (T29473)
8259 !! options
8260 language=kaa
8261 !! wikitext
8262 [[Something]]'nice
8263 !! html
8264 <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>
8265 </p>
8266 !! end
8267
8268 !! test
8269 Link with multiple ":" in a subpage-supporting namespace (T65636)
8270 !! wikitext
8271 [[User:Foo/Test/63636:Bar|Test]]
8272 !! html/php
8273 <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>
8274 </p>
8275 !! html/parsoid
8276 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8277 !! end
8278
8279 ## Mainly a sanity check for Parsoid
8280 !! test
8281 Handle title parsing for subpages
8282 !! options
8283 title=[[/123123]]
8284 subpage
8285 !! wikitext
8286 123
8287 !! html/php
8288 <p>123
8289 </p>
8290 !! html/parsoid
8291 <p>123</p>
8292 !! end
8293
8294 !! article
8295 User:Test/123
8296 !! text
8297 test 123
8298 !! endarticle
8299
8300 !! test
8301 Link to a subpage from a namespace other than main
8302 !! options
8303 title=[[User:Test]]
8304 subpage
8305 !! wikitext
8306 [[/123]]
8307 !! html/php
8308 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8309 </p>
8310 !! html/parsoid
8311 <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>
8312 !! end
8313
8314 !! test
8315 Ensure that transclusion titles are not url-decoded
8316 !! options
8317 subpage title=[[Test]]
8318 parsoid=wt2html
8319 !! wikitext
8320 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8321 !! html/php
8322 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8323 </p>
8324 !! html/parsoid
8325 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8326 !! end
8327
8328 !! test
8329 Purely hash wikilink
8330 !! options
8331 title=[[User:Test/123]]
8332 subpage
8333 !! wikitext
8334 [[#a|b]]
8335 !! html/php
8336 <p><a href="#a">b</a>
8337 </p>
8338 !! html/parsoid
8339 <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>
8340 !! end
8341
8342 !! test
8343 Serialization of purely hash wikilink
8344 !! options
8345 title=[[User:Test/123]]
8346 subpage
8347 parsoid=html2wt
8348 !! html/parsoid
8349 <p><a href="#a">[[</a></p>
8350 !! wikitext
8351 [[#a|<nowiki>[[</nowiki>]]
8352 !! html/php
8353 <p><a href="#a">[[</a>
8354 </p>
8355 !! end
8356
8357 !! test
8358 1. Interaction of linktrail and template encapsulation
8359 !! wikitext
8360 {{echo|[[Foo]]}}l
8361 !! html/parsoid
8362 <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>
8363 !! end
8364
8365 !! test
8366 2. Interaction of linktrail and template encapsulation
8367 !! options
8368 parsoid
8369 !! wikitext
8370 {{echo|Some [[Fool]]}}s
8371 !! html
8372 <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>
8373 !! end
8374
8375 !! test
8376 3. Interaction of linktrail and template encapsulation
8377 !! options
8378 parsoid
8379 !! wikitext
8380 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8381 !! html
8382 <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>
8383 !! end
8384
8385 !! article
8386 Söfnuður
8387 !! text
8388 Test.
8389 !! endarticle
8390
8391 !! test
8392 Internal link with is link prefix
8393 !! options
8394 language=is
8395 !! wikitext
8396 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8397 !! html
8398 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8399 </p>
8400 !! end
8401
8402 !! article
8403 Mótmælendatrú
8404 !! text
8405 Test.
8406 !! endarticle
8407
8408 !! test
8409 Internal link with is link trail and link prefix
8410 !! options
8411 language=is
8412 !! wikitext
8413 [[mótmælendatrú|xxx]]ar
8414 [[mótmælendatrú]]ar
8415 mótmælenda[[söfnuður]]
8416 mótmælenda[[söfnuður|söfnuðir]]
8417 mótmælenda[[söfnuður|söfnuðir]]xxx
8418 !! html
8419 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8420 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8421 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8422 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8423 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8424 </p>
8425 !! end
8426
8427 !! test
8428 Parsoid link trail escaping
8429 !! options
8430 parsoid=html2wt,html2html
8431 !! html/parsoid
8432 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8433 !! wikitext
8434 [[apple]]<nowiki/>s
8435 !! end
8436
8437 !! test
8438 Parsoid link prefix escaping
8439 !! options
8440 language=is
8441 parsoid=html2wt,html2html
8442 !! html/parsoid
8443 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8444 !! wikitext
8445 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8446 !! end
8447
8448 !! test
8449 Parsoid link bracket escaping
8450 !! options
8451 parsoid=html2wt,html2html
8452 !! html/parsoid
8453 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8454 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8455 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8456 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8457 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8458 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8459 !! wikitext
8460 [[Test]]
8461
8462 [<nowiki/>[[Test]]]
8463
8464 [[[[Test]]]]
8465
8466 [[[<nowiki/>[[Test]]]]]
8467
8468 [[[[[[Test]]]]]]
8469
8470 [[[[[<nowiki/>[[Test]]]]]]]
8471 !! end
8472
8473 !! test
8474 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8475 !! wikitext
8476 [[Foo| bar]]
8477
8478 [[Foo| ''bar'']]
8479
8480 [http://wp.org foo]
8481
8482 [http://wp.org ''foo'']
8483 !! html
8484 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8485 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8486 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8487 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8488 </p>
8489 !! end
8490
8491 !! test
8492 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8493 !! wikitext
8494 [[Foo|{{echo|a}} b {{echo|c}}]]
8495 !! html/parsoid
8496 <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>
8497 !! end
8498
8499 !! test
8500 Link with angle bracket after anchor
8501 !! config
8502 wgFragmentMode=[ 'html5', 'legacy' ]
8503 !! wikitext
8504 [[Foo#<bar>]]
8505 !! html/php
8506 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8507 </p>
8508 !! html/parsoid
8509 <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>
8510 !! end
8511
8512 !! test
8513 Link with angle bracket after anchor (legacy)
8514 !! config
8515 wgFragmentMode=[ 'legacy' ]
8516 !! wikitext
8517 [[Foo#<bar>]]
8518 !! html/php
8519 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8520 </p>
8521 !! end
8522
8523 ###
8524 ### Interwiki links (see maintenance/interwiki.sql)
8525 ###
8526
8527 !! test
8528 Inline interwiki link
8529 !! options
8530 parsoid=wt2html,wt2wt,html2html
8531 !! wikitext
8532 [[MeatBall:SoftSecurity]]
8533 !! html/php
8534 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8535 </p>
8536 !! html/parsoid
8537 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8538 !! end
8539
8540 !! test
8541 Inline interwiki link with empty title (T4372)
8542 !! options
8543 parsoid=wt2html,wt2wt,html2html
8544 !! wikitext
8545 [[MeatBall:]]
8546 !! html/php
8547 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8548 </p>
8549 !! html/parsoid
8550 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8551 !! end
8552
8553 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8554 !! test
8555 Interwiki link encoding conversion (T3636)
8556 !! options
8557 parsoid=wt2html,wt2wt
8558 !! wikitext
8559 *[[Wikipedia:ro:Olteni&#0355;a]]
8560 *[[Wikipedia:ro:Olteni&#355;a]]
8561 !! html
8562 <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>
8563 <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>
8564
8565 !! html/php+tidy
8566 <ul>
8567 <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>
8568 <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>
8569 </ul>
8570 !! html/parsoid
8571 <ul>
8572 <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>
8573 <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>
8574 </ul>
8575 !! end
8576
8577 !! test
8578 Interwiki link with fragment (T4130)
8579 !! wikitext
8580 [[MeatBall:SoftSecurity#foo]]
8581 !! html
8582 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8583 </p>
8584 !! end
8585
8586 !! test
8587 Link scenarios with escaped fragments
8588 !! config
8589 wgFragmentMode=[ 'html5', 'legacy' ]
8590 !! wikitext
8591 [[#Is this great?]]
8592 [[Foo#Is this great?]]
8593 [[meatball:Foo#Is this great?]]
8594 !! html/php
8595 <p><a href="#Is_this_great?">#Is this great?</a>
8596 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8597 <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>
8598 </p>
8599 !! html/parsoid
8600 <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>
8601 <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>
8602 <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>
8603 !! end
8604
8605 !! test
8606 Link scenarios with escaped fragments (legacy)
8607 !! config
8608 wgFragmentMode=[ 'legacy' ]
8609 !! wikitext
8610 [[#Is this great?]]
8611 [[Foo#Is this great?]]
8612 [[meatball:Foo#Is this great?]]
8613 !! html/php
8614 <p><a href="#Is_this_great.3F">#Is this great?</a>
8615 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8616 <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>
8617 </p>
8618 !! end
8619
8620 # Ideally the wikipedia: prefix here should be proto-relative too
8621 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8622 # define the 'en' prefix, and originally the test used 'wikipedia',
8623 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8624 # article.
8625 !! test
8626 Different interwiki prefixes mapping to the same URL
8627 !! wikitext
8628 [[:en:Foo]]
8629
8630 [[:en:Foo|Foo]]
8631
8632 [[wikipedia:Foo]]
8633
8634 [[:wikipedia:Foo|Foo]]
8635
8636 [[wikipedia:en:Foo]]
8637
8638 [[:wikipedia:en:Foo]]
8639
8640 [[ wikiPEdia :Foo]]
8641 !! html/parsoid
8642 <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>
8643
8644 <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>
8645
8646 <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>
8647
8648 <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>
8649
8650 <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>
8651
8652 <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>
8653
8654 <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>
8655 !! end
8656
8657 !! test
8658 Interwiki links that cannot be represented in wiki syntax
8659 !! wikitext
8660 [[meatball:ok]]
8661 [[meatball:ok#foo|ok with fragment]]
8662 [[meatball:ok_as_well?|ok ending with ? mark]]
8663 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8664 [http://de.wikipedia.org/wiki/#foo is just fragment]
8665
8666 !! html/php
8667 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8668 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8669 <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>
8670 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8671 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8672 </p>
8673 !! html/parsoid
8674 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8675 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8676 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8677 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8678 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8679 !! end
8680
8681 !! test
8682 Interwiki links: trail
8683 !! wikitext
8684 [[wikipedia:Foo|Ba]]r
8685 !! html/php
8686 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8687 </p>
8688 !! html/parsoid
8689 <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>
8690 !! end
8691
8692 !! test
8693 Local interwiki link
8694 !! options
8695 parsoid=wt2html,wt2wt,html2html
8696 !! wikitext
8697 [[local:Template:Foo]]
8698 !! html/php
8699 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8700 </p>
8701 !! html/parsoid
8702 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8703 !! end
8704
8705 # Parsoid does not mark self-links, by design.
8706 !! test
8707 Local interwiki link: self-link to current page
8708 !! options
8709 title=[[Main Page]]
8710 parsoid=wt2html,wt2wt,html2html
8711 !! wikitext
8712 [[local:Main Page]]
8713 !! html/php
8714 <p><a class="mw-selflink selflink">local:Main Page</a>
8715 </p>
8716 !! html/parsoid
8717 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8718 !! end
8719
8720 !! test
8721 Local interwiki link: prefix only (T66167)
8722 !! options
8723 parsoid=wt2html,wt2wt,html2html
8724 !! wikitext
8725 [[local:]]
8726 !! html/php
8727 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8728 </p>
8729 !! html/parsoid
8730 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8731 !! end
8732
8733 !! test
8734 Local interwiki link: with additional interwiki prefix (T63357)
8735 !! options
8736 parsoid=wt2html,wt2wt,html2html
8737 !! wikitext
8738 [[local:meatball:Hello]]
8739 !! html/php
8740 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8741 </p>
8742 !! html/parsoid
8743 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8744 !! end
8745
8746 !! test
8747 Multiple local interwiki link prefixes
8748 !! wikitext
8749 [[local:local:local:local:mi:local:Foo]]
8750 !! options
8751 parsoid=wt2html,wt2wt,html2html
8752 !! html/php
8753 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8754 </p>
8755 !! html/parsoid
8756 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8757 !! end
8758
8759 ###
8760 ### Interlanguage links
8761 ### Language links (so that searching for '### language' matches..)
8762 ###
8763
8764 !! test
8765 Interlanguage link
8766 !! wikitext
8767 Blah blah blah
8768 [[zh:Chinese]]
8769 !! html/php
8770 <p>Blah blah blah
8771 </p>
8772 !! html/parsoid
8773 <p>Blah blah blah</p>
8774 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8775 !! end
8776
8777 ## parsoid html2wt will lose the space variations
8778 !! test
8779 Interlanguage link with spacing
8780 !! options
8781 parsoid=wt2html,wt2wt,html2html
8782 !! wikitext
8783 Blah blah blah
8784 [[ zh : Chinese ]]
8785 !! html/php
8786 <p>Blah blah blah
8787 </p>
8788 !! html/parsoid
8789 <p>Blah blah blah</p>
8790 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8791 !! end
8792
8793 !! test
8794 Double interlanguage link
8795 !! wikitext
8796 Blah blah blah
8797 [[es:Spanish]]
8798 [[zh:Chinese]]
8799 !! html/php
8800 <p>Blah blah blah
8801 </p>
8802 !! html/parsoid
8803 <p>Blah blah blah</p>
8804 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8805 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8806 !! end
8807
8808 ## parsoid html2wt will lose the space variations
8809 !! test
8810 Interlanguage link variations
8811 !! options
8812 parsoid=wt2html,wt2wt,html2html
8813 !! wikitext
8814 Blah blah blah
8815 [[ es :Spanish]]
8816 [[ ZH :Chinese]]
8817 [[es:Foo_bar]]
8818 !! html/php
8819 <p>Blah blah blah
8820 </p>
8821 !! html/parsoid
8822 <p>Blah blah blah</p>
8823 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8824 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8825 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8826 !! end
8827
8828 !! test
8829 Escaping of interlanguage links (T129218, T156308)
8830 !! wikitext
8831 Blah blah blah
8832 [[:es:Spanish]]
8833 [[ : zh : Chinese ]]
8834 !! html/php
8835 <p>Blah blah blah
8836 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8837 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
8838 </p>
8839 !! html/parsoid
8840 <p>Blah blah blah
8841 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8842 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
8843 !! end
8844
8845 !! test
8846 Multiple colons escaping interlanguage links
8847 !! options
8848 parsoid=wt2html
8849 !! wikitext
8850 [[:es:Spanish]]
8851 [[::es:Spanish]]
8852 [[:::es:Spanish]]
8853 !! html/php
8854 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
8855 [[::es:Spanish]]
8856 [[:::es:Spanish]]
8857 </p>
8858 !! html/parsoid
8859 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
8860 [[::es:Spanish]]
8861 [[:::es:Spanish]]</p>
8862 !! end
8863
8864 ## parsoid html2wt will normalize the space to _
8865 !! test
8866 Space and question mark encoding in interlanguage links (T95473)
8867 !! options
8868 parsoid=wt2html,wt2wt,html2html
8869 !! wikitext
8870 Blah blah blah
8871 [[es:Foo bar?]]
8872 !! html/php
8873 <p>Blah blah blah
8874 </p>
8875 !! html/parsoid
8876 <p>Blah blah blah</p>
8877 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8878 !! end
8879
8880 !! test
8881 Interlanguage link, with prefix links
8882 !! options
8883 language=ln
8884 !! wikitext
8885 Blah blah blah
8886 [[zh:Chinese]]
8887 !! html/php
8888 <p>Blah blah blah
8889 </p>
8890 !! html/parsoid
8891 <p>Blah blah blah</p>
8892 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8893 !! end
8894
8895 !! test
8896 Double interlanguage link, with prefix links (T10897)
8897 !! options
8898 language=ln
8899 !! wikitext
8900 Blah blah blah
8901 [[es:Spanish]]
8902 [[zh:Chinese]]
8903 !! html/php
8904 <p>Blah blah blah
8905 </p>
8906 !! html/parsoid
8907 <p>Blah blah blah</p>
8908 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8909 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8910 !! end
8911
8912 !! test
8913 "Extra" interlanguage links (T34189 / gerrit 111390)
8914 !! wikitext
8915 Blah blah blah
8916 [[mul:Article]]
8917 !! html/php
8918 <p>Blah blah blah
8919 </p>
8920 !! html/parsoid
8921 <p>Blah blah blah</p>
8922 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8923 !! end
8924
8925 ## PHP parser tests script needs an update
8926 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8927 !! test
8928 Language links render as inline links if $wgInterwikiMagic=false
8929 !! options
8930 wgInterwikiMagic=false
8931 parsoid=wt2html,wt2wt,html2html
8932 !! wikitext
8933 Blah blah blah
8934 [[zh:Chinese]]
8935 !! html/parsoid
8936 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8937 !! end
8938
8939 ## PHP parser tests script needs an update
8940 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8941 !! test
8942 Language links render as inline links in the Talk namespace
8943 !! options
8944 title=Talk:Foo
8945 parsoid=wt2html,wt2wt,html2html
8946 !! wikitext
8947 Blah blah blah
8948 [[zh:Chinese]]
8949 !! html/parsoid
8950 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8951 !! end
8952
8953 !! test
8954 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8955 !! options
8956 language=ln
8957 !! wikitext
8958 [[WW&nbsp;II]]
8959 !! html
8960 <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>
8961 </p>
8962 !! end
8963
8964 !! test
8965 Parsoid T55221: Wikilinks should be properly entity-escaped
8966 !! options
8967 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8968 !! html/parsoid
8969 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8970 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8971 !! wikitext
8972 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8973
8974 He&amp;nbsp;llo He&amp;nbsp;llo
8975 !! html/php
8976 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8977 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8978 </p>
8979 !! end
8980
8981 # html2wt will fail because of title normalization without data-parsoid
8982 !! test
8983 Parsoid: handle constructor well
8984 !! options
8985 parsoid=wt2html,wt2wt
8986 !! wikitext
8987 [[constructor]]
8988
8989 [[constructor:foo]]
8990 !! html/php
8991 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8992 </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>
8993 </p>
8994 !! html/parsoid
8995 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8996
8997 <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>
8998 !! end
8999
9000 !! article
9001 ko:
9002 !! text
9003 Test.
9004 !! endarticle
9005
9006 # Note that `ko` isn't a known interlanguage prefix
9007 !! test
9008 Parsoid: recognize interlanguage links without a target page
9009 !! options
9010 ill
9011 !! wikitext
9012 [[es:]]
9013
9014 [[ko:]]
9015 !! html/php
9016 es:
9017 !! html/parsoid
9018 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9019
9020 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9021 !! end
9022
9023 # Note that `ko` isn't a known interwiki prefix
9024 !! test
9025 Parsoid: recognize interwiki links without a target page
9026 !! options
9027 parsoid=wt2html,wt2wt,html2html
9028 !! wikitext
9029 [[:es:]]
9030
9031 [[:ko:]]
9032 !! html/php
9033 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9034 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9035 </p>
9036 !! html/parsoid
9037 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9038 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9039 !! end
9040
9041 !! test
9042 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9043 !! wikitext
9044 [[mi:Foo]]
9045 !! html/php
9046 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9047 </p>
9048 !! html/parsoid
9049 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9050 !! end
9051
9052 !! test
9053 Interlanguage link with preceding local interwiki link (T70085)
9054 !! options
9055 parsoid=wt2html,wt2wt,html2html
9056 !! wikitext
9057 Blah blah blah
9058 [[local:es:Spanish]]
9059 !! html/php
9060 <p>Blah blah blah
9061 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9062 </p>
9063 !! html/parsoid
9064 <p>Blah blah blah
9065 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9066 !! end
9067
9068 !! test
9069 Looks like an interlanguage link, but is actually a local interwiki
9070 !! options
9071 parsoid=wt2html,wt2wt,html2html
9072 !! wikitext
9073 Blah blah blah
9074 [[mi:Template:Foo]]
9075 !! html/php
9076 <p>Blah blah blah
9077 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9078 </p>
9079 !! html/parsoid
9080 <p>Blah blah blah
9081 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9082 !! end
9083
9084 ###
9085 ### Redirects, Parsoid-only
9086 ###
9087
9088 !! test
9089 1. Simple redirect to page
9090 !! wikitext
9091 #REDIRECT [[Main Page]]
9092 !! html/parsoid
9093 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9094 !! end
9095
9096 !! test
9097 2. Other redirect variants
9098 !! wikitext
9099 #REDIRECT [[Main_Page]]
9100 !! html/parsoid
9101 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9102 !! end
9103
9104 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9105 # This tests the Parsoid bail-out code.
9106 !! test
9107 3. Other redirect variants
9108 !! options
9109 parsoid=wt2html
9110 !! wikitext
9111 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9112 !! html/parsoid
9113 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9114 !! end
9115
9116 !! test
9117 4. Redirect to a templated destination
9118 !! wikitext
9119 #REDIRECT [[{{echo|Foo}}bar]]
9120 !! html/parsoid
9121 <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"}]]}'/>
9122 !! end
9123
9124 !! test
9125 Empty redirect
9126 !! options
9127 parsoid=wt2html,wt2wt
9128 !! wikitext
9129 #REDIRECT [[]]
9130 !! html/parsoid
9131 <ol>
9132 <li>REDIRECT [[]]</li></ol>
9133 !! end
9134
9135 !! test
9136 Optional colon in #REDIRECT
9137 !! options
9138 # the colon is archaic syntax. we support it for wt2html, but we
9139 # don't care that it roundtrips back to the modern syntax.
9140 parsoid=wt2html,html2html
9141 !! wikitext
9142 #REDIRECT:[[Main Page]]
9143 !! html/parsoid
9144 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9145 !! end
9146
9147 !! test
9148 Whitespace in #REDIRECT with optional colon
9149 !! options
9150 # the colon and gratuitous whitespace is archaic syntax. we support
9151 # it for wt2html, but we don't care that it roundtrips back to the
9152 # modern syntax (without extra whitespace)
9153 parsoid=wt2html,html2html
9154 !! wikitext
9155
9156 #REDIRECT
9157 :
9158 [[Main Page]]
9159 !! html/parsoid
9160 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9161 !! end
9162
9163 !! test
9164 Piped link in #REDIRECT
9165 !! options
9166 # content after piped link is ignored. we support this syntax,
9167 # but don't care that the piped link is lost when we roundtrip this.
9168 parsoid=wt2html
9169 !! wikitext
9170 #REDIRECT [[Main Page|bar]]
9171 !! html/parsoid
9172 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9173 !! end
9174
9175 !! test
9176 Redirect to category (T104502)
9177 !! options
9178 parsoid=wt2html,wt2wt
9179 !! wikitext
9180 #REDIRECT [[Category:Foo]]
9181 !! html/parsoid
9182 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9183 !! end
9184
9185 !! test
9186 Redirect to category with URL encoding (T104502)
9187 !! options
9188 parsoid=wt2html
9189 !! wikitext
9190 #REDIRECT [[Category%3AFoo]]
9191 !! html/parsoid
9192 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9193 !! end
9194
9195 !! test
9196 Redirect to category page
9197 !! wikitext
9198 #REDIRECT [[:Category:Foo]]
9199 !! html/parsoid
9200 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9201 !! end
9202
9203 !! test
9204 Redirect to image page (1)
9205 !! wikitext
9206 #REDIRECT [[File:Wiki.png]]
9207 !! html/parsoid
9208 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9209 !! end
9210
9211 !! test
9212 Redirect to image page (2)
9213 !! wikitext
9214 #REDIRECT [[Image:Wiki.png]]
9215 !! html/parsoid
9216 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9217 !! end
9218
9219 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9220 # Next test confirms this.
9221 !! test
9222 Redirect to language (1) (T104918)
9223 !! options
9224 parsoid=wt2html,wt2wt,html2html
9225 !! wikitext
9226 #REDIRECT [[en:File:Wiki.png]]
9227 !! html/parsoid
9228 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9229 !! end
9230
9231 !! test
9232 Redirect to language (2) (T104918)
9233 !! wikitext
9234 #REDIRECT [[:en:File:Wiki.png]]
9235 !! html/parsoid
9236 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9237 !! end
9238
9239 !! test
9240 Redirect to interwiki (T104918)
9241 !! wikitext
9242 #REDIRECT [[meatball:File:Wiki.png]]
9243 !! html/parsoid
9244 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9245 !! end
9246
9247 !! test
9248 Non-English #REDIRECT
9249 !! options
9250 language=is
9251 !! wikitext
9252 #TILVÍSUN [[Main Page]]
9253 !! html/parsoid
9254 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9255 !! end
9256
9257 !! test
9258 Redirect syntax under text isn't considered a redirect
9259 !! wikitext
9260 some text
9261
9262 #redirect [[Main Page]]
9263 !! html/parsoid
9264 <p>some text</p>
9265 <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>
9266 !! end
9267
9268 !! test
9269 New redirect
9270 !! options
9271 parsoid=html2wt
9272 !! html/parsoid
9273 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9274 !! wikitext
9275 #REDIRECT [[Foo]]
9276 Foo
9277 !! end
9278
9279 !! test
9280 Redirect followed by block on the same line
9281 !! options
9282 parsoid=wt2html
9283 !! wikitext
9284 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9285 !! html/parsoid
9286 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9287 !! end
9288
9289 !! test
9290 Redirect followed by a newline
9291 !! wikitext
9292 #REDIRECT [[Main Page]]
9293 A newline
9294 !! html/parsoid
9295 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9296 <p>A newline</p>
9297 !! end
9298
9299 !! test
9300 Redirect followed by multiple newlines
9301 !! wikitext
9302 #REDIRECT [[Main Page]]
9303
9304
9305 A newline
9306 !! html/parsoid
9307 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9308
9309 <p><br/>
9310 A newline</p>
9311 !! end
9312
9313 !! test
9314 Drop duplicate redirects
9315 !! options
9316 parsoid=html2wt
9317 !! html/parsoid
9318 <link rel="mw:PageProp/redirect" href="./Foo"/>
9319 <link rel="mw:PageProp/redirect" href="./Bar"/>
9320 <link rel="mw:PageProp/redirect" href="./Baz"/>
9321 !! wikitext
9322 #REDIRECT [[Foo]]
9323 !! end
9324
9325 ##
9326 ## XHTML tidiness
9327 ###
9328
9329 !! test
9330 <br> to <br />
9331 !! wikitext
9332 1<br>2<br />3
9333 !! html
9334 <p>1<br />2<br />3
9335 </p>
9336 !! end
9337
9338 !! test
9339 Broken br tag sanitization
9340 !! wikitext
9341 </br>
9342 !! html/php
9343 <p>&lt;/br&gt;
9344 </p>
9345 !! end
9346
9347 # TODO: Fix html2html mode (T53055)!
9348 !! test
9349 Parsoid: Broken br tag recognition
9350 !! options
9351 parsoid=wt2html
9352 !! wikitext
9353 </br>
9354
9355 <br/ >
9356 !! html+tidy
9357 <p><br />
9358 </p><p><br />
9359 </p>
9360 !! end
9361
9362 !! test
9363 Incorrecly removing closing slashes from correctly formed XHTML
9364 !! wikitext
9365 <br style="clear:both;" />
9366 !! html
9367 <p><br style="clear:both;" />
9368 </p>
9369 !! end
9370
9371 !! test
9372 Failing to transform badly formed HTML into correct XHTML
9373 !! wikitext
9374 <br style="clear: left;">
9375 <br style="clear: right;">
9376 <br style="clear: both;">
9377 !! html
9378 <p><br style="clear: left;" />
9379 <br style="clear: right;" />
9380 <br style="clear: both;" />
9381 </p>
9382 !!end
9383
9384 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9385 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9386 !! test
9387 Handling html with a div self-closing tag
9388 !! wikitext
9389 <div title />
9390 <div title/>
9391 <div title/ >
9392 <div title=bar />
9393 <div title=bar/>
9394 <div title=bar/ >
9395 !! html/php
9396 <p>&lt;div title /&gt;
9397 &lt;div title/&gt;
9398 </p>
9399 <div>
9400 <p>&lt;div title=bar /&gt;
9401 &lt;div title=bar/&gt;
9402 </p>
9403 <div title="bar/"></div>
9404 </div>
9405
9406 !! html/parsoid
9407 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9408 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9409 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9410 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9411 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9412 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9413 !! end
9414
9415 !! test
9416 Handling html with a br self-closing tag
9417 !! wikitext
9418 <br title />
9419 <br title/>
9420 <br title/ >
9421 <br title=bar />
9422 <br title=bar/>
9423 <br title=bar/ >
9424 !! html/php
9425 <p><br title="" />
9426 <br title="" />
9427 <br />
9428 <br title="bar" />
9429 <br title="bar" />
9430 <br title="bar/" />
9431 </p>
9432 !! html/parsoid
9433 <p><br title="" />
9434 <br title="" />
9435 <br title="" />
9436 <br title="bar" />
9437 <br title="bar" />
9438 <br title="bar/" />
9439 </p>
9440 !! end
9441
9442 !! test
9443 Horizontal ruler (should it add that extra space?)
9444 !! wikitext
9445 <hr>
9446 <hr >
9447 foo <hr
9448 > bar
9449 !! html+tidy
9450 <hr />
9451 <hr /><p>
9452 foo </p><hr /><p> bar
9453 </p>
9454 !! end
9455
9456 !! test
9457 Horizontal ruler -- 4+ dashes render hr
9458 !! wikitext
9459 ----
9460 !! html
9461 <hr />
9462
9463 !! end
9464
9465 !! test
9466 Horizontal ruler -- eats additional dashes on the same line
9467 !! wikitext
9468 ---------
9469 !! html
9470 <hr />
9471
9472 !! end
9473
9474 !! test
9475 Horizontal ruler -- does not collapse dashes on consecutive lines
9476 !! wikitext
9477 ----
9478 ----
9479 !! html
9480 <hr />
9481 <hr />
9482
9483 !! end
9484
9485 !! test
9486 Horizontal ruler -- <4 dashes render as plain text
9487 !! wikitext
9488 ---
9489 !! html
9490 <p>---
9491 </p>
9492 !! end
9493
9494 !! test
9495 Horizontal ruler -- Supports content following dashes on same line
9496 !! wikitext
9497 ---- Foo
9498 !! html
9499 <hr /> Foo
9500
9501 !! html+tidy
9502 <hr /><p> Foo
9503 </p>
9504 !! end
9505
9506 ###
9507 ### Block-level elements
9508 ###
9509 !! test
9510 Common list
9511 !! wikitext
9512 *Common list
9513 *item 2
9514 *item 3
9515 !! html
9516 <ul><li>Common list</li>
9517 <li>item 2</li>
9518 <li>item 3</li></ul>
9519
9520 !! end
9521
9522 !! test
9523 Numbered list
9524 !! wikitext
9525 #Numbered list
9526 #item 2
9527 #item 3
9528 !! html
9529 <ol><li>Numbered list</li>
9530 <li>item 2</li>
9531 <li>item 3</li></ol>
9532
9533 !! end
9534
9535 # the switch from level 3 to ordered should not introduce a newline between
9536 !! test
9537 Mixed list
9538 !! wikitext
9539 *Mixed list
9540 *#with numbers
9541 **and bullets
9542 *#and numbers
9543 *bullets again
9544 **bullet level 2
9545 ***bullet level 3
9546 ***#Number on level 4
9547 **bullet level 2
9548 **#Number on level 3
9549 **#Number on level 3
9550 *#number level 2
9551 *Level 1
9552 ***Level 3
9553 #**Level 3, but ordered
9554 !! html
9555 <ul><li>Mixed list
9556 <ol><li>with numbers</li></ol>
9557 <ul><li>and bullets</li></ul>
9558 <ol><li>and numbers</li></ol></li>
9559 <li>bullets again
9560 <ul><li>bullet level 2
9561 <ul><li>bullet level 3
9562 <ol><li>Number on level 4</li></ol></li></ul></li>
9563 <li>bullet level 2
9564 <ol><li>Number on level 3</li>
9565 <li>Number on level 3</li></ol></li></ul>
9566 <ol><li>number level 2</li></ol></li>
9567 <li>Level 1
9568 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9569 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9570
9571 !! end
9572
9573 !! test
9574 1. Nested mixed wikitext and html list
9575 !! wikitext
9576 *hi
9577 *<ul><li>ho</li></ul>
9578 *hi
9579 **ho
9580 !! html/php
9581 <ul><li>hi</li>
9582 <li><ul><li>ho</li></ul></li>
9583 <li>hi
9584 <ul><li>ho</li></ul></li></ul>
9585
9586 !! html/parsoid
9587 <ul><li>hi</li>
9588 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9589 <li>hi
9590 <ul><li>ho</li></ul></li></ul>
9591 !! end
9592
9593 !! test
9594 2. Nested mixed wikitext and html list (incompatible)
9595 !! wikitext
9596 ;hi
9597 :{{echo|<li>ho</li>}}
9598 !! html/php
9599 <dl><dt>hi</dt>
9600 <dd><li>ho</li></dd></dl>
9601
9602 !! html/parsoid
9603 <dl><dt>hi</dt>
9604 <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>
9605 !! end
9606
9607 !! test
9608 Nested lists 1
9609 !! wikitext
9610 *foo
9611 **bar
9612 !! html
9613 <ul><li>foo
9614 <ul><li>bar</li></ul></li></ul>
9615
9616 !! end
9617
9618 !! test
9619 Nested lists 2
9620 !! wikitext
9621 **foo
9622 *bar
9623 !! html
9624 <ul><li><ul><li>foo</li></ul></li>
9625 <li>bar</li></ul>
9626
9627 !! end
9628
9629 !! test
9630 Nested lists 3 (first element empty)
9631 !! wikitext
9632 *
9633 **bar
9634 !! html
9635 <ul><li>
9636 <ul><li>bar</li></ul></li></ul>
9637
9638 !! end
9639
9640 !! test
9641 Nested lists 4 (first element empty)
9642 !! wikitext
9643 **
9644 *bar
9645 !! html
9646 <ul><li><ul><li></li></ul></li>
9647 <li>bar</li></ul>
9648
9649 !! end
9650
9651 !! test
9652 Nested lists 5 (both elements empty)
9653 !! wikitext
9654 **
9655 *
9656 !! html
9657 <ul><li><ul><li></li></ul></li>
9658 <li></li></ul>
9659
9660 !! end
9661
9662 !! test
9663 Nested lists 6 (both elements empty)
9664 !! wikitext
9665 *
9666 **
9667 !! html
9668 <ul><li>
9669 <ul><li></li></ul></li></ul>
9670
9671 !! end
9672
9673 !! test
9674 Nested lists 7 (skip initial nesting levels)
9675 !! wikitext
9676 ***foo
9677 !! html
9678 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9679
9680 !! end
9681
9682 !! test
9683 Nested lists 8 (multiple nesting transitions)
9684 !! wikitext
9685 *foo
9686 ***bar
9687 **baz
9688 *boo
9689 !! html
9690 <ul><li>foo
9691 <ul><li><ul><li>bar</li></ul></li>
9692 <li>baz</li></ul></li>
9693 <li>boo</li></ul>
9694
9695 !! end
9696
9697 !! test
9698 Nested lists 9 (extension interaction)
9699 !! options
9700 parsoid
9701 !! wikitext
9702 *<references />
9703 !! html/parsoid
9704 <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>
9705 !! end
9706
9707 !! test
9708 1. Lists with start-of-line-transparent tokens before bullets: Comments
9709 !! wikitext
9710 *foo
9711 *<!--cmt-->bar
9712 <!--cmt-->*baz
9713 !! html
9714 <ul><li>foo</li>
9715 <li>bar</li>
9716 <li>baz</li></ul>
9717
9718 !! end
9719
9720 !! test
9721 2. Lists with start-of-line-transparent tokens before bullets: Template close
9722 !! wikitext
9723 *foo {{echo|bar
9724 }}*baz
9725 !! html
9726 <ul><li>foo bar</li>
9727 <li>baz</li></ul>
9728
9729 !! end
9730
9731 !! test
9732 List items are not parsed correctly following a <pre> block (T2785)
9733 !! wikitext
9734 *<pre>foo</pre>
9735 *<pre>bar</pre>
9736 *zar
9737 !! html/php
9738 <ul><li><pre>foo</pre></li>
9739 <li><pre>bar</pre></li>
9740 <li>zar</li></ul>
9741
9742 !! html/parsoid
9743 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9744 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9745 <li>zar</li></ul>
9746 !! end
9747
9748 # FIXME: Might benefit from a html/parsoid since this has a template
9749 !! test
9750 List items from template
9751 !! wikitext
9752
9753 {{inner list}}
9754 *item 2
9755
9756 *item 0
9757 {{inner list}}
9758 *item 2
9759
9760 *item 0
9761 *notSOL{{inner list}}
9762 *item 2
9763 !! html
9764 <ul><li>item 1</li>
9765 <li>item 2</li></ul>
9766 <ul><li>item 0</li>
9767 <li>item 1</li>
9768 <li>item 2</li></ul>
9769 <ul><li>item 0</li>
9770 <li>notSOL</li>
9771 <li>item 1</li>
9772 <li>item 2</li></ul>
9773
9774 !! end
9775
9776 !! test
9777 List interrupted by empty line or heading
9778 !! wikitext
9779 *foo
9780
9781 **bar
9782 ==A heading==
9783 *Another list item
9784 !! html
9785 <ul><li>foo</li></ul>
9786 <ul><li><ul><li>bar</li></ul></li></ul>
9787 <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>
9788 <ul><li>Another list item</li></ul>
9789
9790 !!end
9791
9792 !!test
9793 Multiple list tags generated by templates
9794 !! wikitext
9795 {{echo|<li>}}a
9796 {{echo|<li>}}b
9797 {{echo|<li>}}c
9798 !! html
9799 <li>a
9800 <li>b
9801 <li>c</li>
9802 </li>
9803 </li>
9804
9805 !! html+tidy
9806 <li>a
9807 </li><li>b
9808 </li><li>c
9809 </li>
9810 !! html/parsoid
9811 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
9812 </li><li about="#mwt1">b
9813 </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
9814 !!end
9815
9816 !!test
9817 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9818 !! wikitext
9819 *a
9820 <!--This line will NOT split the list-->
9821 *b
9822 <!--This line will NOT split the list either-->
9823 *c
9824 <!--foo--> <!----> <!--This line NOT split the list either-->
9825 *d
9826 !! html
9827 <ul><li>a</li>
9828 <li>b</li>
9829 <li>c</li>
9830 <li>d</li></ul>
9831
9832 !!end
9833
9834 !!test
9835 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9836 !! wikitext
9837 *a
9838 <!--This line will NOT split the list-->
9839 *b
9840 <!--This line will NOT split the list either-->
9841 *c
9842 <!--foo--> <!----> <!--This line NOT split the list
9843 either-->
9844 *d
9845 !! html
9846 <ul><li>a</li>
9847 <li>b</li>
9848 <li>c</li>
9849 <li>d</li></ul>
9850
9851 !!end
9852
9853 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
9854 # That pass could possibly be removed.
9855 !!test
9856 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
9857 !!options
9858 parsoid=wt2html,wt2wt
9859 !! wikitext
9860 *foo
9861 *<li>li-hack
9862 *{{echo|<li>templated li-hack}}
9863 *<!--foo--><li> unsupported li-hack with preceding comments
9864
9865 <ul>
9866 <li><li>not a li-hack
9867 </li>
9868 </ul>
9869 !! html+tidy
9870 <ul><li>foo</li>
9871 <li class="mw-empty-elt"></li><li>li-hack</li>
9872 <li class="mw-empty-elt"></li><li>templated li-hack</li>
9873 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
9874 <ul>
9875 <li class="mw-empty-elt"></li><li>not a li-hack
9876 </li>
9877 </ul>
9878 !! html/parsoid
9879 <ul><li> foo</li>
9880 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
9881 <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>
9882 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
9883
9884 <ul data-parsoid='{"stx":"html"}'>
9885 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
9886 </li>
9887 </ul>
9888
9889 !!end
9890
9891 !! test
9892 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9893 !! options
9894 parsoid
9895 !! wikitext
9896 #foo
9897 ##bar
9898
9899 *foo
9900 **bar
9901
9902 :foo
9903 ::bar
9904 !! html
9905 <ol>
9906 <li>foo<ol>
9907 <li>bar</li>
9908 </ol></li>
9909 </ol><ul>
9910 <li>foo<ul>
9911 <li>bar</li>
9912 </ul></li>
9913 </ul><dl>
9914 <dd>foo<dl>
9915 <dd>bar</dd>
9916 </dl></dd>
9917 </dl>
9918 !! end
9919
9920 !! test
9921 Parsoid: Test of whitespace serialization with Templated bullets
9922 !! options
9923 parsoid
9924 !! wikitext
9925 * {{bullet}}
9926 !! html/parsoid
9927 <ul>
9928 <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>
9929 </ul>
9930 !! end
9931
9932 # ------------------------------------------------------------------------
9933 # The next set of tests are about Parsoid's ability to handle badly nested
9934 # tags (parse, minimize scope of fixup, and roundtrip back)
9935 # ------------------------------------------------------------------------
9936
9937 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
9938 # Parsoid's list handling is more aware of block structure.
9939 !! test
9940 Unbalanced closing block tags break a list
9941 !! wikitext
9942 <div>
9943 *a</div><div>
9944 *b</div>
9945 !! html+tidy
9946 <div>
9947 <ul><li>a</li></ul></div><div>
9948 <li>b</li></div>
9949 !! html/parsoid
9950 <div><ul>
9951 <li>a</li>
9952 </ul></div>
9953 <div><ul>
9954 <li>b</li>
9955 </ul></div>
9956 !! end
9957
9958 !! test
9959 Unbalanced closing non-block tags don't break a list
9960 !! wikitext
9961 <span>
9962 *a</span><span>
9963 *b</span>
9964 !! html/php+tidy
9965 <p><span>
9966 </span></p>
9967 <ul><li>a<span></span></li>
9968 <li>b</li></ul>
9969 !! html/parsoid
9970 <span>
9971 <ul>
9972 <li>a<span></span></li>
9973 <li>b</li>
9974 </ul>
9975 </span>
9976 !! end
9977
9978 # Parsoid does some post-dom-building cleanup
9979 # which is why its output differs from Remex.
9980 !! test
9981 Unclosed formatting tags that straddle lists are closed and reopened
9982 !! options
9983 parsoid=wt2html,wt2wt,html2html
9984 !! wikitext
9985 #<s> a
9986 #b </s>
9987 !! html/php+tidy
9988 <ol><li><s> a</s></li><s>
9989 </s><li><s>b </s></li></ol>
9990 !! html/parsoid
9991 <ol><li><s> a</s></li>
9992 <li><s>b </s></li></ol>
9993 !! end
9994
9995 # Output is ugly because of all the misnested tag fixups.
9996 # Remex is wrapping p-tags around empty elements.
9997 # Parsoid has special-case handling of this pattern of
9998 # wrapping lists in formatting tags.
9999 # FIXME: Should we remove this code from Parsoid? Or add
10000 # special support in Remex? If the latter, maybe just wait
10001 # for Parsoid to become the default parser.
10002 # See T70395.
10003 !!test
10004 1. List embedded in a formatting tag
10005 !! wikitext
10006 <small>
10007 *foo
10008 </small>
10009 !! html/php+tidy
10010 <p><small>
10011 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10012 </p>
10013 !! html/parsoid
10014 <small>
10015 <ul>
10016 <li>foo</li>
10017 </ul>
10018 </small>
10019 !!end
10020
10021 # Output is ugly because of all the misnested tag fixups
10022 # Remex is wrapping p-tags around empty elements.
10023 # Parsoid has code that strips useless p-tags.
10024 !!test
10025 2. List embedded in a formatting tag in a misnested way
10026 !! wikitext
10027 <small>
10028 *a
10029 *b</small>
10030 !! html/php+tidy
10031 <p><small>
10032 </small></p><small></small><ul><small><li>a</li>
10033 </small><li><small>b</small></li></ul>
10034 !! html/parsoid
10035 <small></small>
10036 <ul><small>
10037 <li>a</li>
10038 </small>
10039 <li><small>b</small></li>
10040 </ul>
10041 !!end
10042
10043 !! test
10044 Table with missing opening <tr> tag
10045 !! options
10046 parsoid=wt2html,wt2wt
10047 !! wikitext
10048 <table>
10049 <td>foo</td>
10050 </tr>
10051 </table>
10052 !! html+tidy
10053 <table>
10054 <tbody><tr><td>foo</td>
10055 </tr>
10056 </tbody></table>
10057 !! end
10058
10059 ###
10060 ### Magic Words
10061 ###
10062
10063 # Note that the current date is hard-coded as
10064 # 1970-01-01T00:02:03Z (a Thursday)
10065 # when running parser tests. The timezone is also fixed to GMT, so
10066 # local date will be identical to current date.
10067
10068 !! test
10069 Magic Word: {{CURRENTDAY}}
10070 !! wikitext
10071 {{CURRENTDAY}}
10072 !! html
10073 <p>1
10074 </p>
10075 !! end
10076
10077 !! test
10078 Magic Word: {{CURRENTDAY2}}
10079 !! wikitext
10080 {{CURRENTDAY2}}
10081 !! html
10082 <p>01
10083 </p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{CURRENTDAYNAME}}
10088 !! wikitext
10089 {{CURRENTDAYNAME}}
10090 !! html
10091 <p>Thursday
10092 </p>
10093 !! end
10094
10095 !! test
10096 Magic Word: {{CURRENTDOW}}
10097 !! wikitext
10098 {{CURRENTDOW}}
10099 !! html
10100 <p>4
10101 </p>
10102 !! end
10103
10104 !! test
10105 Magic Word: {{CURRENTMONTH}}
10106 !! wikitext
10107 {{CURRENTMONTH}}
10108 !! html
10109 <p>01
10110 </p>
10111 !! end
10112
10113 !! test
10114 Magic Word: {{CURRENTMONTH1}}
10115 !! wikitext
10116 {{CURRENTMONTH1}}
10117 !! html
10118 <p>1
10119 </p>
10120 !! end
10121
10122 !! test
10123 Magic Word: {{CURRENTMONTHABBREV}}
10124 !! wikitext
10125 {{CURRENTMONTHABBREV}}
10126 !! html
10127 <p>Jan
10128 </p>
10129 !! end
10130
10131 !! test
10132 Magic Word: {{CURRENTMONTHNAME}}
10133 !! wikitext
10134 {{CURRENTMONTHNAME}}
10135 !! html
10136 <p>January
10137 </p>
10138 !! end
10139
10140 !! test
10141 Magic Word: {{CURRENTMONTHNAMEGEN}}
10142 !! wikitext
10143 {{CURRENTMONTHNAMEGEN}}
10144 !! html
10145 <p>January
10146 </p>
10147 !! end
10148
10149 !! test
10150 Magic Word: {{CURRENTTIME}}
10151 !! wikitext
10152 {{CURRENTTIME}}
10153 !! html
10154 <p>00:02
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{CURRENTHOUR}}
10160 !! wikitext
10161 {{CURRENTHOUR}}
10162 !! html
10163 <p>00
10164 </p>
10165 !! end
10166
10167 !! test
10168 Magic Word: {{CURRENTWEEK}} (T6594)
10169 !! wikitext
10170 {{CURRENTWEEK}}
10171 !! html
10172 <p>1
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{CURRENTYEAR}}
10178 !! wikitext
10179 {{CURRENTYEAR}}
10180 !! html
10181 <p>1970
10182 </p>
10183 !! end
10184
10185 !! test
10186 Magic Word: {{CURRENTTIMESTAMP}}
10187 !! wikitext
10188 {{CURRENTTIMESTAMP}}
10189 !! html
10190 <p>19700101000203
10191 </p>
10192 !! end
10193
10194 !! test
10195 Magic Words LOCAL (UTC)
10196 !! wikitext
10197 *{{LOCALMONTH}}
10198 *{{LOCALMONTH1}}
10199 *{{LOCALMONTHNAME}}
10200 *{{LOCALMONTHNAMEGEN}}
10201 *{{LOCALMONTHABBREV}}
10202 *{{LOCALDAY}}
10203 *{{LOCALDAY2}}
10204 *{{LOCALDAYNAME}}
10205 *{{LOCALYEAR}}
10206 *{{LOCALTIME}}
10207 *{{LOCALHOUR}}
10208 *{{LOCALWEEK}}
10209 *{{LOCALDOW}}
10210 *{{LOCALTIMESTAMP}}
10211 !! html
10212 <ul><li>01</li>
10213 <li>1</li>
10214 <li>January</li>
10215 <li>January</li>
10216 <li>Jan</li>
10217 <li>1</li>
10218 <li>01</li>
10219 <li>Thursday</li>
10220 <li>1970</li>
10221 <li>00:02</li>
10222 <li>00</li>
10223 <li>1</li>
10224 <li>4</li>
10225 <li>19700101000203</li></ul>
10226
10227 !! end
10228
10229 !! test
10230 Magic Word: {{FULLPAGENAME}}
10231 !! options
10232 title=[[User:Ævar Arnfjörð Bjarmason]]
10233 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10234 !! wikitext
10235 {{FULLPAGENAME}}
10236 !! html/*
10237 <p>User:Ævar Arnfjörð Bjarmason
10238 </p>
10239 !! end
10240
10241 !! test
10242 Magic Word: {{FULLPAGENAMEE}}
10243 !! options
10244 title=[[User:Ævar Arnfjörð Bjarmason]]
10245 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10246 !! wikitext
10247 {{FULLPAGENAMEE}}
10248 !! html/*
10249 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10250 </p>
10251 !! end
10252
10253 !! test
10254 Magic Word: {{TALKSPACE}}
10255 !! options
10256 title=[[User:Ævar Arnfjörð Bjarmason]]
10257 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10258 !! wikitext
10259 {{TALKSPACE}}
10260 !! html/*
10261 <p>User talk
10262 </p>
10263 !! end
10264
10265 !! test
10266 Magic Word: {{TALKSPACE}}, same namespace
10267 !! options
10268 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10269 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10270 !! wikitext
10271 {{TALKSPACE}}
10272 !! html/*
10273 <p>User talk
10274 </p>
10275 !! end
10276
10277 !! test
10278 Magic Word: {{TALKSPACE}}, main namespace
10279 !! options
10280 title=[[Parser Test]]
10281 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10282 !! wikitext
10283 {{TALKSPACE}}
10284 !! html/*
10285 <p>Talk
10286 </p>
10287 !! end
10288
10289 !! test
10290 Magic Word: {{TALKSPACEE}}
10291 !! options
10292 title=[[User:Ævar Arnfjörð Bjarmason]]
10293 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10294 !! wikitext
10295 {{TALKSPACEE}}
10296 !! html/*
10297 <p>User_talk
10298 </p>
10299 !! end
10300
10301 !! test
10302 Magic Word: {{SUBJECTSPACE}}
10303 !! options
10304 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10305 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10306 !! wikitext
10307 {{SUBJECTSPACE}}
10308 !! html/*
10309 <p>User
10310 </p>
10311 !! end
10312
10313 !! test
10314 Magic Word: {{SUBJECTSPACE}}, same namespace
10315 !! options
10316 title=[[User:Ævar Arnfjörð Bjarmason]]
10317 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10318 !! wikitext
10319 {{SUBJECTSPACE}}
10320 !! html/*
10321 <p>User
10322 </p>
10323 !! end
10324
10325 !! test
10326 Magic Word: {{SUBJECTSPACE}}, main namespace
10327 !! options
10328 title=[[Parser Test]]
10329 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10330 !! wikitext
10331 {{SUBJECTSPACE}}
10332 !! html/*
10333
10334 !! end
10335
10336 !! test
10337 Magic Word: {{SUBJECTSPACEE}}
10338 !! options
10339 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10340 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10341 !! wikitext
10342 {{SUBJECTSPACEE}}
10343 !! html/*
10344 <p>User
10345 </p>
10346 !! end
10347
10348 !! test
10349 Magic Word: {{NAMESPACE}}
10350 !! options
10351 title=[[User:Ævar Arnfjörð Bjarmason]]
10352 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10353 !! wikitext
10354 {{NAMESPACE}}
10355 !! html/*
10356 <p>User
10357 </p>
10358 !! end
10359
10360 !! test
10361 Magic Word: {{NAMESPACEE}}
10362 !! options
10363 title=[[User:Ævar Arnfjörð Bjarmason]]
10364 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10365 !! wikitext
10366 {{NAMESPACEE}}
10367 !! html/*
10368 <p>User
10369 </p>
10370 !! end
10371
10372 !! test
10373 Magic Word: {{NAMESPACENUMBER}}
10374 !! options
10375 title=[[User:Ævar Arnfjörð Bjarmason]]
10376 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10377 !! wikitext
10378 {{NAMESPACENUMBER}}
10379 !! html/*
10380 <p>2
10381 </p>
10382 !! end
10383
10384 !! test
10385 Magic Word: {{SUBPAGENAME}}
10386 !! options
10387 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10388 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10389 !! wikitext
10390 {{SUBPAGENAME}}
10391 !! html/*
10392 <p>sub ö
10393 </p>
10394 !! end
10395
10396 !! test
10397 Magic Word: {{SUBPAGENAMEE}}
10398 !! options
10399 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10400 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10401 !! wikitext
10402 {{SUBPAGENAMEE}}
10403 !! html/*
10404 <p>sub_%C3%B6
10405 </p>
10406 !! end
10407
10408 !! test
10409 Magic Word: {{ROOTPAGENAME}}
10410 !! options
10411 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10412 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10413 !! wikitext
10414 {{ROOTPAGENAME}}
10415 !! html/*
10416 <p>Ævar Arnfjörð Bjarmason
10417 </p>
10418 !! end
10419
10420 !! test
10421 Magic Word: {{ROOTPAGENAMEE}}
10422 !! options
10423 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10424 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10425 !! wikitext
10426 {{ROOTPAGENAMEE}}
10427 !! html/*
10428 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10429 </p>
10430 !! end
10431
10432 !! test
10433 Magic Word: {{BASEPAGENAME}}
10434 !! options
10435 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10436 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10437 !! wikitext
10438 {{BASEPAGENAME}}
10439 !! html/*
10440 <p>Ævar Arnfjörð Bjarmason
10441 </p>
10442 !! end
10443
10444 !! test
10445 Magic Word: {{BASEPAGENAMEE}}
10446 !! options
10447 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10448 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10449 !! wikitext
10450 {{BASEPAGENAMEE}}
10451 !! html/*
10452 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10453 </p>
10454 !! end
10455
10456 !! test
10457 Magic Word: {{TALKPAGENAME}}
10458 !! options
10459 title=[[User:Ævar Arnfjörð Bjarmason]]
10460 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10461 !! wikitext
10462 {{TALKPAGENAME}}
10463 !! html/*
10464 <p>User talk:Ævar Arnfjörð Bjarmason
10465 </p>
10466 !! end
10467
10468 !! test
10469 Magic Word: {{TALKPAGENAMEE}}
10470 !! options
10471 title=[[User:Ævar Arnfjörð Bjarmason]]
10472 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10473 !! wikitext
10474 {{TALKPAGENAMEE}}
10475 !! html/*
10476 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10477 </p>
10478 !! end
10479
10480 !! test
10481 Magic Word: {{SUBJECTPAGENAME}}
10482 !! options
10483 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10484 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10485 !! wikitext
10486 {{SUBJECTPAGENAME}}
10487 !! html/*
10488 <p>User:Ævar Arnfjörð Bjarmason
10489 </p>
10490 !! end
10491
10492 !! test
10493 Magic Word: {{SUBJECTPAGENAMEE}}
10494 !! options
10495 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10496 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10497 !! wikitext
10498 {{SUBJECTPAGENAMEE}}
10499 !! html/*
10500 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10501 </p>
10502 !! end
10503
10504 !! test
10505 Magic Word: {{NUMBEROFFILES}}
10506 !! options
10507 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10508 !! wikitext
10509 {{NUMBEROFFILES}}
10510 !! html/*
10511 <p>7
10512 </p>
10513 !! end
10514
10515 !! test
10516 Magic Word: {{PAGENAME}}
10517 !! options
10518 title=[[User:Ævar Arnfjörð Bjarmason]]
10519 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10520 !! wikitext
10521 {{PAGENAME}}
10522 !! html/*
10523 <p>Ævar Arnfjörð Bjarmason
10524 </p>
10525 !! end
10526
10527 !! test
10528 Magic Word: {{PAGENAME}} with metacharacters
10529 !! options
10530 title=[['foo & bar = baz']]
10531 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10532 !! wikitext
10533 ''{{PAGENAME}}''
10534 !! html+tidy
10535 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10536 </p>
10537 !! end
10538
10539 !! test
10540 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10541 !! options
10542 title=[[*RFC 1234 http://example.com/]]
10543 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10544 !! wikitext
10545 {{PAGENAME}}
10546 !! html+tidy
10547 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10548 </p>
10549 !! end
10550
10551 !! test
10552 Magic Word: {{PAGENAMEE}}
10553 !! options
10554 title=[[User:Ævar Arnfjörð Bjarmason]]
10555 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10556 !! wikitext
10557 {{PAGENAMEE}}
10558 !! html/*
10559 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10560 </p>
10561 !! end
10562
10563 !! test
10564 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10565 !! options
10566 title=[[*RFC 1234 http://example.com/]]
10567 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10568 !! wikitext
10569 {{PAGENAMEE}}
10570 !! html+tidy
10571 <p>&#42;RFC_1234_http&#58;//example.com/
10572 </p>
10573 !! end
10574
10575 !! test
10576 Magic Word: {{REVISIONID}}
10577 !! options
10578 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10579 showflags
10580 !! wikitext
10581 {{REVISIONID}}
10582 !! html/*
10583 <p>1337
10584 </p>
10585 flags=vary-revision-id
10586 !! end
10587
10588 !! test
10589 Magic Word: {{SCRIPTPATH}}
10590 !! options
10591 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10592 !! wikitext
10593 {{SCRIPTPATH}}
10594 !! html/*
10595
10596 !! end
10597
10598 !! test
10599 Magic Word: {{STYLEPATH}}
10600 !! options
10601 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10602 !! wikitext
10603 {{STYLEPATH}}
10604 !! html/*
10605 <p>/skins
10606 </p>
10607 !! end
10608
10609 !! test
10610 Magic Word: {{SERVER}}
10611 !! options
10612 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10613 !! wikitext
10614 {{SERVER}}
10615 !! html/*
10616 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10617 </p>
10618 !! end
10619
10620 !! test
10621 Magic Word: {{SERVERNAME}}
10622 !! options
10623 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10624 !! wikitext
10625 {{SERVERNAME}}
10626 !! html/*
10627 <p>example.org
10628 </p>
10629 !! end
10630
10631 !! test
10632 Magic Word: {{SITENAME}}
10633 !! options
10634 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10635 !! wikitext
10636 {{SITENAME}}
10637 !! html/*
10638 <p>MediaWiki
10639 </p>
10640 !! end
10641
10642 !! test
10643 Magic Word: {{PAGELANGUAGE}}
10644 !! options
10645 language=fr
10646 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10647 !! wikitext
10648 {{PAGELANGUAGE}}
10649 !! html/*
10650 <p>fr
10651 </p>
10652 !! end
10653
10654 !! test
10655 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10656 !! options
10657 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10658 !! wikitext
10659 {{PAGELANGUAGE}}
10660 !! html/*
10661 <p>en
10662 </p>
10663 !! end
10664
10665 !! test
10666 Case-sensitive magic words, when cased differently, should just be template transclusions
10667 !! wikitext
10668 {{CurrentMonth}}
10669 {{currentday}}
10670 {{cURreNTweEK}}
10671 {{currentHour}}
10672 !! html
10673 <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>
10674 <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>
10675 <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>
10676 <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>
10677 </p>
10678 !! end
10679
10680 !! test
10681 Case-insensitive magic words should still work with weird casing.
10682 !! wikitext
10683 {{sErVeRNaMe}}
10684 {{LCFirst:AOEU}}
10685 {{ucFIRST:aoeu}}
10686 {{SERver}}
10687 !! html
10688 <p>example.org
10689 aOEU
10690 Aoeu
10691 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10692 </p>
10693 !! end
10694
10695 # From plwiki:PLOS_ONE
10696 !! test
10697 Parsoid: Page property magic word with magic word contents
10698 !! wikitext
10699 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10700 !! html/parsoid
10701 <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>"}]]}'/>
10702 !! end
10703
10704 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
10705 # But, this is a limitation of our representation and is documented in
10706 # TemplateHandler.js in processSpecialMagicWord
10707 !! test
10708 Parsoid: Template-generated DISPLAYTITLE
10709 !! wikitext
10710 {{{{echo|DISPLAYTITLE}}:Foo}}
10711 !! options
10712 showtitle
10713 !! config
10714 wgAllowDisplayTitle=true
10715 wgRestrictDisplayTitle=false
10716 !! html/php
10717 Foo
10718
10719 !! html/parsoid
10720 <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"}]]}'/>
10721 !! end
10722
10723 !! test
10724 Namespace 1 {{ns:1}}
10725 !! wikitext
10726 {{ns:1}}
10727 !! html
10728 <p>Talk
10729 </p>
10730 !! end
10731
10732 !! test
10733 Namespace 1 {{ns:01}}
10734 !! wikitext
10735 {{ns:01}}
10736 !! html
10737 <p>Talk
10738 </p>
10739 !! end
10740
10741 !! test
10742 Namespace 0 {{ns:0}} (T6783)
10743 !! wikitext
10744 {{ns:0}}
10745 !! html
10746
10747 !! end
10748
10749 !! test
10750 Namespace 0 {{ns:00}} (T6783)
10751 !! wikitext
10752 {{ns:00}}
10753 !! html
10754
10755 !! end
10756
10757 !! test
10758 Namespace -1 {{ns:-1}}
10759 !! wikitext
10760 {{ns:-1}}
10761 !! html
10762 <p>Special
10763 </p>
10764 !! end
10765
10766 !! test
10767 Namespace User {{ns:User}}
10768 !! wikitext
10769 {{ns:User}}
10770 !! html
10771 <p>User
10772 </p>
10773 !! end
10774
10775 !! test
10776 Namespace User talk {{ns:User_talk}}
10777 !! wikitext
10778 {{ns:User_talk}}
10779 !! html
10780 <p>User talk
10781 </p>
10782 !! end
10783
10784 !! test
10785 Namespace User talk {{ns:uSeR tAlK}}
10786 !! wikitext
10787 {{ns:uSeR tAlK}}
10788 !! html
10789 <p>User talk
10790 </p>
10791 !! end
10792
10793 !! test
10794 Namespace File {{ns:File}}
10795 !! wikitext
10796 {{ns:File}}
10797 !! html
10798 <p>File
10799 </p>
10800 !! end
10801
10802 !! test
10803 Namespace File {{ns:Image}}
10804 !! wikitext
10805 {{ns:Image}}
10806 !! html
10807 <p>File
10808 </p>
10809 !! end
10810
10811 !! test
10812 Namespace (lang=de) Benutzer {{ns:User}}
10813 !! options
10814 language=de
10815 !! wikitext
10816 {{ns:User}}
10817 !! html
10818 <p>Benutzer
10819 </p>
10820 !! end
10821
10822 !! test
10823 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10824 !! options
10825 language=de
10826 !! wikitext
10827 {{ns:3}}
10828 !! html
10829 <p>Benutzer Diskussion
10830 </p>
10831 !! end
10832
10833 !! test
10834 Urlencode
10835 !! wikitext
10836 {{urlencode:hi world?!}}
10837 {{urlencode:hi world?!|WIKI}}
10838 {{urlencode:hi world?!|PATH}}
10839 {{urlencode:hi world?!|QUERY}}
10840 !! html/php
10841 <p>hi+world%3F%21
10842 hi_world%3F!
10843 hi%20world%3F%21
10844 hi+world%3F%21
10845 </p>
10846 !! end
10847
10848 !! test
10849 Magic Word: prioritize type info over data-parsoid
10850 !! options
10851 parsoid=html2wt
10852 !! html/parsoid
10853 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10854 !! wikitext
10855 __FORCETOC__
10856 !! end
10857
10858 !! test
10859 Magic Word: serialize on separate line (parsoid)
10860 !! options
10861 parsoid=wt2wt,html2wt
10862 !! wikitext
10863 foo
10864 __NOTOC__
10865 bar
10866 !! html/parsoid
10867 foo<meta property="mw:PageProp/notoc"/>bar
10868 !! end
10869
10870 !! test
10871 Magic Word: rt non-english wikis
10872 !! options
10873 parsoid=wt2wt
10874 language=de
10875 !! wikitext
10876 __NOEDITSECTION__
10877 !! html/parsoid
10878 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10879 !! end
10880
10881 !!test
10882 __proto__ is treated as normal wikitext (T105997)
10883 !!wikitext
10884 __proto__
10885 !!html
10886 <p>__proto__
10887 </p>
10888 !!end
10889
10890 ###
10891 ### Magic links
10892 ###
10893 !! test
10894 Magic links: internal link to RFC (T2479)
10895 !! wikitext
10896 [[RFC 123]]
10897 !! html/php
10898 <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>
10899 </p>
10900 !! html/parsoid
10901 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10902 !! end
10903
10904 !! test
10905 Magic links: RFC (T2479)
10906 !! wikitext
10907 RFC 822
10908 !! html/php
10909 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10910 </p>
10911 !! html/parsoid
10912 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
10913 !! end
10914
10915 !! test
10916 Magic links: RFC (T67278)
10917 !! wikitext
10918 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10919 !! html/php
10920 <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.
10921 </p>
10922 !! html/parsoid
10923 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10924 !! end
10925
10926 !! test
10927 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
10928 !! wikitext
10929 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10930 RFC
10931 822
10932 !! html/php
10933 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
10934 RFC
10935 822
10936 </p>
10937 !! html/parsoid
10938 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">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>
10939 RFC
10940 822</p>
10941 !! end
10942
10943 !! test
10944 Magic links: ISBN (T3937)
10945 !! wikitext
10946 ISBN 0-306-40615-2
10947 !! html/php
10948 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10949 </p>
10950 !! html/parsoid
10951 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10952 !! end
10953
10954 !! test
10955 Magic links: ISBN (T67278)
10956 !! wikitext
10957 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10958 !! html/php
10959 <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.
10960 </p>
10961 !! html/parsoid
10962 <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>
10963 !! end
10964
10965 !! test
10966 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
10967 !! wikitext
10968 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10969 ISBN
10970 9780316098113
10971 ISBN 978
10972 0316098113
10973 !! html/php
10974 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10975 ISBN
10976 9780316098113
10977 ISBN 978
10978 0316098113
10979 </p>
10980 !! html/parsoid
10981 <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>
10982 ISBN
10983 9780316098113
10984 ISBN 978
10985 0316098113</p>
10986 !! end
10987
10988 !! test
10989 Magic links: PMID incorrectly converts space to underscore
10990 !! wikitext
10991 PMID 1234
10992 !! html/php
10993 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10994 </p>
10995 !! html/parsoid
10996 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
10997 !! end
10998
10999 !! test
11000 Magic links: PMID (T67278)
11001 !! wikitext
11002 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11003 !! html/php
11004 <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.
11005 </p>
11006 !! html/parsoid
11007 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11008 !! end
11009
11010 !! test
11011 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11012 !! wikitext
11013 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11014 PMID
11015 1234
11016 !! html/php
11017 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11018 PMID
11019 1234
11020 </p>
11021 !! html/parsoid
11022 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">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>
11023 PMID
11024 1234</p>
11025 !! end
11026
11027 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11028 # since these are ExtLinkText, not MagicLinkText
11029 !! test
11030 Magic links: use appropriate serialization for "almost" magic links.
11031 !! wikitext
11032 X[[Special:BookSources/0978739256|foo]]
11033
11034 X[https://tools.ietf.org/html/rfc1234 foo]
11035 !! html/php
11036 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11037 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11038 </p>
11039 !! html/parsoid
11040 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11041 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11042 !! end
11043
11044 !! test
11045 Magic links: All disabled (T47942)
11046 !! options
11047 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11048 !! wikitext
11049 ISBN 0-306-40615-2
11050 PMID 1234
11051 RFC 4321
11052 !! html/php
11053 <p>ISBN 0-306-40615-2
11054 PMID 1234
11055 RFC 4321
11056 </p>
11057 !! end
11058
11059 ###
11060 ### Templates
11061 ####
11062
11063 !! test
11064 Nonexistent template
11065 !! wikitext
11066 {{thistemplatedoesnotexist}}
11067 !! html
11068 <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>
11069 </p>
11070 !! end
11071
11072 !! test
11073 Template with invalid target containing tags
11074 !! wikitext
11075 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11076 !! html
11077 <p>{{a<b>b</b>|foo|a=b|a = b}}
11078 </p>
11079 !! end
11080
11081 !! test
11082 Template with invalid target containing unclosed tag
11083 !! wikitext
11084 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11085 !! html
11086 <p>{{a<b>|foo|a=b|a = b}}</b>
11087 </p>
11088 !! end
11089
11090 !! test
11091 Template with invalid target containing wikilink
11092 !! wikitext
11093 {{[[Main Page]]}}
11094 !! html/php
11095 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11096 </p>
11097 !! html/parsoid
11098 <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>
11099 !! end
11100
11101 !! test
11102 Template with just whitespace in it, T70421
11103 !! wikitext
11104 {{echo|{{ }}}}
11105 !! html/parsoid
11106 <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>
11107 !! end
11108
11109 !! article
11110 Template:test
11111 !! text
11112 This is a test template
11113 !! endarticle
11114
11115 !! test
11116 Simple template
11117 !! wikitext
11118 {{test}}
11119 !! html
11120 <p>This is a test template
11121 </p>
11122 !! end
11123
11124 !! test
11125 Template with explicit namespace
11126 !! wikitext
11127 {{Template:test}}
11128 !! html
11129 <p>This is a test template
11130 </p>
11131 !! end
11132
11133
11134 !! article
11135 Template:paramtest
11136 !! text
11137 This is a test template with parameter {{{param}}}
11138 !! endarticle
11139
11140 !! test
11141 Template parameter
11142 !! wikitext
11143 {{paramtest|param=foo}}
11144 !! html
11145 <p>This is a test template with parameter foo
11146 </p>
11147 !! end
11148
11149 !! article
11150 Template:paramtestnum
11151 !! text
11152 [[{{{1}}}|{{{2}}}]]
11153 !! endarticle
11154
11155 !! test
11156 Template unnamed parameter
11157 !! wikitext
11158 {{paramtestnum|Main Page|the main page}}
11159 !! html
11160 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11161 </p>
11162 !! end
11163
11164 !! article
11165 Template:templatesimple
11166 !! text
11167 (test)
11168 !! endarticle
11169
11170 !! article
11171 Template:templateredirect
11172 !! text
11173 #redirect [[Template:templatesimple]]
11174 !! endarticle
11175
11176 !! article
11177 Template:templateasargtestnum
11178 !! text
11179 {{{{{1}}}}}
11180 !! endarticle
11181
11182 !! article
11183 Template:templateasargtest
11184 !! text
11185 {{template{{{templ}}}}}
11186 !! endarticle
11187
11188 !! article
11189 Template:templateasargtest2
11190 !! text
11191 {{{{{templ}}}}}
11192 !! endarticle
11193
11194 !! test
11195 Template with template name as unnamed argument
11196 !! wikitext
11197 {{templateasargtestnum|templatesimple}}
11198 !! html
11199 <p>(test)
11200 </p>
11201 !! end
11202
11203 !! test
11204 Template with template name as argument
11205 !! wikitext
11206 {{templateasargtest|templ=simple}}
11207 !! html
11208 <p>(test)
11209 </p>
11210 !! end
11211
11212 !! test
11213 Template with template name as argument (2)
11214 !! wikitext
11215 {{templateasargtest2|templ=templatesimple}}
11216 !! html
11217 <p>(test)
11218 </p>
11219 !! end
11220
11221 !! article
11222 Template:templateasargtestdefault
11223 !! text
11224 {{{{{templ|templatesimple}}}}}
11225 !! endarticle
11226
11227 !! article
11228 Template:templa
11229 !! text
11230 '''templ'''
11231 !! endarticle
11232
11233 !! test
11234 Template with default value
11235 !! wikitext
11236 {{templateasargtestdefault}}
11237 !! html
11238 <p>(test)
11239 </p>
11240 !! end
11241
11242 !! test
11243 Template with default value (value set)
11244 !! wikitext
11245 {{templateasargtestdefault|templ=templa}}
11246 !! html
11247 <p><b>templ</b>
11248 </p>
11249 !! end
11250
11251 !! test
11252 Template redirect
11253 !! wikitext
11254 {{templateredirect}}
11255 !! html/php
11256 <p>(test)
11257 </p>
11258 !! html/parsoid
11259 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11260 !! end
11261
11262 !! test
11263 Template with argument in separate line
11264 !! wikitext
11265 {{ templateasargtest |
11266 templ = simple }}
11267 !! html
11268 <p>(test)
11269 </p>
11270 !! end
11271
11272 !! test
11273 Template with complex template as argument
11274 !! wikitext
11275 {{paramtest|
11276 param ={{ templateasargtest |
11277 templ = simple }}}}
11278 !! html
11279 <p>This is a test template with parameter (test)
11280 </p>
11281 !! end
11282
11283 !! test
11284 Templates with templated name
11285 !! wikitext
11286 {{{{echo|echo}}|foo}}
11287 {{{{echo|inner list}} }}
11288 !! html
11289 <p>foo
11290 </p>
11291 <ul><li>item 1</li></ul>
11292
11293 !! html/parsoid
11294 <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>
11295 <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>
11296 !! end
11297
11298 ## Regression test; the output here isn't really that interesting.
11299 !! test
11300 Templates with templated name and top level template args
11301 !! wikitext
11302 {{1{{2{{{3}}}|4=5}}}}
11303 !! html/parsoid
11304 <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>
11305 !! end
11306
11307 # Parsoid markup is deliberate "broken". This is an edge case.
11308 # See long comment in TemplateHandler.js:convertAttribsToString.
11309 !! test
11310 Templates with invalid templated targets
11311 !! wikitext
11312 {{echo
11313 {{echo|foo}}
11314 }}
11315 !! html/php
11316 <p>{{echo
11317 foo
11318 }}
11319 </p>
11320 !! html/parsoid
11321 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11322 foo }}</p>
11323 !! end
11324
11325 !! test
11326 Template with thumb image (with link in description)
11327 !! wikitext
11328 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11329 !! html/php
11330 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>
11331
11332 !! html+tidy
11333 <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>
11334 !! html/parsoid
11335 <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>
11336 !! end
11337
11338 !! article
11339 Template:complextemplate
11340 !! text
11341 {{{1}}} {{paramtest|
11342 param ={{{param}}}}}
11343 !! endarticle
11344
11345 !! test
11346 Template with complex arguments
11347 !! wikitext
11348 {{complextemplate|
11349 param ={{ templateasargtest |
11350 templ = simple }}|[[Template:complextemplate|link]]}}
11351 !! html
11352 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11353 </p>
11354 !! end
11355
11356 !! test
11357 T2553: link with two variables in a piped link
11358 !! wikitext
11359 {|
11360 |[[{{{1}}}|{{{2}}}]]
11361 |}
11362 !! html/php
11363 <table>
11364 <tr>
11365 <td>[[{{{1}}}|{{{2}}}]]
11366 </td></tr></table>
11367
11368 !! html/parsoid
11369 <table>
11370 <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>
11371 </tbody></table>
11372 !! end
11373
11374 # See: T2553
11375 !! test
11376 Abort table cell attribute parsing on wikilink
11377 !! wikitext
11378 {|
11379 |testing [[one|two]] |three||four
11380 |testing one two |three||four
11381 |testing="[[one|two]]" |three||four
11382 |}
11383 !! html/php
11384 <table>
11385 <tr>
11386 <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>
11387 <td>four
11388 </td>
11389 <td>three</td>
11390 <td>four
11391 </td>
11392 <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>
11393 <td>four
11394 </td></tr></table>
11395
11396 !! html/parsoid
11397 <table>
11398 <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>
11399 <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>
11400 <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>
11401 </tbody></table>
11402 !! end
11403
11404 !! test
11405 Don't abort table cell attribute parsing if wikilink is found in template arg
11406 !! wikitext
11407 {|
11408 |Test {{#tag:ref|One two "[[three]]" four}}
11409 |}
11410 !! html/parsoid
11411 <table>
11412 <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>
11413 </tbody></table>
11414 !! end
11415
11416 !! test
11417 Magic variable as template parameter
11418 !! wikitext
11419 {{paramtest|param={{SITENAME}}}}
11420 !! html
11421 <p>This is a test template with parameter MediaWiki
11422 </p>
11423 !! end
11424
11425 !! article
11426 Template:linktest
11427 !! text
11428 [[{{{param}}}|link]]
11429 !! endarticle
11430
11431 !! test
11432 Template parameter as link source
11433 !! wikitext
11434 {{linktest|param=Main Page}}
11435 !! html
11436 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11437 </p>
11438 !! end
11439
11440 !!article
11441 Template:paramtest2
11442 !! text
11443 including another template, {{paramtest|param={{{arg}}}}}
11444 !! endarticle
11445
11446 !! test
11447 Template passing argument to another template
11448 !! wikitext
11449 {{paramtest2|arg='hmm'}}
11450 !! html
11451 <p>including another template, This is a test template with parameter 'hmm'
11452 </p>
11453 !! end
11454
11455 !! article
11456 Template:Linktest2
11457 !! text
11458 Main Page
11459 !! endarticle
11460
11461 !! test
11462 Template as link source
11463 !! wikitext
11464 [[{{linktest2}}]]
11465
11466 [[{{linktest2}}|Main Page]]
11467
11468 [[{{linktest2}}]]Page
11469 !! html
11470 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11471 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11472 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11473 </p>
11474 !! end
11475
11476
11477 !! article
11478 Template:loop1
11479 !! text
11480 {{loop2}}
11481 !! endarticle
11482
11483 !! article
11484 Template:loop2
11485 !! text
11486 {{loop1}}
11487 !! endarticle
11488
11489 !! test
11490 Template infinite loop
11491 !! wikitext
11492 {{loop1}}
11493 !! html
11494 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11495 </p>
11496 !! end
11497
11498 !! test
11499 Template from main namespace
11500 !! wikitext
11501 {{:Main Page}}
11502 !! html
11503 <p>blah blah
11504 </p>
11505 !! end
11506
11507 !! article
11508 Template:table
11509 !! text
11510 {|
11511 | 1 || 2
11512 |-
11513 | 3 || 4
11514 |}
11515 !! endarticle
11516
11517 !! test
11518 T2529: Template with table, not included at beginning of line
11519 !! wikitext
11520 foo {{table}}
11521 !! html
11522 <p>foo
11523 </p>
11524 <table>
11525 <tr>
11526 <td>1</td>
11527 <td>2
11528 </td></tr>
11529 <tr>
11530 <td>3</td>
11531 <td>4
11532 </td></tr></table>
11533
11534 !! end
11535
11536 !! test
11537 T2523: Template shouldn't eat newline (or add an extra one before table)
11538 !! wikitext
11539 foo
11540 {{table}}
11541 !! html
11542 <p>foo
11543 </p>
11544 <table>
11545 <tr>
11546 <td>1</td>
11547 <td>2
11548 </td></tr>
11549 <tr>
11550 <td>3</td>
11551 <td>4
11552 </td></tr></table>
11553
11554 !! end
11555
11556 !! test
11557 T2041: Template parameters shown as broken links
11558 !! wikitext
11559 {{{parameter}}}
11560 !! html
11561 <p>{{{parameter}}}
11562 </p>
11563 !! end
11564
11565 !! test
11566 Template with targets containing wikilinks
11567 !! options
11568 parsoid=wt2html
11569 !! wikitext
11570 {{[[foo]]}}
11571
11572 {{[[{{echo|foo}}]]}}
11573
11574 {{{{echo|[[foo}}]]}}
11575 !! html/php
11576 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11577 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11578 </p><p>{{[[foo}}]]
11579 </p>
11580 !! html/parsoid
11581 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11582 <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>
11583 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11584 !! end
11585
11586 !! article
11587 Template:''
11588 !! text
11589 bar
11590 !! endarticle
11591
11592 !! test
11593 Templates: Double quotes as template target
11594 !! wikitext
11595 foo {{''}} baz
11596 !! html/php
11597 <p>foo bar baz
11598 </p>
11599 !! html/parsoid
11600 <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
11601 </p>
11602 !! end
11603
11604 ## This test is about making sure Parsoid's data-mw is well formed in the
11605 ## face of multiple templates with intersecting and overlapping ranges. The
11606 ## wikitext itself is wretched.
11607 !! test
11608 Templates with intersecting and overlapping ranges
11609 !! wikitext
11610 {|{{echo|
11611 <p>ha</p>}}
11612 {|{{echo|
11613 <p>ho</p>}}
11614 {{echo|{{!}}hi}}
11615 |}
11616 !! html/php+tidy
11617 <p>ha</p><table>
11618
11619 </table><p>ho</p><table>
11620
11621 <tbody><tr>
11622 <td>hi
11623 </td></tr></tbody></table>
11624 !! html/parsoid
11625 <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":""}]]}'>
11626
11627 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11628
11629 <tbody><tr><td>hi</td></tr>
11630 </tbody></table>
11631 !! end
11632
11633 !! article
11634 Template:MSGNW test
11635 !! text
11636 ''None'' of '''this''' should be
11637 * interpreted
11638 but rather passed unmodified
11639 {{test}}
11640 <gallery>
11641 File:Foobar.jpg
11642 </gallery>
11643 <!-- comment -->
11644 !! endarticle
11645
11646 # hmm, fix this or just deprecate msgnw and document its behavior?
11647 !! test
11648 msgnw keyword
11649 !! wikitext
11650 {{msgnw:MSGNW test}}
11651 !! html/php
11652 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11653 &#42; interpreted
11654 &#32;but rather passed unmodified
11655 &#123;&#123;test&#125;&#125;
11656 &#60;gallery&#62;
11657 File:Foobar.jpg
11658 &#60;/gallery&#62;
11659 &#60;!-- comment --&#62;
11660 </p>
11661 !! end
11662
11663 !! test
11664 int keyword
11665 !! wikitext
11666 {{int:youhavenewmessages|lots of money|not!}}
11667 !! html
11668 <p>You have lots of money (not!).
11669 </p>
11670 !! end
11671
11672 !! test
11673 int keyword - non-existing message
11674 !! wikitext
11675 {{int:var}}
11676 !! html
11677 <p>⧼var⧽
11678 </p>
11679 !! end
11680
11681 !! article
11682 Template:Includes
11683 !! text
11684 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11685 !! endarticle
11686
11687 !! test
11688 <includeonly> and <noinclude> being included
11689 !! wikitext
11690 {{Includes}}
11691 !! html
11692 <p>Foobar
11693 </p>
11694 !! end
11695
11696 !! article
11697 Template:Includes2
11698 !! text
11699 <onlyinclude>Foo</onlyinclude>bar
11700 !! endarticle
11701
11702 !! test
11703 <onlyinclude> being included
11704 !! wikitext
11705 {{Includes2}}
11706 !! html
11707 <p>Foo
11708 </p>
11709 !! end
11710
11711
11712 !! article
11713 Template:Includes3
11714 !! text
11715 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11716 !! endarticle
11717
11718 !! test
11719 <onlyinclude> and <includeonly> being included
11720 !! wikitext
11721 {{Includes3}}
11722 !! html
11723 <p>Foo
11724 </p>
11725 !! end
11726
11727 !! test
11728 <includeonly> and <noinclude> on a page
11729 !! wikitext
11730 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11731 !! html
11732 <p>Foozar
11733 </p>
11734 !! end
11735
11736 !! test
11737 Un-closed <noinclude>
11738 !! wikitext
11739 <noinclude>
11740 !! html
11741 !! end
11742
11743 !! test
11744 <onlyinclude> on a page
11745 !! wikitext
11746 <onlyinclude>Foo</onlyinclude>bar
11747 !! html
11748 <p>Foobar
11749 </p>
11750 !! end
11751
11752 !! test
11753 Un-closed <onlyinclude>
11754 !! wikitext
11755 <onlyinclude>
11756 !! html
11757 !! end
11758
11759 !!test
11760 Self-closed noinclude, includeonly, onlyinclude tags
11761 !! wikitext
11762 <noinclude />
11763 <includeonly />
11764 <onlyinclude />
11765 !! html
11766 <p><br />
11767 </p>
11768 !!end
11769
11770 !!test
11771 Unbalanced includeonly and noinclude tags
11772 !! wikitext
11773 {|
11774 |a</noinclude>
11775 |b</noinclude></noinclude>
11776 |c</noinclude></includeonly>
11777 |d</includeonly></includeonly>
11778 |}
11779 !! html
11780 <table>
11781 <tr>
11782 <td>a
11783 </td>
11784 <td>b
11785 </td>
11786 <td>c&lt;/includeonly&gt;
11787 </td>
11788 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11789 </td></tr></table>
11790
11791 !!end
11792
11793 !! article
11794 Template:Includeonly section
11795 !! text
11796 <includeonly>
11797 ==Includeonly section==
11798 </includeonly>
11799 ==Section T-1==
11800 !!endarticle
11801
11802 !! test
11803 T8563: Edit link generation for section shown by <includeonly>
11804 !! wikitext
11805 {{includeonly section}}
11806 !! html
11807 <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>
11808 <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>
11809
11810 !! end
11811
11812 # Uses same input as the contents of [[Template:Includeonly section]]
11813 !! test
11814 T8563: Section extraction for section shown by <includeonly>
11815 !! options
11816 section=T-2
11817 !! wikitext
11818 <includeonly>
11819 ==Includeonly section==
11820 </includeonly>
11821 ==Section T-2==
11822 !! html
11823 ==Section T-2==
11824 !! end
11825
11826 !! test
11827 T8563: Edit link generation for section suppressed by <includeonly>
11828 !! wikitext
11829 <includeonly>
11830 ==Includeonly section==
11831 </includeonly>
11832 ==Section 1==
11833 !! html
11834 <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>
11835
11836 !! end
11837
11838 !! test
11839 T8563: Section extraction for section suppressed by <includeonly>
11840 !! options
11841 section=1
11842 !! wikitext
11843 <includeonly>
11844 ==Includeonly section==
11845 </includeonly>
11846 ==Section 1==
11847 !! html
11848 ==Section 1==
11849 !! end
11850
11851 !! test
11852 Un-closed <includeonly>
11853 !! wikitext
11854 <includeonly>
11855 !! html/php
11856 !! html/parsoid
11857 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11858 !! end
11859
11860 ## We used to, but no longer wt2wt this test since the default serializer
11861 ## will normalize the include directives to serialize on their own line.
11862 ## Selser will take care of preserving formatting in scenarios where they
11863 ## intermingled with other wikitext.
11864 !! test
11865 Includes and comments at SOL
11866 !! options
11867 parsoid=wt2html,html2html
11868 !! wikitext
11869 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
11870
11871 <noinclude>
11872 some
11873 </noinclude>*stuff
11874 *here
11875
11876 <includeonly>can have stuff</includeonly>===here===
11877
11878 !! html/php
11879 <h2><span class="mw-headline" id="hu">hu</span></h2>
11880 <p>some
11881 </p>
11882 <ul><li>stuff</li>
11883 <li>here</li></ul>
11884 <h3><span class="mw-headline" id="here">here</span></h3>
11885
11886 !! html/parsoid
11887 <!-- 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>
11888
11889 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11890 <p>some</p>
11891 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
11892 <li>here</li></ul>
11893
11894 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
11895
11896 !! end
11897
11898 # TODO: test with DOM fragment reuse!
11899 !! test
11900 Parsoid: DOM fragment reuse
11901 !! options
11902 parsoid=wt2wt,wt2html
11903 !! wikitext
11904 a{{echo|b<table></table>c}}d
11905
11906 a{{echo|b
11907 <table></table>
11908 c}}d
11909
11910 {{echo|a
11911
11912 <table></table>
11913
11914 b}}
11915 !! html
11916 <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>
11917
11918 <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">
11919 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11920 </span><p about="#mwt2">cd</p>
11921
11922 <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">
11923
11924 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11925
11926 </span><p about="#mwt3">b</p>
11927 !! end
11928
11929 !! test
11930 Parsoid: Merge double tds (T52603)
11931 !! options
11932 parsoid
11933 !! wikitext
11934 {|
11935 |{{echo|{{!}} foo}}
11936 |}
11937 !! html
11938 <table><tbody>
11939 <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>
11940 </tbody></table>
11941 !! end
11942
11943 !! test
11944 Parsoid: Merge double tds in nested transclusion content (T52603)
11945 !! options
11946 parsoid
11947 !! wikitext
11948 {{echo|<div>}}
11949 {|
11950 |{{echo|{{!}} foo}}
11951 |}
11952 {{echo|</div>}}
11953 !! html
11954 <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}}]}'>
11955 <table><tbody>
11956 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11957 </tbody></table>
11958 </div>
11959 !! end
11960
11961 ###
11962 ### <includeonly> and <noinclude> in attributes
11963 ###
11964 !!test
11965 0. includeonly around the entire attribute
11966 !! wikitext
11967 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11968 !! html
11969 <p><span id="v2">bar</span>
11970 </p>
11971 !!end
11972
11973 !!test
11974 1. includeonly in html attr key
11975 !! wikitext
11976 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11977 !! html
11978 <p><span id="foo">bar</span>
11979 </p>
11980 !!end
11981
11982 !!test
11983 2. includeonly in html attr value
11984 !! wikitext
11985 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11986 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11987 !! html
11988 <p><span id="v1">bar</span>
11989 <span id="v1">bar</span>
11990 </p>
11991 !!end
11992
11993 !!test
11994 3. includeonly in part of an attr value
11995 !! wikitext
11996 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11997 !! html
11998 <p><span style="color:red;">bar</span>
11999 </p>
12000 !!end
12001
12002 !!test
12003 4. includeonly in table attributes
12004 !! wikitext
12005 {|
12006 |- <noinclude>
12007 |-
12008 |a
12009 </noinclude>
12010 |- <includeonly>
12011 |-
12012 |b
12013 </includeonly>
12014 |}
12015 !! html
12016 <table>
12017
12018
12019 <tr>
12020 <td>a
12021 </td></tr>
12022 </table>
12023
12024 !!end
12025
12026 ###
12027 ### Preprocessor precedence tests
12028 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12029 ###
12030 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12031 !! test
12032 Preprocessor precedence 1: link is rightmost opening
12033 !! options
12034 parsoid=wt2html
12035 !! wikitext
12036 {{[[Foo|bar}}]]
12037
12038 But close-brace is not a valid character in a link title:
12039 {{[[Foo}}|bar]]
12040
12041 However, we can still tell this was handled as a link in the preprocessor:
12042 {{echo|[[Foo}}|bar]]|bat}}
12043 !! html/php
12044 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12045 </p><p>But close-brace is not a valid character in a link title:
12046 {{[[Foo}}|bar]]
12047 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12048 [[Foo}}|bar]]
12049 </p>
12050 !! html/parsoid
12051 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12052 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12053 <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>
12054 !! end
12055
12056 !! test
12057 Preprocessor precedence 2: template is rightmost opening
12058 !! options
12059 language=zh
12060 !! wikitext
12061 -{{echo|foo}-}}-
12062 !! html/php
12063 <p>-foo}--
12064 </p>
12065 !! html/parsoid
12066 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12067 !! end
12068
12069 !! test
12070 Preprocessor precedence 3: language converter is rightmost opening
12071 !! options
12072 language=zh
12073 parsoid=wt2html
12074 !! wikitext
12075 {{echo|hi}}
12076
12077 {{-{R|echo|hi}}}-
12078
12079 [[-{R|raw]]}-
12080 !! html/php
12081 <p>hi
12082 </p><p>{{echo|hi}}
12083 </p><p>[[raw]]
12084 </p>
12085 !! html/parsoid
12086 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12087 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12088 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12089 !! end
12090
12091 !! test
12092 Preprocessor precedence 4: left-most angle bracket
12093 !! options
12094 language=zh
12095 !! wikitext
12096 <!--{raw}-->
12097 !! html/php
12098 !! html/parsoid
12099 <!--{raw}-->
12100 !! end
12101
12102 !! article
12103 Template:Precedence5
12104 !! text
12105 {{{{{1}}}}}
12106 !! endarticle
12107
12108 !! test
12109 Preprocessor precedence 5: tplarg takes precedence over template
12110 !! wikitext
12111 {{Precedence5|Bullet}}
12112 !! html/php
12113 <ul><li>Bar</li></ul>
12114
12115 !! html/parsoid
12116 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12117 !! end
12118
12119 !! test
12120 Preprocessor precedence 6: broken link is rightmost opening
12121 !! options
12122 parsoid=wt2html
12123 !! wikitext
12124 {{echo|[[Foo}}
12125
12126 {{echo|[[Foo|bar|bat=baz}}
12127 !! html/php
12128 <p>{{echo|[[Foo}}
12129 </p><p>{{echo|[[Foo|bar|bat=baz}}
12130 </p>
12131 !! html/parsoid
12132 <p>{{echo|[[Foo}}</p>
12133 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12134 !! end
12135
12136 # This next test exposes a difference between PHP and Parsoid:
12137 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12138 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12139 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12140 # outer `[[Foo` extends until the `y]]`
12141 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12142 # intermediate result (after template expansion), and link processing
12143 # happens on this intermediate result, which moves the wikilink
12144 # boundary leftward to `[[Foo|Bar]]`
12145 # 2b) Parsoid works in a single step, so it's going to keep the
12146 # wikilink as extending to the `y]]`
12147 # 3a) Then PHP does linktrail processing which slurps up the trailing
12148 # `xy` inside the link.
12149 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12150 # `z` inside the link.
12151 # This is "correct" behavior. Parsoid's basic worldview is that the
12152 # `]]` inside the template shouldn't be allowed to leak out to affect
12153 # the surrounding wikilink. PHP may match Parsoid (in the future)
12154 # if you use {{#balance}} (T114445).
12155
12156 !! test
12157 Preprocessor precedence 7: broken template is rightmost opening
12158 !! options
12159 parsoid=wt2html
12160 !! wikitext
12161 [[Foo|{{echo|Bar]]
12162
12163 [[Foo|{{echo|Bar]]-x}}-y]]-z
12164
12165 Careful: linktrails can move the end of the wikilink:
12166 [[Foo|{{echo|y']]a}}l]]l
12167 !! html/php
12168 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12169 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12170 </p><p>Careful: linktrails can move the end of the wikilink:
12171 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12172 </p>
12173 !! html/parsoid
12174 <p>[[Foo|{{echo|Bar]]</p>
12175 <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>
12176 <p>Careful: linktrails can move the end of the wikilink:
12177 <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>
12178 !! end
12179
12180 !! test
12181 Preprocessor precedence 8: broken language converter is rightmost opening
12182 !! options
12183 language=zh
12184 !! wikitext
12185 [[Foo-{R|raw]]
12186 !! html
12187 <p>[[Foo-{R|raw]]
12188 </p>
12189 !! end
12190
12191 !! article
12192 Template:Preprocessor_precedence_9
12193 !! text
12194 ;4: {{{{1}}}}
12195 ;5: {{{{{2}}}}}
12196 ;6: {{{{{{3}}}}}}
12197 ;7: {{{{{{{4}}}}}}}
12198 !! endarticle
12199
12200 !! test
12201 Preprocessor precedence 9: groups of braces
12202 !! wikitext
12203 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12204 !! html/php
12205 <dl><dt>4</dt>
12206 <dd>{Four}</dd>
12207 <dt>5</dt>
12208 <dd></dd></dl>
12209 <ul><li>Bar</li></ul>
12210 <dl><dt>6</dt>
12211 <dd>Four</dd>
12212 <dt>7</dt>
12213 <dd>{Bullet}</dd></dl>
12214
12215 !! html/parsoid
12216 <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}}]}'>
12217 <dt>4</dt>
12218 <dd>{Four}</dd>
12219 <dt>5</dt>
12220 <dd></dd>
12221 </dl><ul about="#mwt1">
12222 <li>Bar</li>
12223 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12224 <dt>6</dt>
12225 <dd>Four</dd>
12226 <dt>7</dt>
12227 <dd>{Bullet}</dd>
12228 </dl>
12229 !! end
12230
12231 !! article
12232 Template:Preprocessor_precedence_10
12233 !! text
12234 ;1: -{R|raw}-
12235 ;2: -{{Bullet}}-
12236 ;3: -{{{1}}}-
12237 ;4: -{{{{2}}}}-
12238 ;5: -{{{{{3}}}}}-
12239 ;6: -{{{{{{4}}}}}}-
12240 ;7: -{{{{{{{5}}}}}}}-
12241 !! endarticle
12242
12243 !! test
12244 Preprocessor precedence 10: groups of braces with leading dash
12245 !! options
12246 language=zh
12247 !! wikitext
12248 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12249 !! html/php
12250 <dl><dt>1</dt>
12251 <dd>raw</dd>
12252 <dt>2</dt>
12253 <dd>-</dd></dl>
12254 <ul><li>Bar-</li></ul>
12255 <dl><dt>3</dt>
12256 <dd>-Three-</dd>
12257 <dt>4</dt>
12258 <dd>raw2</dd>
12259 <dt>5</dt>
12260 <dd>-</dd></dl>
12261 <ul><li>Bar-</li></ul>
12262 <dl><dt>6</dt>
12263 <dd>-Three-</dd>
12264 <dt>7</dt>
12265 <dd>raw2</dd></dl>
12266
12267 !! html/parsoid
12268 <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}}]}'>
12269 <dt>1</dt>
12270 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12271 <dt>2</dt>
12272 <dd>-</dd>
12273 </dl><ul about="#mwt1">
12274 <li>Bar-</li>
12275 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12276 <dt>3</dt>
12277 <dd>-Three-</dd>
12278 <dt>4</dt>
12279 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12280 <dt>5</dt>
12281 <dd>-</dd>
12282 </dl><ul about="#mwt1">
12283 <li>Bar-</li>
12284 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12285 <dt>6</dt>
12286 <dd>-Three-</dd>
12287 <dt>7</dt>
12288 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12289 </dl>
12290 !! end
12291
12292 !! test
12293 Preprocessor precedence 11: found during visual diff testing
12294 !! wikitext
12295 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12296
12297 {{echo|-{{echo|-{{echo|x}}}}}}
12298
12299 {{echo|-{{echo|x}}}}
12300 !! html/php
12301 <p><span>-<span>-x</span></span>
12302 </p><p>--x
12303 </p><p>-x
12304 </p>
12305 !! html/parsoid
12306 <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>
12307
12308 <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>
12309
12310 <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>
12311 !! end
12312
12313 !! test
12314 Preprocessor precedence 12: broken language converter closed by brace.
12315 !! options
12316 parsoid=wt2html
12317 !! wikitext
12318 This form breaks the template, which is unfortunate:
12319 *{{echo|foo-{bar}bat}}
12320
12321 But if the broken language converter markup is inside an extension
12322 tag, nothing bad happens:
12323 *<nowiki>foo-{bar}bat</nowiki>
12324 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12325 *<pre>foo-{bar}bat</pre>
12326 *{{echo|<pre>foo-{bar}bat</pre>}}
12327
12328 <tag>foo-{bar}bat</tag>
12329 {{echo|<tag>foo-{bar}bat</tag>}}
12330
12331 !! html/php+tidy
12332 <p>This form breaks the template, which is unfortunate:
12333 </p>
12334 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12335 <p>But if the broken language converter markup is inside an extension
12336 tag, nothing bad happens:
12337 </p>
12338 <ul><li>foo-&#123;bar}bat</li>
12339 <li>foo-&#123;bar}bat</li>
12340 <li><pre>foo-{bar}bat</pre></li>
12341 <li><pre>foo-{bar}bat</pre></li></ul>
12342 <pre>'foo-{bar}bat'
12343 array (
12344 )
12345 </pre>
12346 <pre>'foo-{bar}bat'
12347 array (
12348 )
12349 </pre>
12350 !! html/parsoid
12351 <p>This form breaks the template, which is unfortunate:</p>
12352 <ul>
12353 <li>{{echo|foo-{bar}bat}}</li>
12354 </ul>
12355 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12356 <ul>
12357 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12358 <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>
12359 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12360 <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>
12361 </ul>
12362 <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>
12363 !! end
12364
12365 !! test
12366 Preprocessor precedence 13: broken language converter in external link
12367 !! options
12368 parsoid=wt2html
12369 !! wikitext
12370 *[http://example.com/-{foo Example in URL]
12371 *[http://example.com Example in -{link} description]
12372 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12373 !! html/php+tidy
12374 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12375 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12376 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12377 !! html/parsoid
12378 <ul>
12379 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12380 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12381 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12382 </ul>
12383 !! end
12384
12385 !! test
12386 Preprocessor precedence 14: broken language converter in comment
12387 !! wikitext
12388 *<!--{{foo}}-->...should be ok
12389 *<!---{{foo}}-->...extra dashes
12390 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12391 !! html/php+tidy
12392 <ul><li>...should be ok</li>
12393 <li>...extra dashes</li>
12394 <li>foobat...should be ok</li></ul>
12395 !! html/parsoid
12396 <ul>
12397 <li><!--{{foo}}-->...should be ok</li>
12398 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12399 <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>
12400 </ul>
12401 !! end
12402
12403 !! test
12404 Preprocessor precedence 15: broken brace markup in headings
12405 !! config
12406 wgFragmentMode=[ 'html5', 'legacy' ]
12407 !! options
12408 parsoid=wt2html
12409 !! wikitext
12410 __NOTOC__ __NOEDITSECTION__
12411 ===1 foo[bar 1===
12412 1
12413 ===2 foo[[bar 2===
12414 2
12415 ===3 foo{bar 3===
12416 3
12417 ===4 foo{{bar 4===
12418 4
12419 ===5 foo{{{bar 5===
12420 5
12421 ===6 foo-{bar 6===
12422 6
12423 !! html/php+tidy
12424 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12425 <p>1
12426 </p>
12427 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12428 <p>2
12429 </p>
12430 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12431 <p>3
12432 </p>
12433 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12434 <p>4
12435 </p>
12436 <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>
12437 <p>5
12438 </p>
12439 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12440 <p>6
12441 </p>
12442 !! html/parsoid
12443 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12444 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12445 <p>1</p>
12446 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12447 <p>2</p>
12448 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12449 <p>3</p>
12450 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12451 <p>4</p>
12452 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12453 <p>5</p>
12454 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12455 <p>6</p>
12456 !! end
12457
12458 !! test
12459 Preprocessor precedence 16: matching closing braces to opening braces
12460 !! options
12461 language=zh
12462 parsoid=wt2html
12463 !! wikitext
12464 -{{{echo|foo}}bar}-
12465 !! html/php
12466 <p>foobar
12467 </p>
12468 !! html/parsoid
12469 <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>
12470 !! end
12471
12472 !! test
12473 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12474 !! options
12475 parsoid=wt2html
12476 !! wikitext
12477 {{echo|hi {{}}}}
12478 !! html/php
12479 <p>hi {{}}
12480 </p>
12481 !! html/parsoid
12482 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12483 !! end
12484
12485 !! test
12486 Preprocessor precedence 18: another rightmost wins scenario
12487 !! options
12488 parsoid=wt2html
12489 !! wikitext
12490 {{ -{{{{1|tplarg}}} }} }-
12491 !! html/php
12492 <p>{{ -{tplarg }} }-
12493 </p>
12494 !! html/parsoid
12495 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12496 !! end
12497
12498 !! test
12499 Preprocessor precedence 19: break syntax
12500 !! options
12501 parsoid=wt2html
12502 !! wikitext
12503 -{{
12504 !! html/php
12505 <p>-{{
12506 </p>
12507 !! html/parsoid
12508 <p>-{{</p>
12509 !! end
12510
12511 ###
12512 ### Token Stream Patcher tests
12513 ###
12514 ### These tests won't always pass wt2wt and other modes because
12515 ### on serialization, the table will be output on a new line.
12516 ### For now, we are blacklisting them, and using this to test selser.
12517 ###
12518
12519 !!test
12520 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12521 !!options
12522 parsoid=wt2html,wt2wt
12523 !!wikitext
12524 {{echo|}}{| width = '100%'
12525 |foo
12526 |}
12527 !!html/parsoid
12528 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12529 <tbody><tr><td>foo</td></tr>
12530 </tbody></table>
12531 !!end
12532
12533 ## We used to, but no longer wt2wt this test since the default serializer
12534 ## will normalize the include directives to serialize on their own line.
12535 ## Selser will take care of preserving formatting in scenarios where they
12536 ## intermingled with other wikitext.
12537 !!test
12538 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12539 !!options
12540 parsoid=wt2html
12541 !!wikitext
12542 <includeonly>a</includeonly>{| {{{b}}}
12543 |c
12544 |}
12545 !!html/parsoid
12546 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
12547 <tbody><tr><td>c</td></tr>
12548 </tbody></table>
12549 !!end
12550
12551 !! test
12552 Table wikitext syntax outside wiki-tables
12553 !! wikitext
12554 a
12555 |+ not a caption
12556 ! not a table heading
12557 |- not a table row
12558 | not a table cell
12559 | class="foo bar" | baz
12560 b
12561 |}
12562 |-
12563 c
12564 !! html
12565 <p>a
12566 |+ not a caption
12567 ! not a table heading
12568 |- not a table row
12569 | not a table cell
12570 | class="foo bar" | baz
12571 b
12572 |}
12573 |-
12574 c
12575 </p>
12576 !! end
12577
12578 ###
12579 ### Testing parsing of templates where a template arg
12580 ### has the same name as the template itself.
12581 ###
12582
12583 !! article
12584 Template:quote
12585 !! text
12586 {{{quote|{{{1}}}}}}
12587 !! endarticle
12588
12589 !!test
12590 Templates: Template Name/Arg clash: 1. Use of positional param
12591 !! wikitext
12592 {{quote|foo}}
12593 !! html
12594 <p>foo
12595 </p>
12596 !!end
12597
12598 !!test
12599 Templates: Template Name/Arg clash: 2. Use of named param
12600 !! wikitext
12601 {{quote|quote=foo}}
12602 !! html
12603 <p>foo
12604 </p>
12605 !!end
12606
12607 !!test
12608 Templates: Template Name/Arg clash: 3. Use of named param with empty input
12609 !! wikitext
12610 {{quote|quote}}
12611 !! html
12612 <p>quote
12613 </p>
12614 !!end
12615
12616 ###
12617 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
12618 ###
12619
12620 !!test
12621 Templates: 1. Simple use
12622 !! wikitext
12623 {{echo|Foo}}
12624 !! html
12625 <p>Foo
12626 </p>
12627 !!end
12628
12629 !!test
12630 Templates: 2. Inside a block tag
12631 !! wikitext
12632 <div>{{echo|Foo}}</div>
12633 <blockquote>{{echo|Foo}}</blockquote>
12634 !! html
12635 <div>Foo</div>
12636 <blockquote>Foo</blockquote>
12637
12638 !! html+tidy
12639 <div>Foo</div>
12640 <blockquote><p>Foo</p></blockquote>
12641 !!end
12642
12643 !!test
12644 Templates: P-wrapping: 1a. Templates on consecutive lines
12645 !! wikitext
12646 {{echo|Foo}}
12647 {{echo|bar}}
12648 !! html
12649 <p>Foo
12650 bar
12651 </p>
12652 !!end
12653
12654 !!test
12655 Templates: P-wrapping: 1b. Templates on consecutive lines
12656 !! wikitext
12657 Foo
12658
12659 {{echo|bar}}
12660 {{echo|baz}}
12661 !! html
12662 <p>Foo
12663 </p><p>bar
12664 baz
12665 </p>
12666 !!end
12667
12668 !!test
12669 Templates: P-wrapping: 1c. Templates on consecutive lines
12670 !! wikitext
12671 {{echo|Foo}}
12672 {{echo|bar}} <div>baz</div>
12673 !! html
12674 <p>Foo
12675 </p>
12676 bar <div>baz</div>
12677
12678 !! html+tidy
12679 <p>Foo
12680 </p><p>
12681 bar </p><div>baz</div>
12682 !! end
12683
12684 !!test
12685 Templates: P-wrapping: 1d. Template preceded by comment-only line
12686 !!options
12687 parsoid
12688 !! wikitext
12689 <!-- foo -->
12690 {{echo|Bar}}
12691 !! html
12692 <!-- foo -->
12693
12694 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
12695 !!end
12696
12697 !!test
12698 Templates: Inline Text: 1. Multiple template uses
12699 !! wikitext
12700 {{echo|Foo}}bar{{echo|baz}}
12701 !! html
12702 <p>Foobarbaz
12703 </p>
12704 !!end
12705
12706 !!test
12707 Templates: Inline Text: 2. Back-to-back template uses
12708 !! wikitext
12709 {{echo|Foo}}{{echo|bar}}
12710 !! html
12711 <p>Foobar
12712 </p>
12713 !!end
12714
12715 !!test
12716 Templates: Block Tags: 1. Multiple template uses
12717 !! wikitext
12718 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
12719 !! html
12720 <div>Foo</div><div>bar</div><div>baz</div>
12721
12722 !!end
12723
12724 !!test
12725 Templates: Block Tags: 2. Back-to-back template uses
12726 !! wikitext
12727 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
12728 !! html
12729 <div>Foo</div><div>bar</div>
12730
12731 !!end
12732
12733 # This is an edge case relating to paragraph wrapping.
12734 !!test
12735 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
12736 !! wikitext
12737 {{echo|a
12738 b</p>}}
12739 !! html/parsoid
12740 <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
12741 b</p>
12742 !!end
12743
12744 !!test
12745 Templates: Links: 1. Simple example
12746 !! wikitext
12747 {{echo|[[Foo|bar]]}}
12748 !! html
12749 <p><a href="/wiki/Foo" title="Foo">bar</a>
12750 </p>
12751 !!end
12752
12753 !!test
12754 Templates: Links: 2. Generation of link href
12755 !! wikitext
12756 [[{{echo|Foo}}|bar]]
12757 !! html
12758 <p><a href="/wiki/Foo" title="Foo">bar</a>
12759 </p>
12760 !!end
12761
12762 !!test
12763 Templates: Links: 3. Generation of part of a link href
12764 !! wikitext
12765 [[Fo{{echo|o}}|bar]]
12766
12767 [[Foo{{echo|bar}}]]
12768
12769 [[Foo{{echo|bar}}baz]]
12770
12771 [[Foo{{echo|bar}}|bar]]
12772
12773 [[:Foo{{echo|bar}}]]
12774
12775 [[:Foo{{echo|bar}}|bar]]
12776 !! html
12777 <p><a href="/wiki/Foo" title="Foo">bar</a>
12778 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12779 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
12780 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12781 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12782 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
12783 </p>
12784 !!end
12785
12786 !!test
12787 Templates: Links: 4. Multiple templates generating link href
12788 !! wikitext
12789 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
12790 !! html
12791 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
12792 </p>
12793 !!end
12794
12795 !!test
12796 Templates: Links: 5. Generation of link text
12797 !! wikitext
12798 [[Foo|{{echo|bar}}]]
12799 !! html
12800 <p><a href="/wiki/Foo" title="Foo">bar</a>
12801 </p>
12802 !!end
12803
12804 !!test
12805 Templates: Links: 5. Nested templates (only outermost template should be marked)
12806 !! wikitext
12807 {{echo|[[{{echo|Foo}}|bar]]}}
12808 !! html
12809 <p><a href="/wiki/Foo" title="Foo">bar</a>
12810 </p>
12811 !!end
12812
12813 !!test
12814 Templates: HTML Tag: 1. Generation of HTML attr. key
12815 !! wikitext
12816 <div {{echo|style}}="color:red;">foo</div>
12817 !! html
12818 <div style="color:red;">foo</div>
12819
12820 !!end
12821
12822 !!test
12823 Templates: HTML Tag: 2. Generation of HTML attr. value
12824 !! wikitext
12825 <div style={{echo|'color:red;'}}>foo</div>
12826 !! html
12827 <div style="color:red;">foo</div>
12828
12829 !!end
12830
12831 !!test
12832 Templates: HTML Tag: 3. Generation of HTML attr key and value
12833 !! wikitext
12834 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
12835 !! html
12836 <div style="color:red;">foo</div>
12837
12838 !!end
12839
12840 !!test
12841 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
12842 !! wikitext
12843 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
12844 !! html
12845 <div title="This is a long title with just one piece templated">foo</div>
12846
12847 !!end
12848
12849 !!test
12850 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
12851 !! wikitext
12852 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
12853 !! html
12854 <div title="This is a long title with just one piece templated">foo</div>
12855
12856 !!end
12857
12858 !!test
12859 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
12860 !! wikitext
12861 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
12862 !! html
12863 <div title="This is a long title with just one piece templated">foo</div>
12864
12865 !!end
12866
12867 # SSS FIXME: While it is great we added support for all this,
12868 # do we want to make this part of the spec? Maybe we want to
12869 # deprecate this kind of usage in the future?
12870 !!test
12871 Templates: HTML Tag: 7. Generation of partial attribute key string
12872 !! wikitext
12873 <div st{{echo|yle}}="color:red;">foo</div>
12874 !! html
12875 <div style="color:red;">foo</div>
12876
12877 !!end
12878
12879 !! test
12880 Templates: HTML Tag: 8. Template-generated attribute (k=v)
12881 !! wikitext
12882 <div {{echo|1=id="v1"}}>bar</div>
12883 !! html
12884 <div id="v1">bar</div>
12885
12886 !!end
12887
12888 !! test
12889 Templates: HTML Tag: 9. Multiple template-generated attributes
12890 !! wikitext
12891 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12892 !! html
12893 <div id="v1" title="foo">bar</div>
12894
12895 !!end
12896
12897 !! test
12898 Templates: Support for templates generating attributes and content
12899 !! wikitext
12900 {| {{mixed_attr_content_template}}
12901 |-
12902 |bar
12903 |}
12904 !! html/php
12905 <table style="color:red;" title="T48811">
12906
12907 <tr>
12908 <td>foo
12909 </td></tr>
12910 <tr>
12911 <td>bar
12912 </td></tr></table>
12913
12914 !! html/parsoid
12915 <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|}"]}'>
12916 <tbody><tr>
12917 <td>foo</td></tr>
12918 <tr>
12919 <td>bar</td></tr>
12920 </tbody></table>
12921 !!end
12922
12923 !! test
12924 1. Entities and nowikis inside templated attributes should be handled correctly
12925 !! wikitext
12926 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12927 !! html/php
12928 <div style="background:#f9f9f9;">foo</div>
12929
12930 !! html/parsoid
12931 <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>
12932 !! end
12933
12934 !! test
12935 2. Entities and nowikis inside templated attributes should be handled correctly
12936 !! wikitext
12937 {|
12938 |{{table_attribs_3}}
12939 |}
12940 !! html/php
12941 <table>
12942 <tr>
12943 <td style="background:#f9f9f9;">Foo
12944 </td></tr></table>
12945
12946 !! html/parsoid
12947 <table>
12948 <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>
12949 </tbody></table>
12950 !! end
12951
12952 !! test
12953 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12954 !! wikitext
12955 {{tbl-start}}
12956 |{{table_attribs_3}}
12957 {{tbl-end}}
12958 !! html/php
12959 <table>
12960 <tr>
12961 <td style="background:#f9f9f9;">Foo
12962 </td></tr></table>
12963
12964 !! html/parsoid
12965 <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}}]}'>
12966 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12967 </tbody></table>
12968 !! end
12969
12970 # T107622
12971 !! test
12972 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12973 !! wikitext
12974 {|
12975 |{{table_attribs_6}} hi
12976 |}
12977 !! html/php
12978 <table>
12979 <tr>
12980 <td style="background: red;">hi
12981 </td></tr></table>
12982
12983 !! html/parsoid
12984 <table>
12985 <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>
12986 </tbody></table>
12987 !! end
12988
12989 !!test
12990 Templates: HTML Tables: 1. Generating start of a HTML table
12991 !! wikitext
12992 {{echo|<table><tr><td>foo</td>}}</tr></table>
12993 !! html
12994 <table><tr><td>foo</td></tr></table>
12995
12996 !!end
12997
12998 !!test
12999 Templates: HTML Tables: 2a. Generating middle of a HTML table
13000 !! wikitext
13001 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13002 !! html
13003 <table><tr><td>foo</td></tr></table>
13004
13005 !!end
13006
13007 !!test
13008 Templates: HTML Tables: 2b. Generating middle of a HTML table
13009 !! wikitext
13010 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13011 !! html
13012 <table><tr><td>foo</td></tr></table>
13013
13014 !!end
13015
13016 !!test
13017 Templates: HTML Tables: 3. Generating end of a HTML table
13018 !! wikitext
13019 <table><tr>{{echo|<td>foo</td></tr></table>}}
13020 !! html
13021 <table><tr><td>foo</td></tr></table>
13022
13023 !!end
13024
13025 !!test
13026 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13027 !! wikitext
13028 {{echo|<table>}}<tr><td>foo</td></tr></table>
13029 !! html
13030 <table><tr><td>foo</td></tr></table>
13031
13032 !!end
13033
13034 !!test
13035 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13036 !! wikitext
13037 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13038 !! html
13039 <table><tr><td>foo</td></tr></table>
13040
13041 !!end
13042
13043 !!test
13044 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13045 !! wikitext
13046 <table><tr>{{echo|<td>}}foo</td></tr></table>
13047 !! html
13048 <table><tr><td>foo</td></tr></table>
13049
13050 !!end
13051
13052 !!test
13053 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13054 !! wikitext
13055 <table><tr><td>foo{{echo|</td>}}</tr></table>
13056 !! html
13057 <table><tr><td>foo</td></tr></table>
13058
13059 !!end
13060
13061 !!test
13062 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13063 !! wikitext
13064 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13065 !! html
13066 <table><tr><td>foo</td></tr></table>
13067
13068 !!end
13069
13070 !!test
13071 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13072 !! wikitext
13073 <table><tr><td>foo</td></tr>{{echo|</table>}}
13074 !! html
13075 <table><tr><td>foo</td></tr></table>
13076
13077 !!end
13078
13079 !!test
13080 Templates: HTML Tables: 5. Proper fostering of categories from inside
13081 !!options
13082 parsoid=wt2html,wt2wt
13083 !! wikitext
13084 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13085 <!--Two categories (T52330)-->
13086 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13087 !! html
13088 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13089 <!--Two categories (T52330)-->
13090 <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>
13091 !!end
13092
13093 !!test
13094 Templates: Wiki Tables: 1a. Fostering of entire template content
13095 !! wikitext
13096 {|
13097 {{echo|a}}
13098 |}
13099 !! html
13100 <table>
13101 a
13102 <tr><td></td></tr></table>
13103
13104 !! html/php+tidy
13105
13106 a
13107 <table><tbody><tr><td></td></tr></tbody></table>
13108 !! html/parsoid
13109 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":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">
13110
13111 </table>
13112 !! end
13113
13114 !!test
13115 Templates: Wiki Tables: 1b. Fostering of entire template content
13116 !! wikitext
13117 {|
13118 {{echo|<div>}}
13119 foo
13120 {{echo|</div>}}
13121 |}
13122 !! html
13123 <table>
13124 <div>
13125 <p>foo
13126 </p>
13127 </div>
13128 <tr><td></td></tr></table>
13129
13130 !! html/php+tidy
13131 <div>
13132 <p>foo
13133 </p>
13134 </div><table>
13135
13136 <tbody><tr><td></td></tr></tbody></table>
13137 !! html/parsoid
13138 <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|}"]}'>
13139 <p>foo</p>
13140 </div><table about="#mwt3">
13141
13142 </table>
13143 !! end
13144
13145 !!test
13146 Templates: Wiki Tables: 2. Fostering of partial template content
13147 !! wikitext
13148 {|
13149 {{echo|a
13150 <div>b</div>}}
13151 |}
13152 !! html
13153 <table>
13154 a
13155 <div>b</div>
13156 <tr><td></td></tr></table>
13157
13158 !! html/php+tidy
13159
13160 a
13161 <div>b</div><table>
13162 <tbody><tr><td></td></tr></tbody></table>
13163 !! html/parsoid
13164 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":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">
13165
13166
13167 </table>
13168 !! end
13169
13170 !!test
13171 Templates: Wiki Tables: 3. td-content via multiple templates
13172 !! wikitext
13173 {|
13174 {{echo|{{pipe}}a}}{{echo|b}}
13175 |}
13176 !! html
13177 <table>
13178 <tr>
13179 <td>ab
13180 </td></tr></table>
13181
13182 !!end
13183
13184 !!test
13185 Templates: Wiki Tables: 4. Templated tags, no content
13186 !! wikitext
13187 {{tbl-start}}
13188 {{tbl-end}}
13189 !! html
13190 <table>
13191 <tr><td></td></tr></table>
13192
13193 !!end
13194
13195 !!test
13196 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13197 !! wikitext
13198 {{tbl-start}}
13199 |foo
13200 {{tbl-end}}
13201 !! html
13202 <table>
13203 <tr>
13204 <td>foo
13205 </td></tr></table>
13206
13207 !!end
13208
13209 !!test
13210 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13211 !! wikitext
13212 {{tbl-start}}
13213 {{!}}foo
13214 {{tbl-end}}
13215 !! html
13216 <table>
13217 <tr>
13218 <td>foo
13219 </td></tr></table>
13220
13221 !!end
13222
13223 ## This test case is very specific to Parsoid's internals
13224 ## and is hence only tested for Parsoid's code. Parsoid uses
13225 ## a <meta> marker tag for <ref> tags and they are expanded
13226 ## much later. We are verifying that this <meta> tag usage
13227 ## doesn't prevent foster parenting.
13228 !!test
13229 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13230 !!wikitext
13231 {{PartialTable}}<ref>foo</ref>
13232 |}
13233
13234 <references />
13235 !!html/parsoid
13236 <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup><table about="#mwt2">
13237 <tbody>
13238 </tbody></table>
13239
13240 <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>
13241 !!end
13242
13243 !! test
13244 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13245 !! wikitext
13246 {{echo|
13247 {{{!}}
13248 {{!}}-}}
13249 <onlyinclude>
13250 |foo
13251 </onlyinclude>
13252 {{!}}}
13253 !! html/parsoid
13254 <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{{!}}}"]}'>
13255 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13256 <tbody><tr>
13257
13258 <td>foo
13259 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13260 </tbody></table>
13261 !! end
13262
13263 !!test
13264 Templates: Lists: Multi-line list-items via templates
13265 !! wikitext
13266 *{{echo|a {{nonexistent|
13267 unused}}}}
13268 *{{echo|b {{nonexistent|
13269 unused}}}}
13270 !! html
13271 <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>
13272 <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>
13273
13274 !!end
13275
13276 !!test
13277 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13278 !! wikitext
13279 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13280 !! html
13281 <p><i>ab</i>c<i>d</i>e
13282 </p>
13283 !!end
13284
13285 !!test
13286 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13287 (PHP parser generates misnested html)
13288 !! wikitext
13289 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13290 !! html/parsoid
13291 <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>
13292 !!end
13293
13294 !!test
13295 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13296 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13297 !! options
13298 parsoid=wt2html,wt2wt
13299 !! wikitext
13300 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13301 !! html
13302 <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>
13303 <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>
13304 <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>
13305 !!end
13306
13307 !!test
13308 Templates: Ugly nesting: 4. Divs opened/closed across templates
13309 !! wikitext
13310 a<div>b{{echo|c</div>d}}e
13311 !! html
13312 a<div>bc</div>de
13313
13314 !! html+tidy
13315 <p>a</p><div>bc</div><p>de
13316 </p>
13317 !! end
13318
13319 !! test
13320 Templates: Ugly templates: 3. newline-only template parameter
13321 !! wikitext
13322 foo {{echo|
13323 }}
13324 !! html
13325 <p>foo
13326 </p>
13327 !! end
13328
13329 # This looks like a bug: a single newline triggers p/br for some reason.
13330 !! test
13331 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13332 !! wikitext
13333 {{echo|
13334 }}
13335 !! html
13336 <p><br />
13337 </p>
13338 !! end
13339
13340 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13341 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13342 !! test
13343 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13344 !! wikitext
13345 {{echo|<table>}}
13346 {{echo|<div>foo}}
13347 {{echo|</table>}}
13348 !! html/parsoid
13349 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
13350 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13351 </table>
13352 !! end
13353
13354 # T66017 -- ugly wikitext with fostered content generates two template ranges
13355 # that are "identical" and generate nesting cycles in the algorithm
13356 !! test
13357 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13358 !! wikitext
13359 {{echo|<table><tr><td><table>}}
13360 {{echo|<div>}}
13361 {{echo|</div>}}
13362 !! html/parsoid
13363 <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"}'>
13364 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13365 </table></td></tr></tbody></table>
13366 !! end
13367
13368 !! test
13369 Templates: Parameters substituted at the top-level
13370 !! wikitext
13371 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13372
13373 {{{foo|bar|baz}}}
13374 !! html/php
13375 <p><i>who</i> me? <b>never!</b>
13376 </p><p>bar
13377 </p>
13378 !! html/parsoid
13379 <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>
13380
13381 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13382 !! end
13383
13384 !! test
13385 Templates: Param with empty arg in the final position
13386 !! wikitext
13387 {{{hi|}}}
13388 !! html/parsoid
13389 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13390 !! end
13391
13392 !!test
13393 Parser Functions: 1. Simple example
13394 !! wikitext
13395 {{uc:foo}}
13396 !! html
13397 <p>FOO
13398 </p>
13399 !!end
13400
13401 !!test
13402 Parser Functions: 2. Nested use (only outermost should be marked up)
13403 !! wikitext
13404 {{uc:{{lc:FOO}}}}
13405 !! html
13406 <p>FOO
13407 </p>
13408 !!end
13409
13410 ###
13411 ### Pre-save transform tests
13412 ###
13413 !! test
13414 pre-save transform: subst:
13415 !! options
13416 pst
13417 !! wikitext
13418 {{subst:test}}
13419 !! html/php
13420 This is a test template
13421 !! end
13422
13423 !! test
13424 pre-save transform: normal template
13425 !! options
13426 pst
13427 !! wikitext
13428 {{test}}
13429 !! html/php
13430 {{test}}
13431 !! end
13432
13433 !! test
13434 pre-save transform: nonexistent template
13435 !! options
13436 pst
13437 !! wikitext
13438 {{thistemplatedoesnotexist}}
13439 !! html/php
13440 {{thistemplatedoesnotexist}}
13441 !! end
13442
13443 !! test
13444 pre-save transform: subst magic variables
13445 !! options
13446 pst
13447 !! wikitext
13448 {{subst:SITENAME}}
13449 !! html/php
13450 MediaWiki
13451 !! end
13452
13453 # This is T2089, which I fixed. -- wtm
13454 !! test
13455 pre-save transform: subst: templates with parameters
13456 !! options
13457 pst
13458 !! wikitext
13459 {{subst:paramtest|param="something else"}}
13460 !! html/php
13461 This is a test template with parameter "something else"
13462 !! end
13463
13464 !! article
13465 Template:nowikitest
13466 !! text
13467 <nowiki>'''not wiki'''</nowiki>
13468 !! endarticle
13469
13470 !! test
13471 pre-save transform: nowiki in subst (T3188)
13472 !! options
13473 pst
13474 !! wikitext
13475 {{subst:nowikitest}}
13476 !! html/php
13477 <nowiki>'''not wiki'''</nowiki>
13478 !! end
13479
13480 !! article
13481 Template:commenttest
13482 !! text
13483 This template has <!-- a comment --> in it.
13484 !! endarticle
13485
13486 !! test
13487 pre-save transform: comment in subst (T3936)
13488 !! options
13489 pst
13490 !! wikitext
13491 {{subst:commenttest}}
13492 !! html/php
13493 This template has <!-- a comment --> in it.
13494 !! end
13495
13496 !! test
13497 pre-save transform: unclosed tag
13498 !! options
13499 pst
13500 !! wikitext
13501 <nowiki>'''not wiki'''
13502 !! html/php
13503 <nowiki>'''not wiki'''
13504 !! end
13505
13506 !! test
13507 pre-save transform: mixed tag case
13508 !! options
13509 pst
13510 !! wikitext
13511 <NOwiki>'''not wiki'''</noWIKI>
13512 !! html/php
13513 <NOwiki>'''not wiki'''</noWIKI>
13514 !! end
13515
13516 !! test
13517 pre-save transform: unclosed comment in <nowiki>
13518 !! options
13519 pst
13520 !! wikitext
13521 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13522 !! html/php
13523 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13524 !!end
13525
13526 # Leading @ in this template definition works around a limitation
13527 # in parsoid's parserTests which otherwise strips the <span> from the
13528 # result (confusing it for a template wrapper)
13529 !! article
13530 Template:dangerous
13531 !!text
13532 @<span onmouseover="alert('crap')">Oh no</span>
13533 !!endarticle
13534
13535 !!test
13536 (confirming safety of fix for subst T3936)
13537 !! wikitext
13538 {{Template:dangerous}}
13539 !! html
13540 <p>@<span>Oh no</span>
13541 </p>
13542 !! end
13543
13544 !! test
13545 pre-save transform: comment containing gallery (T7024)
13546 !! options
13547 pst
13548 !! wikitext
13549 <!-- <gallery>data</gallery> -->
13550 !! html/php
13551 <!-- <gallery>data</gallery> -->
13552 !!end
13553
13554 !! test
13555 pre-save transform: comment containing extension
13556 !! options
13557 pst
13558 !! wikitext
13559 <!-- <tag>data</tag> -->
13560 !! html/php
13561 <!-- <tag>data</tag> -->
13562 !!end
13563
13564 !! test
13565 pre-save transform: comment containing nowiki
13566 !! options
13567 pst
13568 !! wikitext
13569 <!-- <nowiki>data</nowiki> -->
13570 !! html/php
13571 <!-- <nowiki>data</nowiki> -->
13572 !!end
13573
13574 !! test
13575 pre-save transform: <noinclude> in subst (T5298)
13576 !! options
13577 pst
13578 !! wikitext
13579 {{subst:Includes}}
13580 !! html/php
13581 Foobar
13582 !! end
13583
13584 !! test
13585 pre-save transform: <onlyinclude> in subst (T5298)
13586 !! options
13587 pst
13588 !! wikitext
13589 {{subst:Includes2}}
13590 !! html/php
13591 Foo
13592 !! end
13593
13594 !! article
13595 Template:SubstTest
13596 !!text
13597 {{<includeonly>subst:</includeonly>Includes}}
13598 !! endarticle
13599
13600 !! article
13601 Template:SafeSubstTest
13602 !! text
13603 {{<includeonly>safesubst:</includeonly>Includes}}
13604 !! endarticle
13605
13606 !! test
13607 T24297: safesubst: works during PST
13608 !! options
13609 pst
13610 !! wikitext
13611 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
13612 !! html/php
13613 FoobarFoobar
13614 !! end
13615
13616 !! test
13617 T24297: safesubst: works during normal parse
13618 !! wikitext
13619 {{SafeSubstTest}}
13620 !! html
13621 <p>Foobar
13622 </p>
13623 !! end
13624
13625 !! test
13626 subst: does not work during normal parse
13627 !! wikitext
13628 {{SubstTest}}
13629 !! html
13630 <p>{{subst:Includes}}
13631 </p>
13632 !! end
13633
13634 !! test
13635 pre-save transform: context links ("pipe trick")
13636 !! options
13637 pst
13638 !! wikitext
13639 [[Article (context)|]]
13640 [[Bar:Article|]]
13641 [[:Bar:Article|]]
13642 [[Bar:Article (context)|]]
13643 [[:Bar:Article (context)|]]
13644 [[|Article]]
13645 [[|Article (context)]]
13646 [[Bar:X (Y) Z|]]
13647 [[:Bar:X (Y) Z|]]
13648 !! html/php
13649 [[Article (context)|Article]]
13650 [[Bar:Article|Article]]
13651 [[:Bar:Article|Article]]
13652 [[Bar:Article (context)|Article]]
13653 [[:Bar:Article (context)|Article]]
13654 [[Article]]
13655 [[Article (context)]]
13656 [[Bar:X (Y) Z|X (Y) Z]]
13657 [[:Bar:X (Y) Z|X (Y) Z]]
13658 !! end
13659
13660 !! test
13661 pre-save transform: context links ("pipe trick") with interwiki prefix
13662 !! options
13663 pst
13664 !! wikitext
13665 [[interwiki:Article|]]
13666 [[:interwiki:Article|]]
13667 [[interwiki:Bar:Article|]]
13668 [[:interwiki:Bar:Article|]]
13669 !! html/php
13670 [[interwiki:Article|Article]]
13671 [[:interwiki:Article|Article]]
13672 [[interwiki:Bar:Article|Bar:Article]]
13673 [[:interwiki:Bar:Article|Bar:Article]]
13674 !! end
13675
13676 !! test
13677 pre-save transform: context links ("pipe trick") with parens in title
13678 !! options
13679 pst title=[[Somearticle (context)]]
13680 !! wikitext
13681 [[|Article]]
13682 !! html/php
13683 [[Article (context)|Article]]
13684 !! end
13685
13686 !! test
13687 pre-save transform: context links ("pipe trick") with comma in title
13688 !! options
13689 pst title=[[Someplace, Somewhere]]
13690 !! wikitext
13691 [[|Otherplace]]
13692 [[Otherplace, Elsewhere|]]
13693 [[Otherplace, Elsewhere, Anywhere|]]
13694 !! html/php
13695 [[Otherplace, Somewhere|Otherplace]]
13696 [[Otherplace, Elsewhere|Otherplace]]
13697 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
13698 !! end
13699
13700 !! test
13701 pre-save transform: context links ("pipe trick") with parens and comma
13702 !! options
13703 pst title=[[Someplace (IGNORED), Somewhere]]
13704 !! wikitext
13705 [[|Otherplace]]
13706 [[Otherplace (place), Elsewhere|]]
13707 !! html/php
13708 [[Otherplace, Somewhere|Otherplace]]
13709 [[Otherplace (place), Elsewhere|Otherplace]]
13710 !! end
13711
13712 !! test
13713 pre-save transform: context links ("pipe trick") with comma and parens
13714 !! options
13715 pst title=[[Who, me? (context)]]
13716 !! wikitext
13717 [[|Yes, you.]]
13718 [[Me, Myself, and I (1937 song)|]]
13719 !! html/php
13720 [[Yes, you. (context)|Yes, you.]]
13721 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
13722 !! end
13723
13724 !! test
13725 pre-save transform: context links ("pipe trick") with namespace
13726 !! options
13727 pst title=[[Ns:Somearticle]]
13728 !! wikitext
13729 [[|Article]]
13730 !! html/php
13731 [[Ns:Article|Article]]
13732 !! end
13733
13734 !! test
13735 pre-save transform: context links ("pipe trick") with namespace and parens
13736 !! options
13737 pst title=[[Ns:Somearticle (context)]]
13738 !! wikitext
13739 [[|Article]]
13740 !! html/php
13741 [[Ns:Article (context)|Article]]
13742 !! end
13743
13744 !! test
13745 pre-save transform: context links ("pipe trick") with namespace and comma
13746 !! options
13747 pst title=[[Ns:Somearticle, Context, Whatever]]
13748 !! wikitext
13749 [[|Article]]
13750 !! html/php
13751 [[Ns:Article, Context, Whatever|Article]]
13752 !! end
13753
13754 !! test
13755 pre-save transform: context links ("pipe trick") with namespace, comma and parens
13756 !! options
13757 pst title=[[Ns:Somearticle, Context (context)]]
13758 !! wikitext
13759 [[|Article]]
13760 !! html/php
13761 [[Ns:Article (context)|Article]]
13762 !! end
13763
13764 !! test
13765 pre-save transform: context links ("pipe trick") with namespace, parens and comma
13766 !! options
13767 pst title=[[Ns:Somearticle (IGNORED), Context]]
13768 !! wikitext
13769 [[|Article]]
13770 !! html/php
13771 [[Ns:Article, Context|Article]]
13772 !! end
13773
13774 !! test
13775 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
13776 !! options
13777 pst
13778 !! wikitext
13779 [[Article(context)|]]
13780 [[Bar:Article(context)|]]
13781 [[:Bar:Article(context)|]]
13782 [[|Article(context)]]
13783 [[Bar:X(Y)Z|]]
13784 [[:Bar:X(Y)Z|]]
13785 !! html/php
13786 [[Article(context)|Article]]
13787 [[Bar:Article(context)|Article]]
13788 [[:Bar:Article(context)|Article]]
13789 [[Article(context)]]
13790 [[Bar:X(Y)Z|X(Y)Z]]
13791 [[:Bar:X(Y)Z|X(Y)Z]]
13792 !! end
13793
13794 !! test
13795 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
13796 !! options
13797 pst
13798 !! wikitext
13799 [[Article (context)|]]
13800 [[Bar:Article (context)|]]
13801 [[:Bar:Article (context)|]]
13802 [[|Article (context)]]
13803 [[Bar:X (Y) Z|]]
13804 [[:Bar:X (Y) Z|]]
13805 !! html/php
13806 [[Article (context)|Article]]
13807 [[Bar:Article (context)|Article]]
13808 [[:Bar:Article (context)|Article]]
13809 [[Article (context)]]
13810 [[Bar:X (Y) Z|X (Y) Z]]
13811 [[:Bar:X (Y) Z|X (Y) Z]]
13812 !! end
13813
13814 !! test
13815 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
13816 !! options
13817 pst
13818 !! wikitext
13819 [[Article(context)|]]
13820 [[Bar:Article(context)|]]
13821 [[:Bar:Article(context)|]]
13822 [[|Article(context)]]
13823 [[Bar:X(Y)Z|]]
13824 [[:Bar:X(Y)Z|]]
13825 !! html/php
13826 [[Article(context)|Article]]
13827 [[Bar:Article(context)|Article]]
13828 [[:Bar:Article(context)|Article]]
13829 [[Article(context)]]
13830 [[Bar:X(Y)Z|X(Y)Z]]
13831 [[:Bar:X(Y)Z|X(Y)Z]]
13832 !! end
13833
13834 !! test
13835 pre-save transform: context links ("pipe trick") with commas (T23660)
13836 !! options
13837 pst
13838 !! wikitext
13839 [[Article (context), context|]]
13840 [[Article (context),context|]]
13841 [[Bar:Article (context), context|]]
13842 [[Bar:Article (context),context|]]
13843 [[:Bar:Article (context), context|]]
13844 [[:Bar:Article (context),context|]]
13845 !! html/php
13846 [[Article (context), context|Article]]
13847 [[Article (context),context|Article]]
13848 [[Bar:Article (context), context|Article]]
13849 [[Bar:Article (context),context|Article]]
13850 [[:Bar:Article (context), context|Article]]
13851 [[:Bar:Article (context),context|Article]]
13852 !! end
13853
13854 !! test
13855 Parsoid: backwards pipe trick
13856 !! wikitext
13857 [[|'''bar''']]
13858 !! html/php
13859 <p>[[|<b>bar</b>]]
13860 </p>
13861 !! html/parsoid
13862 <p>[[|<b>bar</b>]]</p>
13863 !! end
13864
13865 !! test
13866 pre-save transform: trim trailing empty lines
13867 !! options
13868 pst
13869 !! wikitext
13870 Empty lines are trimmed
13871
13872
13873
13874
13875 !! html/php
13876 Empty lines are trimmed
13877 !! end
13878
13879 !! test
13880 pre-save transform: Signature expansion
13881 !! options
13882 pst
13883 !! wikitext
13884 * ~~~
13885 * ~~~~
13886 * ~~~~~
13887 * <noinclude>~~~</noinclude>
13888 * <includeonly>~~~</includeonly>
13889 * <onlyinclude>~~~</onlyinclude>
13890 !! html/php
13891 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13892 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13893 * 00:02, 1 January 1970 (UTC)
13894 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13895 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13896 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13897 !! end
13898
13899
13900 !! test
13901 ParserOutput flags from signature expansion (T84843)
13902 !! options
13903 pst
13904 showflags
13905 !! wikitext
13906 ~~~~
13907 !! html/php
13908 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
13909 flags=user-signature
13910 !! end
13911
13912
13913 !! test
13914 pre-save transform: Signature expansion in nowiki tags (T2093)
13915 !! options
13916 pst disabled
13917 !! wikitext
13918 Shall not expand:
13919
13920 <nowiki>~~~~</nowiki>
13921
13922 <includeonly><nowiki>~~~~</nowiki></includeonly>
13923
13924 <noinclude><nowiki>~~~~</nowiki></noinclude>
13925
13926 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13927
13928 {{subst:Foo}} shall be converted to FOO
13929
13930 As well as inside noinclude/onlyinclude
13931 <noinclude>{{subst:Foo}}</noinclude>
13932 <onlyinclude>{{subst:Foo}}</onlyinclude>
13933
13934 But not inside includeonly
13935 <includeonly>{{subst:Foo}}</includeonly>
13936 !! html/php
13937 Shall not expand:
13938
13939 <nowiki>~~~~</nowiki>
13940
13941 <includeonly><nowiki>~~~~</nowiki></includeonly>
13942
13943 <noinclude><nowiki>~~~~</nowiki></noinclude>
13944
13945 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13946
13947 FOO shall be converted to FOO
13948
13949 As well as inside noinclude/onlyinclude
13950 <noinclude>FOO</noinclude>
13951 <onlyinclude>FOO</onlyinclude>
13952
13953 But not inside includeonly
13954 <includeonly>{{subst:Foo}}</includeonly>
13955 !! end
13956
13957 !! test
13958 Parsoid: Recognize nowiki with trailing space in tags
13959 !! options
13960 parsoid=wt2html
13961 !! wikitext
13962 <nowiki ><div>[[foo]]</nowiki >
13963
13964 a<nowiki / >b
13965
13966 c<nowiki />d
13967
13968 e<nowiki/ >f
13969 !! html
13970 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13971 <p>ab</p>
13972 <p>cd</p>
13973 <p>ef</p>
13974 !! end
13975
13976 !! test
13977 Parsoid: Recognize nowiki with odd capitalization
13978 !! options
13979 parsoid=wt2html
13980 !! wikitext
13981 <noWikI ><div>[[foo]]</Nowiki >
13982 !! html
13983 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13984 !! end
13985
13986
13987 !! test
13988 Parsoid: Escape nowiki with trailing space in tags
13989 !! options
13990 parsoid=html2wt
13991 !! html/parsoid
13992 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13993 <p>a&lt;nowiki /&gt;b</p>
13994 <p>c&lt;nowiki/ &gt;d</p>
13995 !! wikitext
13996 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13997
13998 a&lt;nowiki /&gt;b
13999
14000 c&lt;nowiki/ &gt;d
14001 !! end
14002
14003 !! test
14004 Parsoid: Escape weird noWikI capitalizations
14005 !! options
14006 parsoid=html2wt
14007 !! html/parsoid
14008 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14009 !! wikitext
14010 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14011 !! end
14012
14013 ###
14014 ### Message transform tests
14015 ###
14016 !! test
14017 message transform: magic variables
14018 !! options
14019 msg
14020 !! wikitext
14021 {{SITENAME}}
14022 !! html
14023 MediaWiki
14024 !! end
14025
14026 !! test
14027 message transform: should not transform wiki markup
14028 !! options
14029 msg
14030 !! wikitext
14031 ''test''
14032 !! html
14033 ''test''
14034 !! end
14035
14036 !! test
14037 message transform: <noinclude> in transcluded template (T6926)
14038 !! options
14039 msg
14040 !! wikitext
14041 {{Includes}}
14042 !! html
14043 Foobar
14044 !! end
14045
14046 !! test
14047 message transform: <onlyinclude> in transcluded template (T6926)
14048 !! options
14049 msg
14050 !! wikitext
14051 {{Includes2}}
14052 !! html
14053 Foo
14054 !! end
14055
14056 !! test
14057 {{#special:}} page name, known
14058 !! options
14059 msg
14060 !! wikitext
14061 {{#special:Recentchanges}}
14062 !! html
14063 Special:RecentChanges
14064 !! end
14065
14066 !! test
14067 {{#special:}} page name with subpage, known
14068 !! options
14069 msg
14070 !! wikitext
14071 {{#special:Recentchanges/param}}
14072 !! html
14073 Special:RecentChanges/param
14074 !! end
14075
14076 !! test
14077 {{#special:}} page name, unknown
14078 !! options
14079 msg
14080 !! wikitext
14081 {{#special:foobar nonexistent}}
14082 !! html
14083 Special:Foobar nonexistent
14084 !! end
14085
14086 !! test
14087 {{#speciale:}} page name, known
14088 !! options
14089 msg
14090 !! wikitext
14091 {{#speciale:Recentchanges}}
14092 !! html
14093 Special:RecentChanges
14094 !! end
14095
14096 !! test
14097 {{#speciale:}} page name with subpage, known
14098 !! options
14099 msg
14100 !! wikitext
14101 {{#speciale:Recentchanges/param}}
14102 !! html
14103 Special:RecentChanges/param
14104 !! end
14105
14106 !! test
14107 {{#speciale:}} page name, unknown
14108 !! options
14109 msg
14110 !! wikitext
14111 {{#speciale:foobar nonexistent}}
14112 !! html
14113 Special:Foobar_nonexistent
14114 !! end
14115
14116 ###
14117 ### Images
14118 ###
14119 ### For Parsoid-specific tests, see
14120 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14121
14122 !! test
14123 Simple image
14124 !! options
14125 parsoid=wt2html,wt2wt,html2html
14126 !! wikitext
14127 [[Image:foobar.jpg]]
14128 !! html/php
14129 <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>
14130 </p>
14131 !! html/parsoid
14132 <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>
14133 !! end
14134
14135 !! test
14136 Serialize simple image with span wrapper
14137 !! options
14138 parsoid=html2wt
14139 !! html/parsoid
14140 <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>
14141 !! wikitext
14142 [[File:Foobar.jpg]]
14143 !! end
14144
14145 !! test
14146 Simple image (using File: namespace, now canonical)
14147 !! wikitext
14148 [[File:Foobar.jpg]]
14149 !! html/php
14150 <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>
14151 </p>
14152 !! html/parsoid
14153 <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>
14154 !! end
14155
14156 !! test
14157 Right-aligned image
14158 !! wikitext
14159 [[File:Foobar.jpg|right]]
14160 !! html/php
14161 <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>
14162
14163 !! html/parsoid
14164 <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>
14165 !! end
14166
14167 !! test
14168 Image with caption
14169 !! wikitext
14170 [[File:Foobar.jpg|right|Caption text]]
14171 !! html/php
14172 <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>
14173
14174 !! html/parsoid
14175 <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>
14176 !! end
14177
14178 !! test
14179 Image with caption, T55312 #1
14180 !! wikitext
14181 [[File:Foobar.jpg|right|Caption page stuff]]
14182 !! html/php
14183 <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>
14184
14185 !! html/parsoid
14186 <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>
14187 !! end
14188
14189 !! test
14190 Image with caption, T55312 #2
14191 !! wikitext
14192 [[File:Foobar.jpg|right|Caption page=]]
14193 !! html/php
14194 <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>
14195
14196 !! html/parsoid
14197 <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>
14198 !! end
14199
14200 !! test
14201 Image with caption, T55312 #3
14202 !! wikitext
14203 [[File:Foobar.jpg|right|Caption page=stuff]]
14204 !! html/php
14205 <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>
14206
14207 !! html/parsoid
14208 <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>
14209 !! end
14210
14211 !! test
14212 Image caption with pipe entity
14213 !! wikitext
14214 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14215 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14216 !! html/php
14217 <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>
14218 <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>
14219
14220 !! html/parsoid
14221 <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>
14222 <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>
14223 !! end
14224
14225 !! test
14226 Allow empty links in image captions (T62753)
14227 !! options
14228 thumbsize=220
14229 !! wikitext
14230 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14231 [[]]
14232 [[Link2]]
14233 ]]
14234 !! html/php
14235 <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>
14236
14237 !! html/parsoid
14238 <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>
14239 [[]]
14240 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14241 </figcaption></figure>
14242 !! end
14243
14244 !! test
14245 Titles in unlinked images (T23454)
14246 !! wikitext
14247 [[File:Foobar.jpg|link=|stuff]]
14248 !! html/php
14249 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
14250 </p>
14251 !! html/parsoid
14252 <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>
14253 !! end
14254
14255 !! test
14256 Link with empty target
14257 !! wikitext
14258 [[]]
14259 !! html
14260 <p>[[]]
14261 </p>
14262 !! end
14263
14264 !! test
14265 Image with link trail
14266 !! wikitext
14267 Linktrails should not work for images: [[File:Foobar.jpg]]s
14268 !! html/php
14269 <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
14270 </p>
14271 !! html/parsoid
14272 <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>
14273 !! end
14274
14275 !! test
14276 Image with empty attribute
14277 !! options
14278 parsoid=wt2html,wt2wt,html2html
14279 !! wikitext
14280 [[File:Foobar.jpg|right||Caption text]]
14281 !! html/php
14282 <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>
14283
14284 !! html/parsoid
14285 <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>
14286 !! end
14287
14288 !! test
14289 1. Block image with individual attributes from templates
14290 !! wikitext
14291 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14292 !! html/php
14293 <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>
14294
14295 !! html/parsoid
14296 <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>
14297 !! end
14298
14299 !! test
14300 2. Block Image with individual attributes from templates
14301 !! wikitext
14302 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14303 !! html/php
14304 <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>
14305
14306 !! html/parsoid
14307 <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>
14308 !! end
14309
14310 !! test
14311 3. Inline image with individual attributes from templates
14312 !! wikitext
14313 [[File:Foobar.jpg|{{echo|50px}}]]
14314 !! html/php
14315 <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>
14316 </p>
14317 !! html/parsoid
14318 <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>
14319 !! end
14320
14321 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14322 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14323 !! test
14324 Image with multiple attributes from the same template
14325 !! wikitext
14326 [[File:Foobar.jpg|{{image_attribs}}]]
14327 !! html/php
14328 <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>
14329
14330 !! html/parsoid
14331 <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>
14332 !! end
14333
14334 !! test
14335 Image with link tails
14336 !! options
14337 thumbsize=220
14338 !! wikitext
14339 123[[File:Foobar.jpg]]456
14340 123[[File:Foobar.jpg|right]]456
14341 123[[File:Foobar.jpg|thumb]]456
14342 !! html/php
14343 <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
14344 </p>
14345 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
14346 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
14347
14348 !! html/php+tidy
14349 <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
14350 </p><p>
14351 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
14352 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
14353 </p>
14354 !! html/parsoid
14355 <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>
14356 <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</p>
14357 <p>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>
14358 !! end
14359
14360 !! test
14361 Image with multiple captions -- only last one is accepted
14362 !! wikitext
14363 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14364 !! html/php
14365 <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>
14366
14367 !! html/parsoid
14368 <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>
14369 !! end
14370
14371 !! test
14372 Image with multiple widths -- use last
14373 !! wikitext
14374 [[File:Foobar.jpg|200px|300px|caption]]
14375 !! html/php
14376 <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>
14377 </p>
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 !! test
14383 Image with multiple alignments -- use first (T50664)
14384 !! options
14385 thumbsize=220
14386 !! wikitext
14387 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14388
14389 [[File:Foobar.jpg|middle|text-top|caption]]
14390 !! html/php
14391 <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>
14392 <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>
14393 </p>
14394 !! html/parsoid
14395 <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>
14396 <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>
14397 !! end
14398
14399 !! test
14400 Image with width attribute at different positions
14401 !! wikitext
14402 [[File:Foobar.jpg|200px|right|Caption]]
14403 [[File:Foobar.jpg|right|200px|Caption]]
14404 [[File:Foobar.jpg|right|Caption|200px]]
14405 !! html/php
14406 <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>
14407 <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>
14408 <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>
14409
14410 !! html/parsoid
14411 <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>
14412 <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>
14413 <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>
14414 !! end
14415
14416 # a sad bit of backward-compatibility
14417 !! test
14418 Image with size specified with pxpx (T15500, T53628)
14419 !! options
14420 parsoid=wt2html,wt2wt,html2html
14421 !! wikitext
14422 [[File:Foobar.jpg|20pxpx]]
14423 [[File:Foobar.jpg|200x20pxpx]]
14424 !! html/php
14425 <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>
14426 <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>
14427 </p>
14428 !! html/parsoid
14429 <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>
14430 !! end
14431
14432 !! test
14433 Image with link parameter, wiki target
14434 !! wikitext
14435 [[File:Foobar.jpg|link=Main Page]]
14436 !! html/php
14437 <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>
14438 </p>
14439 !! html/parsoid
14440 <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>
14441 !! end
14442
14443 # parsoid T51293 (part 1)
14444 !! test
14445 Image with link parameter, URL target
14446 !! wikitext
14447 [[File:Foobar.jpg|link=http://example.com/]]
14448 !! html/php
14449 <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>
14450 </p>
14451 !! html/parsoid
14452 <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>
14453 !! end
14454
14455 # parsoid T51293 (part 2)
14456 !! test
14457 Image with link parameter, protocol-less URL target
14458 !! wikitext
14459 [[File:Foobar.jpg|link=//example.com/]]
14460 !! html/php
14461 <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>
14462 </p>
14463 !! html/parsoid
14464 <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>
14465 !! end
14466
14467 !! test
14468 Escaping non-block captions (T107435)
14469 !! options
14470 parsoid={
14471 "modes": ["wt2wt"],
14472 "changes": [
14473 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14474 ]
14475 }
14476 !! wikitext
14477 [[Image:Foobar.jpg|caption]]
14478 !! wikitext/edited
14479 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14480 !! end
14481
14482 # wgExternalLinkTarget not supported by Parsoid
14483 !! test
14484 Image with link parameter, wgExternalLinkTarget
14485 !! wikitext
14486 [[Image:foobar.jpg|link=http://example.com/]]
14487 !! config
14488 wgExternalLinkTarget='foobar'
14489 !! html/php
14490 <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>
14491 </p>
14492 !! end
14493
14494 !! test
14495 Image with link parameter, wgNoFollowLinks set to false
14496 !! wikitext
14497 [[Image:foobar.jpg|link=http://example.com/]]
14498 !! config
14499 wgNoFollowLinks=false
14500 !! html/php
14501 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14502 </p>
14503 !! end
14504
14505 !! test
14506 Image with link parameter, wgNoFollowDomainExceptions
14507 !! wikitext
14508 [[Image:foobar.jpg|link=http://example.com/]]
14509 !! config
14510 wgNoFollowDomainExceptions='example.com'
14511 !! html/php
14512 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
14513 </p>
14514 !! end
14515
14516 # wgExternalLinkTarget not supported by Parsoid
14517 !! test
14518 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14519 !! wikitext
14520 [[Image:foobar.jpg|link=http://example.com/|Title]]
14521 !! config
14522 wgExternalLinkTarget='foobar'
14523 !! html/php
14524 <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>
14525 </p>
14526 !! end
14527
14528 !! test
14529 Image with empty link parameter
14530 !! wikitext
14531 [[File:Foobar.jpg|link=]]
14532 !! html/php
14533 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
14534 </p>
14535 !! html/parsoid
14536 <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>
14537 !! end
14538
14539 !! test
14540 Image with link parameter (wiki target) and unnamed parameter
14541 !! wikitext
14542 [[File:Foobar.jpg|link=Main_Page|Title]]
14543 !! html/php
14544 <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>
14545 </p>
14546 !! html/parsoid
14547 <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>
14548 !! end
14549
14550 !! test
14551 Image with link parameter (URL target) and unnamed parameter
14552 !! wikitext
14553 [[File:Foobar.jpg|link=http://example.com/|Title]]
14554 !! html/php
14555 <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>
14556 </p>
14557 !! html/parsoid
14558 <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>
14559 !! end
14560
14561 !! test
14562 Thumbnail image with link parameter
14563 !! options
14564 thumbsize=220
14565 parsoid=wt2html,wt2wt,html2html
14566 !! wikitext
14567 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
14568 !! html/php
14569 <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>
14570
14571 !! html/parsoid
14572 <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>
14573 !! end
14574
14575 !! test
14576 Manually-specified thumbnail image
14577 !! options
14578 thumbsize=220
14579 !! wikitext
14580 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
14581 !! html/php
14582 <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>
14583
14584 !! html/parsoid
14585 <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>
14586 !! end
14587
14588 !! test
14589 Manually-specified thumbnail image with explicit link to wiki page
14590 !! options
14591 thumbsize=220
14592 parsoid=wt2html,wt2wt,html2html
14593 !! wikitext
14594 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
14595 !! html/php
14596 <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>
14597
14598 !! html/parsoid
14599 <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>
14600 !! end
14601
14602 !! test
14603 Manually-specified thumbnail image with explicit link to url
14604 !! options
14605 thumbsize=220
14606 parsoid=wt2html,wt2wt,html2html
14607 !! wikitext
14608 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
14609 !! html/php
14610 <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>
14611
14612 !! html/parsoid
14613 <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>
14614 !! end
14615
14616 !! test
14617 Manually-specified thumbnail image with explicit no link
14618 !! options
14619 thumbsize=220
14620 parsoid=wt2html,wt2wt,html2html
14621 !! wikitext
14622 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
14623 !! html/php
14624 <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>
14625
14626 !! html/parsoid
14627 <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>
14628 !! end
14629
14630 !! test
14631 Manually-specified thumbnail image with explicit link and alt text
14632 !! options
14633 thumbsize=220
14634 parsoid=wt2html,wt2wt,html2html
14635 !! wikitext
14636 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
14637 !! html/php
14638 <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>
14639
14640 !! html/parsoid
14641 <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>
14642 !! end
14643
14644 !! test
14645 Image with frame and link
14646 !! options
14647 parsoid=wt2html,wt2wt,html2html
14648 !! wikitext
14649 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
14650 !! html/php
14651 <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>
14652
14653 !! html/parsoid
14654 <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>
14655 !! end
14656
14657 !! test
14658 Image with frame and link and explicit alt
14659 !! options
14660 parsoid=wt2html,wt2wt,html2html
14661 !! wikitext
14662 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
14663 !! html/php
14664 <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>
14665
14666 !! html/parsoid
14667 <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>
14668 !! end
14669
14670 !! test
14671 Image with wiki markup in implicit alt
14672 !! wikitext
14673 [[Image:Foobar.jpg|testing '''bold''' in alt]]
14674
14675 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
14676 !! html/php
14677 <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>
14678 </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>
14679 </p>
14680 !! html/parsoid
14681 <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>
14682
14683 <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>
14684 !! end
14685
14686 !! test
14687 Alt image option should handle most kinds of wikitext without barfing
14688 !! wikitext
14689 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
14690 !! html/php
14691 <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>
14692
14693 !! html/parsoid
14694 <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>
14695 !! end
14696
14697 !! test
14698 Image with table with attributes in caption
14699 !! options
14700 parsoid=wt2html,html2html
14701 !! wikitext
14702 [[File:Foobar.jpg|thumb|
14703 {| class="123" |
14704 |- class="456" |
14705 | ha
14706 |}
14707 ]]
14708 !! html/parsoid
14709 <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>
14710 <table class="123">
14711 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
14712 <td> ha</td></tr>
14713 </tbody></table>
14714 </figcaption></figure>
14715 !! end
14716
14717 !! test
14718 Image with table with rows from templates in caption
14719 !! wikitext
14720 [[File:Foobar.jpg|thumb|
14721 {|
14722 {{echo|{{!}} hi}}
14723 |}
14724 ]]
14725 !! html/parsoid
14726 <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>
14727 <table>
14728 <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>
14729 </tbody></table>
14730 </figcaption></figure>
14731 !! end
14732
14733 !! test
14734 Image with nested tables in caption
14735 !! wikitext
14736 [[File:Foobar.jpg|thumb|Foo<br />
14737 {|
14738 |
14739 {|
14740 |z
14741 |}
14742 |}
14743 ]]
14744 !! html/parsoid
14745 <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}'/>
14746 <table>
14747 <tbody><tr><td>
14748 <table>
14749 <tbody><tr><td>z</td></tr>
14750 </tbody></table></td></tr>
14751 </tbody></table>
14752 </figcaption></figure>
14753 !! end
14754
14755 ###################
14756 # Conflicting image format options.
14757 # First option specified should 'win'.
14758 # All three cases in each test should be identical.
14759
14760 !! test
14761 Image with 'frameless' first.
14762 !! options
14763 parsoid=wt2html,wt2wt,html2html
14764 !! wikitext
14765 [[File:Foobar.jpg|frameless|caption]]
14766
14767 [[File:Foobar.jpg|frameless|frame|caption]]
14768
14769 [[File:Foobar.jpg|frameless|thumb|caption]]
14770 !! html/php
14771 <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>
14772 </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>
14773 </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>
14774 </p>
14775 !! html/parsoid
14776 <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>
14777 <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>
14778 <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>
14779 !! end
14780
14781 !! test
14782 Image with 'frame' first.
14783 !! options
14784 parsoid=wt2html,wt2wt,html2html
14785 !! wikitext
14786 [[File:Foobar.jpg|frame|caption]]
14787 [[File:Foobar.jpg|frame|frameless|caption]]
14788 [[File:Foobar.jpg|frame|thumb|caption]]
14789 !! html/php
14790 <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>
14791 <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>
14792 <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>
14793
14794 !! html/parsoid
14795 <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>
14796 <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>
14797 <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>
14798 !! end
14799
14800 !! test
14801 Image with 'thumb' first.
14802 !! options
14803 parsoid=wt2html,wt2wt,html2html
14804 !! wikitext
14805 [[File:Foobar.jpg|thumb|caption]]
14806 [[File:Foobar.jpg|thumb|frameless|caption]]
14807 [[File:Foobar.jpg|thumb|frame|caption]]
14808 !! html/php
14809 <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>
14810 <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>
14811 <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>
14812
14813 !! html/parsoid
14814 <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>
14815 <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>
14816 <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>
14817 !! end
14818
14819 ###################
14820 # Image sizing.
14821 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
14822 # and https://phabricator.wikimedia.org/T64258
14823 # Foobar has actual size of 1941x220
14824 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
14825 # a scalable format.
14826 # 2. Framed images always ignore size options; always render at default size.
14827 # 3. "Unspecified format" and border are the only types which can be
14828 # enlarged.
14829
14830 !! test
14831 Image: unspecified format and border enlarge
14832 !! options
14833 parsoid=wt2html,wt2wt,html2html
14834 !! wikitext
14835 [[File:Foobar.jpg|2000px]]
14836
14837 [[File:Foobar.jpg|border|2000px]]
14838 !! html/php
14839 <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>
14840 </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>
14841 </p>
14842 !! html/parsoid
14843 <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>
14844 <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>
14845 !! end
14846
14847 !! test
14848 Image: "unspecified format" and border reduce
14849 !! options
14850 parsoid=wt2html,wt2wt,html2html
14851 !! wikitext
14852 [[File:Foobar.jpg|1000px]]
14853
14854 [[File:Foobar.jpg|border|1000px]]
14855 !! html/php
14856 <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>
14857 </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>
14858 </p>
14859 !! html/parsoid
14860 <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>
14861 <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>
14862 !! end
14863
14864 !! test
14865 Image: thumbs reduce
14866 !! options
14867 parsoid=wt2html,wt2wt,html2html
14868 !! wikitext
14869 [[File:Foobar.jpg|thumb|50px]]
14870 !! html/php
14871 <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>
14872
14873 !! html/parsoid
14874 <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>
14875 !! end
14876
14877 !! test
14878 Image: bitmap thumbs can't be enlarged past original size, but vector can.
14879 !! options
14880 parsoid=wt2html,wt2wt,html2html
14881 !! wikitext
14882 [[File:Foobar.jpg|thumb|2000px]]
14883
14884 [[File:Foobar.svg|thumb|2000px]]
14885 !! html/php
14886 <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>
14887 <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>
14888
14889 !! html/parsoid
14890 <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>
14891 <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>
14892 !! end
14893
14894 !! test
14895 Image: frameless can reduce in size
14896 !! options
14897 parsoid=wt2html,wt2wt,html2html
14898 !! wikitext
14899 [[File:Foobar.jpg|frameless|50px]]
14900 !! html/php
14901 <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>
14902 </p>
14903 !! html/parsoid
14904 <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>
14905 !! end
14906
14907 !! test
14908 Image: bitmap frameless can't be enlarged past original size, but vector can
14909 !! options
14910 parsoid=wt2html,wt2wt,html2html
14911 !! wikitext
14912 [[File:Foobar.jpg|frameless|2000px]]
14913
14914 [[File:Foobar.svg|frameless|2000px]]
14915 !! html/php
14916 <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>
14917 </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>
14918 </p>
14919 !! html/parsoid
14920 <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>
14921 <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>
14922 !! end
14923
14924 !! test
14925 Image: framed images are always unscaled.
14926 !! options
14927 parsoid=wt2html,wt2wt,html2html
14928 !! wikitext
14929 [[File:Foobar.jpg|frame]]
14930
14931 [[File:Foobar.jpg|frame|50px]]
14932
14933 [[File:Foobar.jpg|frame|50x50px]]
14934
14935 [[File:Foobar.jpg|frame|2000px]]
14936 !! html/php
14937 <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>
14938 <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>
14939 <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>
14940 <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>
14941
14942 !! html/parsoid
14943 <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>
14944 <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>
14945 <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>
14946 <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>
14947 !! end
14948
14949 ###################
14950
14951 !! test
14952 Link to image page- image page normally doesn't exists, hence edit link
14953 Add test with existing image page
14954 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14955 !! wikitext
14956 [[:Image:test]]
14957 !! html
14958 <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>
14959 </p>
14960 !! end
14961
14962 !! test
14963 T20784 Link to non-existent image page with caption should use caption as link text
14964 !! wikitext
14965 [[:Image:test|caption]]
14966 !! html
14967 <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>
14968 </p>
14969 !! end
14970
14971 !! test
14972 Frameless image caption with a free URL
14973 !! wikitext
14974 [[File:Foobar.jpg|http://example.com]]
14975 !! html/php
14976 <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>
14977 </p>
14978 !! html/parsoid
14979 <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>
14980 !! end
14981
14982 !! test
14983 Thumbnail image caption with a free URL
14984 !! options
14985 thumbsize=220
14986 !! wikitext
14987 [[File:Foobar.jpg|thumb|http://example.com]]
14988 !! html/php
14989 <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>
14990
14991 !! html/parsoid
14992 <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>
14993 !! end
14994
14995 !! test
14996 Thumbnail image caption with a free URL and explicit alt
14997 !! options
14998 thumbsize=220
14999 parsoid=wt2html,wt2wt,html2html
15000 !! wikitext
15001 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15002 !! html/php
15003 <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>
15004
15005 !! html/parsoid
15006 <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>
15007 !! end
15008
15009 !! test
15010 SVG thumbnails with no language set
15011 !! options
15012 !! wikitext
15013 [[File:Foobar.svg|thumb|caption]]
15014 !! html/php
15015 <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>
15016
15017 !! html/parsoid
15018 <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>
15019 !! end
15020
15021 !! test
15022 SVG thumbnails with language de
15023 !! options
15024 parsoid=wt2html,wt2wt,html2html
15025 !! wikitext
15026 [[File:Foobar.svg|thumb|caption|lang=de]]
15027 !! html/php
15028 <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>
15029
15030 !! html/parsoid
15031 <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>
15032 !! end
15033
15034 !! test
15035 SVG thumbnails with invalid language code
15036 !! options
15037 parsoid=wt2html,wt2wt,html2html
15038 !! wikitext
15039 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15040 !! html/php
15041 <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>
15042
15043 !! html/parsoid
15044 <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>
15045 !! end
15046
15047 !! test
15048 T3887: A ISBN with a thumbnail
15049 !! wikitext
15050 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15051 !! html/php
15052 <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>
15053
15054 !! html/parsoid
15055 <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>
15056 !! end
15057
15058 !! test
15059 T3887: A RFC with a thumbnail
15060 !! wikitext
15061 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15062 !! html/php
15063 <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>
15064
15065 !! html/parsoid
15066 <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 text">RFC 12354</a></figcaption></figure>
15067 !! end
15068
15069 !! test
15070 T3887: A mailto link with a thumbnail
15071 !! wikitext
15072 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15073 !! html/php
15074 <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>
15075
15076 !! html/parsoid
15077 <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>
15078 !! end
15079
15080 # Pending resolution to T2368
15081 !! test
15082 T2648: Frameless image caption with a link
15083 !! wikitext
15084 [[File:Foobar.jpg|text with a [[link]] in it]]
15085 !! html/php
15086 <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>
15087 </p>
15088 !! html/parsoid
15089 <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>
15090 !! end
15091
15092 !! test
15093 T2648: Frameless image caption with a link (suffix)
15094 !! wikitext
15095 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15096 !! html/php
15097 <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>
15098 </p>
15099 !! html/parsoid
15100 <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>
15101 !! end
15102
15103 !! test
15104 T2648: Frameless image caption with an interwiki link
15105 !! wikitext
15106 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15107 !! html/php
15108 <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>
15109 </p>
15110 !! html/parsoid
15111 <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>
15112 !! end
15113
15114 !! test
15115 T2648: Frameless image caption with a piped interwiki link
15116 !! wikitext
15117 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
15118 !! html/php
15119 <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>
15120 </p>
15121 !! html/parsoid
15122 <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>
15123 !! end
15124
15125 !! test
15126 T107474: Frameless image caption with <nowiki>
15127 !! wikitext
15128 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
15129 !! html/parsoid
15130 <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>
15131 !! end
15132
15133 !! test
15134 Escape HTML special chars in image alt text
15135 !! wikitext
15136 [[File:Foobar.jpg|& < > "]]
15137 !! html/php
15138 <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>
15139 </p>
15140 !! html/parsoid
15141 <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>
15142 !! end
15143
15144 !! test
15145 Escape HTML special chars in image alt text with LanguageConverter
15146 !! options
15147 language=zh
15148 !! wikitext
15149 [[File:Foobar.jpg|& < > "]]
15150 !! html/php
15151 <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>
15152 </p>
15153 !! html/parsoid
15154 <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>
15155 !! end
15156
15157 !! test
15158 Entities in file name and attributes
15159 !! wikitext
15160 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
15161 !! html/php
15162 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
15163 </p>
15164 !! html/parsoid
15165 <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>
15166 !! end
15167
15168 !! test
15169 T2499: Alt text should have &#1234;, not &amp;1234;
15170 !! wikitext
15171 [[File:Foobar.jpg|&#9792;]]
15172 !! html/php
15173 <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>
15174 </p>
15175 !! html/parsoid
15176 <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>
15177 !! end
15178
15179 !! test
15180 Broken image caption with link
15181 !! options
15182 parsoid=wt2html,wt2wt,html2html
15183 !! wikitext
15184 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
15185 !! html/php
15186 <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.
15187 </p>
15188 !! html/parsoid
15189 <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>
15190 !! end
15191
15192 !! test
15193 Image caption containing another image
15194 !! wikitext
15195 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
15196 !! html/php
15197 <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>
15198
15199 !! html/parsoid
15200 <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>
15201 !! end
15202
15203 !! test
15204 Image: caption containing a newline
15205 !! wikitext
15206 [[File:Foobar.jpg|This
15207 *is some text]]
15208 !! html/php
15209 <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>
15210 </p>
15211 !! html/parsoid
15212 <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>
15213 !!end
15214
15215 !!test
15216 Image: caption containing leading space
15217 (The leading space should not trigger nowiki escaping in wt2wt mode)
15218 !! wikitext
15219 [[File:Foobar.jpg|thumb| bar]]
15220 !! html/php
15221 <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>
15222
15223 !! html/parsoid
15224 <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>
15225 !!end
15226
15227 # html/php output not have newlines after table, td, th, etc. because
15228 # Linker::makeThumbLink2() replaces the newlines with spaces since
15229 # the table is inside a caption.
15230 # FIXME: Verify if that circa 2004 fix is still required.
15231 !! test
15232 Image: caption containing a table
15233 !! options
15234 parsoid=wt2html,wt2wt,html2html
15235 !! wikitext
15236 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
15237 {|
15238 !Foo!!Bar
15239 |-
15240 |Foo1||Bar1
15241 |}
15242 and some more text.]]
15243 !! html/php
15244 <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>
15245
15246 !! html/parsoid
15247 <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
15248 <table>
15249 <tbody>
15250 <tr><th>Foo</th><th>Bar</th></tr>
15251 <tr>
15252 <td>Foo1</td>
15253 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
15254 !! end
15255
15256 !! test
15257 T5090: External links other than http: in image captions
15258 !! wikitext
15259 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
15260 !! html/php
15261 <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>
15262
15263 !! html/parsoid
15264 <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>
15265 !! end
15266
15267 !! test
15268 Custom class
15269 !! options
15270 parsoid=wt2html,wt2wt,html2html
15271 !! wikitext
15272 [[Image:foobar.jpg|a|class=b]]
15273 !! html/php
15274 <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>
15275 </p>
15276 !! html/parsoid
15277 <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>
15278 !! end
15279
15280 !! test
15281 Localized image handling (1).
15282 !! options
15283 parsoid=wt2html,wt2wt,html2html
15284 language=es
15285 !! wikitext
15286 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
15287 !! html/php
15288 <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>
15289
15290 !! html/parsoid
15291 <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>
15292 !! end
15293
15294 !! test
15295 Localized image handling (2).
15296 !! options
15297 thumbsize=220
15298 parsoid=wt2html,wt2wt,html2html
15299 language=es
15300 !! wikitext
15301 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
15302 !! html/php
15303 <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>
15304
15305 !! html/parsoid
15306 <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>
15307 !! end
15308
15309 !! test
15310 Localized image handling (3).
15311 !! options
15312 language=fa
15313 parsoid=html2wt
15314 !! html/parsoid
15315 <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>
15316 !! wikitext
15317 [[File:Foobar.jpg|بندانگشتی]]
15318 !! end
15319
15320 !! test
15321 "border", "frameless" and "class" attributes on an image.
15322 !! options
15323 thumbsize=220
15324 parsoid=wt2html,wt2wt,html2html
15325 !! wikitext
15326 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
15327 !! html/php
15328 <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>
15329 </p>
15330 !! html/parsoid
15331 <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>
15332 !! end
15333
15334 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
15335 !! test
15336 Invalid image attributes (T64500)
15337 !! options
15338 thumbsize=220
15339 parsoid=wt2html,wt2wt,html2html
15340 !! wikitext
15341 [[File:Foobar.jpg|thumb|float|left|caption]]
15342
15343 [[File:Foobar.jpg|thumb|righ|caption]]
15344
15345 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
15346 !! html/php
15347 <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>
15348 <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>
15349 <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>
15350
15351 !! html/parsoid
15352 <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>
15353 <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>
15354 <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>
15355 !! end
15356
15357 !! article
15358 File:Barfoo.jpg
15359 !! text
15360 #REDIRECT [[File:Barfoo.jpg]]
15361 !! endarticle
15362
15363 # FIXME: Parsoid should run this test -- but we'd need to teach the
15364 # mockAPI about the redirected Barfoo.jpg image.
15365 !! test
15366 Redirected image
15367 !! wikitext
15368 [[Image:Barfoo.jpg]]
15369 !! html/php
15370 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
15371 </p>
15372 !! end
15373
15374 !! test
15375 Missing image with uploads disabled
15376 !! options
15377 wgEnableUploads=0
15378 !! wikitext
15379 [[File:Foobaz.jpg]]
15380 !! html/php
15381 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
15382 </p>
15383 !! html/parsoid
15384 <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>
15385 !! end
15386
15387 # Parsoid-specific testing for images
15388 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
15389 # Currently imperfect due to a flaw in the Parsoid testrunner
15390 # Work in progress
15391 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
15392 # image tests.
15393
15394 !! test
15395 Parsoid-specific image handling - simple image with size and middle alignment
15396 !! wikitext
15397 [[File:Foobar.jpg|middle|50px]]
15398 !! html/parsoid
15399 <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>
15400 !! end
15401
15402 !! test
15403 Parsoid-specific image handling - simple image with size, middle alignment,
15404 non-standard namespace alias
15405 !! options
15406 parsoid=wt2wt,wt2html,html2html
15407 !! wikitext
15408 [[Image:Foobar.jpg|middle|50px]]
15409 !! html/parsoid
15410 <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>
15411 !! end
15412
15413 !! test
15414 Parsoid-specific image handling - simple image with size and middle alignment
15415 (existing content)
15416 !! wikitext
15417 [[File:Foobar.jpg|50px|middle]]
15418 !! html/parsoid
15419 <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>
15420 !! end
15421
15422 !! test
15423 Parsoid-specific image handling - simple image with size and middle alignment
15424 and non-standard namespace name
15425 !! options
15426 parsoid=wt2html,wt2wt,html2html
15427 !! wikitext
15428 [[Image:Foobar.jpg|50px|middle]]
15429 !! html/parsoid
15430 <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>
15431 !! end
15432
15433 !! test
15434 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
15435 !! wikitext
15436 [[File:Foobar.jpg|500x10px|baseline|caption]]
15437 !! html/parsoid
15438 <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>
15439 !! end
15440
15441 !! test
15442 Parsoid-specific image handling - simple image with border and size spec
15443 !! wikitext
15444 [[File:Foobar.jpg|50px|border|caption]]
15445 !! html/parsoid
15446 <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>
15447 !! end
15448
15449 !! test
15450 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15451 !! wikitext
15452 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
15453 !! html/parsoid
15454 <figure class="mw-default-size mw-halign-left mw-valign-baseline" 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>
15455 !! end
15456
15457 !! test
15458 Parsoid-specific image handling - thumbnail with halign, valign, and caption
15459 (existing content)
15460 !! wikitext
15461 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
15462 !! html/parsoid
15463 <figure class="mw-default-size mw-halign-left mw-valign-baseline" 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>
15464 !! end
15465
15466 !! test
15467 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
15468 !! wikitext
15469 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
15470 !! html/parsoid
15471 <figure class="mw-halign-right mw-valign-middle" 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>
15472 !! end
15473
15474 !! test
15475 Parsoid-specific image handling - thumbnail with specific size, halign,
15476 valign, and caption (existing content)
15477 !! wikitext
15478 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
15479 !! html/parsoid
15480 <figure class="mw-halign-right mw-valign-middle" 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>
15481 !! end
15482
15483 !! test
15484 Parsoid-specific image handling - framed image with specific size and caption
15485 (size is ignored)
15486 !! options
15487 parsoid=wt2html,wt2wt,html2html
15488 !! wikitext
15489 [[File:Foobar.jpg|frame|500x50px|caption]]
15490 !! html/parsoid
15491 <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>
15492 !! end
15493
15494 !! test
15495 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
15496 (size is ignored)
15497 !! options
15498 parsoid=wt2html,wt2wt,html2html
15499 !! wikitext
15500 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
15501 !! html/parsoid
15502 <figure class="mw-halign-left mw-valign-baseline" 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>
15503 !! end
15504
15505 !! test
15506 Parsoid-specific image handling - frameless image with specific size, border, and caption
15507 !! wikitext
15508 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
15509 !! html/parsoid
15510 <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>
15511 !! end
15512
15513 !! test
15514 Parsoid-specific image handling - simple image with a formatted caption
15515 !! wikitext
15516 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
15517 !! html/parsoid
15518 <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>
15519 !! end
15520
15521 !! test
15522 Parsoid-specific image handling - caption with a template in it
15523 !! wikitext
15524 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
15525 !! html/parsoid
15526 <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>
15527 !! end
15528
15529 !! test
15530 Parsoid-specific image handling - caption with unbalanced tags in it
15531 !! options
15532 parsoid=wt2html,wt2wt,html2html
15533 !! wikitext
15534 foo
15535 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
15536 bar
15537 !! html/parsoid
15538 <p>foo</p>
15539 <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>
15540 <p>bar</p>
15541 !! end
15542
15543 !! test
15544 Parsoid-specific image handling - empty caption (1)
15545 !! options
15546 parsoid=wt2html,wt2wt
15547 !! wikitext
15548 [[File:Foobar.jpg|thumb|]]
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></figcaption></figure>
15551 !! end
15552
15553 # empty captions don't get serialized unless we're in the "round trip" case
15554 !! test
15555 Parsoid-specific image handling - empty caption (2)
15556 !! options
15557 parsoid=html2wt
15558 !! html/parsoid
15559 <figure class="mw-default-size" typeof="mw:Image/Thumb">
15560 <a href="./File:Foobar.jpg">
15561 <img resource="./File:Foobar.jpg"
15562 src="//example.com/images/3/3a/Foobar.jpg"
15563 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
15564 height="25" width="220"/>
15565 </a>
15566 <figcaption></figcaption>
15567 </figure>
15568 !! wikitext
15569 [[File:Foobar.jpg|thumb]]
15570 !! end
15571
15572 !! test
15573 Parsoid-specific image handling - whitespace caption
15574 !! wikitext
15575 [[File:Foobar.jpg|thumb| ]]
15576 !! html/parsoid
15577 <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>
15578 !! end
15579
15580 !! test
15581 Parsoid-specific image handling - lang option
15582 !! wikitext
15583 foo
15584 [[File:Foobar.svg|lang=de|caption]]
15585 bar
15586 !! html/parsoid
15587 <p>foo
15588 <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>
15589 bar</p>
15590 !! end
15591
15592 ## Edge case bugs in Parsoid from T93580
15593 !! test
15594 T93580: 1. Templated <ref> inside block images
15595 !! wikitext
15596 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
15597
15598 <references />
15599 !! html/parsoid
15600 <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>
15601
15602 <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>
15603 !! end
15604
15605 !! test
15606 T93580: 2. <ref> inside inline images
15607 !! wikitext
15608 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
15609
15610 <references />
15611 !! html/parsoid
15612 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15613
15614 <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>
15615 !! end
15616
15617 !! test
15618 T93580: 3. Templated <ref> inside inline images
15619 !! wikitext
15620 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
15621
15622 <references />
15623 !! html/parsoid
15624 <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>
15625
15626 <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>
15627 !! end
15628
15629 ###
15630 ### Subpages
15631 ###
15632 !! article
15633 Subpage test/subpage
15634 !! text
15635 foo
15636 !! endarticle
15637
15638 !! test
15639 Subpage link
15640 !! options
15641 subpage title=[[Subpage test]]
15642 !! wikitext
15643 [[/subpage]]
15644 !! html
15645 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
15646 </p>
15647 !! end
15648
15649 !! test
15650 Subpage noslash link
15651 !! options
15652 subpage title=[[Subpage test]]
15653 !! wikitext
15654 [[/subpage/]]
15655 !! html
15656 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
15657 </p>
15658 !! end
15659
15660 !! article
15661 Subpage test/1/2/subpage
15662 !! text
15663 blah
15664 !! endarticle
15665
15666 !! test
15667 Relative subpage noslash link
15668 !! options
15669 parsoid=wt2wt,wt2html,html2html
15670 subpage title=[[Subpage test/1/2/3/4]]
15671 !! wikitext
15672 [[../../subpage/]]
15673
15674 [[../../subpage]]
15675 !! html/php
15676 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
15677 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
15678 </p>
15679 !! html/parsoid
15680 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
15681 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
15682 !! end
15683
15684 !! test
15685 Parsoid: dot-slash prefixed wikilinks
15686 !! wikitext
15687 [[./foo]]
15688
15689 [[././bar]]
15690
15691 [[././baz/]]
15692 !! html/php
15693 <p>[[./foo]]
15694 </p><p>[[././bar]]
15695 </p><p>[[././baz/]]
15696 </p>
15697 !! html/parsoid
15698 <p>[[./foo]]
15699 </p><p>[[././bar]]
15700 </p><p>[[././baz/]]
15701 </p>
15702 !! end
15703
15704 !! test
15705 Render invalid page names as plain text (T53090)
15706 !! wikitext
15707 [[./../foo|bar]]
15708 [[foo�|bar]]
15709 [[foo/.|bar]]
15710 [[foo/..|bar]]
15711 [[foo~~~bar]]
15712 [[foo>bar]]
15713 [[foo[bar]]
15714 [[.]]
15715 [[..]]
15716 [[foo././bar]]
15717 [[foo[http://example.com]xyz]]
15718
15719 [[{{echo|./../foo}}|bar]]
15720 [[{{echo|foo/.}}|bar]]
15721 [[{{echo|foo/..}}|bar]]
15722 [[{{echo|foo~~~~bar}}]]
15723 [[{{echo|foo>bar}}]]
15724 [[{{echo|foo././bar}}]]
15725 [[{{echo|foo{bar}}]]
15726 [[{{echo|foo}bar}}]]
15727 [[{{echo|foo[bar}}]]
15728 [[{{echo|foo]bar}}]]
15729 [[{{echo|foo<bar}}]]
15730 !!html/php
15731 <p>[[./../foo|bar]]
15732 [[foo�|bar]]
15733 [[foo/.|bar]]
15734 [[foo/..|bar]]
15735 [[foo~~~bar]]
15736 [[foo&gt;bar]]
15737 [[foo[bar]]
15738 [[.]]
15739 [[..]]
15740 [[foo././bar]]
15741 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
15742 </p><p>[[./../foo|bar]]
15743 [[foo/.|bar]]
15744 [[foo/..|bar]]
15745 [[foo~~~~bar]]
15746 [[foo&gt;bar]]
15747 [[foo././bar]]
15748 [[foo{bar]]
15749 [[foo}bar]]
15750 [[foo[bar]]
15751 [[foo]bar]]
15752 [[foo&lt;bar]]
15753 </p>
15754 !!html/parsoid
15755 <p>[[./../foo|bar]]
15756 [[foo�|bar]]
15757 [[foo/.|bar]]
15758 [[foo/..|bar]]
15759 [[foo~~~bar]]
15760 [[foo>bar]]
15761 [[foo[bar]]
15762 [[.]]
15763 [[..]]
15764 [[foo././bar]]
15765 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
15766
15767 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
15768 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
15769 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
15770 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
15771 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
15772 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
15773 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
15774 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
15775 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
15776 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
15777 [[<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>
15778 !!end
15779
15780 !! test
15781 Disabled subpages
15782 !! wikitext
15783 [[/subpage]]
15784 !! html
15785 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
15786 </p>
15787 !! end
15788
15789 !! test
15790 T2561: {{/Subpage}}
15791 !! options
15792 subpage title=[[Page]]
15793 !! wikitext
15794 {{/Subpage}}
15795 !! html
15796 <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>
15797 </p>
15798 !! end
15799
15800 ###
15801 ### Categories
15802 ###
15803 !! article
15804 Category:MediaWiki User's Guide
15805 !! text
15806 blah
15807 !! endarticle
15808
15809 !! test
15810 Link to category
15811 !! wikitext
15812 [[:Category:MediaWiki User's Guide]]
15813 !! html
15814 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
15815 </p>
15816 !! end
15817
15818 !! test
15819 Simple category
15820 !! options
15821 cat
15822 !! wikitext
15823 [[Category:MediaWiki User's Guide]]
15824 !! html/php
15825 cat=MediaWiki_User's_Guide sort=
15826 !! html/parsoid
15827 <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"}}'/>
15828 !! end
15829
15830 !! test
15831 PAGESINCATEGORY invalid title fatal (r33546 fix)
15832 !! wikitext
15833 {{PAGESINCATEGORY:<bogus>}}
15834 !! html
15835 <p>0
15836 </p>
15837 !! end
15838
15839 !! test
15840 Category with different sort key
15841 !! options
15842 cat
15843 !! wikitext
15844 [[Category:MediaWiki User's Guide|Foo]]
15845 !! html/php
15846 cat=MediaWiki_User's_Guide sort=Foo
15847 !! html/parsoid
15848 <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"}}'/>
15849 !! end
15850
15851 !! test
15852 Category with identical sort key
15853 !! options
15854 cat
15855 !! wikitext
15856 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15857 !! html/php
15858 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
15859 !! html/parsoid
15860 <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"}}'/>
15861 !! end
15862
15863 !! test
15864 Category with empty sort key
15865 !! options
15866 cat
15867 pst
15868 !! wikitext
15869 [[Category:MediaWiki User's Guide|]]
15870 !! html/php
15871 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
15872 !! end
15873
15874 !! test
15875 Category with empty sort key and parentheses
15876 !! options
15877 cat
15878 pst
15879 !! wikitext
15880 [[Category:Foo (bar)|]]
15881 !! html/php
15882 [[Category:Foo (bar)|Foo]]
15883 !! end
15884
15885 !! test
15886 Category with link tail
15887 !! options
15888 cat
15889 pst
15890 !! wikitext
15891 123[[Category:Foo]]456
15892 !! html/php
15893 123[[Category:Foo]]456
15894 !! end
15895
15896 !! test
15897 Category with template
15898 !! options
15899 cat
15900 pst
15901 !! wikitext
15902 [[Category:{{echo|Foo}}]]
15903 !! html/php
15904 [[Category:{{echo|Foo}}]]
15905 !! end
15906
15907 !! test
15908 Category with template in sort key
15909 !! options
15910 cat
15911 pst
15912 !! wikitext
15913 [[Category:Foo|{{echo|Bar}}]]
15914 !! html/php
15915 [[Category:Foo|{{echo|Bar}}]]
15916 !! end
15917
15918 !! test
15919 Category with template in sort key and title
15920 !! options
15921 cat
15922 pst
15923 !! wikitext
15924 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15925 !! html/php
15926 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
15927 !! end
15928
15929 ## We used to, but no longer wt2wt this test since the default serializer
15930 ## will normalize all categories to serialize on their own line.
15931 ## This wikitext usage is going to be fairly uncommon in production and
15932 ## selser will take care of preserving formatting in those scenarios.
15933 !! test
15934 Category / paragraph interactions
15935 !! options
15936 parsoid=wt2html
15937 !! wikitext
15938 Foo [[Category:Baz]] Bar
15939
15940 Foo [[Category:Baz]]
15941 Bar
15942
15943 Foo
15944 [[Category:Baz]]
15945 Bar
15946
15947 Foo
15948 [[Category:Baz]] Bar
15949
15950 Foo
15951 [[Category:Baz]]
15952 [[Category:Baz]]
15953 [[Category:Baz]]
15954 Bar
15955
15956 [[Category:Baz]]
15957 [[Category:Baz]]
15958 [[Category:Baz]]
15959
15960 [[Category:Baz]]
15961 {{echo|[[Category:Baz]]}}
15962 [[Category:Baz]]
15963 !! html/php
15964 <p>Foo Bar
15965 </p><p>Foo
15966 Bar
15967 </p><p>Foo
15968 Bar
15969 </p><p>Foo Bar
15970 </p><p>Foo
15971 Bar
15972 </p>
15973 !! html/parsoid
15974 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15975 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15976 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15977 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
15978 <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>
15979 <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}}]}'/>
15980 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
15981 !! end
15982
15983 ## We used to, but no longer wt2wt this test since the default serializer
15984 ## will normalize all categories to serialize on their own line.
15985 ## This wikitext usage is going to be fairly uncommon in production and
15986 ## selser will take care of preserving formatting in those scenarios.
15987 ##
15988 ## The whitespace on the empty line is part of the test. Please do not delete
15989 !! test
15990 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
15991 !! options
15992 parsoid=wt2html
15993 !! wikitext
15994 This
15995
15996 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15997
15998 {{echo|[[Category:Foo]] and so should this!}}
15999 !! html/php
16000 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16001 </p>
16002 !! html/parsoid
16003 <p>This
16004
16005 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16006
16007 <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>
16008 !! end
16009
16010 ## Parsoid will not try to wt2wt this while preserving newlines because
16011 ## it suppresses excess newlines within list items -- and we don't want to
16012 ## introduce a special case just for categories, which is, in reality somewhat
16013 ## odd behavior -- categories are unlikely to be used in list items like this
16014 ## in top-level pages and are only likely to show up in template-generated
16015 ## list items where this RT-ing is a non-issue.
16016 ##
16017 ## The whitespace on the empty line is part of the test. Please do not delete
16018 !! test
16019 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16020 !! options
16021 parsoid=wt2html
16022 !! wikitext
16023 * This
16024
16025 [[Category:Foo]] and this should be part of the same list item
16026 * So should this
16027
16028 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16029 !! html
16030 <ul><li>This and this should be part of the same list item</li>
16031 <li>So should this and this should be part of the same list item</li></ul>
16032 !! html/parsoid
16033 <ul>
16034 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16035 <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>
16036 </ul>
16037 !! end
16038
16039 ## Newlines and categories that follow the last item of a list
16040 ## are treated differently because this (list followed by categories)
16041 ## is an extremely common pattern on wikis.
16042 !! test
16043 3. Categories and newlines: newline suppression for last list item should RT properly
16044 !! wikitext
16045 * a
16046 * b
16047
16048 [[Category:Foo]]
16049
16050 [[Category:Bar]]
16051 [[Category:Baz]]
16052 !! html/parsoid
16053 <ul><li> a</li>
16054 <li> b</li></ul>
16055
16056 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16057
16058 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16059 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16060 !! end
16061
16062 !! test
16063 4. Categories and newlines: newline suppression for last list item should RT properly
16064 !! wikitext
16065 * a
16066 **** b
16067
16068 [[Category:Foo]]
16069 !! html/parsoid
16070 <ul><li> a
16071 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
16072
16073 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16074 !! end
16075
16076 ## only wt2html for this to make sure the algo only applies to the rightmost path
16077 !! test
16078 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16079 !! options
16080 parsoid=wt2html
16081 !! wikitext
16082 * a
16083 ** b
16084 [[Category:Foo]]
16085 * c
16086 ** d
16087 [[Category:Foo]]
16088 !! html/parsoid
16089 <ul><li> a
16090 <ul><li> b
16091 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16092 <li> c
16093 <ul><li> d</li></ul></li></ul>
16094 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16095 !! end
16096
16097 ## We used to, but no longer wt2wt this test since the default serializer
16098 ## will normalize all categories to serialize on their own line.
16099 ## This wikitext usage is going to be fairly uncommon in production and
16100 ## selser will take care of preserving formatting in those scenarios.
16101 !! test
16102 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16103 !! options
16104 parsoid=wt2html
16105 !! wikitext
16106 * a [[Category:Foo]]
16107 !! html/parsoid
16108 <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>
16109 !! end
16110
16111 # This test also demonstrates because of newline+category tunneling
16112 # through the list hander, template wrapping doesn't expand to the
16113 # containing list when the list item swallows the category.
16114 !! test
16115 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
16116 !! wikitext
16117 * {{echo|a
16118 [[Category:Foo]]}}
16119 !! html/parsoid
16120 <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
16121 </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>
16122 !! end
16123
16124 !! test
16125 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
16126 !! wikitext
16127 * a
16128
16129 {{echo|[[Category:Foo]]
16130 [[Category:Bar]]}}
16131 [[Category:Baz]]
16132 !! html/parsoid
16133 <ul><li> a</li></ul>
16134
16135 <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">
16136 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
16137 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
16138 !! end
16139
16140 !! test
16141 9. Categories and newlines: should behave properly with linkprefix (T87753)
16142 !! options
16143 language=ar
16144 !! wikitext
16145 foo bar
16146 foo bar
16147 [[تصنيف:Foo]]
16148 [[تصنيف:Bar]]
16149 !! html/php
16150 <p>foo bar
16151 foo bar
16152 </p>
16153 !! html/parsoid
16154 <p>foo bar
16155 foo bar</p>
16156 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
16157 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
16158 !! end
16159
16160 !! test
16161 10. No regressions on internal links following category (T174639)
16162 !! options
16163 parsoid=wt2html,html2html
16164 !! wikitext
16165 [[Category:Foo]]<div>a
16166
16167 [[Foo]]</div>
16168 !! html/php
16169 <div>a
16170 <a href="/wiki/Foo" title="Foo">Foo</a></div>
16171
16172 !! html/parsoid
16173 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
16174
16175 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
16176 !! end
16177
16178 # Note that Parsoid differs slightly from PHP due to T175421
16179 !! test
16180 11. Special case where only newlines separate links (T175416)
16181 !! options
16182 parsoid=wt2html,html2html
16183 !! wikitext
16184 [[Category:Foo]]
16185
16186 [[Foo]][[es:Alimento]]
16187
16188 [[Foo]]
16189 !! html/php
16190 <p><br />
16191 <a href="/wiki/Foo" title="Foo">Foo</a>
16192 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
16193 </p>
16194 !! html/parsoid
16195 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16196
16197 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16198
16199 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
16200 !! end
16201
16202 !! test
16203 Category links with multiple namespaces
16204 !! wikitext
16205 [[Category:Project:Foo]]
16206 !! html/parsoid
16207 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
16208 !! end
16209
16210 !! test
16211 Parsoid: Serialize link to category page with colon escape
16212 !! options
16213 parsoid
16214 !! wikitext
16215
16216 [[:Category:Foo]]
16217 [[:Category:Foo|Bar]]
16218 !! html
16219 <p>
16220 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
16221 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
16222 </p>
16223 !! end
16224
16225 # We used to, but no longer wt2wt this test since the default serializer
16226 # will normalize all categories to serialize on their own line.
16227 # This wikitext usage is going to be fairly uncommon in production and
16228 # selser will take care of preventing whitespace insertion if this
16229 # occurs in an article.
16230 #
16231 # html2html disabled for the same reason (whitespace insertion between
16232 # x and y).
16233 #
16234 # html2wt disabled because it localizes the "Category" namespace.
16235 !! test
16236 Link prefix/suffixes aren't applied to category links
16237 !! options
16238 parsoid=wt2html
16239 language=is
16240 !! wikitext
16241 x[[Category:Foo]]y
16242 !! html/php
16243 <p>xy
16244 </p>
16245 !! html/parsoid
16246 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
16247 !! end
16248
16249 !! test
16250 Link prefix/suffixes aren't applied to language links
16251 !! options
16252 parsoid=wt2html
16253 language=is
16254 !! wikitext
16255 x[[es:Foo]]y
16256 !! html/php
16257 <p>xy
16258 </p>
16259 !! html/parsoid
16260 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
16261 !! end
16262
16263 !! test
16264 Parsoid: Serialize link to file page with colon escape
16265 !! options
16266 parsoid
16267 !! wikitext
16268
16269 [[:File:Foo.png]]
16270 [[:File:Foo.png|Bar]]
16271 !! html
16272 <p>
16273 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
16274 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
16275 </p>
16276 !! end
16277
16278 !! test
16279 Parsoid: Serialize a genuine category link without colon escape
16280 !! options
16281 parsoid
16282 !! wikitext
16283 [[Category:Foo]]
16284 [[Category:Foo|Bar]]
16285 !! html
16286 <link rel="mw:PageProp/Category" href="./Category:Foo">
16287 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
16288 !! end
16289
16290 !! test
16291 Normalize hrefs properly before testing for invalid link targets (T72894)
16292 !! options
16293 parsoid=html2wt
16294 !! html/parsoid
16295 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
16296 !! wikitext
16297 [[Category:Toxine bactérienne]]
16298 !! end
16299
16300 !! test
16301 Parsoid: Defaultsort
16302 !! wikitext
16303 {{DEFAULTSORT:Foo}}
16304 !! html/parsoid
16305 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
16306 !! end
16307
16308 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
16309 # But, this is a limitation of our representation and is documented in
16310 # TemplateHandler.js in processSpecialMagicWord
16311 !! test
16312 Parsoid: Defaultsort (template-generated)
16313 !! wikitext
16314 {{{{echo|DEFAULTSORT}}:Foo}}
16315 !! html/parsoid
16316 <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"}]]}'/>
16317 !! end
16318
16319 ###
16320 ### Inter-language links
16321 ###
16322 !! test
16323 Interlanguage links
16324 !! options
16325 ill
16326 !! wikitext
16327 [[es:Alimento]]
16328 [[fr:Nourriture]]
16329 [[zh:食品]]
16330 !! html/php
16331 es:Alimento fr:Nourriture zh:食品
16332 !! html/parsoid
16333 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
16334 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
16335 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
16336 !! end
16337
16338 !! test
16339 Duplicate interlanguage links (T26502)
16340 !! options
16341 ill
16342 !! wikitext
16343 [[es:1]]
16344 [[es:2]]
16345 [[fr:1]]
16346 [[fr:2]]
16347 !! html/php
16348 es:1 fr:1
16349 !! html/parsoid
16350 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
16351 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
16352 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
16353 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
16354 !! end
16355
16356 ###
16357 ### Sections
16358 ###
16359 !! test
16360 Basic section headings
16361 !! wikitext
16362 ==Headline 1==
16363 Some text
16364
16365 ==Headline 2==
16366 More
16367 ===Smaller headline===
16368 Blah blah
16369 !! html
16370 <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>
16371 <p>Some text
16372 </p>
16373 <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>
16374 <p>More
16375 </p>
16376 <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>
16377 <p>Blah blah
16378 </p>
16379 !! end
16380
16381 !! test
16382 Section headings with TOC
16383 !! wikitext
16384 ==Headline 1==
16385 ===Subheadline 1===
16386 =====Skipping a level=====
16387 ======Skipping a level======
16388
16389 ==Headline 2==
16390 Some text
16391 ===Another headline===
16392 !! html
16393 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16394 <ul>
16395 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
16396 <ul>
16397 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
16398 <ul>
16399 <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>
16400 <ul>
16401 <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>
16402 </ul>
16403 </li>
16404 </ul>
16405 </li>
16406 </ul>
16407 </li>
16408 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
16409 <ul>
16410 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
16411 </ul>
16412 </li>
16413 </ul>
16414 </div>
16415
16416 <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>
16417 <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>
16418 <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>
16419 <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>
16420 <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>
16421 <p>Some text
16422 </p>
16423 <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>
16424
16425 !! end
16426
16427 !! test
16428 TOC anchors don't collide
16429 !! wikitext
16430 __FORCETOC__
16431 ==Headline 2==
16432 ==Headline==
16433 ==Headline 2==
16434 ==Headline==
16435 !! html/php
16436 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16437 <ul>
16438 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
16439 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
16440 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
16441 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
16442 </ul>
16443 </div>
16444
16445 <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>
16446 <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>
16447 <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>
16448 <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>
16449
16450 !! end
16451
16452 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
16453 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
16454 !! test
16455 Handling of sections up to level 6 and beyond
16456 !! options
16457 parsoid=wt2html
16458 !! wikitext
16459 =Level 1 Heading=
16460 ==Level 2 Heading==
16461 ===Level 3 Heading===
16462 ====Level 4 Heading====
16463 =====Level 5 Heading=====
16464 ======Level 6 Heading======
16465 =======Level 7 Heading=======
16466 ========Level 8 Heading========
16467 =========Level 9 Heading=========
16468 ==========Level 10 Heading==========
16469 !! html/php
16470 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16471 <ul>
16472 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
16473 <ul>
16474 <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>
16475 <ul>
16476 <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>
16477 <ul>
16478 <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>
16479 <ul>
16480 <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>
16481 <ul>
16482 <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>
16483 <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>
16484 <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>
16485 <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>
16486 <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>
16487 </ul>
16488 </li>
16489 </ul>
16490 </li>
16491 </ul>
16492 </li>
16493 </ul>
16494 </li>
16495 </ul>
16496 </li>
16497 </ul>
16498 </div>
16499
16500 <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>
16501 <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>
16502 <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>
16503 <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>
16504 <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>
16505 <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>
16506 <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>
16507 <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>
16508 <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>
16509 <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>
16510
16511 !! html/parsoid
16512 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
16513 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
16514 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
16515 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
16516 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
16517 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
16518 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
16519 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
16520 <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>
16521 <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>
16522 !! end
16523
16524 !! test
16525 TOC regression (T11764)
16526 !! wikitext
16527 ==title 1==
16528 ===title 1.1===
16529 ====title 1.1.1====
16530 ===title 1.2===
16531 ==title 2==
16532 ===title 2.1===
16533 !! html
16534 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16535 <ul>
16536 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16537 <ul>
16538 <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>
16539 <ul>
16540 <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>
16541 </ul>
16542 </li>
16543 <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>
16544 </ul>
16545 </li>
16546 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16547 <ul>
16548 <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>
16549 </ul>
16550 </li>
16551 </ul>
16552 </div>
16553
16554 <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>
16555 <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>
16556 <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>
16557 <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>
16558 <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>
16559 <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>
16560
16561 !! end
16562
16563 !! test
16564 TOC for heading containing <span id="..."></span> (T96153)
16565 !! wikitext
16566 __FORCETOC__
16567 ==<span id="old-anchor"></span>New title==
16568 !! html/php
16569 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16570 <ul>
16571 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
16572 </ul>
16573 </div>
16574
16575 <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>
16576
16577 !! end
16578
16579 !! test
16580 TOC with wgMaxTocLevel=3 (T8204)
16581 !! options
16582 wgMaxTocLevel=3
16583 !! wikitext
16584 ==title 1==
16585 ===title 1.1===
16586 ====title 1.1.1====
16587 ===title 1.2===
16588 ==title 2==
16589 ===title 2.1===
16590 !! html
16591 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16592 <ul>
16593 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16594 <ul>
16595 <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>
16596 <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>
16597 </ul>
16598 </li>
16599 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
16600 <ul>
16601 <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>
16602 </ul>
16603 </li>
16604 </ul>
16605 </div>
16606
16607 <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>
16608 <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>
16609 <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>
16610 <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>
16611 <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>
16612 <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>
16613
16614 !! end
16615
16616 !! test
16617 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
16618 !! options
16619 wgMaxTocLevel=3
16620 !! wikitext
16621 ==Section 1==
16622 ===Section 1.1===
16623 ====Section 1.1.1====
16624 ====Section 1.1.1.1====
16625 ==Section 2==
16626 !! html
16627 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16628 <ul>
16629 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
16630 <ul>
16631 <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>
16632 </ul>
16633 </li>
16634 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
16635 </ul>
16636 </div>
16637
16638 <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>
16639 <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>
16640 <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>
16641 <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>
16642 <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>
16643
16644 !! end
16645
16646
16647 !! test
16648 Resolving duplicate section names
16649 !! wikitext
16650 ==Foo bar==
16651 ==Foo bar==
16652 !! html
16653 <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>
16654 <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>
16655
16656 !! end
16657
16658 !! test
16659 Resolving duplicate section names with differing case (T12721)
16660 !! wikitext
16661 ==Foo bar==
16662 ==Foo Bar==
16663 !! html
16664 <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>
16665 <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>
16666
16667 !! end
16668
16669 !! article
16670 Template:sections
16671 !! text
16672 ===Section 1===
16673 ==Section 2==
16674 !! endarticle
16675
16676 !! test
16677 Template with sections, __NOTOC__
16678 !! wikitext
16679 __NOTOC__
16680 ==Section 0==
16681 {{sections}}
16682 ==Section 4==
16683 !! html
16684 <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>
16685 <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>
16686 <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>
16687 <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>
16688
16689 !! end
16690
16691 !! test
16692 __NOEDITSECTION__ keyword
16693 !! wikitext
16694 __NOEDITSECTION__
16695 ==Section 1==
16696 ==Section 2==
16697 !! html
16698 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
16699 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
16700
16701 !! end
16702
16703 !! test
16704 Link inside a section heading
16705 !! wikitext
16706 ==Section with a [[Main Page|link]] in it==
16707 !! html
16708 <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>
16709
16710 !! end
16711
16712 !! test
16713 TOC regression (T14077)
16714 !! wikitext
16715 __TOC__
16716 ==title 1==
16717 ===title 1.1===
16718 ==title 2==
16719 !! html
16720 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16721 <ul>
16722 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
16723 <ul>
16724 <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>
16725 </ul>
16726 </li>
16727 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
16728 </ul>
16729 </div>
16730
16731 <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>
16732 <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>
16733 <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>
16734
16735 !! end
16736
16737 !! test
16738 T3219 URL next to image (good)
16739 !! wikitext
16740 http://example.com [[File:Foobar.jpg]]
16741 !! html/php
16742 <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>
16743 </p>
16744 !! html/parsoid
16745 <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>
16746 !!end
16747
16748 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
16749 !! test
16750 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
16751 !! options
16752 parsoid=wt2html,html2html
16753 !! wikitext
16754 ===
16755 The line above must have a trailing space!
16756 === <!--
16757 --> <!-- -->
16758 But just in case it doesn't...
16759 !! html/php
16760 <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>
16761 <p>The line above must have a trailing space!
16762 </p>
16763 <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>
16764 <p>But just in case it doesn't...
16765 </p>
16766 !! html/parsoid
16767 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
16768 <p>The line above must have a trailing space!</p>
16769 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
16770 --> <!-- -->
16771 <p>But just in case it doesn't...</p>
16772 !! end
16773
16774 !! test
16775 Header with special characters (T27462)
16776 !! wikitext
16777 The tooltips shall not show entities to the user (ie. be double escaped)
16778
16779 ==text > text==
16780 section 1
16781
16782 ==text < text==
16783 section 2
16784
16785 ==text & text==
16786 section 3
16787
16788 ==text ' text==
16789 section 4
16790
16791 ==text " text==
16792 section 5
16793 !! html/php
16794 <p>The tooltips shall not show entities to the user (ie. be double escaped)
16795 </p>
16796 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16797 <ul>
16798 <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>
16799 <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>
16800 <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>
16801 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
16802 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
16803 </ul>
16804 </div>
16805
16806 <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>
16807 <p>section 1
16808 </p>
16809 <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>
16810 <p>section 2
16811 </p>
16812 <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>
16813 <p>section 3
16814 </p>
16815 <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>
16816 <p>section 4
16817 </p>
16818 <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>
16819 <p>section 5
16820 </p>
16821 !! html/parsoid
16822 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
16823
16824 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
16825 <p>section 1</p>
16826
16827 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
16828 <p>section 2</p>
16829
16830 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
16831 <p>section 3</p>
16832
16833 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
16834 <p>section 4</p>
16835
16836 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
16837 <p>section 5</p>
16838 !! end
16839
16840 !! test
16841 Header with space, plus and underscore as entity
16842 !! wikitext
16843 Id should not contain + for spaces
16844
16845 ==Space between Text==
16846 section 1
16847
16848 ==Space-Entity&#32;between&#32;Text==
16849 section 2
16850
16851 ==Plus+between+Text==
16852 section 3
16853
16854 ==Plus-Entity&#43;between&#43;Text==
16855 section 4
16856
16857 ==Underscore_between_Text==
16858 section 5
16859
16860 ==Underscore-Entity&#95;between&#95;Text==
16861 section 6
16862
16863 [[#Space between Text]]
16864 [[#Space-Entity&#32;between&#32;Text]]
16865 [[#Plus+between+Text]]
16866 [[#Plus-Entity&#43;between&#43;Text]]
16867 [[#Underscore_between_Text]]
16868 [[#Underscore-Entity&#95;between&#95;Text]]
16869 !! html/php
16870 <p>Id should not contain + for spaces
16871 </p>
16872 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16873 <ul>
16874 <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>
16875 <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>
16876 <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>
16877 <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>
16878 <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>
16879 <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>
16880 </ul>
16881 </div>
16882
16883 <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>
16884 <p>section 1
16885 </p>
16886 <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>
16887 <p>section 2
16888 </p>
16889 <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>
16890 <p>section 3
16891 </p>
16892 <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>
16893 <p>section 4
16894 </p>
16895 <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>
16896 <p>section 5
16897 </p>
16898 <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>
16899 <p>section 6
16900 </p><p><a href="#Space_between_Text">#Space between Text</a>
16901 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
16902 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
16903 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
16904 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
16905 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
16906 </p>
16907 !! html/parsoid
16908 <p>Id should not contain + for spaces</p>
16909
16910 <h2 id="Space_between_Text">Space between Text</h2>
16911 <p>section 1</p>
16912
16913 <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>
16914 <p>section 2</p>
16915
16916 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
16917 <p>section 3</p>
16918
16919 <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>
16920 <p>section 4</p>
16921
16922 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
16923 <p>section 5</p>
16924
16925 <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>
16926 <p>section 6</p>
16927
16928 <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>
16929 <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>
16930 <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>
16931 <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>
16932 <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>
16933 <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>
16934 !! end
16935
16936 # Parsoid html2wt disabled because it adds padding spaces around =
16937 !! test
16938 Headers with excess '=' characters
16939 (Are similar tests necessary beyond the 1st level?)
16940 !! options
16941 parsoid=wt2html,wt2wt,html2html
16942 !! wikitext
16943 =foo==
16944 ==foo=
16945 =''italic'' heading==
16946 ==''italic'' heading=
16947 !! html/php
16948 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16949 <ul>
16950 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
16951 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
16952 <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>
16953 <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>
16954 </ul>
16955 </div>
16956
16957 <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>
16958 <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>
16959 <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>
16960 <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>
16961
16962 !! html/parsoid
16963 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
16964 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
16965 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
16966 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
16967 !! end
16968
16969 !! test
16970 HTML headers vs TOC (T25393)
16971 (__NOEDITSECTION__ for clearer output, doesn't matter here)
16972 !! wikitext
16973 <h1>Header 1</h1>
16974 ==Header 1.1==
16975 ==Header 1.2==
16976
16977 <h1>Header 2
16978 </h1>
16979 ==Header 2.1==
16980 ==Header 2.2==
16981 __NOEDITSECTION__
16982 !! html/php
16983 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
16984 <ul>
16985 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
16986 <ul>
16987 <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>
16988 <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>
16989 </ul>
16990 </li>
16991 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
16992 <ul>
16993 <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>
16994 <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>
16995 </ul>
16996 </li>
16997 </ul>
16998 </div>
16999
17000 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17001 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17002 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17003 <h1><span class="mw-headline" id="Header_2">Header 2
17004 </span></h1>
17005 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17006 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17007
17008 !! html/parsoid
17009 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17010 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17011 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17012
17013 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17014 </h1>
17015 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17016 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17017 <meta property="mw:PageProp/noeditsection"/>
17018 !! end
17019
17020 !! test
17021 Single-line or multiline-comments can follow headings
17022 !! options
17023 parsoid=wt2html,wt2wt
17024 !! wikitext
17025 ==foo==<!---->
17026 ==bar==<!--c1-->
17027 ==baz==<!--
17028 c2
17029 c3-->
17030 !! html/php
17031 <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>
17032 <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>
17033 <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>
17034
17035 !! html/parsoid
17036 <h2 id="foo">foo</h2><!---->
17037 <h2 id="bar">bar</h2><!--c1-->
17038 <h2 id="baz">baz</h2><!--
17039 c2
17040 c3-->
17041 !! end
17042
17043 !! test
17044 T3219 URL next to image (broken)
17045 !! wikitext
17046 http://example.com[[File:Foobar.jpg]]
17047 !! html/php
17048 <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>
17049 </p>
17050 !! html/parsoid
17051 <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>
17052 !!end
17053
17054 !! test
17055 T3186 news: in the middle of text
17056 !! wikitext
17057 http://en.wikinews.org/wiki/Wikinews:Workplace
17058 !! html
17059 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17060 </p>
17061 !!end
17062
17063
17064 !! test
17065 Namespaced link must have a title
17066 !! wikitext
17067 [[Project:]]
17068 !! html
17069 <p>[[Project:]]
17070 </p>
17071 !!end
17072
17073 !! test
17074 Namespaced link must have a title (bad fragment version)
17075 !! wikitext
17076 [[Project:#fragment]]
17077 !! html
17078 <p>[[Project:#fragment]]
17079 </p>
17080 !!end
17081
17082
17083 ###
17084 ### HTML tags and HTML attributes
17085 ###
17086
17087 !! test
17088 div with no attributes
17089 !! wikitext
17090 <div>HTML rocks</div>
17091 !! html
17092 <div>HTML rocks</div>
17093
17094 !! end
17095
17096 !! test
17097 div with double-quoted attribute
17098 !! wikitext
17099 <div id="rock">HTML rocks</div>
17100 !! html
17101 <div id="rock">HTML rocks</div>
17102
17103 !! end
17104
17105 !! test
17106 div with single-quoted attribute
17107 !! wikitext
17108 <div id='rock'>HTML rocks</div>
17109 !! html
17110 <div id="rock">HTML rocks</div>
17111
17112 !! end
17113
17114 !! test
17115 div with unquoted attribute
17116 !! wikitext
17117 <div id=rock>HTML rocks</div>
17118 !! html
17119 <div id="rock">HTML rocks</div>
17120
17121 !! end
17122
17123 !! test
17124 div with illegal double attributes
17125 !! wikitext
17126 <div id="a" id="b">HTML rocks</div>
17127 !! html
17128 <div id="b">HTML rocks</div>
17129
17130 !!end
17131
17132 !! test
17133 div with empty attribute value, space before equals
17134 !! options
17135 parsoid=wt2html,html2html
17136 !! wikitext
17137 <div class =>HTML rocks</div>
17138 !! html/php
17139 <div class="">HTML rocks</div>
17140
17141 !! html/parsoid
17142 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17143 !! end
17144
17145 !! test
17146 div with multiple empty attribute values
17147 !! config
17148 wgFragmentMode=[ 'html5', 'legacy' ]
17149 !! options
17150 parsoid=wt2html,html2html
17151 !! wikitext
17152 <div id= title=>HTML rocks</div>
17153 !! html/php
17154 <div id="title=">HTML rocks</div>
17155
17156 !! html/parsoid
17157 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
17158 !! end
17159
17160 # FIXME Parsoid doesn't actually match PHP here.
17161 # Probably we should use the synthetic <foo /> or <indicator>
17162 # extensions for this test, which are enabled when running parser tests.
17163 !! test
17164 Extension tag in attribute value
17165 !! wikitext
17166 <span title="<translate>123</translate>">ok</span>
17167 !! html/php+disabled
17168 <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
17169 </p>
17170 !! html/parsoid
17171 <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>
17172 !! end
17173
17174 !! test
17175 table with multiple empty attribute values
17176 !! options
17177 parsoid=wt2html,html2html
17178 !! wikitext
17179 {| title= id=
17180 |hi
17181 |}
17182 !! html/php
17183 <table title="id=">
17184 <tr>
17185 <td>hi
17186 </td></tr></table>
17187
17188 !! html/parsoid
17189 <table title="id=">
17190 <tbody><tr><td>hi</td></tr>
17191 </tbody></table>
17192 !! end
17193
17194 !! test
17195 div with braces in attribute value
17196 !! wikitext
17197 <div title="{}">Foo</div>
17198 !! html/php
17199 <div title="&#123;&#125;">Foo</div>
17200
17201 !! html/parsoid
17202 <div title="{}">Foo</div>
17203 !! end
17204
17205 !! test
17206 div with empty attribute value, no space before equals
17207 !! options
17208 parsoid=wt2html,html2html
17209 !! wikitext
17210 <div class=>HTML rocks</div>
17211 !! html/php
17212 <div class="">HTML rocks</div>
17213
17214 !! html/parsoid
17215 <div class="">HTML rocks</div>
17216 !! end
17217
17218 !! test
17219 HTML multiple attributes correction
17220 !! wikitext
17221 <p class="error" class="awesome">Awesome!</p>
17222 !! html
17223 <p class="awesome">Awesome!</p>
17224
17225 !!end
17226
17227 !! test
17228 Table multiple attributes correction
17229 !! wikitext
17230 {|
17231 !+ class="error" class="awesome"|status
17232 |}
17233 !! html
17234 <table>
17235 <tr>
17236 <th class="awesome">status
17237 </th></tr></table>
17238
17239 !!end
17240
17241 !! test
17242 DIV IN UPPERCASE
17243 !! wikitext
17244 <DIV ID="x">HTML ROCKS</DIV>
17245 !! html
17246 <div id="x">HTML ROCKS</div>
17247
17248 !!end
17249
17250 !! test
17251 Non-ASCII pseudo-tags are rendered as text
17252 !! wikitext
17253 <khyô>
17254 !! html
17255 <p>&lt;khyô&gt;
17256 </p>
17257 !! end
17258
17259 !! test
17260 Pseudo-tag with URL 'name' renders as url link
17261 !! wikitext
17262 <http://example.com/>
17263 !! html
17264 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
17265 </p>
17266 !! end
17267
17268 !! test
17269 text with amp in the middle of nowhere
17270 !! wikitext
17271 Remember AT&T?
17272 !! html
17273 <p>Remember AT&amp;T?
17274 </p>
17275 !! end
17276
17277 !! test
17278 text with character entity: eacute
17279 !! wikitext
17280 I always thought &eacute; was a cute letter.
17281 !! html+tidy
17282 <p>I always thought &#233; was a cute letter.
17283 </p>
17284 !! end
17285
17286 !! test
17287 text with entity-escaped character entity-like string: eacute
17288 !! wikitext
17289 I always thought &amp;eacute; was a cute letter.
17290 !! html
17291 <p>I always thought &amp;eacute; was a cute letter.
17292 </p>
17293 !! end
17294
17295 !! test
17296 text with undefined character entity: xacute
17297 !! wikitext
17298 I always thought &xacute; was a cute letter.
17299 !! html
17300 <p>I always thought &amp;xacute; was a cute letter.
17301 </p>
17302 !! end
17303
17304 !! test
17305 HTML5 tags
17306 !! wikitext
17307 <data value="5">five</data>
17308 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17309 <mark>This highlighted text</mark>
17310 !! html
17311 <p><data value="5">five</data>
17312 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
17313 <mark>This highlighted text</mark>
17314 </p>
17315 !! end
17316
17317 !! test
17318 HTML tag with leading space is parsed as text
17319 !! wikitext
17320 < div>foo< /div>
17321 !! html
17322 <p>&lt; div&gt;foo&lt; /div&gt;
17323 </p>
17324 !! end
17325
17326 ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
17327 ## the HTML5 parsing spec.
17328 !! test
17329 Element with broken attribute syntax
17330 !! options
17331 parsoid=wt2html
17332 !! wikitext
17333 <div style=" style="123">hi</div>
17334 <div =>ho</div>
17335 !! html/php
17336 <div style="123">hi</div>
17337 <div>ho</div>
17338
17339 !! html/parsoid
17340 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
17341 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
17342 !! end
17343
17344 ###
17345 ### Nesting tests (see T43545, T52604, T53081)
17346 ###
17347
17348 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
17349 # Note that html2wt is considerably more difficult if we use <b> in
17350 # the test case, instead of <small>
17351 !! test
17352 Ensure that HTML adoption agency algorithm is properly implemented.
17353 !! wikitext
17354 <small>X<small>Y</small>Z</small>
17355 !! html
17356 <p><small>X<small>Y</small>Z</small>
17357 </p>
17358 !! end
17359
17360 # This was T43545 in the PHP parser.
17361 !! test
17362 Nesting of <kbd>
17363 !! wikitext
17364 <kbd>X<kbd>Y</kbd>Z</kbd>
17365 !! html+tidy
17366 <p><kbd>X<kbd>Y</kbd>Z</kbd>
17367 </p>
17368 !! end
17369
17370 # The following cases were T53081 in the PHP parser.
17371 # Note that there are some other nestable tags (b, i, etc) which are
17372 # not covered; see T53081 for discussion.
17373
17374 !! test
17375 Nesting of <em>
17376 !! wikitext
17377 <em>X<em>Y</em>Z</em>
17378 !! html+tidy
17379 <p><em>X<em>Y</em>Z</em>
17380 </p>
17381 !! end
17382
17383 !! test
17384 Nesting of <strong>
17385 !! wikitext
17386 <strong>X<strong>Y</strong>Z</strong>
17387 !! html+tidy
17388 <p><strong>X<strong>Y</strong>Z</strong>
17389 </p>
17390 !! end
17391
17392 !! test
17393 Nesting of <q>
17394 !! wikitext
17395 <q>X<q>Y</q>Z</q>
17396 !! html+tidy
17397 <p><q>X<q>Y</q>Z</q>
17398 </p>
17399 !! end
17400
17401 !! test
17402 Nesting of <ruby>
17403 !! wikitext
17404 <ruby>X<ruby>Y</ruby>Z</ruby>
17405 !! html
17406 <p><ruby>X<ruby>Y</ruby>Z</ruby>
17407 </p>
17408 !! end
17409
17410 !! test
17411 Nesting of <bdo>
17412 !! wikitext
17413 <bdo>X<bdo>Y</bdo>Z</bdo>
17414 !! html
17415 <p><bdo>X<bdo>Y</bdo>Z</bdo>
17416 </p>
17417 !! end
17418
17419
17420 ###
17421 ### Media links
17422 ###
17423
17424 !! test
17425 Media link
17426 !! wikitext
17427 [[Media:Foobar.jpg]]
17428 [[Media:Video.ogv]]
17429 [[:Media:Video.ogv]]
17430 !! html/php
17431 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
17432 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17433 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
17434 </p>
17435 !! html/parsoid
17436 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
17437 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
17438 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv" data-parsoid='{"a":{"namespace":"Media"},"sa":{"namespace":":Media"}}'>Media:Video.ogv</a></p>
17439 !! end
17440
17441 !! test
17442 Media link with text
17443 !! wikitext
17444 [[Media:Foobar.jpg|A neat file to look at]]
17445 !! html/php
17446 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
17447 </p>
17448 !! html/parsoid
17449 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
17450 !! end
17451
17452 # FIXME: this is still bad HTML tag nesting
17453 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
17454 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
17455 !! test
17456 Media link with nasty text
17457 !! wikitext
17458 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
17459 !! html/php
17460 <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>
17461
17462 !! html/php+tidy
17463 <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>
17464 !! html/parsoid
17465 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true}'>Safe Link</a></p><div style="display:none" data-parsoid='{"stx":"html"}'><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'>" onmouseover="alert(document.cookie)" onfoo="</a></div>
17466
17467 !! end
17468
17469 !! test
17470 Media link to nonexistent file (T3702)
17471 !! wikitext
17472 [[Media:No such.jpg]]
17473 [[Media:No_such file.jpg]]
17474 !! html/php
17475 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
17476 <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>
17477 </p>
17478 !! html/parsoid
17479 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
17480 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
17481 !! end
17482
17483 !! test
17484 Image link to nonexistent file (T3850 - good)
17485 !! wikitext
17486 [[File:No_such.jpg]]
17487 !! html/php
17488 <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>
17489 </p>
17490 !! html/parsoid
17491 <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>
17492 !! end
17493
17494 !! test
17495 :Image link to nonexistent file (T3850 - bad)
17496 !! wikitext
17497 [[:Image:No such.jpg]]
17498 !! html/php
17499 <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>
17500 </p>
17501 !! html/parsoid
17502 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
17503 !! end
17504
17505 !! test
17506 Character reference normalization in link text (T3938)
17507 !! wikitext
17508 [[Main Page|this&that]]
17509 !! html
17510 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
17511 </p>
17512 !!end
17513
17514 !! article
17515 אַ
17516 !! text
17517 Test for unicode normalization
17518
17519 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
17520 !! endarticle
17521
17522 !! test
17523 (T21451) Links should refer to the normalized form.
17524 !! wikitext
17525 [[&#xFB2E;]]
17526 [[&#x5d0;&#x5b7;]]
17527 [[&#x5d0;ַ]]
17528 [[א&#x5b7;]]
17529 [[אַ]]
17530 !! html
17531 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
17532 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
17533 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
17534 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
17535 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
17536 </p>
17537 !! end
17538
17539 !! test
17540 Empty attribute crash test (T4067)
17541 !! wikitext
17542 <font color="">foo</font>
17543 !! html
17544 <p><font color="">foo</font>
17545 </p>
17546 !! end
17547
17548 !! test
17549 Empty attribute crash test single-quotes (T4067)
17550 !! wikitext
17551 <font color=''>foo</font>
17552 !! html
17553 <p><font color="">foo</font>
17554 </p>
17555 !! end
17556
17557 !! test
17558 Attribute test: equals, then nothing
17559 !! options
17560 parsoid=wt2html,html2html
17561 !! wikitext
17562 <font color=>foo</font>
17563 !! html/php
17564 <p><font color="">foo</font>
17565 </p>
17566 !! html/parsoid
17567 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
17568 !! end
17569
17570 !! test
17571 Attribute test: unquoted value
17572 !! options
17573 parsoid=wt2html,html2html
17574 !! wikitext
17575 <font color=x>foo</font>
17576 !! html/php
17577 <p><font color="x">foo</font>
17578 </p>
17579 !! html/parsoid
17580 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
17581 !! end
17582
17583 !! test
17584 Attribute test: unquoted but illegal value (hash)
17585 !! wikitext
17586 <font color=#x>foo</font>
17587 !! html
17588 <p><font color="#x">foo</font>
17589 </p>
17590 !! end
17591
17592 # Parsoid does not serialize to empty attribute syntax,
17593 # so wt2wt and html2wt cases are skipped
17594 !! test
17595 Attribute test: no value (T54330)
17596 !! options
17597 parsoid=wt2html,html2html
17598 !! wikitext
17599 <font color>foo</font>
17600 !! html/php
17601 <p><font color="">foo</font>
17602 </p>
17603 !! html/parsoid
17604 <p><font color="">foo</font></p>
17605 !! end
17606
17607 !! test
17608 T4095: link with three closing brackets
17609 !! wikitext
17610 [[Main Page]]]
17611 !! html/php
17612 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
17613 </p>
17614 !! html/parsoid
17615 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
17616 !! end
17617
17618 !! test
17619 T4095: link with pipe and three closing brackets
17620 !! wikitext
17621 [[Main Page|link]]]
17622 !! html/php
17623 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
17624 </p>
17625 !! html/parsoid
17626 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
17627 !! end
17628
17629 !! test
17630 T4095: link with pipe and three closing brackets, version 2
17631 !! wikitext
17632 [[Main Page|[http://example.com/]]]
17633 !! html/php
17634 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
17635 </p>
17636 !! html/parsoid
17637 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
17638 !! end
17639
17640
17641 ###
17642 ### Safety
17643 ###
17644
17645 !! article
17646 Template:Dangerous attribute
17647 !! text
17648 " onmouseover="alert(document.cookie)
17649 !! endarticle
17650
17651 !! article
17652 Template:Dangerous style attribute
17653 !! text
17654 border-size: expression(alert(document.cookie))
17655 !! endarticle
17656
17657 !! article
17658 Template:Div style
17659 !! text
17660 <div style="float: right; {{{1}}}">Magic div</div>
17661 !! endarticle
17662
17663 !! test
17664 T4304: HTML attribute safety (safe template; regression T4309)
17665 !! wikitext
17666 <div title="{{test}}"></div>
17667 !! html/php
17668 <div title="This is a test template"></div>
17669
17670 !! html/parsoid
17671 <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>
17672 !! end
17673
17674 # Parsoid has enough context to handle this case
17675 !! test
17676 T4304: HTML attribute safety (dangerous template; 2309)
17677 !! wikitext
17678 <div title="{{dangerous attribute}}"></div>
17679 !! html/php
17680 <div title=""></div>
17681
17682 !! html/parsoid
17683 <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>
17684 !! end
17685
17686 !! test
17687 T4304: HTML attribute safety (dangerous style template; 2309)
17688 !! wikitext
17689 <div style="{{dangerous style attribute}}"></div>
17690 !! html/php
17691 <div style="/* insecure input */"></div>
17692
17693 !! html/parsoid
17694 <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>
17695 !! end
17696
17697 !! test
17698 T4304: HTML attribute safety (safe parameter; 2309)
17699 !! wikitext
17700 {{div style|width: 200px}}
17701 !! html/php
17702 <div style="float: right; width: 200px">Magic div</div>
17703
17704 !! html/parsoid
17705 <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>
17706 !! end
17707
17708 !! test
17709 T4304: HTML attribute safety (unsafe parameter; 2309)
17710 !! wikitext
17711 {{div style|width: expression(alert(document.cookie))}}
17712 !! html/php
17713 <div style="/* insecure input */">Magic div</div>
17714
17715 !! html/parsoid
17716 <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>
17717 !! end
17718
17719 ## Parsoid output here differs; needs investigation.
17720 !! test
17721 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
17722 !! wikitext
17723 {{div style|"><script>alert(document.cookie)</script>}}
17724 !! html
17725 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17726
17727 !! end
17728
17729 ## Parsoid output here differs; needs investigation.
17730 !! test
17731 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
17732 !! wikitext
17733 {{div style|" ><script>alert(document.cookie)</script>}}
17734 !! html
17735 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
17736
17737 !! end
17738
17739 !! test
17740 T4304: HTML attribute safety (link)
17741 !! wikitext
17742 <div title="[[Main Page]]"></div>
17743 !! html/php
17744 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
17745
17746 !! html/parsoid
17747 <div title="[[Main Page]]"></div>
17748 !! end
17749
17750 !! test
17751 T4304: HTML attribute safety (italics)
17752 !! wikitext
17753 <div title="''foobar''"></div>
17754 !! html
17755 <div title="&#39;&#39;foobar&#39;&#39;"></div>
17756
17757 !! end
17758
17759 !! test
17760 T4304: HTML attribute safety (bold)
17761 !! wikitext
17762 <div title="'''foobar'''"></div>
17763 !! html
17764 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
17765
17766 !! end
17767
17768 !! test
17769 T4304: HTML attribute safety (ISBN)
17770 !! wikitext
17771 <div title="ISBN 1234567890"></div>
17772 !! html
17773 <div title="&#73;SBN 1234567890"></div>
17774
17775 !! end
17776
17777 !! test
17778 T4304: HTML attribute safety (RFC)
17779 !! wikitext
17780 <div title="RFC 1234"></div>
17781 !! html
17782 <div title="&#82;FC 1234"></div>
17783
17784 !! end
17785
17786 !! test
17787 T4304: HTML attribute safety (PMID)
17788 !! wikitext
17789 <div title="PMID 1234567890"></div>
17790 !! html
17791 <div title="&#80;MID 1234567890"></div>
17792
17793 !! end
17794
17795 !! test
17796 T4304: HTML attribute safety (web link)
17797 !! wikitext
17798 <div title="http://example.com/"></div>
17799 !! html
17800 <div title="http&#58;//example.com/"></div>
17801
17802 !! end
17803
17804 !! test
17805 T4304: HTML attribute safety (named web link)
17806 !! wikitext
17807 <div title="[http://example.com/ link]"></div>
17808 !! html/php
17809 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
17810
17811 !! html/parsoid
17812 <div title="[http://example.com/ link]"></div>
17813 !! end
17814
17815 !! test
17816 T5244: HTML attribute safety (extension; safe)
17817 !! wikitext
17818 <div style="<nowiki>background:blue</nowiki>"></div>
17819 !! html/php
17820 <div style="background:blue"></div>
17821
17822 !! html/parsoid
17823 <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
17824 !! end
17825
17826 !! test
17827 T5244: HTML attribute safety (extension; unsafe)
17828 !! wikitext
17829 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
17830 !! html/php
17831 <div style="/* insecure input */"></div>
17832
17833 !! html/parsoid
17834 <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>
17835 !! end
17836
17837 # More MSIE fun discovered by Tom Gilder
17838
17839 !! test
17840 MSIE CSS safety test: spurious slash
17841 !! wikitext
17842 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
17843 !! html/php
17844 <div style="/* insecure input */">evil</div>
17845
17846 !! html/parsoid
17847 <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>
17848 !! end
17849
17850 !! test
17851 MSIE CSS safety test: hex code
17852 !! wikitext
17853 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
17854 !! html/php
17855 <div style="/* insecure input */">evil</div>
17856
17857 !! html/parsoid
17858 <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>
17859 !! end
17860
17861 !! test
17862 MSIE CSS safety test: comment in url
17863 !! wikitext
17864 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
17865 !! html/php
17866 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
17867
17868 !! html/parsoid
17869 <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>
17870 !! end
17871
17872 !! test
17873 MSIE CSS safety test: comment in expression
17874 !! wikitext
17875 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
17876 !! html/php
17877 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
17878
17879 !! html/parsoid
17880 <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>
17881 !! end
17882
17883 !! test
17884 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
17885 !! wikitext
17886 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
17887 !! html/php
17888 <p style="/* invalid control char */">A</p>
17889
17890 !! html/parsoid
17891 <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>
17892 !! end
17893
17894 !! test
17895 MSIE 6 CSS safety test: Fullwidth (T57332)
17896 !! wikitext
17897 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
17898 <div style="top:EXPRESSION(alert())">B</div>
17899 !! html/php
17900 <p style="/* insecure input */">A</p>
17901 <div style="/* insecure input */">B</div>
17902
17903 !! html/parsoid
17904 <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>
17905 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
17906 !! end
17907
17908 !! test
17909 MSIE 6 CSS safety test: IPA extensions (T57332)
17910 !! wikitext
17911 <div style="background-image:uʀʟ(javascript:alert())">A</div>
17912 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
17913 !! html/php
17914 <div style="/* insecure input */">A</div>
17915 <p style="/* insecure input */">B</p>
17916
17917 !! html/parsoid
17918 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
17919 <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>
17920 !! end
17921
17922 !! test
17923 MSIE 6 CSS safety test: sup/sub script (T57332)
17924 !! wikitext
17925 <div style="background-image:url⁽javascript:alert())">A</div>
17926 <div style="background-image:url₍javascript:alert())">B</div>
17927 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
17928 !! html/php
17929 <div style="/* insecure input */">A</div>
17930 <div style="/* insecure input */">B</div>
17931 <p style="/* insecure input */">C</p>
17932
17933 !! html/parsoid
17934 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
17935 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
17936 <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>
17937 !! end
17938
17939 !! test
17940 Opera -o-link CSS
17941 !! options
17942 parsoid=wt2html,html2html
17943 !! wikitext
17944 <div
17945 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;"
17946 style="-o-link:attr(title);-o-link-source:current">X</div>
17947 !! html/php
17948 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
17949
17950 !! html/parsoid
17951 <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>
17952 !! end
17953
17954 !! test
17955 MSIE 6 CSS safety test: Repetition markers (T57332)
17956 !! wikitext
17957 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
17958 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
17959 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
17960 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
17961 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
17962 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
17963 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
17964 !! html/php
17965 <p style="/* insecure input */">A</p>
17966 <p style="/* insecure input */">B</p>
17967 <p style="/* insecure input */">C</p>
17968 <p style="/* insecure input */">D</p>
17969 <p style="/* insecure input */">E</p>
17970 <p style="/* insecure input */">F</p>
17971 <p style="/* insecure input */">G</p>
17972
17973 !! html/parsoid
17974 <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>
17975 <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>
17976 <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>
17977 <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>
17978 <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>
17979 <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>
17980 <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>
17981 !! end
17982
17983 !! test
17984 Table attribute legitimate extension
17985 !! wikitext
17986 {|
17987 !+ style="<nowiki>color:blue</nowiki>"|status
17988 |}
17989 !! html
17990 <table>
17991 <tr>
17992 <th style="color:blue">status
17993 </th></tr></table>
17994
17995 !!end
17996
17997 !! test
17998 Table attribute safety
17999 !! wikitext
18000 {|
18001 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18002 |}
18003 !! html
18004 <table>
18005 <tr>
18006 <th style="/* insecure input */">status
18007 </th></tr></table>
18008
18009 !! end
18010
18011 !! test
18012 CSS line continuation 1
18013 !! wikitext
18014 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18015 !! html
18016 <div style="/* insecure input */"></div>
18017
18018 !! end
18019
18020 !! test
18021 CSS line continuation 2
18022 !! wikitext
18023 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18024 !! html
18025 <div style="/* invalid control char */"></div>
18026
18027 !! end
18028
18029 !! article
18030 Template:Identity
18031 !! text
18032 {{{1}}}
18033 !! endarticle
18034
18035 !! test
18036 Expansion of multi-line templates in attribute values (T8255)
18037 !! wikitext
18038 <div style="background: {{identity|#00FF00}}">-</div>
18039 !! html
18040 <div style="background: #00FF00">-</div>
18041
18042 !! end
18043
18044 !! test
18045 Expansion of multi-line templates in attribute values (T8255 sanity check)
18046 !! wikitext
18047 <div style="background:
18048 #00FF00">-</div>
18049 !! html/php
18050 <div style="background: #00FF00">-</div>
18051
18052 !! html/parsoid
18053 <div style="background:
18054 #00FF00">-</div>
18055 !! end
18056
18057 !! test
18058 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18059 !! wikitext
18060 <div style="background: &#10;#00FF00">-</div>
18061 !! html
18062 <div style="background: &#10;#00FF00">-</div>
18063
18064 !! end
18065
18066 !! test
18067 Tags which are hidden from tidiers cannot pass through the Sanitizer
18068 !! wikitext
18069 <mw:toc><script>alert();</script></mw:toc>
18070 !! html+tidy
18071 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18072 </p>
18073 !! end
18074
18075 ###
18076 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
18077 ###
18078
18079 !! test
18080 Parser hook: empty input
18081 !! wikitext
18082 <tag></tag>
18083 !! html/php
18084 <pre>
18085 ''
18086 array (
18087 )
18088 </pre>
18089
18090 !! html/parsoid
18091 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18092 !! end
18093
18094 ## Don't expect parsoid to rt this form.
18095 !! test
18096 Parser hook: empty input using terminated empty elements
18097 !! options
18098 parsoid=wt2html,html2html
18099 !! wikitext
18100 <tag/>
18101 !! html/php
18102 <pre>
18103 NULL
18104 array (
18105 )
18106 </pre>
18107
18108 !! html/parsoid
18109 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18110 !! end
18111
18112 !! test
18113 Parser hook: empty input using terminated empty elements (space before)
18114 !! wikitext
18115 <tag />
18116 !! html/php
18117 <pre>
18118 NULL
18119 array (
18120 )
18121 </pre>
18122
18123 !! html/parsoid
18124 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
18125 !! end
18126
18127 !! test
18128 Parser hook: basic input
18129 !! wikitext
18130 <tag>input</tag>
18131 !! html/php
18132 <pre>
18133 'input'
18134 array (
18135 )
18136 </pre>
18137
18138 !! html/parsoid
18139 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18140 !! end
18141
18142 ## Don't expect parsoid to rt this form.
18143 !! test
18144 Parser hook: case insensitive
18145 !! options
18146 parsoid=wt2html,html2html
18147 !! wikitext
18148 <TAG>input</TAG>
18149 !! html/php
18150 <pre>
18151 'input'
18152 array (
18153 )
18154 </pre>
18155
18156 !! html/parsoid
18157 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18158 !! end
18159
18160 ## Don't expect parsoid to rt this form.
18161 !! test
18162 Parser hook: case insensitive, redux
18163 !! options
18164 parsoid=wt2html,html2html
18165 !! wikitext
18166 <TaG>input</TAg>
18167 !! html/php
18168 <pre>
18169 'input'
18170 array (
18171 )
18172 </pre>
18173
18174 !! html/parsoid
18175 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
18176 !! end
18177
18178 !! test
18179 Parser hook: nested tags
18180 !! wikitext
18181 <tag><tag></tag></tag>
18182 !! html/php
18183 <pre>
18184 '<tag>'
18185 array (
18186 )
18187 </pre>&lt;/tag&gt;
18188
18189 !! html/parsoid
18190 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
18191 !! end
18192
18193 !! test
18194 Parser hook: basic arguments
18195 !! wikitext
18196 <tag width="200" height="100" depth="50" square=""></tag>
18197 !! html/php
18198 <pre>
18199 ''
18200 array (
18201 'width' => '200',
18202 'height' => '100',
18203 'depth' => '50',
18204 'square' => '',
18205 )
18206 </pre>
18207
18208 !! html/parsoid
18209 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18210 !! end
18211
18212 ## Don't expect parsoid to rt this form.
18213 !! test
18214 Parser hook: basic arguments, variations
18215 !! options
18216 parsoid=wt2html,html2html
18217 !! wikitext
18218 <tag width=200 height = "100" depth = '50' square></tag>
18219 !! html/php
18220 <pre>
18221 ''
18222 array (
18223 'width' => '200',
18224 'height' => '100',
18225 'depth' => '50',
18226 'square' => '',
18227 )
18228 </pre>
18229
18230 !! html/parsoid
18231 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18232 !! end
18233
18234 !! test
18235 Parser hook: argument containing a forward slash (T7344)
18236 !! wikitext
18237 <tag filename="/tmp/bla"></tag>
18238 !! html/php
18239 <pre>
18240 ''
18241 array (
18242 'filename' => '/tmp/bla',
18243 )
18244 </pre>
18245
18246 !! html/parsoid
18247 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18248 !! end
18249
18250 ## Don't expect parsoid to rt this form.
18251 !! test
18252 Parser hook: empty input using terminated empty elements (T4374)
18253 !! options
18254 parsoid=wt2html,html2html
18255 !! wikitext
18256 <tag foo=bar/>text
18257 !! html/php
18258 <pre>
18259 NULL
18260 array (
18261 'foo' => 'bar',
18262 )
18263 </pre>text
18264
18265 !! html/parsoid
18266 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
18267 !! end
18268
18269 ## </tag> should be output literally since there is no matching tag that begins it
18270 ## Don't expect parsoid to rt this form.
18271 !! test
18272 Parser hook: basic arguments using terminated empty elements (T4374)
18273 !! options
18274 parsoid=wt2html
18275 !! wikitext
18276 <tag width=200 height = "100" depth = '50' square/>
18277 other stuff
18278 </tag>
18279 !! html/php
18280 <pre>
18281 NULL
18282 array (
18283 'width' => '200',
18284 'height' => '100',
18285 'depth' => '50',
18286 'square' => '',
18287 )
18288 </pre>
18289 <p>other stuff
18290 &lt;/tag&gt;
18291 </p>
18292 !! html/parsoid
18293 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
18294 &lt;/tag></p>
18295 !! end
18296
18297 ## Don't expect parsoid to rt this form.
18298 !! test
18299 Parser hook: Don't allow unclosed extension tags
18300 !! options
18301 parsoid=wt2html
18302 !! wikitext
18303 test <tag>123
18304
18305 this is a '''test'''
18306 !! html/php
18307 <p>test &lt;tag&gt;123
18308 </p><p>this is a <b>test</b>
18309 </p>
18310 !! html/parsoid
18311 <p>test &lt;tag>123</p>
18312
18313 <p>this is a <b>test</b></p>
18314 !! end
18315
18316 !! test
18317 Parser hook: horizontal rule inside extension tag that outputs <pre>
18318 !! wikitext
18319 <tag>
18320 Hello
18321 <hr/>
18322 Goodbye
18323 </tag>
18324 !! html/php
18325 <pre>
18326 '
18327 Hello
18328 <hr/>
18329 Goodbye
18330 '
18331 array (
18332 )
18333 </pre>
18334
18335 !! end
18336
18337 ###
18338 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18339 ###
18340
18341 !! test
18342 Parser hook: static parser hook not inside a comment
18343 !! wikitext
18344 <statictag>hello, world</statictag>
18345
18346 <statictag action="flush" />
18347 !! html/php
18348 <p><br />
18349 hello, world
18350 </p>
18351 !! html/parsoid
18352 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18353 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18354 !! end
18355
18356 !! test
18357 Parser hook: static parser hook inside a comment
18358 !! wikitext
18359 <!-- <statictag>hello, world</statictag> -->
18360 <statictag action="flush" />
18361 !! html/php
18362 <p><br />
18363 </p>
18364 !! html/parsoid
18365 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18366 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18367 !! end
18368
18369 # Nested template calls; this case was broken by Parser.php rev 1.506,
18370 # since reverted.
18371
18372 !! article
18373 Template:One-parameter
18374 !! text
18375 (My parameter is: {{{1}}})
18376 !! endarticle
18377
18378 !! article
18379 Template:Map-one-parameter
18380 !! text
18381 {{{{{1}}}|{{{2}}}}}
18382 !! endarticle
18383
18384 !! test
18385 Nested template calls
18386 !! wikitext
18387 {{Map-one-parameter|One-parameter|param}}
18388 !! html
18389 <p>(My parameter is: param)
18390 </p>
18391 !! end
18392
18393
18394 ###
18395 ### Sanitizer
18396 ###
18397
18398 # Remex wraps empty tag runs with p-tags.
18399 # Parsoid strips them out during p-wrapping.
18400 !! test
18401 Sanitizer: Closing of open tags
18402 !! wikitext
18403 <s></s><table></table>
18404 !! html/php+tidy
18405 <p><s></s></p><table></table>
18406 !! html/parsoid
18407 <s></s><table></table>
18408 !! end
18409
18410 !! test
18411 Sanitizer: Closing of open but not closed tags
18412 !! wikitext
18413 <s>foo
18414 !! html
18415 <p><s>foo</s>
18416 </p>
18417 !! end
18418
18419 !! test
18420 Sanitizer: Closing of closed but not open tags
18421 !! options
18422 parsoid=wt2html
18423 !! wikitext
18424 </s>
18425 !! html/php+tidy
18426 <p class="mw-empty-elt">
18427 </p>
18428 !! html/parsoid
18429 !! end
18430
18431 !! test
18432 Sanitizer: Closing of closed but not open table tags
18433 !! options
18434 parsoid=wt2html
18435 !! wikitext
18436 Table not started</td></tr></table>
18437 !! html+tidy
18438 <p>Table not started
18439 </p>
18440 !! end
18441
18442 !! test
18443 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18444 !! config
18445 wgFragmentMode=[ 'html5', 'legacy' ]
18446 !! wikitext
18447 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18448 !! html/php
18449 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18450 </p>
18451 !! html/parsoid
18452 <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>
18453 !! end
18454
18455 !! test
18456 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18457 !! config
18458 wgFragmentMode=[ 'legacy' ]
18459 !! wikitext
18460 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18461 !! html/php
18462 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18463 </p>
18464 !! end
18465
18466 # In HTML5, the restrictions are that id must contain at least one character,
18467 # and must not contain any space characters.
18468 !! test
18469 Sanitizer: Validating the contents of the id attribute (T6515)
18470 !! options
18471 disabled
18472 !! wikitext
18473 <br id="" /><br id="a space" />
18474 !! html
18475 Something ...
18476 !! end
18477
18478 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18479 !! test
18480 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18481 !! options
18482 disabled
18483 !! wikitext
18484 <br id="foo" /><br id="foo" />
18485 !! html
18486 Something need to be done. foo-2 ?
18487 !! end
18488
18489 !! test
18490 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18491 !! wikitext
18492 <div itemscope>
18493 <meta itemprop="hello" content="world">
18494 <meta http-equiv="refresh" content="5">
18495 <meta itemprop="hello" http-equiv="refresh" content="5">
18496 <link itemprop="hello" href="{{SERVER}}">
18497 <link rel="stylesheet" href="{{SERVER}}">
18498 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18499 </div>
18500 !! html
18501 <div itemscope="">
18502 <p> <meta itemprop="hello" content="world" />
18503 &lt;meta http-equiv="refresh" content="5"&gt;
18504 <meta itemprop="hello" content="5" />
18505 <link itemprop="hello" href="http&#58;//example.org" />
18506 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18507 <link itemprop="hello" href="http&#58;//example.org" />
18508 </p>
18509 </div>
18510
18511 !! end
18512
18513 !! test
18514 Sanitizer: Strip comments from CSS attributes
18515 !! options
18516 parsoid=wt2html,wt2wt
18517 !! wikitext
18518 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18519 !! html/php
18520 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18521 </p>
18522 !! html/parsoid
18523 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18524 !! end
18525
18526 !! test
18527 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18528 !! wikitext
18529 [[meatball:Soft"Security]]
18530 !! html/php
18531 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18532 </p>
18533 !! html/parsoid
18534 <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>
18535 !! end
18536
18537 !! test
18538 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18539 !! wikitext
18540 [[meatball:Foo<Bar]]
18541 [[meatball:Foo>Bar]]
18542 [[meatball:Foo&lt;bar]]
18543 [[meatball:Foo&gt;bar]]
18544 !! html/php
18545 <p>[[meatball:Foo&lt;Bar]]
18546 [[meatball:Foo&gt;Bar]]
18547 [[meatball:Foo&lt;bar]]
18548 [[meatball:Foo&gt;bar]]
18549 </p>
18550 !! html/parsoid
18551 <p>[[meatball:Foo&lt;Bar]]
18552 [[meatball:Foo>Bar]]
18553 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18554 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18555 !! end
18556
18557 !! test
18558 Language converter: output gets cut off unexpectedly (T7757)
18559 !! options
18560 language=zh
18561 !! wikitext
18562 this bit is safe: }-
18563
18564 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18565
18566 then we get cut off here: }-
18567
18568 all additional text is vanished
18569 !! html/php
18570 <p>this bit is safe: }-
18571 </p><p>but if we add a conversion instance: xxx
18572 </p><p>then we get cut off here: }-
18573 </p><p>all additional text is vanished
18574 </p>
18575 !! html/parsoid
18576 <p>this bit is safe: }-</p>
18577 <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>
18578 <p>then we get cut off here: }-</p>
18579 <p>all additional text is vanished</p>
18580 !! end
18581
18582 !! test
18583 Language converter glossary rules inside attributes (T119158)
18584 !! options
18585 language=sr variant=sr-el
18586 !! wikitext
18587 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18588
18589 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18590 !! html/php
18591 <p>
18592 </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>
18593 </p>
18594 !! html/parsoid
18595 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18596
18597 <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>
18598 !! end
18599
18600 !! test
18601 Self closed html pairs (T7487)
18602 !! wikitext
18603 <center><font id="bug" />Centered text</center>
18604 <div><font id="bug2" />In div text</div>
18605 !! html+tidy
18606 <center><font id="bug"></font>Centered text</center>
18607 <div><font id="bug2"></font>In div text</div>
18608 !! end
18609
18610 !! test
18611 Punctuation: nbsp before exclamation
18612 !! wikitext
18613 C'est grave !
18614 !! html
18615 <p>C'est grave&#160;!
18616 </p>
18617 !! end
18618
18619 !! test
18620 Punctuation: CSS !important (T13874)
18621 !! wikitext
18622 <div style="width:50% !important">important</div>
18623 !! html
18624 <div style="width:50% !important">important</div>
18625
18626 !!end
18627
18628 !! test
18629 Punctuation: CSS ! important (T13874; with space after)
18630 !! wikitext
18631 <div style="width:50% ! important">important</div>
18632 !! html
18633 <div style="width:50% ! important">important</div>
18634
18635 !!end
18636
18637 !! test
18638 HTML bullet list, closed tags (T7497)
18639 !! wikitext
18640 <ul>
18641 <li>One</li>
18642 <li>Two</li>
18643 </ul>
18644 !! html/php
18645 <ul>
18646 <li>One</li>
18647 <li>Two</li>
18648 </ul>
18649
18650 !! html/parsoid
18651 <ul data-parsoid='{"stx":"html"}'>
18652 <li data-parsoid='{"stx":"html"}'>One</li>
18653 <li data-parsoid='{"stx":"html"}'>Two</li>
18654 </ul>
18655
18656 !! end
18657
18658 !! test
18659 HTML bullet list, unclosed tags (T7497)
18660 !! wikitext
18661 <ul>
18662 <li>One
18663 <li>Two
18664 </ul>
18665 !! html/php+tidy
18666 <ul>
18667 <li>One
18668 </li><li>Two
18669 </li></ul>
18670 !! html/parsoid
18671 <ul data-parsoid='{"stx":"html"}'>
18672 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18673 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18674 </ul>
18675
18676 !! end
18677
18678 !! test
18679 HTML ordered list, closed tags (T7497)
18680 !! wikitext
18681 <ol>
18682 <li>One</li>
18683 <li>Two</li>
18684 </ol>
18685 !! html/php
18686 <ol>
18687 <li>One</li>
18688 <li>Two</li>
18689 </ol>
18690
18691 !! html/parsoid
18692 <ol data-parsoid='{"stx":"html"}'>
18693 <li data-parsoid='{"stx":"html"}'>One</li>
18694 <li data-parsoid='{"stx":"html"}'>Two</li>
18695 </ol>
18696
18697 !! end
18698
18699 !! test
18700 HTML ordered list, unclosed tags (T7497)
18701 !! options
18702 !! wikitext
18703 <ol>
18704 <li>One
18705 <li>Two
18706 </ol>
18707 !! html/php+tidy
18708 <ol>
18709 <li>One
18710 </li><li>Two
18711 </li></ol>
18712 !! html/parsoid
18713 <ol data-parsoid='{"stx":"html"}'>
18714 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18715 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18716 </ol>
18717
18718 !! end
18719
18720 !! test
18721 HTML nested bullet list, closed tags (T7497)
18722 !! wikitext
18723 <ul>
18724 <li>One</li>
18725 <li>Two:
18726 <ul>
18727 <li>Sub-one</li>
18728 <li>Sub-two</li>
18729 </ul>
18730 </li>
18731 </ul>
18732 !! html/php
18733 <ul>
18734 <li>One</li>
18735 <li>Two:
18736 <ul>
18737 <li>Sub-one</li>
18738 <li>Sub-two</li>
18739 </ul>
18740 </li>
18741 </ul>
18742
18743 !! html/parsoid
18744 <ul data-parsoid='{"stx":"html"}'>
18745 <li data-parsoid='{"stx":"html"}'>One</li>
18746 <li data-parsoid='{"stx":"html"}'>Two:
18747 <ul data-parsoid='{"stx":"html"}'>
18748 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18749 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18750 </ul>
18751 </li>
18752 </ul>
18753 !! end
18754
18755 !! test
18756 HTML nested bullet list, open tags (T7497)
18757 !! wikitext
18758 <ul>
18759 <li>One
18760 <li>Two:
18761 <ul>
18762 <li>Sub-one
18763 <li>Sub-two
18764 </ul>
18765 </ul>
18766 !! html+tidy
18767 <ul>
18768 <li>One
18769 </li><li>Two:
18770 <ul>
18771 <li>Sub-one
18772 </li><li>Sub-two
18773 </li></ul>
18774 </li></ul>
18775 !! end
18776
18777 !! test
18778 HTML nested ordered list, closed tags (T7497)
18779 !! wikitext
18780 <ol>
18781 <li>One</li>
18782 <li>Two:
18783 <ol>
18784 <li>Sub-one</li>
18785 <li>Sub-two</li>
18786 </ol>
18787 </li>
18788 </ol>
18789 !! html
18790 <ol>
18791 <li>One</li>
18792 <li>Two:
18793 <ol>
18794 <li>Sub-one</li>
18795 <li>Sub-two</li>
18796 </ol>
18797 </li>
18798 </ol>
18799
18800 !! end
18801
18802 !! test
18803 HTML nested ordered list, open tags (T7497)
18804 !! wikitext
18805 <ol>
18806 <li>One
18807 <li>Two:
18808 <ol>
18809 <li>Sub-one
18810 <li>Sub-two
18811 </ol>
18812 </ol>
18813 !! html/php
18814 <ol>
18815 <li>One
18816 <li>Two:
18817 <ol>
18818 <li>Sub-one
18819 <li>Sub-two
18820 </ol>
18821 </ol>
18822
18823 !! html/parsoid
18824 <ol>
18825 <li>One
18826 </li>
18827 <li>Two:
18828 <ol>
18829 <li>Sub-one
18830 </li>
18831 <li>Sub-two
18832 </li>
18833 </ol>
18834 </li>
18835 </ol>
18836
18837 !! end
18838
18839 !! test
18840 HTML ordered list item with parameters oddity
18841 !! wikitext
18842 <ol><li id="fragment">One</li>
18843 </ol>
18844 !! html
18845 <ol><li id="fragment">One</li>
18846 </ol>
18847
18848 !! end
18849
18850 # parsoid doesn't explicitly mark autonumbered links, see T55505
18851 !!test
18852 T7918: autonumbering
18853 !! wikitext
18854 [http://first/] [http://second] [ftp://ftp]
18855
18856 ftp://inlineftp
18857
18858 [mailto:enclosed@mail.tld With target]
18859
18860 [mailto:enclosed@mail.tld]
18861
18862 mailto:inline@mail.tld
18863 !! html/php
18864 <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>
18865 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18866 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18867 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18868 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18869 </p>
18870 !! html/parsoid
18871 <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>
18872 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18873 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18874 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18875 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18876 !! end
18877
18878
18879 #
18880 # Security and HTML correctness
18881 # From Nick Jenkins' fuzz testing
18882 #
18883
18884 !! test
18885 Fuzz testing: Parser13
18886 !! wikitext
18887 {|
18888 | http://a|
18889 !! html
18890 <table>
18891 <tr>
18892 <td>
18893 </td>
18894 </tr>
18895 </table>
18896
18897 !! end
18898
18899 # Note that Parsoid output differs from the PHP parser here: the PHP
18900 # parser breaks the URL for the magic word, while in Parsoid the URL
18901 # production takes precedence.
18902 !! test
18903 Fuzz testing: Parser14
18904 !! wikitext
18905 ==onmouseover===
18906 http://__TOC__
18907 !! html/php
18908 <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>
18909 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18910 <ul>
18911 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18912 </ul>
18913 </div>
18914
18915
18916 !! html/php+tidy
18917 <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>
18918 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18919 <ul>
18920 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18921 </ul>
18922 </div>
18923 !! html/parsoid
18924 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18925 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18926 !! end
18927
18928 !! test
18929 Fuzz testing: Parser14-table
18930 !! options
18931 parsoid=wt2html,html2html
18932 !! wikitext
18933 ==a==
18934 {| STYLE=__TOC__
18935 !! html
18936 <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>
18937 <table style="&#95;_TOC&#95;_">
18938 <tr><td></td></tr>
18939 </table>
18940
18941 !! html+tidy
18942 <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>
18943 <table style="__TOC__">
18944 <tr>
18945 <td></td>
18946 </tr>
18947 </table>
18948 !! html/parsoid
18949 <h2 id="a">a</h2>
18950 <table style="__TOC__"></table>
18951 !! end
18952
18953 # Known to produce bogus xml (extra </td>)
18954 # Don't add the html/php section since it generates broken HTML
18955 !! test
18956 Fuzz testing: Parser16
18957 !! wikitext
18958 {|
18959 !https://||||||
18960 !! html+tidy
18961 <table>
18962 <tbody><tr>
18963 <th>https://</th>
18964 <th></th>
18965 <th></th>
18966 <th>
18967
18968 </th></tr>
18969 </tbody></table>
18970 !! end
18971
18972 !! test
18973 Fuzz testing: Parser21
18974 !! wikitext
18975 {|
18976 !irc://{{ftp://a" onmouseover="alert('hello world');"
18977 |
18978 !! html
18979 <table>
18980 <tr>
18981 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18982 </th>
18983 <td>
18984 </td>
18985 </tr>
18986 </table>
18987
18988 !! end
18989
18990 !! test
18991 Fuzz testing: Parser22
18992 !! wikitext
18993 http://===r:::https://b
18994
18995 {|
18996 !! html
18997 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18998 </p>
18999 <table>
19000 <tr><td></td></tr>
19001 </table>
19002
19003 !! end
19004
19005 # Known to produce bad XML for now
19006 !! test
19007 Fuzz testing: Parser24
19008 !! options
19009 parsoid=wt2html
19010 !! wikitext
19011 {|
19012 {{{|
19013 <u CLASS=
19014 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19015 <br style="onmouseover='alert(document.cookie);' " />
19016
19017 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19018 |
19019 !! html/php
19020 <table>
19021 {{{|
19022 <u class="&#124;">}}}} &gt;
19023 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19024
19025 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19026 <tr>
19027 <td></u>
19028 </td>
19029 </tr>
19030 </table>
19031
19032 !! html/parsoid
19033 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19034 <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>"}'/>}}}} >
19035 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true,"autoInsertedStart":true}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
19036
19037
19038
19039 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19040 !! end
19041
19042 # Note: the current result listed for this is not what the original one was,
19043 # but the original bug was JavaScript injection, which is fixed in any case.
19044 # It's not clear that the original result listed was any more correct than the
19045 # current one. Original result:
19046 # <p>{{{|
19047 # </p>
19048 # <li class="&#124;&#124;">
19049 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19050 !!test
19051 Fuzz testing: Parser25 (T8055)
19052 !! wikitext
19053 {{{
19054 |
19055 <LI CLASS=||
19056 >
19057 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19058 !! html/php
19059 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19060 </p>
19061 !! html/parsoid
19062 <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"]}'>
19063 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19064 !! end
19065
19066 !!test
19067 Fuzz testing: URL adjacent extension (with space, clean)
19068 !! wikitext
19069 http://example.com <nowiki>junk</nowiki>
19070 !! html/php
19071 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19072 </p>
19073 !! html/parsoid
19074 <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>
19075 !! end
19076
19077 !!test
19078 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19079 !! wikitext
19080 http://example.com<nowiki>junk</nowiki>
19081 !! html/php
19082 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19083 </p>
19084 !! html/parsoid
19085 <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>
19086 !! end
19087
19088 !! test
19089 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19090 !! wikitext
19091 http://example.com<pre>junk</pre>
19092 !! html/php
19093 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19094
19095 !! html/php+tidy
19096 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19097 !! html/parsoid
19098 <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>
19099 !! end
19100
19101 !! test
19102 Fuzz testing: image with bogus manual thumbnail
19103 !! wikitext
19104 [[Image:foobar.jpg|thumbnail= ]]
19105 !! html/php
19106 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19107
19108 !! html/parsoid
19109 <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>
19110 !! end
19111
19112 # Parsoid will emit the newline literally in wt2wt; see next test case.
19113 !! test
19114 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19115 !! options
19116 parsoid=wt2html
19117 !! wikitext
19118 <pre dir="&#10;"></pre>
19119 !! html/php
19120 <pre dir="&#10;"></pre>
19121
19122 !! html/parsoid
19123 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19124 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19125 !! end
19126
19127 !! test
19128 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19129 !! options
19130 parsoid=html2wt
19131 !! html/parsoid
19132 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19133 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19134 !! wikitext
19135 <pre dir="
19136 "></pre>
19137 !! html/php
19138 <pre dir=""></pre>
19139
19140 !! end
19141
19142 !! test
19143 Templates in extension attributes are not expanded
19144 !! wikitext
19145 <pre dir="{{echo|ltr}}"></pre>
19146 !! html/php
19147 <pre dir="{{echo|ltr}}"></pre>
19148
19149 !! html/parsoid
19150 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19151 !! end
19152
19153 !! test
19154 Parsing optional HTML elements (T8171)
19155 !! options
19156 !! wikitext
19157 <table>
19158 <tr>
19159 <td> Some tabular data</td>
19160 <td> More tabular data ...
19161 <td> And yet som tabular data</td>
19162 </tr>
19163 </table>
19164 !! html
19165 <table>
19166 <tr>
19167 <td> Some tabular data</td>
19168 <td> More tabular data ...
19169 </td><td> And yet som tabular data</td>
19170 </tr>
19171 </table>
19172
19173 !! end
19174
19175 !! test
19176 Correct handling of <td>, <tr> (T8171)
19177 !! options
19178 !! wikitext
19179 <table>
19180 <tr>
19181 <td> Some tabular data</td>
19182 <td> More tabular data ...</td>
19183 <td> And yet som tabular data</td>
19184 </tr>
19185 </table>
19186 !! html
19187 <table>
19188 <tr>
19189 <td> Some tabular data</td>
19190 <td> More tabular data ...</td>
19191 <td> And yet som tabular data</td>
19192 </tr>
19193 </table>
19194
19195 !! end
19196
19197
19198 !! test
19199 Parsing crashing regression (fr:JavaScript)
19200 !! wikitext
19201 </body></x>
19202 !! html
19203 <p>&lt;/body&gt;&lt;/x&gt;
19204 </p>
19205 !! end
19206
19207 !! test
19208 Inline wiki vs wiki block nesting
19209 !! wikitext
19210 '''Bold paragraph
19211
19212 New wiki paragraph
19213 !! html
19214 <p><b>Bold paragraph</b>
19215 </p><p>New wiki paragraph
19216 </p>
19217 !! end
19218
19219 # FIXME: The current php output is documented
19220 # and desired output is the parsoid target.
19221 !! test
19222 Inline HTML vs wiki block nesting
19223 !! wikitext
19224 <b>Bold paragraph
19225
19226 New wiki paragraph
19227 !! html/php
19228 <p><b>Bold paragraph
19229 </p><p>New wiki paragraph</b>
19230 </p>
19231 !! html/parsoid
19232 <p><b>Bold paragraph</b>
19233 </p><p>New wiki paragraph
19234 </p>
19235 !! end
19236
19237 # Original result was this:
19238 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19239 # </p>
19240 # While that might be marginally more intuitive, maybe, the six-apostrophe
19241 # construct is clearly pathological and the result stated here (which is what
19242 # the parser actually does) is about as reasonable as anything.
19243 !!test
19244 Mixing markup for italics and bold
19245 !! options
19246 !! wikitext
19247 '''bold''''''bold''bolditalics'''''
19248 !! html
19249 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19250 </p>
19251 !! end
19252
19253
19254 !! article
19255 Xyzzyx
19256 !! text
19257 Article for special page transclusion test
19258 !! endarticle
19259
19260 !! test
19261 Special page transclusion
19262 !! options
19263 !! wikitext
19264 {{Special:Prefixindex/Xyzzyx}}
19265 !! html
19266 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19267 </ul>
19268
19269 !! end
19270
19271 !! test
19272 Special page transclusion twice (T7021)
19273 !! options
19274 !! wikitext
19275 {{Special:Prefixindex/Xyzzyx}}
19276 {{Special:Prefixindex/Xyzzyx}}
19277 !! html
19278 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19279 </ul>
19280 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19281 </ul>
19282
19283 !! end
19284
19285 !! test
19286 Transclusion of default MediaWiki message
19287 !! wikitext
19288 {{MediaWiki:Mainpage}}
19289 !! html
19290 <p>Main Page
19291 </p>
19292 !! end
19293
19294 !! test
19295 Transclusion of nonexistent MediaWiki message
19296 !! wikitext
19297 {{MediaWiki:Mainpagexxx}}
19298 !! html
19299 <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>
19300 </p>
19301 !! end
19302
19303 !! test
19304 Transclusion of MediaWiki message with underscore
19305 !! wikitext
19306 {{MediaWiki:history_short}}
19307 !! html
19308 <p>History
19309 </p>
19310 !! end
19311
19312 !! test
19313 Transclusion of MediaWiki message with space
19314 !! wikitext
19315 {{MediaWiki:history short}}
19316 !! html
19317 <p>History
19318 </p>
19319 !! end
19320
19321 !! test
19322 Invalid header with following text
19323 !! wikitext
19324 = x = y
19325 !! html
19326 <p>= x = y
19327 </p>
19328 !! end
19329
19330
19331 !! test
19332 Section extraction test (section 0)
19333 !! options
19334 section=0
19335 !! wikitext
19336 start
19337 ==a==
19338 ===aa===
19339 ====aaa====
19340 ==b==
19341 ===ba===
19342 ===bb===
19343 ====bba====
19344 ===bc===
19345 ==c==
19346 ===ca===
19347 !! html/php
19348 start
19349 !! end
19350
19351 !! test
19352 Section extraction test (section 1)
19353 !! options
19354 section=1
19355 !! wikitext
19356 start
19357 ==a==
19358 ===aa===
19359 ====aaa====
19360 ==b==
19361 ===ba===
19362 ===bb===
19363 ====bba====
19364 ===bc===
19365 ==c==
19366 ===ca===
19367 !! html/php
19368 ==a==
19369 ===aa===
19370 ====aaa====
19371 !! end
19372
19373 !! test
19374 Section extraction test (section 2)
19375 !! options
19376 section=2
19377 !! wikitext
19378 start
19379 ==a==
19380 ===aa===
19381 ====aaa====
19382 ==b==
19383 ===ba===
19384 ===bb===
19385 ====bba====
19386 ===bc===
19387 ==c==
19388 ===ca===
19389 !! html/php
19390 ===aa===
19391 ====aaa====
19392 !! end
19393
19394 !! test
19395 Section extraction test (section 3)
19396 !! options
19397 section=3
19398 !! wikitext
19399 start
19400 ==a==
19401 ===aa===
19402 ====aaa====
19403 ==b==
19404 ===ba===
19405 ===bb===
19406 ====bba====
19407 ===bc===
19408 ==c==
19409 ===ca===
19410 !! html/php
19411 ====aaa====
19412 !! end
19413
19414 !! test
19415 Section extraction test (section 4)
19416 !! options
19417 section=4
19418 !! wikitext
19419 start
19420 ==a==
19421 ===aa===
19422 ====aaa====
19423 ==b==
19424 ===ba===
19425 ===bb===
19426 ====bba====
19427 ===bc===
19428 ==c==
19429 ===ca===
19430 !! html/php
19431 ==b==
19432 ===ba===
19433 ===bb===
19434 ====bba====
19435 ===bc===
19436 !! end
19437
19438 !! test
19439 Section extraction test (section 5)
19440 !! options
19441 section=5
19442 !! wikitext
19443 start
19444 ==a==
19445 ===aa===
19446 ====aaa====
19447 ==b==
19448 ===ba===
19449 ===bb===
19450 ====bba====
19451 ===bc===
19452 ==c==
19453 ===ca===
19454 !! html/php
19455 ===ba===
19456 !! end
19457
19458 !! test
19459 Section extraction test (section 6)
19460 !! options
19461 section=6
19462 !! wikitext
19463 start
19464 ==a==
19465 ===aa===
19466 ====aaa====
19467 ==b==
19468 ===ba===
19469 ===bb===
19470 ====bba====
19471 ===bc===
19472 ==c==
19473 ===ca===
19474 !! html/php
19475 ===bb===
19476 ====bba====
19477 !! end
19478
19479 !! test
19480 Section extraction test (section 7)
19481 !! options
19482 section=7
19483 !! wikitext
19484 start
19485 ==a==
19486 ===aa===
19487 ====aaa====
19488 ==b==
19489 ===ba===
19490 ===bb===
19491 ====bba====
19492 ===bc===
19493 ==c==
19494 ===ca===
19495 !! html/php
19496 ====bba====
19497 !! end
19498
19499 !! test
19500 Section extraction test (section 8)
19501 !! options
19502 section=8
19503 !! wikitext
19504 start
19505 ==a==
19506 ===aa===
19507 ====aaa====
19508 ==b==
19509 ===ba===
19510 ===bb===
19511 ====bba====
19512 ===bc===
19513 ==c==
19514 ===ca===
19515 !! html/php
19516 ===bc===
19517 !! end
19518
19519 !! test
19520 Section extraction test (section 9)
19521 !! options
19522 section=9
19523 !! wikitext
19524 start
19525 ==a==
19526 ===aa===
19527 ====aaa====
19528 ==b==
19529 ===ba===
19530 ===bb===
19531 ====bba====
19532 ===bc===
19533 ==c==
19534 ===ca===
19535 !! html/php
19536 ==c==
19537 ===ca===
19538 !! end
19539
19540 !! test
19541 Section extraction test (section 10)
19542 !! options
19543 section=10
19544 !! wikitext
19545 start
19546 ==a==
19547 ===aa===
19548 ====aaa====
19549 ==b==
19550 ===ba===
19551 ===bb===
19552 ====bba====
19553 ===bc===
19554 ==c==
19555 ===ca===
19556 !! html/php
19557 ===ca===
19558 !! end
19559
19560 !! test
19561 Section extraction test (nonexistent section 11)
19562 !! options
19563 section=11
19564 !! wikitext
19565 start
19566 ==a==
19567 ===aa===
19568 ====aaa====
19569 ==b==
19570 ===ba===
19571 ===bb===
19572 ====bba====
19573 ===bc===
19574 ==c==
19575 ===ca===
19576 !! html/php
19577 !! end
19578
19579 !! test
19580 Section extraction test with bogus heading (section 1)
19581 !! options
19582 section=1
19583 !! wikitext
19584 ==a==
19585 ==bogus== not a legal section
19586 ==b==
19587 !! html/php
19588 ==a==
19589 ==bogus== not a legal section
19590 !! end
19591
19592 !! test
19593 Section extraction test with bogus heading (section 2)
19594 !! options
19595 section=2
19596 !! wikitext
19597 ==a==
19598 ==bogus== not a legal section
19599 ==b==
19600 !! html/php
19601 ==b==
19602 !! end
19603
19604 !! test
19605 Section extraction test with comment after heading (section 1)
19606 !! options
19607 section=1
19608 !! wikitext
19609 ==a==
19610 ==b== <!-- -->
19611 ==c==
19612 !! html/php
19613 ==a==
19614 !! end
19615
19616 !! test
19617 Section extraction test with comment after heading (section 2)
19618 !! options
19619 section=2
19620 !! wikitext
19621 ==a==
19622 ==b== <!-- -->
19623 ==c==
19624 !! html/php
19625 ==b== <!-- -->
19626 !! end
19627
19628 !! test
19629 Section extraction test with bogus <nowiki> heading (section 1)
19630 !! options
19631 section=1
19632 !! wikitext
19633 ==a==
19634 ==bogus== <nowiki>not a legal section</nowiki>
19635 ==b==
19636 !! html/php
19637 ==a==
19638 ==bogus== <nowiki>not a legal section</nowiki>
19639 !! end
19640
19641 !! test
19642 Section extraction test with bogus <nowiki> heading (section 2)
19643 !! options
19644 section=2
19645 !! wikitext
19646 ==a==
19647 ==bogus== <nowiki>not a legal section</nowiki>
19648 ==b==
19649 !! html/php
19650 ==b==
19651 !! end
19652
19653 # Formerly testing for T4587, now resolved by the use of unmarked sections
19654 # instead of respecting commented sections
19655 !! test
19656 Section extraction prefixed by comment (section 1)
19657 !! options
19658 section=1
19659 !! wikitext
19660 <!-- -->==sec1==
19661 ==sec2==
19662 !! html/php
19663 ==sec2==
19664 !!end
19665
19666 !! test
19667 Section extraction prefixed by comment (section 2)
19668 !! options
19669 section=2
19670 !! wikitext
19671 <!-- -->==sec1==
19672 ==sec2==
19673 !! html/php
19674
19675 !!end
19676
19677 # Formerly testing for T4607, now resolved by the use of unmarked sections
19678 # instead of respecting HTML-style headings
19679 !! test
19680 Section extraction, mixed wiki and html (section 1)
19681 !! options
19682 section=1
19683 !! wikitext
19684 <h2>unmarked</h2>
19685 unmarked
19686 ==1==
19687 one
19688 ==2==
19689 two
19690 !! html/php
19691 ==1==
19692 one
19693 !! end
19694
19695 !! test
19696 Section extraction, mixed wiki and html (section 2)
19697 !! options
19698 section=2
19699 !! wikitext
19700 <h2>unmarked</h2>
19701 unmarked
19702 ==1==
19703 one
19704 ==2==
19705 two
19706 !! html/php
19707 ==2==
19708 two
19709 !! end
19710
19711
19712 # Formerly testing for T5342
19713 !! test
19714 Section extraction, heading surrounded by <noinclude>
19715 !! options
19716 section=1
19717 !! wikitext
19718 <noinclude>==unmarked==</noinclude>
19719 ==marked==
19720 !! html/php
19721 ==marked==
19722 !!end
19723
19724 # Test behavior of T21910
19725 !! test
19726 Sectiion with all-equals
19727 !! options
19728 section=2
19729 !! wikitext
19730 ===
19731 The line above must have a trailing space
19732 === <!--
19733 --> <!-- -->
19734 But just in case it doesn't...
19735 !! html/php
19736 === <!--
19737 --> <!-- -->
19738 But just in case it doesn't...
19739 !! end
19740
19741 !! test
19742 Section replacement test (section 0)
19743 !! options
19744 replace=0,"xxx"
19745 !! wikitext
19746 start
19747 ==a==
19748 ===aa===
19749 ====aaa====
19750 ==b==
19751 ===ba===
19752 ===bb===
19753 ====bba====
19754 ===bc===
19755 ==c==
19756 ===ca===
19757 !! html/php
19758 xxx
19759
19760 ==a==
19761 ===aa===
19762 ====aaa====
19763 ==b==
19764 ===ba===
19765 ===bb===
19766 ====bba====
19767 ===bc===
19768 ==c==
19769 ===ca===
19770 !! end
19771
19772 !! test
19773 Section replacement test (section 1)
19774 !! options
19775 replace=1,"xxx"
19776 !! wikitext
19777 start
19778 ==a==
19779 ===aa===
19780 ====aaa====
19781 ==b==
19782 ===ba===
19783 ===bb===
19784 ====bba====
19785 ===bc===
19786 ==c==
19787 ===ca===
19788 !! html/php
19789 start
19790 xxx
19791
19792 ==b==
19793 ===ba===
19794 ===bb===
19795 ====bba====
19796 ===bc===
19797 ==c==
19798 ===ca===
19799 !! end
19800
19801 !! test
19802 Section replacement test (section 2)
19803 !! options
19804 replace=2,"xxx"
19805 !! wikitext
19806 start
19807 ==a==
19808 ===aa===
19809 ====aaa====
19810 ==b==
19811 ===ba===
19812 ===bb===
19813 ====bba====
19814 ===bc===
19815 ==c==
19816 ===ca===
19817 !! html/php
19818 start
19819 ==a==
19820 xxx
19821
19822 ==b==
19823 ===ba===
19824 ===bb===
19825 ====bba====
19826 ===bc===
19827 ==c==
19828 ===ca===
19829 !! end
19830
19831 !! test
19832 Section replacement test (section 3)
19833 !! options
19834 replace=3,"xxx"
19835 !! wikitext
19836 start
19837 ==a==
19838 ===aa===
19839 ====aaa====
19840 ==b==
19841 ===ba===
19842 ===bb===
19843 ====bba====
19844 ===bc===
19845 ==c==
19846 ===ca===
19847 !! html/php
19848 start
19849 ==a==
19850 ===aa===
19851 xxx
19852
19853 ==b==
19854 ===ba===
19855 ===bb===
19856 ====bba====
19857 ===bc===
19858 ==c==
19859 ===ca===
19860 !! end
19861
19862 !! test
19863 Section replacement test (section 4)
19864 !! options
19865 replace=4,"xxx"
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 start
19880 ==a==
19881 ===aa===
19882 ====aaa====
19883 xxx
19884
19885 ==c==
19886 ===ca===
19887 !! end
19888
19889 !! test
19890 Section replacement test (section 5)
19891 !! options
19892 replace=5,"xxx"
19893 !! wikitext
19894 start
19895 ==a==
19896 ===aa===
19897 ====aaa====
19898 ==b==
19899 ===ba===
19900 ===bb===
19901 ====bba====
19902 ===bc===
19903 ==c==
19904 ===ca===
19905 !! html/php
19906 start
19907 ==a==
19908 ===aa===
19909 ====aaa====
19910 ==b==
19911 xxx
19912
19913 ===bb===
19914 ====bba====
19915 ===bc===
19916 ==c==
19917 ===ca===
19918 !! end
19919
19920 !! test
19921 Section replacement test (section 6)
19922 !! options
19923 replace=6,"xxx"
19924 !! wikitext
19925 start
19926 ==a==
19927 ===aa===
19928 ====aaa====
19929 ==b==
19930 ===ba===
19931 ===bb===
19932 ====bba====
19933 ===bc===
19934 ==c==
19935 ===ca===
19936 !! html/php
19937 start
19938 ==a==
19939 ===aa===
19940 ====aaa====
19941 ==b==
19942 ===ba===
19943 xxx
19944
19945 ===bc===
19946 ==c==
19947 ===ca===
19948 !! end
19949
19950 !! test
19951 Section replacement test (section 7)
19952 !! options
19953 replace=7,"xxx"
19954 !! wikitext
19955 start
19956 ==a==
19957 ===aa===
19958 ====aaa====
19959 ==b==
19960 ===ba===
19961 ===bb===
19962 ====bba====
19963 ===bc===
19964 ==c==
19965 ===ca===
19966 !! html/php
19967 start
19968 ==a==
19969 ===aa===
19970 ====aaa====
19971 ==b==
19972 ===ba===
19973 ===bb===
19974 xxx
19975
19976 ===bc===
19977 ==c==
19978 ===ca===
19979 !! end
19980
19981 !! test
19982 Section replacement test (section 8)
19983 !! options
19984 replace=8,"xxx"
19985 !! wikitext
19986 start
19987 ==a==
19988 ===aa===
19989 ====aaa====
19990 ==b==
19991 ===ba===
19992 ===bb===
19993 ====bba====
19994 ===bc===
19995 ==c==
19996 ===ca===
19997 !! html/php
19998 start
19999 ==a==
20000 ===aa===
20001 ====aaa====
20002 ==b==
20003 ===ba===
20004 ===bb===
20005 ====bba====
20006 xxx
20007
20008 ==c==
20009 ===ca===
20010 !!end
20011
20012 !! test
20013 Section replacement test (section 9)
20014 !! options
20015 replace=9,"xxx"
20016 !! wikitext
20017 start
20018 ==a==
20019 ===aa===
20020 ====aaa====
20021 ==b==
20022 ===ba===
20023 ===bb===
20024 ====bba====
20025 ===bc===
20026 ==c==
20027 ===ca===
20028 !! html/php
20029 start
20030 ==a==
20031 ===aa===
20032 ====aaa====
20033 ==b==
20034 ===ba===
20035 ===bb===
20036 ====bba====
20037 ===bc===
20038 xxx
20039 !! end
20040
20041 !! test
20042 Section replacement test (section 10)
20043 !! options
20044 replace=10,"xxx"
20045 !! wikitext
20046 start
20047 ==a==
20048 ===aa===
20049 ====aaa====
20050 ==b==
20051 ===ba===
20052 ===bb===
20053 ====bba====
20054 ===bc===
20055 ==c==
20056 ===ca===
20057 !! html/php
20058 start
20059 ==a==
20060 ===aa===
20061 ====aaa====
20062 ==b==
20063 ===ba===
20064 ===bb===
20065 ====bba====
20066 ===bc===
20067 ==c==
20068 xxx
20069 !! end
20070
20071 !! test
20072 Section replacement test with initial whitespace (T15728)
20073 !! options
20074 replace=2,"xxx"
20075 !! wikitext
20076 Preformatted initial line
20077 ==a==
20078 ===a===
20079 !! html/php
20080 Preformatted initial line
20081 ==a==
20082 xxx
20083 !! end
20084
20085
20086 !! test
20087 Section extraction, heading followed by pre with 20 spaces (T8398)
20088 !! options
20089 section=1
20090 !! wikitext
20091 ==a==
20092 a
20093 !! html/php
20094 ==a==
20095 a
20096 !! end
20097
20098 !! test
20099 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20100 !! options
20101 section=1
20102 !! wikitext
20103 ==a==
20104 a
20105 !! html/php
20106 ==a==
20107 a
20108 !! end
20109
20110
20111 !! test
20112 Section extraction, <pre> around bogus header (T12309)
20113 !! options
20114 section=2
20115 !! wikitext
20116 == Section One ==
20117 <pre>
20118 =======
20119 </pre>
20120
20121 == Section Two ==
20122 stuff
20123 !! html/php
20124 == Section Two ==
20125 stuff
20126 !! end
20127
20128 !! test
20129 Section replacement, <pre> around bogus header (T12309)
20130 !! options
20131 replace=2,"xxx"
20132 !! wikitext
20133 == Section One ==
20134 <pre>
20135 =======
20136 </pre>
20137
20138 == Section Two ==
20139 stuff
20140 !! html/php
20141 == Section One ==
20142 <pre>
20143 =======
20144 </pre>
20145
20146 xxx
20147 !! end
20148
20149 !! test
20150 Handling of &#x0A; in URLs
20151 !! wikitext
20152 *irc://&#x0A;a
20153 !! html/php
20154 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20155
20156 !! html/parsoid
20157 <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>
20158 !! end
20159
20160 !! test
20161 Handling of %0A in URLs
20162 !! wikitext
20163 *irc://%0Aa
20164 !! html/php
20165 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20166
20167 !! html/parsoid
20168 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20169 !! end
20170
20171 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20172 !! test
20173 5 quotes, code coverage +1 line
20174 !! options
20175 parsoid=wt2html
20176 !! wikitext
20177 '''''
20178 !! html/php
20179 !! html/parsoid
20180 <b><i></i></b>
20181 !! end
20182
20183 # same html as previous, but wikitext adjusted to match parsoid html2wt
20184 # note that wt2html and html2html will put the <i> before the <b>
20185 !! test
20186 5 quotes, code coverage +1 line w/ nowiki (1)
20187 !! options
20188 parsoid=wt2wt,html2wt
20189 !! wikitext
20190 '''''<nowiki/>'''''
20191 !! html/php
20192 <p><i></i>
20193 </p>
20194 !! html/parsoid
20195 <p><b><i></i></b></p>
20196 !! end
20197
20198 # same as previous, just swapping the <i> and <b>
20199 !! test
20200 5 quotes, code coverage +1 line w/ nowiki (2)
20201 !! wikitext
20202 '''''<nowiki/>'''''
20203 !! html/php
20204 <p><i></i>
20205 </p>
20206 !! html/parsoid
20207 <p><i><b></b></i></p>
20208 !! end
20209
20210 !! test
20211 Special:Search page linking.
20212 !! wikitext
20213 {{Special:search}}
20214 !! html
20215 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20216 </p>
20217 !! end
20218
20219 !! test
20220 {{!}} is a magic word
20221 !! wikitext
20222 {{!}} is a magic word there and {{!}} is still a magic word here
20223 | is not a magic word here but {{!}} is still a magic word here
20224 !! html/php
20225 <p>| is a magic word there and | is still a magic word here
20226 | is not a magic word here but | is still a magic word here
20227 </p>
20228 !! html/parsoid
20229 <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
20230 | 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>
20231 !! end
20232
20233 !! test
20234 Say the magic word
20235 !! options
20236 title=[[Parser test]]
20237 !! wikitext
20238 *{{PAGENAME}}
20239 *{{PAGENAMEE}}
20240 *{{FULLPAGENAME}}
20241 *{{FULLPAGENAMEE}}
20242 *{{BASEPAGENAME}}
20243 *{{BASEPAGENAMEE}}
20244 *{{SUBPAGENAME}}
20245 *{{SUBPAGENAMEE}}
20246 *{{ROOTPAGENAME}}
20247 *{{ROOTPAGENAMEE}}
20248 *{{TALKPAGENAME}}
20249 *{{TALKPAGENAMEE}}
20250 *{{SUBJECTPAGENAME}}
20251 *{{SUBJECTPAGENAMEE}}
20252 *{{NAMESPACEE}}
20253 *{{NAMESPACE}}
20254 *{{NAMESPACENUMBER}}
20255 *{{TALKSPACE}}
20256 *{{TALKSPACEE}}
20257 *{{SUBJECTSPACE}}
20258 *{{SUBJECTSPACEE}}
20259 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20260 !! html
20261 <ul><li>Parser test</li>
20262 <li>Parser_test</li>
20263 <li>Parser test</li>
20264 <li>Parser_test</li>
20265 <li>Parser test</li>
20266 <li>Parser_test</li>
20267 <li>Parser test</li>
20268 <li>Parser_test</li>
20269 <li>Parser test</li>
20270 <li>Parser_test</li>
20271 <li>Talk:Parser test</li>
20272 <li>Talk:Parser_test</li>
20273 <li>Parser test</li>
20274 <li>Parser_test</li>
20275 <li></li>
20276 <li></li>
20277 <li>0</li>
20278 <li>Talk</li>
20279 <li>Talk</li>
20280 <li></li>
20281 <li></li>
20282 <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>
20283
20284 !! end
20285 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20286
20287 !! test
20288 Gallery with valid attributes
20289 !! wikitext
20290 <gallery type="123" summary="345">
20291 File:File:Foobar.jpg
20292 </gallery>
20293 !! html/php
20294 <ul class="gallery mw-gallery-traditional" type="123">
20295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20296 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20297 <div class="gallerytext">
20298 </div>
20299 </div></li>
20300 </ul>
20301
20302 !! html/parsoid
20303 <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"}}'>
20304 <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>
20305 </ul>
20306 !! end
20307
20308 ## Parsoid thinks the "centre" here is a property, not a caption.
20309 !! test
20310 Gallery
20311 !! options
20312 parsoid={
20313 "modes": ["wt2html"],
20314 "nativeGallery": true
20315 }
20316 !! wikitext
20317 <gallery>
20318 image1.png |
20319 image2.gif|||||
20320
20321 image3|
20322 image4 |300px| centre
20323 image5.svg| http://///////
20324 [[x|xx]]]]
20325 * image6
20326 </gallery>
20327 !! html/php
20328 <ul class="gallery mw-gallery-traditional">
20329 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20330 <div class="thumb" style="height: 150px;">Image1.png</div>
20331 <div class="gallerytext">
20332 </div>
20333 </div></li>
20334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20335 <div class="thumb" style="height: 150px;">Image2.gif</div>
20336 <div class="gallerytext">
20337 </div>
20338 </div></li>
20339 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20340 <div class="thumb" style="height: 150px;">Image3</div>
20341 <div class="gallerytext">
20342 </div>
20343 </div></li>
20344 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20345 <div class="thumb" style="height: 150px;">Image4</div>
20346 <div class="gallerytext">
20347 <pre>centre
20348 </pre>
20349 </div>
20350 </div></li>
20351 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20352 <div class="thumb" style="height: 150px;">Image5.svg</div>
20353 <div class="gallerytext">
20354 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20355 </p>
20356 </div>
20357 </div></li>
20358 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20359 <div class="thumb" style="height: 150px;">* image6</div>
20360 <div class="gallerytext">
20361 </div>
20362 </div></li>
20363 </ul>
20364
20365 !! html/parsoid
20366 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20367 <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>
20368 <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>
20369 <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>
20370 <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>
20371 <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>
20372 <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>
20373 </ul>
20374 !! end
20375
20376 !! test
20377 Gallery (with options, html)
20378 !! options
20379 parsoid={
20380 "modes": ["wt2html", "html2html"],
20381 "nativeGallery": true
20382 }
20383 !! wikitext
20384 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20385 File:Nonexistent.jpg|caption
20386 File:Nonexistent.jpg
20387 image:foobar.jpg|some '''caption''' [[Main Page]]
20388 image:foobar.jpg
20389 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20390 </gallery>
20391 !! html/php
20392 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20393 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20394 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20395 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20396 <div class="gallerytext">
20397 <p>caption
20398 </p>
20399 </div>
20400 </div></li>
20401 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20402 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20403 <div class="gallerytext">
20404 </div>
20405 </div></li>
20406 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20407 <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>
20408 <div class="gallerytext">
20409 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20410 </p>
20411 </div>
20412 </div></li>
20413 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20414 <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>
20415 <div class="gallerytext">
20416 </div>
20417 </div></li>
20418 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20419 <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>
20420 <div class="gallerytext">
20421 <p>blabla.
20422 </p>
20423 </div>
20424 </div></li>
20425 </ul>
20426
20427 !! html/parsoid
20428 <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":{}}'>
20429 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20430 <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>
20431 <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>
20432 <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>
20433 <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>
20434 <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>
20435 </ul>
20436 !! end
20437
20438 !! test
20439 Gallery (with options, extsrc)
20440 !! options
20441 parsoid={
20442 "nativeGallery": false
20443 }
20444 !! wikitext
20445 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20446 File:Nonexistent.jpg|caption
20447 File:Nonexistent.jpg
20448 image:foobar.jpg|some '''caption''' [[Main Page]]
20449 image:foobar.jpg
20450 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20451 </gallery>
20452 !! html/php
20453 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20454 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20455 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20456 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20457 <div class="gallerytext">
20458 <p>caption
20459 </p>
20460 </div>
20461 </div></li>
20462 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20463 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20464 <div class="gallerytext">
20465 </div>
20466 </div></li>
20467 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20468 <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>
20469 <div class="gallerytext">
20470 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20471 </p>
20472 </div>
20473 </div></li>
20474 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20475 <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>
20476 <div class="gallerytext">
20477 </div>
20478 </div></li>
20479 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20480 <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>
20481 <div class="gallerytext">
20482 <p>blabla.
20483 </p>
20484 </div>
20485 </div></li>
20486 </ul>
20487
20488 !! html/parsoid
20489 <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"}}'>
20490 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20491 <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>
20492 <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>
20493 <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>
20494 <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>
20495 <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>
20496 </ul>
20497 !! end
20498
20499 !! test
20500 Gallery (without px units)
20501 !! wikitext
20502 <gallery widths="70" heights="40">
20503 File:Foobar.jpg
20504 </gallery>
20505 !! html/php
20506 <ul class="gallery mw-gallery-traditional">
20507 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20508 <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>
20509 <div class="gallerytext">
20510 </div>
20511 </div></li>
20512 </ul>
20513
20514 !! html/parsoid
20515 <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"}}'>
20516 <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>
20517 </ul>
20518 !! end
20519
20520 !! test
20521 Gallery (with invalid units)
20522 !! wikitext
20523 <gallery widths="70em" heights="40em">
20524 File:Foobar.jpg
20525 </gallery>
20526 !! html/php
20527 <ul class="gallery mw-gallery-traditional">
20528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20529 <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>
20530 <div class="gallerytext">
20531 </div>
20532 </div></li>
20533 </ul>
20534
20535 !! html/parsoid
20536 <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"}}'>
20537 <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>
20538 </ul>
20539 !! end
20540
20541 !! test
20542 Gallery with link that has fragment
20543 !! options
20544 parsoid={
20545 "modes": ["wt2html", "html2html"],
20546 "nativeGallery": true
20547 }
20548 !! wikitext
20549 <gallery>
20550 image:foobar.jpg|link=Main_Page
20551 image:foobar.jpg|link=Main_Page#section
20552 image:foobar.jpg|link=Main Page#section|caption
20553 </gallery>
20554 !! html/php
20555 <ul class="gallery mw-gallery-traditional">
20556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20557 <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>
20558 <div class="gallerytext">
20559 </div>
20560 </div></li>
20561 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20562 <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>
20563 <div class="gallerytext">
20564 </div>
20565 </div></li>
20566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20567 <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>
20568 <div class="gallerytext">
20569 <p>caption
20570 </p>
20571 </div>
20572 </div></li>
20573 </ul>
20574
20575 !! html/parsoid
20576 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20577 <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>
20578 <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>
20579 <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>
20580 </ul>
20581 !! end
20582
20583 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20584 !! test
20585 Gallery with template inside caption
20586 !! options
20587 parsoid={
20588 "nativeGallery": true
20589 }
20590 !! wikitext
20591 <gallery caption="{{echo|hi}}">
20592 File:Foobar.jpg|{{echo|ho}}
20593 </gallery>
20594 !! html/php
20595 <ul class="gallery mw-gallery-traditional">
20596 <li class='gallerycaption'>{{echo|hi}}</li>
20597 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20598 <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>
20599 <div class="gallerytext">
20600 <p>ho
20601 </p>
20602 </div>
20603 </div></li>
20604 </ul>
20605
20606 !! html/parsoid
20607 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20608 <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>
20609 <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>
20610 </ul>
20611 !! end
20612
20613 !! test
20614 Gallery with wikitext inside caption
20615 !! options
20616 parsoid={
20617 "nativeGallery": true
20618 }
20619 !! wikitext
20620 <gallery>
20621 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20622 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20623 </gallery>
20624 !! html/php
20625 <ul class="gallery mw-gallery-traditional">
20626 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20627 <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>
20628 <div class="gallerytext">
20629 <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>
20630 </p>
20631 </div>
20632 </div></li>
20633 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20634 <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>
20635 <div class="gallerytext">
20636 <p>This is a test template
20637 </p>
20638 </div>
20639 </div></li>
20640 </ul>
20641
20642 !! html/parsoid
20643 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20644 <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>
20645 <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>
20646 </ul>
20647 !! end
20648
20649 !! test
20650 Gallery (with showfilename option)
20651 !! options
20652 parsoid={
20653 "nativeGallery": true
20654 }
20655 !! wikitext
20656 <gallery showfilename="">
20657 File:Nonexistent.jpg|caption
20658 File:Nonexistent.jpg
20659 File:Foobar.jpg|some '''caption''' [[Main Page]]
20660 File:Foobar.jpg
20661 </gallery>
20662 !! html/php
20663 <ul class="gallery mw-gallery-traditional">
20664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20665 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20666 <div class="gallerytext">
20667 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20668 caption
20669 </p>
20670 </div>
20671 </div></li>
20672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20673 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20674 <div class="gallerytext">
20675 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20676 </p>
20677 </div>
20678 </div></li>
20679 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20680 <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>
20681 <div class="gallerytext">
20682 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20683 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20684 </p>
20685 </div>
20686 </div></li>
20687 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20688 <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>
20689 <div class="gallerytext">
20690 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20691 </p>
20692 </div>
20693 </div></li>
20694 </ul>
20695
20696 !! html/parsoid
20697 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20698 <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>
20699 <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>
20700 <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>
20701 <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>
20702 </ul>
20703 !! end
20704
20705 ## Should Parsoid be preserving these variations? See T151367
20706 !! test
20707 Gallery (with namespace-less filenames)
20708 !! options
20709 parsoid={
20710 "modes": ["wt2html", "html2html"],
20711 "nativeGallery": true
20712 }
20713 !! wikitext
20714 <gallery>
20715 File:Nonexistent.jpg
20716 Nonexistent.jpg
20717 image:foobar.jpg
20718 foobar.jpg
20719 </gallery>
20720 !! html/php
20721 <ul class="gallery mw-gallery-traditional">
20722 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20723 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20724 <div class="gallerytext">
20725 </div>
20726 </div></li>
20727 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20728 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20729 <div class="gallerytext">
20730 </div>
20731 </div></li>
20732 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20733 <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>
20734 <div class="gallerytext">
20735 </div>
20736 </div></li>
20737 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20738 <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>
20739 <div class="gallerytext">
20740 </div>
20741 </div></li>
20742 </ul>
20743
20744 !! html/parsoid
20745 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20746 <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>
20747 <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>
20748 <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>
20749 <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>
20750 </ul>
20751 !! end
20752
20753 !! test
20754 Gallery override link with wikilink (T36852)
20755 !! options
20756 parsoid={
20757 "nativeGallery": true
20758 }
20759 !! wikitext
20760 <gallery>
20761 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20762 </gallery>
20763 !! html/php
20764 <ul class="gallery mw-gallery-traditional">
20765 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20766 <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>
20767 <div class="gallerytext">
20768 </div>
20769 </div></li>
20770 </ul>
20771
20772 !! html/parsoid
20773 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20774 <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>
20775 </ul>
20776 !! end
20777
20778 !! test
20779 Gallery override link with absolute external link (T36852)
20780 !! options
20781 parsoid={
20782 "nativeGallery": true
20783 }
20784 !! wikitext
20785 <gallery>
20786 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20787 </gallery>
20788 !! html/php
20789 <ul class="gallery mw-gallery-traditional">
20790 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20791 <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>
20792 <div class="gallerytext">
20793 </div>
20794 </div></li>
20795 </ul>
20796
20797 !! html/parsoid
20798 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20799 <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>
20800 </ul>
20801 !! end
20802
20803 !! test
20804 Gallery override link with absolute external link with LanguageConverter
20805 !! options
20806 language=zh
20807 !! wikitext
20808 <gallery>
20809 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20810 </gallery>
20811 !! html/php
20812 <ul class="gallery mw-gallery-traditional">
20813 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20814 <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>
20815 <div class="gallerytext">
20816 <p>caption
20817 </p>
20818 </div>
20819 </div></li>
20820 </ul>
20821
20822 !! html/parsoid
20823 <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"}}'>
20824 <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>
20825 </ul>
20826 !! end
20827
20828 !! test
20829 Gallery override link with malicious javascript (T36852)
20830 !! options
20831 parsoid={
20832 "modes": ["wt2html", "html2html"],
20833 "nativeGallery": true
20834 }
20835 !! wikitext
20836 <gallery>
20837 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20838 </gallery>
20839 !! html/php
20840 <ul class="gallery mw-gallery-traditional">
20841 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20842 <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>
20843 <div class="gallerytext">
20844 </div>
20845 </div></li>
20846 </ul>
20847
20848 !! html/parsoid
20849 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20850 <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>
20851 </ul>
20852 !! end
20853
20854 # Note that parsoid uses the invalid link as a caption, PHP does not.
20855 !! test
20856 Gallery with invalid title as link (T45964)
20857 !! options
20858 parsoid={
20859 "modes": ["wt2html", "html2html"],
20860 "nativeGallery": true
20861 }
20862 !! wikitext
20863 <gallery>
20864 File:Foobar.jpg|link=<
20865 </gallery>
20866 !! html/php
20867 <ul class="gallery mw-gallery-traditional">
20868 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20869 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
20870 <div class="gallerytext">
20871 </div>
20872 </div></li>
20873 </ul>
20874
20875 !! html/parsoid
20876 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20877 <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>
20878 </ul>
20879 !! end
20880
20881 !! test
20882 Serialize gallery without attrs in data-mw
20883 !! options
20884 parsoid={
20885 "modes": ["html2wt"],
20886 "nativeGallery": true
20887 }
20888 !! html/parsoid
20889 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20890 <li class="gallerycaption">123</li>
20891 <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>
20892 </ul>
20893 !! wikitext
20894 <gallery caption="123">
20895 File:Test.png
20896 </gallery>
20897 !! end
20898
20899 !! test
20900 Gallery with class and style attributes
20901 !! options
20902 parsoid={
20903 "nativeGallery": true
20904 }
20905 !! wikitext
20906 <gallery class="center" style="text-align: center;">
20907 File:Foobar.jpg
20908 </gallery>
20909 !! html/php
20910 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20911 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20912 <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>
20913 <div class="gallerytext">
20914 </div>
20915 </div></li>
20916 </ul>
20917
20918 !! html/parsoid
20919 <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":{}}'>
20920 <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>
20921 </ul>
20922 !! end
20923
20924 !! test
20925 Gallery in slideshow mode
20926 !! options
20927 parsoid={
20928 "nativeGallery": true
20929 }
20930 !! wikitext
20931 <gallery mode="slideshow" showthumbnails="">
20932 File:Foobar.jpg
20933 </gallery>
20934 !! html/php
20935 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20937 <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>
20938 <div class="gallerytext">
20939 </div>
20940 </div></li>
20941 </ul>
20942
20943 !! html/parsoid
20944 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20945 <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>
20946 </ul>
20947 !! end
20948
20949 !! test
20950 HTML Hex character encoding (spells the word "JavaScript")
20951 !! options
20952 parsoid=wt2html,wt2wt,html2html
20953 !! wikitext
20954 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20955 !! html/php
20956 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20957 </p>
20958 !! html/parsoid
20959 <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>
20960 !! end
20961
20962 !! test
20963 HTML Hex character encoding bogus encoding (T28437 regression check)
20964 !! wikitext
20965 &#xsee;&#XSEE;
20966 !! html
20967 <p>&amp;#xsee;&amp;#XSEE;
20968 </p>
20969 !! end
20970
20971 !! test
20972 HTML Hex character encoding mixed case
20973 !! options
20974 parsoid=wt2html,wt2wt,html2html
20975 !! wikitext
20976 &#xEE;&#Xee;
20977 !! html/php
20978 <p>&#xee;&#xee;
20979 </p>
20980 !! html/parsoid
20981 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20982 !! end
20983
20984 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20985 # Note that U+000C (form feed) is not a valid XML character, so
20986 # it is banned even though allowed in HTML5.
20987 !! test
20988 Illegal character references (T106578)
20989 !! wikitext
20990 ; Null: &#00;
20991 ; FF: &#xC;
20992 ; CR: &#xD;
20993 ; Control (low): &#8;
20994 ; Control (high): &#x7F; &#x9F;
20995 ; Surrogate: &#xD83D;&#xDCA9;
20996 ; This is an okay astral character: &#x1F4A9;
20997 !! html+tidy
20998 <dl><dt>Null</dt>
20999 <dd>&amp;#00;</dd>
21000 <dt>FF</dt>
21001 <dd>&amp;#xC;</dd>
21002 <dt>CR</dt>
21003 <dd>&amp;#xD;</dd>
21004 <dt>Control (low)</dt>
21005 <dd>&amp;#8;</dd>
21006 <dt>Control (high)</dt>
21007 <dd>&amp;#x7F; &amp;#x9F;</dd>
21008 <dt>Surrogate</dt>
21009 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21010 <dt>This is an okay astral character</dt>
21011 <dd>&#x1f4a9;</dd></dl>
21012 !! end
21013
21014 !! test
21015 __FORCETOC__ override
21016 !! wikitext
21017 __NEWSECTIONLINK__
21018 __FORCETOC__
21019 !! html/php
21020 <p><br />
21021 </p>
21022 !! end
21023
21024 !! test
21025 ISBN code coverage
21026 !! wikitext
21027 ISBN 978-0-1234-56&#x20;789
21028 !! html/php
21029 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21030 </p>
21031 !! html/parsoid
21032 <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>
21033 !! end
21034
21035 !! test
21036 ISBN followed by 5 spaces
21037 !! wikitext
21038 ISBN
21039 !! html
21040 <p>ISBN
21041 </p>
21042 !! end
21043
21044 !! test
21045 Double ISBN
21046 !! wikitext
21047 ISBN ISBN 1234567890
21048 !! html/php
21049 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21050 </p>
21051 !! html/parsoid
21052 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21053 !! end
21054
21055 # Uppercase X and lowercase x as well
21056 !! test
21057 ISBN with an X
21058 !! wikitext
21059 ISBN 3-462-04561-X
21060 ISBN 3-462-04561-x
21061 ISBN 080442957X
21062 ISBN 080442957x
21063 ISBN 978080442957X
21064 ISBN 978080442957x
21065 !! html/php
21066 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21067 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21068 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21069 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21070 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21071 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21072 </p>
21073 !! html/parsoid
21074 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21075 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21076 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21077 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21078 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21079 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21080 !! end
21081
21082 !! test
21083 ISBN with empty prefix (parsoid test)
21084 !! wikitext
21085 ISBN 1234567890
21086 !! html/php
21087 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21088 </p>
21089 !! html/parsoid
21090 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21091 !! end
21092
21093 !! test
21094 T24905: <abbr> followed by ISBN followed by </a>
21095 !! wikitext
21096 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21097 !! html/php
21098 <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>
21099 </p>
21100 !! html/parsoid
21101 <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>
21102 !! end
21103
21104 !! test
21105 Double RFC
21106 !! wikitext
21107 RFC RFC 1234
21108 !! html
21109 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21110 </p>
21111 !! end
21112
21113 !! test
21114 Double RFC with a wiki link
21115 !! wikitext
21116 RFC [[RFC 1234]]
21117 !! html
21118 <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>
21119 </p>
21120 !! end
21121
21122 !! test
21123 RFC code coverage
21124 !! wikitext
21125 RFC 983&#x20;987
21126 !! html/php
21127 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21128 </p>
21129 !! html/parsoid
21130 <p><a href="https://tools.ietf.org/html/rfc983" rel="mw:ExtLink" class="external text" data-parsoid='{"stx":"magiclink"}'>RFC 983</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>987</p>
21131 !! end
21132
21133 !! test
21134 Centre-aligned image
21135 !! wikitext
21136 [[Image:foobar.jpg|centre]]
21137 !! html/php
21138 <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>
21139
21140 !! html/parsoid
21141 <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>
21142 !! end
21143
21144 !! test
21145 None-aligned image
21146 !! wikitext
21147 [[Image:foobar.jpg|none]]
21148 !! html/php
21149 <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>
21150
21151 !! html/parsoid
21152 <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>
21153 !! end
21154
21155 !! test
21156 Width + Height sized image (using px) (height is ignored)
21157 !! wikitext
21158 [[Image:foobar.jpg|640x480px]]
21159 !! html/php
21160 <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>
21161 </p>
21162 !! html/parsoid
21163 <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>
21164 !! end
21165
21166 !! test
21167 Width-sized image (using px, no following whitespace)
21168 !! wikitext
21169 [[Image:foobar.jpg|640px]]
21170 !! html/php
21171 <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>
21172 </p>
21173 !! html/parsoid
21174 <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>
21175 !! end
21176
21177 !! test
21178 Width-sized image (using px, with following whitespace - test regression from r39467)
21179 !! wikitext
21180 [[Image:foobar.jpg|640px ]]
21181 !! html/php
21182 <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>
21183 </p>
21184 !! html/parsoid
21185 <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>
21186 !!end
21187
21188 !! test
21189 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21190 !! wikitext
21191 [[Image:foobar.jpg| 640px]]
21192 !! html/php
21193 <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>
21194 </p>
21195 !! html/parsoid
21196 <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>
21197 !! end
21198
21199 !! test
21200 Image with page parameter
21201 !! options
21202 djvu
21203 !! wikitext
21204 [[File:LoremIpsum.djvu|page=2]]
21205 !! html/php
21206 <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>
21207 </p>
21208 !! html/parsoid
21209 <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>
21210 !! end
21211
21212 !! test
21213 Another italics / bold test
21214 !! wikitext
21215 ''' ''x'
21216 !! html
21217 <pre>'<i> </i>x'
21218 </pre>
21219 !!end
21220
21221 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21222 !! test
21223 dt/dd/dl test
21224 !! wikitext
21225 :;;;::
21226 !! html/php
21227 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21228
21229 !! html/parsoid
21230 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21231
21232 !!end
21233
21234 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21235 !! test
21236 Images with the "|" character in the comment
21237 !! wikitext
21238 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21239 !! html/php
21240 <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>
21241
21242 !! html/parsoid
21243 <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>
21244 !! end
21245
21246 !! test
21247 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21248 !! wikitext
21249 <html><script>alert(1);</script></html>
21250 !! html
21251 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21252 </p>
21253 !! end
21254
21255 !! test
21256 HTML with raw HTML ($wgRawHtml==true)
21257 !! options
21258 wgRawHtml=1
21259 !! wikitext
21260 <html><script>alert(1);</script></html>
21261 !! html/php
21262 <p><script>alert(1);</script>
21263 </p>
21264 !! end
21265
21266 !! test
21267 Parents of subpages, one level up
21268 !! options
21269 subpage title=[[Subpage test/L1/L2/L3]]
21270 !! wikitext
21271 [[../|L2]]
21272 !! html
21273 <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>
21274 </p>
21275 !! end
21276
21277
21278 !! test
21279 Parents of subpages, one level up, not named
21280 !! options
21281 subpage title=[[Subpage test/L1/L2/L3]]
21282 !! wikitext
21283 [[../]]
21284 !! html
21285 <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>
21286 </p>
21287 !! end
21288
21289
21290
21291 !! test
21292 Parents of subpages, two levels up
21293 !! options
21294 subpage title=[[Subpage test/L1/L2/L3]]
21295 !! wikitext
21296 [[../../|L1]]2
21297
21298 [[../../|L1]]l
21299 !! html
21300 <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
21301 </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>
21302 </p>
21303 !! end
21304
21305 !! test
21306 Parents of subpages, two levels up, without trailing slash or name.
21307 !! options
21308 subpage title=[[Subpage test/L1/L2/L3]]
21309 !! wikitext
21310 [[../..]]
21311 !! html
21312 <p>[[../..]]
21313 </p>
21314 !! end
21315
21316 !! test
21317 Parents of subpages, two levels up, with lots of extra trailing slashes.
21318 !! options
21319 subpage title=[[Subpage test/L1/L2/L3]]
21320 !! wikitext
21321 [[../../////]]
21322 !! html
21323 <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>
21324 </p>
21325 !! end
21326
21327 !! article
21328 Subpage test/L1/L2/L3Sibling
21329 !! text
21330 Sibling article
21331 !! endarticle
21332
21333 !! test
21334 Transclusion of a sibling page (one level up)
21335 !! options
21336 subpage title=[[Subpage test/L1/L2/L3]]
21337 !! wikitext
21338 {{../L3Sibling}}
21339 !! html
21340 <p>Sibling article
21341 </p>
21342 !! end
21343
21344 !! test
21345 Transclusion of a child page
21346 !! options
21347 subpage title=[[Subpage test/L1/L2]]
21348 !! wikitext
21349 {{/L3Sibling}}
21350 !! html
21351 <p>Sibling article
21352 </p>
21353 !! end
21354
21355 # This is wt2html only in Parsoid because we add <nowiki>
21356 # because of {{..}} and we don't expect to fix that to
21357 # eliminate the nowikis selective for {{..}} markup.
21358 !! test
21359 Non-transclusion because of too many up levels
21360 !! options
21361 subpage title=[[Subpage test/L1/L2/L3]]
21362 parsoid=wt2html
21363 !! wikitext
21364 {{../../../../More than parent}}
21365 !! html/php
21366 <p>{{../../../../More than parent}}
21367 </p>
21368 !! html/parsoid
21369 <p>{{../../../../More than parent}}</p>
21370 !! end
21371
21372 !! test
21373 Definition list code coverage
21374 !! wikitext
21375 ;title : def
21376 ;title : def
21377 ;title: def
21378 !! html/php
21379 <dl><dt>title &#160;</dt>
21380 <dd>def</dd>
21381 <dt>title&#160;</dt>
21382 <dd>def</dd>
21383 <dt>title</dt>
21384 <dd>def</dd></dl>
21385
21386 !! html/parsoid
21387 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21388 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21389 <dt>title</dt><dd> def</dd></dl>
21390 !! end
21391
21392 !! test
21393 Don't fall for the self-closing div
21394 !! wikitext
21395 <div>hello world</div/>
21396 !! html
21397 <div>hello world</div>
21398
21399 !! end
21400
21401 !! test
21402 MSGNW magic word
21403 !! wikitext
21404 {{MSGNW:msg}}
21405 !! html/php
21406 <p>&#91;&#91;:Template:Msg&#93;&#93;
21407 </p>
21408 !! end
21409
21410 !! test
21411 RAW magic word
21412 !! wikitext
21413 {{RAW:QUERTY}}
21414 !! html
21415 <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>
21416 </p>
21417 !! end
21418
21419 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21420 !! test
21421 Always escape literal '>' in output, not just after '<'
21422 !! wikitext
21423 ><>
21424 !! html
21425 <p>&gt;&lt;&gt;
21426 </p>
21427 !! end
21428
21429 !! test
21430 Template caching
21431 !! wikitext
21432 {{Test}}
21433 {{Test}}
21434 !! html
21435 <p>This is a test template
21436 This is a test template
21437 </p>
21438 !! end
21439
21440
21441 !! article
21442 MediaWiki:Fake
21443 !! text
21444 ==header==
21445 !! endarticle
21446
21447 !! test
21448 Inclusion of !userCanEdit() content
21449 !! wikitext
21450 {{MediaWiki:Fake}}
21451 !! html
21452 <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>
21453
21454 !! end
21455
21456
21457 !! test
21458 Out-of-order TOC heading levels
21459 !! wikitext
21460 ==2==
21461 ======6======
21462 ===3===
21463 =1=
21464 =====5=====
21465 ==2==
21466 !! html
21467 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21468 <ul>
21469 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21470 <ul>
21471 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21472 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21473 </ul>
21474 </li>
21475 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21476 <ul>
21477 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21478 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21479 </ul>
21480 </li>
21481 </ul>
21482 </div>
21483
21484 <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>
21485 <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>
21486 <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>
21487 <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>
21488 <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>
21489 <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>
21490
21491 !! end
21492
21493
21494 !! test
21495 ISBN with a dummy number
21496 !! wikitext
21497 ISBN ---
21498 !! html
21499 <p>ISBN ---
21500 </p>
21501 !! end
21502
21503
21504 !! test
21505 ISBN with space-delimited number
21506 !! wikitext
21507 ISBN 92 9017 032 8
21508 !! html/php
21509 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21510 </p>
21511 !! html/parsoid
21512 <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>
21513 !! end
21514
21515
21516 !! test
21517 ISBN with multiple spaces, no number
21518 !! wikitext
21519 ISBN foo
21520 !! html
21521 <p>ISBN foo
21522 </p>
21523 !! end
21524
21525
21526 !! test
21527 ISBN length
21528 !! wikitext
21529 ISBN 123456789
21530
21531 ISBN 1234567890
21532
21533 ISBN 12345678901
21534 !! html/php
21535 <p>ISBN 123456789
21536 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21537 </p><p>ISBN 12345678901
21538 </p>
21539 !! html/parsoid
21540 <p>ISBN 123456789</p>
21541
21542 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21543
21544 <p>ISBN 12345678901</p>
21545 !! end
21546
21547
21548 !! test
21549 ISBN with trailing year (T9110)
21550 !! wikitext
21551 ISBN 1-234-56789-0 - 2006
21552
21553 ISBN 1 234 56789 0 - 2006
21554 !! html/php
21555 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21556 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21557 </p>
21558 !! html/parsoid
21559 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21560
21561 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21562 !! end
21563
21564
21565 !! test
21566 anchorencode
21567 !! config
21568 wgFragmentMode=[ 'html5', 'legacy' ]
21569 !! wikitext
21570 {{anchorencode:foo bar©#%n}}
21571 !! html/php
21572 <p>foo_bar©#%n
21573 </p>
21574 !! html/parsoid
21575 <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>
21576 !! end
21577
21578 !! test
21579 anchorencode (legacy)
21580 !! config
21581 wgFragmentMode=[ 'legacy' ]
21582 !! wikitext
21583 {{anchorencode:foo bar©#%n}}
21584 !! html/php
21585 <p>foo_bar.C2.A9.23.25n
21586 </p>
21587 !! end
21588
21589 !! test
21590 anchorencode trims spaces
21591 !! config
21592 wgFragmentMode=[ 'html5', 'legacy' ]
21593 !! wikitext
21594 {{anchorencode: __pretty__please__}}
21595 !! html/php
21596 <p>pretty_please
21597 </p>
21598 !! html/parsoid
21599 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21600 !! end
21601
21602 !! test
21603 anchorencode deals with links
21604 !! config
21605 wgFragmentMode=[ 'html5', 'legacy' ]
21606 !! wikitext
21607 {{anchorencode: [[hello|world]] [[hi]]}}
21608 !! html/php
21609 <p>world_hi
21610 </p>
21611 !! html/parsoid
21612 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21613 !! end
21614
21615 !! test
21616 anchorencode deals with templates
21617 !! config
21618 wgFragmentMode=[ 'html5', 'legacy' ]
21619 !! wikitext
21620 {{anchorencode: {{Foo}} x}}
21621 !! html/php
21622 <p>FOO_x
21623 </p>
21624 !! html/parsoid
21625 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21626 !! end
21627
21628 !! test
21629 anchorencode encodes like the TOC generator: (T20431)
21630 !! config
21631 wgFragmentMode=[ 'html5', 'legacy' ]
21632 !! wikitext
21633 ===_ +:.3A%3A _ &&amp;]] x===
21634 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21635 __NOEDITSECTION__
21636 !! html/php
21637 <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>
21638 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21639 </p>
21640 !! html/parsoid
21641 <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>
21642 <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>
21643 <meta property="mw:PageProp/noeditsection"/>
21644 !! end
21645
21646 !! test
21647 anchorencode encodes like the TOC generator: (T20431) (legacy)
21648 !! config
21649 wgFragmentMode=[ 'legacy' ]
21650 !! wikitext
21651 ===_ +:.3A%3A&&amp;]]===
21652 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21653 __NOEDITSECTION__
21654 !! html/php
21655 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21656 <p>.2B:.3A.253A.26.26.5D.5D
21657 </p>
21658 !! end
21659
21660 !! test
21661 T8200: blockquotes and paragraph formatting
21662 !! wikitext
21663 <blockquote>
21664 foo
21665 </blockquote>
21666
21667 bar
21668
21669 baz
21670 !! html
21671 <blockquote>
21672 <p>foo
21673 </p>
21674 </blockquote>
21675 <p>bar
21676 </p>
21677 <pre>baz
21678 </pre>
21679 !! end
21680
21681 !! test
21682 T10293: Use of center tag ruins paragraph formatting
21683 !! wikitext
21684 <center>
21685 foo
21686 </center>
21687
21688 bar
21689
21690 baz
21691 !! html
21692 <center>
21693 <p>foo
21694 </p>
21695 </center>
21696 <p>bar
21697 </p>
21698 <pre>baz
21699 </pre>
21700 !! end
21701
21702 !!test
21703 Parsing of overlapping (improperly nested) inline html tags
21704 !! wikitext
21705 <span><s>x</span></s>
21706 !! html/php
21707 <p><span><s>x&lt;/span&gt;</s></span>
21708 </p>
21709 !! html/parsoid
21710 <p><span><s>x</s></span>
21711 </p>
21712 !!end
21713
21714 ###
21715 ### Language variants related tests
21716 ###
21717
21718 # Parsoid does not mark self-links.
21719 # Parsoid does not convert links; PHP will do any necessary redirects.
21720
21721 !! test
21722 Self-link in language variants
21723 !! options
21724 title=[[Dunav]] language=sr
21725 !! wikitext
21726 Both [[Dunav]] and [[Дунав]] are names for this river.
21727 !! html/php
21728 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21729 </p>
21730 !! html/parsoid
21731 <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>
21732 !! end
21733
21734 !! article
21735 Дуна
21736 !! text
21737 content
21738 !! endarticle
21739
21740 !! test
21741 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21742 !! options
21743 title=[[Duna]] language=sr
21744 !! wikitext
21745 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21746 !! html/php
21747 <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.
21748 </p>
21749 !! html/parsoid
21750 <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>
21751 !! end
21752
21753 !! test
21754 Link to a section of a variant of this title shouldn't be parsed as self-link
21755 !! options
21756 title=[[Duna]] language=sr
21757 !! wikitext
21758 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21759 !! html/php
21760 <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.
21761 </p>
21762 !! html/parsoid
21763 <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>
21764 !! end
21765
21766 !! test
21767 Link to pages in language variants
21768 !! options
21769 language=sr
21770 !! wikitext
21771 Main Page can be written as [[Маин Паге]]
21772 !! html/php
21773 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21774 </p>
21775 !! html/parsoid
21776 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21777 !! end
21778
21779
21780 !! test
21781 Multiple links to pages in language variants
21782 !! options
21783 language=sr
21784 !! wikitext
21785 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21786 !! html/php
21787 <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>.
21788 </p>
21789 !! html/parsoid
21790 <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>
21791 !! end
21792
21793
21794 !! test
21795 Simple template in language variants
21796 !! options
21797 language=sr
21798 !! wikitext
21799 {{тест}}
21800 !! html/php
21801 <p>This is a test template
21802 </p>
21803 !! end
21804
21805
21806 !! test
21807 Template with explicit namespace in language variants
21808 !! options
21809 language=sr
21810 !! wikitext
21811 {{Template:тест}}
21812 !! html/php
21813 <p>This is a test template
21814 </p>
21815 !! end
21816
21817
21818 !! test
21819 Basic test for template parameter in language variants
21820 !! options
21821 language=sr
21822 !! wikitext
21823 {{парамтест|param=foo}}
21824 !! html/php
21825 <p>This is a test template with parameter foo
21826 </p>
21827 !! end
21828
21829 !! test
21830 Simple category in language variants
21831 !! options
21832 language=sr cat
21833 !! wikitext
21834 [[Category:МедиаWики Усер'с Гуиде]]
21835 !! html/php
21836 cat=МедиаWики_Усер'с_Гуиде sort=
21837 !! html/parsoid
21838 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21839 !! end
21840
21841 !! article
21842 Category:分类
21843 !! text
21844 blah
21845 !! endarticle
21846
21847 !! article
21848 Category:分類
21849 !! text
21850 blah
21851 !! endarticle
21852
21853 ## We used to, but no longer wt2wt this test since the default serializer
21854 ## will normalize all categories to serialize on their own line.
21855 ## This wikitext usage is going to be fairly uncommon in production and
21856 ## selser will take care of preserving formatting in those scenarios.
21857 !! test
21858 Don't convert blue categorylinks to another variant (T35210)
21859 !! options
21860 cat
21861 language=zh
21862 parsoid=wt2html
21863 !! wikitext
21864 [[A]][[Category:分类]]
21865 !! html/php
21866 cat=分类 sort=
21867 !! html/parsoid
21868 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21869 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21870 !! end
21871
21872 !! test
21873 Stripping -{}- tags (language variants)
21874 !! options
21875 language=sr
21876 !! wikitext
21877 Latin proverb: -{Ne nuntium necare}-
21878 !! html/php
21879 <p>Latin proverb: Ne nuntium necare
21880 </p>
21881 !! html/parsoid
21882 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21883 !! end
21884
21885
21886 !! test
21887 Prevent conversion with -{}- tags (language variants)
21888 !! options
21889 language=sr variant=sr-ec
21890 !! wikitext
21891 Latinski: -{Ne nuntium necare}-
21892 !! html/php
21893 <p>Латински: Ne nuntium necare
21894 </p>
21895 !! html/parsoid
21896 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21897 !! end
21898
21899
21900 !! test
21901 Prevent conversion of text with -{}- tags (language variants)
21902 !! options
21903 language=sr variant=sr-ec
21904 !! wikitext
21905 Latinski: -{Ne nuntium necare}-
21906 !! html/php
21907 <p>Латински: Ne nuntium necare
21908 </p>
21909 !! html/parsoid
21910 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21911 !! end
21912
21913
21914 !! test
21915 Prevent conversion of links with -{}- tags (language variants)
21916 !! options
21917 language=sr variant=sr-ec
21918 !! wikitext
21919 -{[[Main Page]]}-
21920 !! html/php
21921 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21922 </p>
21923 !! html/parsoid
21924 <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>
21925 !! end
21926
21927
21928 !! test
21929 -{}- tags within headlines (within html for parserConvert())
21930 !! config
21931 wgFragmentMode=[ 'html5', 'legacy' ]
21932 !! options
21933 language=sr variant=sr-ec
21934 !! wikitext
21935 ==-{Naslov}-==
21936
21937 Note that even an unprotected headline ID is not affected by language
21938 conversion:
21939
21940 ==Latinski==
21941 !! html/php
21942 <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>
21943 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21944 цонверсион:
21945 </p>
21946 <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>
21947
21948 !! html/parsoid
21949 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21950
21951 <p>Note that even an unprotected headline ID is not affected by language
21952 conversion:</p>
21953
21954 <h2 id="Latinski">Latinski</h2>
21955 !! end
21956
21957 !! test
21958 Explicit definition of language variant alternatives
21959 !! options
21960 language=zh variant=zh-tw
21961 !! wikitext
21962 -{zh:China;zh-tw:Taiwan}-, not China
21963 !! html/php
21964 <p>Taiwan, not China
21965 </p>
21966 !! html/parsoid
21967 <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>
21968 !! end
21969
21970 !! test
21971 Filter syntax for language variants
21972 !! options
21973 language=zh variant=zh-tw
21974 !! wikitext
21975 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21976 !! html/php
21977 <p>fooblog, WEBJOURNAL, WEBLOGquux
21978 </p>
21979 !! html/parsoid
21980 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21981 !! end
21982
21983 # Note that Parsoid post-processing for language variants needs to
21984 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21985 !! test
21986 Conversion around HTML tags
21987 !! options
21988 language=sr variant=sr-ec
21989 !! wikitext
21990 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21991 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21992 !! html/php
21993 <p>
21994 <span title="ЛаCтин">ски</span>
21995 </p>
21996 !! html/parsoid
21997 <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"}]}'/>
21998 <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>
21999 !! end
22000
22001 !! test
22002 Explicit session-wise two-way language variant mapping (A flag and - flag)
22003 !! options
22004 language=zh variant=zh-tw
22005 !! wikitext
22006 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22007
22008 Taiwan is not China.
22009
22010 But -{A|zh:China; zh-tw:Taiwan}- is China,
22011
22012 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22013
22014 and -{China}- is China.
22015 !! html/php
22016 <p>This is Taiwan, but we'll forget that now.
22017 </p><p>Taiwan is not China.
22018 </p><p>But Taiwan is Taiwan,
22019 </p><p>(This should be stripped!)
22020 </p><p>and China is China.
22021 </p>
22022 !! html/parsoid
22023 <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>
22024 <p>Taiwan is not China.</p>
22025 <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>
22026 <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>
22027 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22028 !! end
22029
22030 !! test
22031 Explicit session-wise one-way language variant mapping (A flag and - flag)
22032 !! options
22033 language=zh variant=zh-tw
22034 !! wikitext
22035 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22036
22037 COUNTRY is China or Taiwan.
22038
22039 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22040
22041 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22042
22043 and -{COUNTRY}- is COUNTRY.
22044 !! html/php
22045 <p>This is Taiwan, but we'll forget that now.
22046 </p><p>COUNTRY is China or Taiwan.
22047 </p><p>But Taiwan is Taiwan,
22048 </p><p>(This should be stripped!)
22049 </p><p>and COUNTRY is COUNTRY.
22050 </p>
22051 !! html/parsoid
22052 <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>
22053 <p>COUNTRY is China or Taiwan.</p>
22054 <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>
22055 <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>
22056 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22057 !! end
22058
22059 !! test
22060 Explicit session-wise two-way language variant mapping (H flag for hide)
22061 !! options
22062 language=zh variant=zh-tw
22063 !! wikitext
22064 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22065
22066 Taiwan is China.
22067 !! html/php
22068 <p>(This should be stripped!)
22069 </p><p>Taiwan is Taiwan.
22070 </p>
22071 !! html/parsoid
22072 <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>
22073 <p>Taiwan is China.</p>
22074 !! end
22075
22076 !! test
22077 Explicit session-wise one-way language variant mapping (H flag for hide)
22078 !! options
22079 language=zh variant=zh-tw
22080 !! wikitext
22081 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22082
22083 COUNTRY is Taiwan or China.
22084 !! html/php
22085 <p>(This should be stripped!)
22086 </p><p>Taiwan is Taiwan or China.
22087 </p>
22088 !! html/parsoid
22089 <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>
22090 <p>COUNTRY is Taiwan or China.</p>
22091 !! end
22092
22093 ## Note that parsoid test runner does not support 'showtitle' option.
22094 !! test
22095 Adding explicit conversion rule for title (T flag)
22096 !! options
22097 language=zh variant=zh-tw showtitle
22098 !! wikitext
22099 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22100
22101 Taiwan is China.
22102 !! html/php
22103 Taiwan
22104 <p>Should be stripped!
22105 </p><p>Taiwan is China.
22106 </p>
22107 !! html/parsoid
22108 <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>
22109 <p>Taiwan is China.</p>
22110 !! end
22111
22112 !! test
22113 Code coverage: T combined with H flag
22114 !! options
22115 language=zh variant=zh-tw showtitle
22116 !! wikitext
22117 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22118
22119 Taiwan is China.
22120 !! html/php
22121 Taiwan
22122 <p>Should be stripped!
22123 </p><p>Taiwan is Taiwan.
22124 </p>
22125 !! html/parsoid
22126 <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>
22127 <p>Taiwan is China.</p>
22128 !! end
22129
22130 !! test
22131 Code coverage: T with no variants
22132 !! options
22133 language=zh variant=zh-tw showtitle
22134 !! wikitext
22135 -{H|zh:China; zh-tw:Taiwan}-
22136 Taiwan is China.-{T|Taiwan is China}-
22137 !! html/php
22138 Taiwan is China
22139 <p>
22140 Taiwan is Taiwan.
22141 </p>
22142 !! html/parsoid
22143 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22144 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22145 !! end
22146
22147 !! test
22148 Code coverage: rules with no variants
22149 !! options
22150 language=zh variant=zh-tw
22151 !! wikitext
22152 -{H|zh:China; zh-tw:Taiwan}-
22153 Taiwan is China.
22154 -{H|China}-
22155 Taiwan is China.
22156 !! html/php
22157 <p>
22158 Taiwan is Taiwan.
22159
22160 Taiwan is China.
22161 </p>
22162 !! html/parsoid
22163 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22164 Taiwan is China.
22165 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22166 Taiwan is China.</p>
22167 !! end
22168
22169
22170 !! test
22171 Code coverage: D flag for conversion rule
22172 !! options
22173 language=zh variant=zh-tw
22174 !! wikitext
22175 -{D|zh-cn:XA; zh-tw:YA}-
22176 -{A;D|zh-cn:XB; zh-tw:YB}-
22177 -{D;H|zh-cn:XC; zh-tw:YC}-
22178
22179 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22180
22181 -{D|0=>zh-tw:1}-
22182 -{A;D|2=>zh-tw:3}-
22183 -{D;H|4=>zh-tw:5}-
22184
22185 XA XB XC YA YB YC FOO BAR BAT 012345
22186 !! html/php
22187 <p>大陆:XA;台灣:YA;
22188
22189 大陆:XC;台灣:YC;
22190 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22191 </p><p>0⇒台灣:1;
22192
22193 4⇒台灣:5;
22194 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22195 </p>
22196 !! html/parsoid
22197 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22198 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22199 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22200 <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>
22201 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22202 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22203 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22204 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22205 !! end
22206
22207 !! test
22208 Code coverage: N flag for conversion rule
22209 !! options
22210 language=zh variant=zh-cn
22211 !! wikitext
22212 -{N|zh-cn}-
22213
22214 -{N|zh-tw}-
22215
22216 -{N|sr-ec}-
22217 !! html/php
22218 <p>大陆
22219 </p><p>台灣
22220 </p><p>српски (ћирилица)‎
22221 </p>
22222 !! html/parsoid
22223 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22224 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22225 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22226 !! end
22227
22228 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22229 !! test
22230 Code coverage: N flag for conversion rule (wt2html only)
22231 !! options
22232 language=zh variant=zh-cn
22233 parsoid=wt2html,html2html
22234 !! wikitext
22235 -{D;N|en}-
22236 !! html/php
22237 <p>English
22238 </p>
22239 !! html/parsoid
22240 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22241 !! end
22242
22243 !! test
22244 Testing that changing the language variant here in the tests actually works
22245 !! options
22246 language=zh variant=zh showtitle
22247 !! wikitext
22248 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22249 !! html/php
22250 China
22251 <p>Should be stripped!
22252 </p>
22253 !! html/parsoid
22254 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22255 !! end
22256
22257 !! test
22258 Recursive conversion of alt and title attrs shouldn't clear converter state
22259 !! options
22260 language=zh variant=zh-cn
22261 showtitle
22262 !! wikitext
22263 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22264 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22265 !! html/php
22266 China
22267 <p>
22268 Should be stripped<span title="Exclamation">!</span>
22269 </p>
22270 !! html/parsoid
22271 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22272 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>
22273 !! end
22274
22275 !! test
22276 T26072: more test on conversion rule for title
22277 !! options
22278 language=zh variant=zh-tw showtitle
22279 !! wikitext
22280 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22281
22282 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22283 !! html/php
22284 Taiwan
22285 <p>This should be stripped!
22286 </p><p>This won't take interferes with the title rule.
22287 </p>
22288 !! html/parsoid
22289 <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>
22290 <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>
22291 !! end
22292
22293 !! test
22294 Partly disable title conversion if variant == main language code
22295 !! options
22296 language=zh variant=zh title=[[ZH]] showtitle
22297 !! wikitext
22298 -{T|zh-cn:CN;zh-tw:TW}-
22299 !! html/php
22300 ZH
22301 <p>
22302 </p>
22303 !! html/parsoid
22304 <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>
22305 !! end
22306
22307 !! test
22308 Partly disable title conversion if variant == main language code, more
22309 !! options
22310 language=zh variant=zh title=[[ZH]] showtitle
22311 !! wikitext
22312 -{T|TW}-
22313 !! html/php
22314 ZH
22315 <p>
22316 </p>
22317 !! html/parsoid
22318 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22319 !! end
22320
22321 !! test
22322 Raw output of variant escape tags (R flag)
22323 !! options
22324 language=zh variant=zh-tw
22325 !! wikitext
22326 Raw: -{R|zh:China;zh-tw:Taiwan}-
22327 !! html/php
22328 <p>Raw: zh:China;zh-tw:Taiwan
22329 </p>
22330 !! html/parsoid
22331 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22332 !! end
22333
22334 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22335 !! test
22336 Raw output of variant escape tags (R flag) (wt2html only)
22337 !! options
22338 language=zh variant=zh-tw
22339 parsoid=wt2html,html2html
22340 !! wikitext
22341 -{Variant}- -{D|syntax}- -{D;R|options}-
22342 !! html/php
22343 <p>Variant syntax options
22344 </p>
22345 !! html/parsoid
22346 <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>
22347 !! end
22348
22349 !! test
22350 Nested markup inside raw output of variant escape tags (R flag)
22351 !! options
22352 language=zh variant=zh-tw
22353 !! wikitext
22354 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22355 !! html/php
22356 <p>Nested raw: nested Taiwan nested
22357 </p>
22358 !! html/parsoid
22359 <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>
22360 !! end
22361
22362 !! test
22363 Nested markup and spaces inside raw output of variant escape tags (R flag)
22364 !! options
22365 language=zh variant=zh-tw
22366 !! wikitext
22367 X-{ outer -{ inner }- outer }-X
22368 !! html/php
22369 <p>X outer inner outer X
22370 </p>
22371 !! html/parsoid
22372 <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>
22373 !! end
22374
22375 !! test
22376 Templates inside raw output of variant escape tags (R flag)
22377 !! options
22378 language=zh variant=zh-tw
22379 !! wikitext
22380 Nested raw: -{R|nested {{echo|hi}} templates}-
22381 !! html/php
22382 <p>Nested raw: nested hi templates
22383 </p>
22384 !! html/parsoid
22385 <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>
22386 !! end
22387
22388 !! test
22389 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22390 !! options
22391 language=zh variant=zh-cn
22392 !! wikitext
22393 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22394 !! html/php
22395 <p>0
22396 </p>
22397 !! html/parsoid
22398 <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>
22399 !! end
22400
22401 !! test
22402 Conversion rules from [numeric-only string] to [something else] (T48634)
22403 !! options
22404 language=zh variant=zh-cn
22405 !! wikitext
22406 -{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
22407 !! html/php
22408 <p>D12345EE12345
22409 </p>
22410 !! html/parsoid
22411 <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>
22412 !! end
22413
22414 !! test
22415 Two-way converter rule entries with an empty value should be ignored (T53551)
22416 !! options
22417 language=zh variant=zh-cn
22418 !! wikitext
22419 -{H|zh-cn:foo;zh-tw:;}-foobar
22420 !! html/php
22421 <p>foobar
22422 </p>
22423 !! html/parsoid
22424 <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>
22425 !! end
22426
22427 !! test
22428 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22429 !! options
22430 language=zh variant=zh-cn
22431 !! wikitext
22432 -{H|=>zh-cn:foo;}-foobar
22433 !! html/php
22434 <p>foobar
22435 </p>
22436 !! html/parsoid
22437 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22438 !! end
22439
22440 !! test
22441 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22442 !! options
22443 language=zh variant=zh-cn
22444 !! wikitext
22445 -{H|}-foobar
22446 !! html/php
22447 <p>foobar
22448 </p>
22449 !! html/parsoid
22450 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22451 !! end
22452
22453 !! test
22454 Nested using of manual convert syntax
22455 !! options
22456 language=zh variant=zh-hk
22457 !! wikitext
22458 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22459 !! html/php
22460 <p>Nested: Hello Hong Kong!
22461 </p>
22462 !! html/parsoid
22463 <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>
22464 !! end
22465
22466 !! test
22467 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22468 !! options
22469 language=zh variant=zh-cn
22470 !! wikitext
22471 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22472 !! html/php
22473 <p><span title="X">A</span>
22474 </p>
22475 !! html/parsoid
22476 <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>
22477 !! end
22478
22479 !! test
22480 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22481 !! options
22482 language=zh variant=zh-cn
22483 !! wikitext
22484 -{<span title="-{X}-">A</span>}-
22485 !! html/php+disabled
22486 <p><span title="X">A</span>
22487 </p>
22488 !! html/parsoid
22489 <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>
22490 !! end
22491
22492 # Parsoid and PHP disagree on how to parse this example: Parsoid
22493 # insists that the content of a language converter element be a valid
22494 # DOM fragment or attribute string
22495 !! test
22496 Language converter markup with block content
22497 !! options
22498 language=zh variant=zh-cn
22499 !! wikitext
22500 <span>a-{b<div>c}-d
22501
22502 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22503
22504 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22505 !! html/php+tidy
22506 <span>ab<div>cd
22507 <span>ab<div>cd
22508 <span>ad
22509 </span></div></span></div></span>
22510 !! html/parsoid
22511 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
22512
22513 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
22514
22515 <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=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&#39;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&#39;>c&lt;/div>"}]}'/>d</span></p>
22516 !! end
22517
22518 !! test
22519 LanguageConverter selser (1)
22520 !! options
22521 language=zh variant=zh-cn
22522 parsoid={
22523 "modes": ["wt2wt", "selser"],
22524 "changes": [
22525 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22526 ]
22527 }
22528 !! wikitext
22529 -{raw}-
22530 !! wikitext/edited
22531 -{edited}-
22532 !! end
22533
22534 !! test
22535 LanguageConverter selser (2)
22536 !! options
22537 language=zh variant=zh-cn
22538 parsoid={
22539 "modes": ["wt2wt", "selser"],
22540 "changes": [
22541 ["span[class='x']", "contents", "text", "-{foo}-"],
22542 ["a", "contents", "text", "-{"],
22543 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22544 ]
22545 }
22546 !! wikitext
22547 <span class="x">TEXT1</span>
22548 [http://example.com TEXT2]
22549 [[Foo|TEXT3]]
22550 {{echo|TEXT4}}
22551 !! wikitext/edited
22552 <span class="x"><nowiki>-{foo}-</nowiki></span>
22553 [http://example.com -{]
22554 [[Foo|<nowiki>-{</nowiki>]]
22555 {{1x|<nowiki>-{</nowiki>}}
22556 !! end
22557
22558 # Tests LanguageVariantText in ConstrainedText
22559 !! test
22560 LanguageConverter selser (3)
22561 !! options
22562 language=zh variant=zh-cn
22563 parsoid={
22564 "modes": ["wt2wt", "selser"],
22565 "changes": [
22566 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22567 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22568 ]
22569 }
22570 !! wikitext
22571 {|
22572 |-
22573 |<span>Foo</span>
22574 |}
22575 !! wikitext/edited
22576 {|
22577 |-
22578 |<nowiki/>-{edited}-
22579 |}
22580 !! end
22581
22582 # Tests LanguageVariantText._fromSelSer
22583 !! test
22584 LanguageConverter selser (4)
22585 !! options
22586 language=zh variant=zh-cn
22587 parsoid={
22588 "modes": ["wt2wt", "selser"],
22589 "changes": [
22590 ["td > span.x", "remove"]
22591 ]
22592 }
22593 !! wikitext
22594 {|
22595 |-
22596 |<span class="x">Foo</span>-{Bar}-
22597 ||<span class="x">Foo</span>-{Bar}-
22598 |}
22599 !! wikitext/edited
22600 {|
22601 |-
22602 |<nowiki/>-{Bar}-
22603 ||-{Bar}-
22604 |}
22605 !! end
22606
22607 # Since Parsoid is starting to emit canonical wikitext for links,
22608 # [http://example.com http://example.com] will not RT back to that
22609 # form anymore.
22610 # Parsoid does not language-convert links (it is done in a
22611 # post-processing step)
22612 !! test
22613 Proper conversion of text in external links
22614 !! options
22615 language=sr variant=sr-ec
22616 parsoid=wt2html
22617 !! wikitext
22618 http://www.google.com
22619 gopher://www.google.com
22620 [http://www.google.com http://www.google.com]
22621 [gopher://www.google.com gopher://www.google.com]
22622 [https://www.google.com irc://www.google.com]
22623 [ftp://www.google.com www.google.com/ftp://dir]
22624 [//www.google.com www.google.com]
22625 !! html/php
22626 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22627 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22628 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22629 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22630 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22631 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22632 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22633 </p>
22634 !! html/parsoid
22635 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22636 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22637 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22638 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22639 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22640 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22641 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22642 !! end
22643
22644 !! test
22645 Do not convert roman numbers to language variants
22646 !! options
22647 language=sr variant=sr-ec
22648 !! wikitext
22649 Fridrih IV je car.
22650 !! html/php
22651 <p>Фридрих IV је цар.
22652 </p>
22653 !! html/parsoid
22654 <p>Fridrih IV je car.</p>
22655 !! end
22656
22657 !! test
22658 Unclosed language converter markup "-{"
22659 !! options
22660 language=sr
22661 !! wikitext
22662 -{T|hello
22663 !! html
22664 <p>-{T|hello
22665 </p>
22666 !! end
22667
22668 !! test
22669 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22670 !! options
22671 language=sr
22672 !! wikitext
22673 -{R|=&gt;}-
22674 !! html/php
22675 <p>=&gt;
22676 </p>
22677 !! html/parsoid
22678 <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>
22679 !!end
22680
22681 !! test
22682 Don't break link parsing if language converter markup is in the caption.
22683 !! options
22684 language=sr variant=sr-ec
22685 !! wikitext
22686 [[Main Page|-{R|main page}-]]
22687 !! html/php
22688 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22689 </p>
22690 !! html/parsoid
22691 <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>
22692 !! end
22693
22694 !! test
22695 T146304: Don't break template parsing if language converter markup is in the parameter.
22696 !! options
22697 language=sr variant=sr-ec
22698 !! wikitext
22699 {{echo|-{R|foo}-}}
22700 !! html/php
22701 <p>foo
22702 </p>
22703 !! html/parsoid
22704 <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>
22705 !! end
22706
22707 !! test
22708 T146305: Don't break image parsing if language converter markup is in the caption.
22709 !! options
22710 language=sr
22711 !! wikitext
22712 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22713 !! html/php
22714 <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>
22715
22716 !! html/parsoid
22717 <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>
22718 !! end
22719
22720 !! test
22721 T146305: Don't break image parsing if nested language converter markup is in the caption.
22722 !! options
22723 language=zh variant=zh-cn
22724 !! wikitext
22725 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22726 !! html/php
22727 <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>
22728
22729 !! html/parsoid
22730 <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>
22731 !! end
22732
22733 # XXX html2wt disabled because rich markup in alt is not preserved.
22734 !! test
22735 Don't break gallery if language converter markup is inside.
22736 !! options
22737 language=zh
22738 !! wikitext
22739 <gallery>
22740 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22741 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22742 </gallery>
22743 !! html/php
22744 <ul class="gallery mw-gallery-traditional">
22745 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22746 <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>
22747 <div class="gallerytext">
22748 <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>
22749 </p>
22750 </div>
22751 </div></li>
22752 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22753 <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>
22754 <div class="gallerytext">
22755 <p>This is a test template
22756 </p>
22757 </div>
22758 </div></li>
22759 </ul>
22760
22761 !! html/parsoid
22762 <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"}}'>
22763 <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>
22764 <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>
22765 </ul>
22766 !! end
22767
22768 !! test
22769 T153135: Don't break list handling if language converter markup is in the item.
22770 !! options
22771 language=zh variant=zh-cn
22772 !! wikitext
22773 ;-{zh-cn:AAA;zh-tw:BBB}-
22774 ;-{R|foo:bar}-
22775 !! html/php
22776 <dl><dt>AAA</dt>
22777 <dt>foo:bar</dt></dl>
22778
22779 !! html/parsoid
22780 <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>
22781 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22782 </dl>
22783 !! end
22784
22785 // Note that parsoid does not protect colons unless language converter
22786 // markup is properly nested, because it is a backtracking parser.
22787 !! test
22788 T153135: Unclosed markup in definition list (code coverage)
22789 !! options
22790 language=zh variant=zh-cn
22791 !! wikitext
22792 ;<b>foo:bar
22793 ;-{zh-cn:AAA
22794 !! html/php+tidy
22795 <dl><dt><b>foo:bar</b></dt><b>
22796 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22797 </b></p>
22798 !! html/parsoid
22799 <dl><dt data-parsoid='{"dsr":[0,11,1,0]}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
22800 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22801 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22802 </b></dl>
22803 !! end
22804
22805 !! test
22806 T153135: Nested language converter markup in definition list (code coverage)
22807 !! options
22808 language=zh variant=zh-cn
22809 !! wikitext
22810 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22811 !! html/php
22812 <dl><dt>AAA foo:bar bat:baz</dt>
22813 <dd>def</dd></dl>
22814
22815 !! html/parsoid
22816 <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>
22817 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22818 </dl>
22819 !! end
22820
22821 # html2wt mode disabled due to <nowiki> insertion.
22822 !! test
22823 T153140: Don't break table handling if language converter markup is in the cell.
22824 !! options
22825 language=sr variant=sr-ec
22826 parsoid=wt2html,wt2wt,html2html
22827 !! wikitext
22828 {|
22829 |-
22830 | -{R|B}-
22831 |}
22832 !! html/php
22833 <table>
22834
22835 <tr>
22836 <td>B
22837 </td></tr></table>
22838
22839 !! html/parsoid
22840 <table>
22841 <tbody>
22842 <tr>
22843 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22844 </tr>
22845 </tbody>
22846 </table>
22847 !! end
22848
22849 !! test
22850 Language converter tricky html2wt cases (1)
22851 !! options
22852 language=sr
22853 parsoid=html2wt,wt2wt
22854 !! html/parsoid
22855 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22856 !! wikitext
22857 -{<nowiki>}-</nowiki>}-
22858 !! html/php
22859 <p>&#125;-
22860 </p>
22861 !! end
22862
22863 !! test
22864 Language converter tricky html2wt cases (2)
22865 !! options
22866 language=sr
22867 parsoid=html2wt,wt2wt
22868 !! html/parsoid
22869 <p>-{foo}-</p>
22870 !! wikitext
22871 <nowiki>-{foo}-</nowiki>
22872 !! html/php
22873 <p>-&#123;foo&#125;-
22874 </p>
22875 !! end
22876
22877 !! test
22878 Language converter tricky html2wt cases (3)
22879 !! options
22880 language=sr
22881 parsoid=html2wt,wt2wt
22882 !! html/parsoid
22883 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22884 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22885 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22886 !! wikitext
22887 -{R||}-
22888
22889 -{R|R|raw}-
22890
22891 -{<nowiki>-{foo}-</nowiki>}-
22892 !! html/php
22893 <p>|
22894 </p><p>R|raw
22895 </p><p>-&#123;foo&#125;-
22896 </p>
22897 !! end
22898
22899 !! test
22900 Language converter tricky html2wt cases (4)
22901 !! options
22902 language=sr
22903 parsoid=html2wt,wt2wt
22904 !! html/parsoid
22905 <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>
22906 !! wikitext
22907 -{R|{{echo|hey}}}-
22908 !! html/php
22909 <p>hey
22910 </p>
22911 !! end
22912
22913 # Note that the <nowiki> escaping added by parsoid for source text,
22914 # destination text, and language names only works on the PHP side
22915 # for *destination text*. (HTML entity escaping wouldn't work
22916 # any better.) This is probably a bug, at least for source texts.
22917 # (For language names PHP uses a precise regexp based on the languages
22918 # it currently knows have variants, which is fragile since this set
22919 # can grow/shrink over time.)
22920 !! test
22921 Language converter tricky html2wt cases (5)
22922 !! options
22923 language=zh variant=zh-cn
22924 !! html/parsoid
22925 <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>
22926 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22927 <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>
22928 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22929 <p>a:b=>c xyz</p>
22930 !! wikitext
22931 -{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
22932
22933 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22934
22935 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22936
22937 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22938
22939 a:b=>c xyz
22940 !! html/php+disabled
22941 <p>foobat;xyz=&gt;zh-cn:abc
22942 </p><p>A
22943 </p><p>0;zh-tw:bar
22944 </p><p>abc
22945 </p><p>a:b=&gt;c 0;zh-tw:bar
22946 </p>
22947 !! end
22948
22949 !! test
22950 T179579: Nowiki and lc interaction
22951 !! options
22952 parsoid=wt2html
22953 language=sr
22954 !! wikitext
22955 -{</nowiki>123}-
22956
22957 -{123<nowiki>|</nowiki>456}-
22958 !! html/parsoid
22959 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22960
22961 <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>
22962 !! end
22963
22964 !! test
22965 T2529: Uncovered bullet
22966 !! wikitext
22967 *Foo {{bullet}}
22968 !! html
22969 <ul><li>Foo</li>
22970 <li>Bar</li></ul>
22971
22972 !! end
22973
22974 !! test
22975 T2529: Uncovered bullet in a deeply nested list
22976 !! wikitext
22977 *******Foo {{bullet}}
22978 !! html
22979 <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>
22980 <li>Bar</li></ul>
22981
22982 !! end
22983
22984 !! test
22985 T2529: Uncovered table already at line-start
22986 !! wikitext
22987 x
22988
22989 {{table}}
22990 y
22991 !! html
22992 <p>x
22993 </p>
22994 <table>
22995 <tr>
22996 <td>1</td>
22997 <td>2
22998 </td></tr>
22999 <tr>
23000 <td>3</td>
23001 <td>4
23002 </td></tr></table>
23003 <p>y
23004 </p>
23005 !! end
23006
23007 !! test
23008 T2529: Uncovered bullet in parser function result
23009 !! wikitext
23010 *Foo {{lc:{{bullet}} }}
23011 !! html
23012 <ul><li>Foo</li>
23013 <li>bar</li></ul>
23014
23015 !! end
23016
23017 !! test
23018 T7678: Double-parsed template argument
23019 !! wikitext
23020 {{lc:{{{1}}}|hello}}
23021 !! html
23022 <p>{{{1}}}
23023 </p>
23024 !! end
23025
23026 !! test
23027 T7678: Double-parsed template invocation
23028 !! wikitext
23029 {{lc:{{paramtest {{!}} param = hello }} }}
23030 !! html
23031 <p>{{paramtest | param = hello }}
23032 </p>
23033 !! end
23034
23035 !! test
23036 Case insensitivity of parser functions for non-ASCII characters (T10143)
23037 !! options
23038 language=cs
23039 title=[[Main Page]]
23040 !! wikitext
23041 {{PRVNÍVELKÉ:ěščř}}
23042 {{prvnívelké:ěščř}}
23043 {{PRVNÍMALÉ:ěščř}}
23044 {{prvnímalé:ěščř}}
23045 {{MALÁ:ěščř}}
23046 {{malá:ěščř}}
23047 {{VELKÁ:ěščř}}
23048 {{velká:ěščř}}
23049 !! html
23050 <p>Ěščř
23051 Ěščř
23052 ěščř
23053 ěščř
23054 ěščř
23055 ěščř
23056 ĚŠČŘ
23057 ĚŠČŘ
23058 </p>
23059 !! end
23060
23061 !! test
23062 Morwen/13: Unclosed link followed by heading
23063 !! wikitext
23064 [[link
23065 ==heading==
23066 !! html
23067 <p>[[link
23068 </p>
23069 <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>
23070
23071 !! end
23072
23073 !! test
23074 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23075 !! wikitext
23076 {{foo|
23077 =heading=
23078 !! html
23079 <p>{{foo|
23080 </p>
23081 <h1><span class="mw-headline" id="heading">heading</span></h1>
23082
23083 !! end
23084
23085 !! test
23086 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23087 !! wikitext
23088 {{foo|
23089 ==heading==
23090 !! html
23091 <p>{{foo|
23092 </p>
23093 <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>
23094
23095 !! end
23096
23097 !! test
23098 Tildes in comments
23099 !! options
23100 pst
23101 !! wikitext
23102 <!-- ~~~~ -->
23103 !! html/php
23104 <!-- ~~~~ -->
23105 !! end
23106
23107 !! test
23108 Paragraphs inside divs (no extra line breaks)
23109 !! wikitext
23110 <div>Line one
23111
23112 Line two</div>
23113 !! html
23114 <div>Line one
23115 Line two</div>
23116
23117 !! end
23118
23119 !! test
23120 Paragraphs inside divs (extra line break on open)
23121 !! wikitext
23122 <div>
23123 Line one
23124
23125 Line two</div>
23126 !! html
23127 <div>
23128 <p>Line one
23129 </p>
23130 Line two</div>
23131
23132 !! end
23133
23134 !! test
23135 Paragraphs inside divs (extra line break on close)
23136 !! wikitext
23137 <div>Line one
23138
23139 Line two
23140 </div>
23141 !! html
23142 <div>Line one
23143 <p>Line two
23144 </p>
23145 </div>
23146
23147 !! end
23148
23149 !! test
23150 Paragraphs inside divs (extra line break on open and close)
23151 !! wikitext
23152 <div>
23153 Line one
23154
23155 Line two
23156 </div>
23157 !! html
23158 <div>
23159 <p>Line one
23160 </p><p>Line two
23161 </p>
23162 </div>
23163
23164 !! end
23165
23166 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23167 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23168 !! test
23169 Nesting tags, paragraphs on lines which begin with <div>
23170 !! wikitext
23171 <div></div><strong>A
23172 B</strong>
23173 !! html/php+tidy
23174 <div></div><p><strong>A
23175 </strong></p><strong></strong><p><strong>B</strong>
23176 </p>
23177 !! html/parsoid
23178 <div></div>
23179 <p><strong>A
23180 B</strong>
23181 </p>
23182 !! end
23183
23184 # T8200: <blockquote> should behave like <div> with respect to line breaks
23185 !! test
23186 T8200: paragraphs inside blockquotes (no extra line breaks)
23187 !! wikitext
23188 <blockquote>Line one
23189
23190 Line two</blockquote>
23191 !! html
23192 <blockquote>Line one
23193 Line two</blockquote>
23194
23195 !! html+tidy
23196 <blockquote><p>Line one
23197 Line two</p></blockquote>
23198 !! end
23199
23200 !! test
23201 T8200: paragraphs inside blockquotes (extra line break on open)
23202 !! wikitext
23203 <blockquote>
23204 Line one
23205
23206 Line two</blockquote>
23207 !! html
23208 <blockquote>
23209 <p>Line one
23210 </p>
23211 Line two</blockquote>
23212
23213 !! html+tidy
23214 <blockquote>
23215 <p>Line one
23216 </p><p>
23217 Line two</p></blockquote>
23218 !! end
23219
23220 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23221 !! test
23222 T8200: paragraphs inside blockquotes (extra line break on close)
23223 !! wikitext
23224 <blockquote>Line one
23225
23226 Line two
23227 </blockquote>
23228 !! html
23229 <blockquote>Line one
23230 <p>Line two
23231 </p>
23232 </blockquote>
23233
23234 !! html+tidy
23235 <blockquote><p>Line one
23236 </p><p>Line two
23237 </p>
23238 </blockquote>
23239 !! end
23240
23241 !! test
23242 T8200: paragraphs inside blockquotes (extra line break on open and close)
23243 !! wikitext
23244 <blockquote>
23245 Line one
23246
23247 Line two
23248 </blockquote>
23249 !! html
23250 <blockquote>
23251 <p>Line one
23252 </p><p>Line two
23253 </p>
23254 </blockquote>
23255
23256 !! end
23257
23258 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23259 !! test
23260 Paragraphs inside blockquotes/divs (no extra line breaks)
23261 !! wikitext
23262 <blockquote><div>Line one
23263
23264 Line two</div></blockquote>
23265 !! html
23266 <blockquote><div>Line one
23267 Line two</div></blockquote>
23268
23269 !! end
23270
23271 !! test
23272 Paragraphs inside blockquotes/divs (extra line break on open)
23273 !! wikitext
23274 <blockquote><div>
23275 Line one
23276
23277 Line two</div></blockquote>
23278 !! html
23279 <blockquote><div>
23280 <p>Line one
23281 </p>
23282 Line two</div></blockquote>
23283
23284 !! end
23285
23286 !! test
23287 Paragraphs inside blockquotes/divs (extra line break on close)
23288 !! wikitext
23289 <blockquote><div>Line one
23290
23291 Line two
23292 </div></blockquote>
23293 !! html
23294 <blockquote><div>Line one
23295 <p>Line two
23296 </p>
23297 </div></blockquote>
23298
23299 !! end
23300
23301 !! test
23302 Paragraphs inside blockquotes/divs (extra line break on open and close)
23303 !! wikitext
23304 <blockquote><div>
23305 Line one
23306
23307 Line two
23308 </div></blockquote>
23309 !! html
23310 <blockquote><div>
23311 <p>Line one
23312 </p><p>Line two
23313 </p>
23314 </div></blockquote>
23315
23316 !! end
23317
23318 !! test
23319 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23320 !! options
23321 wgLinkHolderBatchSize=0
23322 !! wikitext
23323 [[meatball:1]]
23324 [[meatball:2]]
23325 [[meatball:3]]
23326 !! html
23327 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23328 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23329 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23330 </p>
23331 !! end
23332
23333 !! test
23334 Free external link invading image caption
23335 !! wikitext
23336 [[Image:Foobar.jpg|thumb|http://x|hello]]
23337 !! html/php
23338 <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>
23339
23340 !! html/parsoid
23341 <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>
23342 !! end
23343
23344 !! test
23345 T17196: localised external link numbers
23346 !! options
23347 language=fa
23348 !! wikitext
23349 [http://en.wikipedia.org/]
23350 !! html/php
23351 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23352 </p>
23353 !! html/parsoid
23354 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23355 !! end
23356
23357 !! test
23358 Multibyte character in padleft
23359 !! wikitext
23360 {{padleft:-Hello|7|Æ}}
23361 !! html/php
23362 <p>Æ-Hello
23363 </p>
23364 !! html/parsoid
23365 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23366 !! end
23367
23368 !! test
23369 Multibyte character in padright
23370 !! wikitext
23371 {{padright:Hello-|7|Æ}}
23372 !! html/php
23373 <p>Hello-Æ
23374 </p>
23375 !! html/parsoid
23376 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23377 !! end
23378
23379 !!test
23380 formatdate parser function
23381 !! wikitext
23382 {{#formatdate:2009-03-24}}
23383 !! html
23384 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23385 </p>
23386 !! end
23387
23388 !!test
23389 formatdate parser function, with default format
23390 !! wikitext
23391 {{#formatdate:2009-03-24|mdy}}
23392 !! html
23393 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23394 </p>
23395 !! end
23396
23397 !! test
23398 Spacing of numbers in formatted dates
23399 !! wikitext
23400 {{#formatdate:January 15}}
23401 !! html
23402 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23403 </p>
23404 !! end
23405
23406 !! test
23407 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
23408 !! options
23409 language=nl title=[[MediaWiki:Common.css]]
23410 !! wikitext
23411 {{#formatdate:2009-03-24|dmy}}
23412 !! html
23413 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23414 </p>
23415 !! end
23416
23417 #
23418 #
23419 #
23420
23421 #
23422 # Edit comments
23423 #
23424
23425 !! test
23426 Edit comment with link
23427 !! options
23428 comment
23429 !! wikitext
23430 I like the [[Main Page]] a lot
23431 !! html/php
23432 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23433 !!end
23434
23435 !! test
23436 Edit comment with link and link text
23437 !! options
23438 comment
23439 !! wikitext
23440 I like the [[Main Page|best pages]] a lot
23441 !! html/php
23442 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23443 !!end
23444
23445 !! test
23446 Edit comment with link and link text with suffix
23447 !! options
23448 comment
23449 !! wikitext
23450 I like the [[Main Page|best page]]s a lot
23451 !! html/php
23452 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23453 !!end
23454
23455 !! test
23456 Edit comment with section link (non-local, eg in history list)
23457 !! options
23458 comment title=[[Main Page]]
23459 !! wikitext
23460 /* External links */ removed bogus entries
23461 !! html/php
23462 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23463 !!end
23464
23465 !! test
23466 Edit comment with section link and text before it (non-local, eg in history list)
23467 !! options
23468 comment title=[[Main Page]]
23469 !! wikitext
23470 pre-comment text /* External links */ removed bogus entries
23471 !! html/php
23472 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>
23473 !!end
23474
23475 !! test
23476 Edit comment with section link (local, eg in diff view)
23477 !! options
23478 comment local title=[[Main Page]]
23479 !! wikitext
23480 /* External links */ removed bogus entries
23481 !! html/php
23482 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23483 !!end
23484
23485 !! test
23486 Edit comment with subpage link (T16080)
23487 !! options
23488 comment
23489 subpage
23490 title=[[Subpage test]]
23491 !! wikitext
23492 Poked at a [[/subpage]] here...
23493 !! html/php
23494 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23495 !!end
23496
23497 !! test
23498 Edit comment with subpage link and link text (T16080)
23499 !! options
23500 comment
23501 subpage
23502 title=[[Subpage test]]
23503 !! wikitext
23504 Poked at a [[/subpage|neat little page]] here...
23505 !! html/php
23506 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23507 !!end
23508
23509 !! test
23510 Edit comment with bogus subpage link in non-subpage NS (T16080)
23511 !! options
23512 comment
23513 title=[[Subpage test]]
23514 !! wikitext
23515 Poked at a [[/subpage]] here...
23516 !! html/php
23517 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...
23518 !!end
23519
23520 !! test
23521 Edit comment with bare anchor link (local, as on diff)
23522 !! options
23523 comment
23524 local
23525 title=[[Main Page]]
23526 !! wikitext
23527 [[#section]]
23528 !! html/php
23529 <a href="#section">#section</a>
23530 !! end
23531
23532 !! test
23533 Edit comment with bare anchor link (non-local, as on history)
23534 !! options
23535 comment
23536 title=[[Main Page]]
23537 !! wikitext
23538 [[#section]]
23539 !! html/php
23540 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23541 !! end
23542
23543 !! test
23544 Anchor starting with underscore
23545 !! options
23546 title=[[Foo]]
23547 !! wikitext
23548 [[#_ref|One]]
23549 !! html/php
23550 <p><a href="#_ref">One</a>
23551 </p>
23552 !! html/parsoid
23553 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23554 !! end
23555
23556 !! test
23557 Id starting with underscore
23558 !! wikitext
23559 <div id="_ref"></div>
23560 !! html/*
23561 <div id="_ref"></div>
23562
23563 !! end
23564
23565 !! test
23566 Edit comment with link with more than one pipe (T99346)
23567 !! options
23568 comment
23569 !! wikitext
23570 [[Main Page|Many|pipes]]
23571 !! html/php
23572 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23573 !! end
23574
23575 !! test
23576 Complex edit comment with link with more than one pipe (T99346)
23577 !! options
23578 comment
23579 !! wikitext
23580 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23581 !! html/php
23582 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;
23583 !! end
23584
23585 !! test
23586 Space normalisation on autocomment (T24784)
23587 !! options
23588 comment
23589 title=[[Main Page]]
23590 !! wikitext
23591 /* __hello__world__ */
23592 !! html/php
23593 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23594 !! end
23595
23596 !! test
23597 percent-encoding and + signs in comments (T28410)
23598 !! options
23599 comment
23600 !! wikitext
23601 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23602 !! html/php
23603 <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>
23604 !! end
23605
23606 # Parsoid doesn't support this yet: see T75581
23607 # but it *should* omit the 'src' attribute if the image is bad.
23608 # PHP side of tests was disabled in
23609 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23610 # because of issues in the PHP parserTests infrastructure
23611 # (but the output below is indeed what the PHP side emits)
23612 !! test
23613 Bad images - basic functionality
23614 !! wikitext
23615 [[File:Bad.jpg]]
23616 !! html/php+disabled
23617 !! html/parsoid
23618 <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>
23619 !! end
23620
23621 !! test
23622 Bad images - T18039: text after bad image disappears
23623 !! wikitext
23624 Foo bar
23625 [[File:Bad.jpg]]
23626 Bar foo
23627 !! html/php+disabled
23628 <p>Foo bar
23629 </p><p>Bar foo
23630 </p>
23631 !! html/parsoid
23632 <p>Foo bar
23633 <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>
23634 Bar foo</p>
23635 !! end
23636
23637 !! test
23638 Verify that displaytitle works (T24501) no displaytitle
23639 !! options
23640 showtitle
23641 !! config
23642 wgAllowDisplayTitle=true
23643 wgRestrictDisplayTitle=false
23644 !! wikitext
23645 this is not the the title
23646 !! html/php
23647 Parser test
23648 <p>this is not the the title
23649 </p>
23650 !! end
23651
23652 !! test
23653 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23654 !! options
23655 showtitle
23656 title=[[Screen]]
23657 !! config
23658 wgAllowDisplayTitle=true
23659 wgRestrictDisplayTitle=false
23660 !! wikitext
23661 this is not the the title
23662 {{DISPLAYTITLE:whatever}}
23663 !! html/php
23664 whatever
23665 <p>this is not the the title
23666 </p>
23667 !! end
23668
23669 !! test
23670 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23671 !! options
23672 showtitle
23673 title=[[Screen]]
23674 !! config
23675 wgAllowDisplayTitle=true
23676 wgRestrictDisplayTitle=true
23677 !! wikitext
23678 this is not the the title
23679 {{DISPLAYTITLE:whatever}}
23680 !! html/php
23681 Screen
23682 <p>this is not the the title
23683 </p>
23684 !! end
23685
23686 !! test
23687 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23688 !! options
23689 showtitle
23690 title=[[Screen]]
23691 !! config
23692 wgAllowDisplayTitle=true
23693 wgRestrictDisplayTitle=true
23694 !! wikitext
23695 this is not the the title
23696 {{DISPLAYTITLE:screen}}
23697 !! html/php
23698 screen
23699 <p>this is not the the title
23700 </p>
23701 !! end
23702
23703 !! test
23704 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23705 !! options
23706 showtitle
23707 title=[[Screen]]
23708 !! config
23709 wgAllowDisplayTitle=false
23710 !! wikitext
23711 this is not the the title
23712 {{DISPLAYTITLE:screen}}
23713 !! html/php
23714 Screen
23715 <p>this is not the the title
23716 <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>
23717 </p>
23718 !! end
23719
23720 !! test
23721 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23722 !! options
23723 showtitle
23724 title=[[Screen]]
23725 !! config
23726 wgAllowDisplayTitle=false
23727 !! wikitext
23728 this is not the the title
23729 !! html/php
23730 Screen
23731 <p>this is not the the title
23732 </p>
23733 !! end
23734
23735 !! test
23736 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23737 !! options
23738 showtitle
23739 title=[[Screen]]
23740 !! config
23741 wgAllowDisplayTitle=true
23742 wgRestrictDisplayTitle=true
23743 !! wikitext
23744 this is not the the title
23745 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23746 !! html/php
23747 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23748 <p>this is not the the title
23749 </p>
23750 !! end
23751
23752 !! test
23753 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23754 !! options
23755 showtitle
23756 title=[[Screen]]
23757 !! config
23758 wgAllowDisplayTitle=true
23759 wgRestrictDisplayTitle=true
23760 !! wikitext
23761 this is not the the title
23762 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23763 !! html/php
23764 <span style="color: red;">s</span>creen
23765 <p>this is not the the title
23766 </p>
23767 !! end
23768
23769 !! test
23770 Page status indicators: Empty name is invalid
23771 !! options
23772 showindicators
23773 !! wikitext
23774 <indicator name=" "></indicator>
23775 <indicator></indicator>
23776 !! html/php
23777 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23778 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23779 </p>
23780 !! end
23781
23782 !! test
23783 Page status indicators: Weird syntaxes that are okay
23784 !! options
23785 showindicators
23786 !! wikitext
23787 <indicator name="empty" />
23788 <indicator name="name"></indicator>
23789 !! html/php
23790 empty=
23791 name=
23792 <p><br />
23793 </p>
23794 !! end
23795
23796 !! test
23797 Page status indicators: Torture test
23798 !! options
23799 showindicators
23800 !! wikitext
23801 <indicator name="01">hello world</indicator>
23802 <indicator name="02">[[Main Page]]</indicator>
23803 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23804 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23805 <indicator name="05">*foo
23806 *bar</indicator>
23807 <indicator name="06"><nowiki>foo</nowiki></indicator>
23808 <indicator name="07"> Preformatted</indicator>
23809 <indicator name="08"><div>Broken tag</indicator>
23810 <indicator name="09">{| class=wikitable
23811 |cell
23812 |}</indicator>
23813 <indicator name="10">Two
23814
23815 paragraphs</indicator>
23816 !! html/php
23817 01=hello world
23818 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23819 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" />
23820 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>
23821 05=<ul><li>foo</li>
23822 <li>bar</li></ul>
23823
23824 06=foo
23825 07=<pre>Preformatted
23826 </pre>
23827 08=<div>Broken tag</div>
23828
23829 09=<table class="wikitable">
23830 <tr>
23831 <td>cell
23832 </td></tr></table>
23833
23834 10=<p>Two
23835 </p><p>paragraphs
23836 </p>
23837 <p><br />
23838 </p><p><br />
23839 </p><p><br />
23840 </p><p><br />
23841 </p><p><br />
23842 </p>
23843 !! end
23844
23845 !! test
23846 preload: check <noinclude> and <includeonly>
23847 !! options
23848 preload
23849 !! wikitext
23850 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23851 !! html/php
23852 Hello kind world.
23853 !! end
23854
23855 !! test
23856 preload: check <onlyinclude>
23857 !! options
23858 preload
23859 !! wikitext
23860 Goodbye <onlyinclude>Hello world</onlyinclude>
23861 !! html/php
23862 Hello world
23863 !! end
23864
23865 !! test
23866 preload: can pass tags through if we want to
23867 !! options
23868 preload
23869 !! wikitext
23870 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23871 !! html/php
23872 <includeonly>Hello world</includeonly>
23873 !! end
23874
23875 !! test
23876 preload: check that it doesn't try to do tricks
23877 !! options
23878 preload
23879 !! wikitext
23880 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23881 !! html/php
23882 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23883 !! end
23884
23885 !! test
23886 Play a bit with r67090 and T5158
23887 !! wikitext
23888 <div style="width:50% !important">&nbsp;</div>
23889 <div style="width:50%&nbsp;!important">&nbsp;</div>
23890 <div style="width:50%&#160;!important">&nbsp;</div>
23891 <div style="border : solid;">&nbsp;</div>
23892 !! html/php
23893 <div style="width:50% !important">&#160;</div>
23894 <div style="width:50% !important">&#160;</div>
23895 <div style="width:50% !important">&#160;</div>
23896 <div style="border&#160;: solid;">&#160;</div>
23897
23898 !! html/parsoid
23899 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23900 <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>
23901 <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>
23902 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23903
23904 !! end
23905
23906 !! test
23907 HTML5 data attributes
23908 !! wikitext
23909 <span data-foo="bar">Baz</span>
23910 <p data-abc-def_hij="">Quuz</p>
23911 !! html/php
23912 <p><span data-foo="bar">Baz</span>
23913 </p>
23914 <p data-abc-def_hij="">Quuz</p>
23915
23916 !! html/parsoid
23917 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23918 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23919 !! end
23920
23921 !! test
23922 Strip reserved data attributes
23923 !! wikitext
23924 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23925 !! html/php
23926 <div data-ok="fred">d</div>
23927
23928 !! html/parsoid
23929 <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>
23930 !! end
23931
23932 !! test
23933 percent-encoding and + signs in internal links (T28410)
23934 !! wikitext
23935 [[User:+%]] [[Page+title%]]
23936 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23937 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23938 [[%33%45]] [[%33%45+]]
23939 !! html/php
23940 <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>
23941 <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>
23942 <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>
23943 <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>
23944 </p>
23945 !! html/parsoid
23946 <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>
23947 <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>
23948 <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>
23949 <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>
23950 !! end
23951
23952 !! test
23953 Special characters in embedded file links (T29679)
23954 !! wikitext
23955 [[File:Contains & ampersand.jpg]]
23956 [[File:Does not exist.jpg|Title with & ampersand]]
23957 !! html/php
23958 <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>
23959 <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>
23960 </p>
23961 !! html/parsoid
23962 <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>
23963 <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>
23964 !! end
23965
23966 !! test
23967 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23968 !! wikitext
23969 Text&apos;s been normalized?
23970 !! html
23971 <p>Text&#39;s been normalized?
23972 </p>
23973 !! end
23974
23975 !! test
23976 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23977 !! wikitext
23978 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23979 !! html
23980 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23981 </p>
23982 !! end
23983
23984 !! test
23985 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23986 !! wikitext
23987 [http://www.example.org/ ideograms]
23988 !! html
23989 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23990 </p>
23991 !! end
23992
23993 !! test
23994 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23995 !! wikitext
23996 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23997 !! html
23998 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23999 </p>
24000 !! end
24001
24002 !! article
24003 Mediawiki:loop1
24004 !! text
24005 {{Identical|A}}
24006 !! endarticle
24007
24008 !! article
24009 Mediawiki:loop2
24010 !! text
24011 {{Identical|B}}
24012 !! endarticle
24013
24014 !! article
24015 Template:Identical
24016 !! text
24017 {{int:loop1}}
24018 {{int:loop2}}
24019 !! endarticle
24020
24021 !! test
24022 T33098 Template which includes system messages which includes the template
24023 !! wikitext
24024 {{Identical}}
24025 !! html
24026 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24027 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24028 </p>
24029 !! end
24030
24031 !! test
24032 T33490 Turkish: ucfirst 'blah'
24033 !! options
24034 language=tr
24035 !! wikitext
24036 {{ucfirst:blah}}
24037 !! html
24038 <p>Blah
24039 </p>
24040 !! end
24041
24042 !! test
24043 T33490 Turkish: ucfirst 'ix'
24044 !! options
24045 language=tr
24046 !! wikitext
24047 {{ucfirst:ix}}
24048 !! html
24049 <p>İx
24050 </p>
24051 !! end
24052
24053 !! test
24054 T33490 Turkish: lcfirst 'BLAH'
24055 !! options
24056 language=tr
24057 !! wikitext
24058 {{lcfirst:BLAH}}
24059 !! html
24060 <p>bLAH
24061 </p>
24062 !! end
24063
24064 !! test
24065 T33490 Turkish: ucfırst (with a dotless i)
24066 !! options
24067 language=tr
24068 !! wikitext
24069 {{ucfırst:blah}}
24070 !! html
24071 <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>
24072 </p>
24073 !! end
24074
24075 !! test
24076 T33490 ucfırst (with a dotless i) with English language
24077 !! options
24078 language=en
24079 !! wikitext
24080 {{ucfırst:blah}}
24081 !! html
24082 <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>
24083 </p>
24084 !! end
24085
24086 # Note that Parsoid doesn't emit an explicit TOC.
24087 # Note also that the html2wt direction tends to emit an extra newline
24088 # between the __TOC__ magicword and the first heading unless *both*
24089 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24090 # it's "{}").
24091
24092 !! test
24093 T28375: TOC with italics
24094 !! options
24095 title=[[Main Page]]
24096 !! wikitext
24097 __TOC__
24098 ==''Lost'' episodes==
24099 !! html/php
24100 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24101 <ul>
24102 <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>
24103 </ul>
24104 </div>
24105
24106 <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>
24107
24108 !! html/parsoid
24109 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24110 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24111 !! end
24112
24113 !! test
24114 T28375: TOC with bold
24115 !! options
24116 title=[[Main Page]]
24117 !! wikitext
24118 __TOC__
24119 =='''should be bold''' then normal text==
24120 !! html/php
24121 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24122 <ul>
24123 <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>
24124 </ul>
24125 </div>
24126
24127 <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>
24128
24129 !! html/parsoid
24130 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24131 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24132 !! end
24133
24134 !! test
24135 T35845: Headings become cursive in TOC when they contain an image
24136 !! options
24137 title=[[Main Page]]
24138 !! wikitext
24139 __TOC__
24140 ==Image [[Image:foobar.jpg]]==
24141 !! html/php
24142 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24143 <ul>
24144 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24145 </ul>
24146 </div>
24147
24148 <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>
24149
24150 !! html/parsoid
24151 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24152 <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>
24153 !! end
24154
24155 !! test
24156 T35845 (2): Headings become bold in TOC when they contain a blockquote
24157 !! options
24158 title=[[Main Page]]
24159 !! wikitext
24160 __TOC__
24161 ==<blockquote>Quote</blockquote>==
24162 !! html/php
24163 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24164 <ul>
24165 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24166 </ul>
24167 </div>
24168
24169 <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>
24170
24171 !! html/php+tidy
24172 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24173 <ul>
24174 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24175 </ul>
24176 </div>
24177
24178 <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>
24179 !! html/parsoid
24180 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24181 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24182 !! end
24183
24184 !! test
24185 Unclosed tags in TOC
24186 !! config
24187 wgFragmentMode=[ 'html5', 'legacy' ]
24188 !! options
24189 title=[[Main Page]]
24190 !! wikitext
24191 __TOC__
24192 ==Proof: 2 < 3==
24193 <small>Hanc marginis exiguitas non caperet.</small>
24194 QED
24195 !! html/php
24196 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24197 <ul>
24198 <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>
24199 </ul>
24200 </div>
24201
24202 <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>
24203 <p><small>Hanc marginis exiguitas non caperet.</small>
24204 QED
24205 </p>
24206 !! html/parsoid
24207 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24208 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24209 <p><small>Hanc marginis exiguitas non caperet.</small>
24210 QED</p>
24211 !! end
24212
24213 !! test
24214 Multiple tags in TOC
24215 !! wikitext
24216 __TOC__
24217 ==<i>Foo</i> <b>Bar</b>==
24218
24219 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24220 !! html/php
24221 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24222 <ul>
24223 <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>
24224 <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>
24225 </ul>
24226 </div>
24227
24228 <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>
24229 <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>
24230
24231 !! html/php+tidy
24232 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24233 <ul>
24234 <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>
24235 <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>
24236 </ul>
24237 </div>
24238
24239 <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>
24240 <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>
24241 !! html/parsoid
24242 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24243 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24244
24245 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24246 !! end
24247
24248 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24249 # html5 tag parsing.
24250 !! test
24251 Tags with parameters in TOC
24252 !! options
24253 parsoid=wt2html
24254 !! wikitext
24255 __TOC__
24256 ==<sup class="in-h2">Hello</sup>==
24257
24258 ==<sup class="a > b">Evilbye</sup>==
24259 !! html/php
24260 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24261 <ul>
24262 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24263 <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>
24264 </ul>
24265 </div>
24266
24267 <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>
24268 <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>
24269
24270 !! html/parsoid
24271 <meta property="mw:PageProp/toc" />
24272 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24273
24274 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24275 !! end
24276
24277 !! test
24278 span tags with directionality in TOC
24279 !! wikitext
24280 __TOC__
24281 ==<span dir="ltr">C++</span>==
24282
24283 ==<span dir="rtl">זבנג!</span>==
24284
24285 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24286
24287 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24288
24289 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24290 !! html/php
24291 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24292 <ul>
24293 <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>
24294 <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>
24295 <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>
24296 <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>
24297 <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>
24298 </ul>
24299 </div>
24300
24301 <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>
24302 <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>
24303 <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>
24304 <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>
24305 <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>
24306
24307 !! html/parsoid
24308 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24309 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24310 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24311 <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>
24312 <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>
24313 <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>
24314 !! end
24315
24316 !! test
24317 T74884: bdi element in ToC
24318 !! wikitext
24319 __TOC__
24320 ==<bdi>test</bdi>==
24321 !! html/php
24322 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24323 <ul>
24324 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24325 </ul>
24326 </div>
24327
24328 <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>
24329
24330 !! html/parsoid
24331 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24332 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24333 !! end
24334
24335 !! test
24336 T35715: s/strike element in ToC
24337 !! wikitext
24338 __TOC__
24339 ==<s>test</s> test <strike>test</strike>==
24340 !! html/php
24341 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24342 <ul>
24343 <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>
24344 </ul>
24345 </div>
24346
24347 <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>
24348
24349 !! html/parsoid
24350 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24351 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24352 !! end
24353
24354 !! test
24355 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24356 !! wikitext
24357 __TOC__
24358 ==x==
24359 !! html/php
24360 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24361 <ul>
24362 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24363 </ul>
24364 </div>
24365
24366 <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>
24367
24368 !! html/parsoid
24369 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24370 <h2 id="x" data-parsoid='{}'>x</h2>
24371 !! end
24372
24373 !! article
24374 MediaWiki:T34057
24375 !! text
24376 == {{int:headline_sample}} ==
24377 !! endarticle
24378
24379 !! test
24380 T34057: Title needed when expanding <h> nodes.
24381 !! options
24382 title=[[Main Page]]
24383 !! wikitext
24384 {{int:T34057}}
24385 !! html
24386 <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>
24387
24388 !! end
24389
24390 !! test
24391 Strip marker in urlencode
24392 !! wikitext
24393 {{urlencode:x<nowiki/>y}}
24394 {{urlencode:x<nowiki/>y|wiki}}
24395 {{urlencode:x<nowiki/>y|path}}
24396 {{urlencode:x<pre id="one">two</pre>y}}
24397 !! html/php
24398 <p>xy
24399 xy
24400 xy
24401 xy
24402 </p>
24403 !! end
24404
24405 !! test
24406 Strip marker in lc
24407 !! wikitext
24408 {{lc:x<nowiki/>y}}
24409 !! html
24410 <p>xy
24411 </p>
24412 !! end
24413
24414 !! test
24415 Strip marker in uc
24416 !! wikitext
24417 {{uc:x<nowiki/>y}}
24418 !! html
24419 <p>XY
24420 </p>
24421 !! end
24422
24423 !! test
24424 Strip marker in formatNum
24425 !! wikitext
24426 {{formatnum:1<nowiki/>2}}
24427 {{formatnum:1<nowiki/>2|R}}
24428 !! html
24429 <p>12
24430 12
24431 </p>
24432 !! end
24433
24434 !! test
24435 Check noCommafy in formatNum
24436 !! options
24437 language=be-tarask
24438 !! wikitext
24439 {{formatnum:123456.78}}
24440 {{formatnum:123456.78|NOSEP}}
24441 !! html
24442 <p>123 456,78
24443 123456.78
24444 </p>
24445 !! end
24446
24447 !! test
24448 Wrong option for formatNum (T58199)
24449 !! wikitext
24450 {{formatnum:1,234.56|Random}}
24451 {{formatnum:1,234.56|EVERYTHING}}
24452 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24453 !! html
24454 <p>1,234.56
24455 1,234.56
24456 1,234.56
24457 </p>
24458 !! end
24459
24460 !! test
24461 Strip marker in grammar
24462 !! options
24463 language=fi
24464 !! wikitext
24465 {{grammar:elative|foo<nowiki/>bar}}
24466 !! html
24467 <p>foobarista
24468 </p>
24469 !! end
24470
24471 !! test
24472 Strip marker in padleft
24473 !! wikitext
24474 {{padleft:|2|x<nowiki/>y}}
24475 !! html
24476 <p>xy
24477 </p>
24478 !! end
24479
24480 !! test
24481 Strip marker in padright
24482 !! wikitext
24483 {{padright:|2|x<nowiki/>y}}
24484 !! html
24485 <p>xy
24486 </p>
24487 !! end
24488
24489 !! test
24490 Strip marker in anchorencode
24491 !! wikitext
24492 {{anchorencode:x<nowiki/>y}}
24493 !! html/php
24494 <p>xy
24495 </p>
24496 !! html/parsoid
24497 <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>
24498 !! end
24499
24500 !! test
24501 nowiki inside link inside heading (T20295)
24502 !! wikitext
24503 ==[[foo|x<nowiki>y</nowiki>z]]==
24504 !! html
24505 <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>
24506
24507 !! end
24508
24509 !! test
24510 new support for bdi element (T33817)
24511 !! wikitext
24512 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24513 !! html
24514 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24515
24516 !!end
24517
24518 !! test
24519 Ignore pipe between table row attributes
24520 !! wikitext
24521 {|
24522 |quux
24523 |- id=foo | style='color: red'
24524 |bar
24525 |}
24526 !! html
24527 <table>
24528 <tr>
24529 <td>quux
24530 </td></tr>
24531 <tr id="foo" style="color: red">
24532 <td>bar
24533 </td></tr></table>
24534
24535 !! end
24536
24537 !!test
24538 Language parser function
24539 !! wikitext
24540 {{#language:ar}}
24541 !! html
24542 <p>العربية
24543 </p>
24544 !! end
24545
24546 !!test
24547 Padleft and padright (default 0-padding)
24548 !! wikitext
24549 {{padleft:xyz|5}}
24550 {{padright:xyz|5}}
24551 !! html/php
24552 <p>00xyz
24553 xyz00
24554 </p>
24555 !! html/parsoid
24556 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24557 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24558 !! end
24559
24560 !!test
24561 Padleft and padright (partial fill)
24562 !! wikitext
24563 {{padleft:xyz|6|ab}}
24564 {{padright:xyz|6|ab}}
24565 !! html/php
24566 <p>abaxyz
24567 xyzaba
24568 </p>
24569 !! html/parsoid
24570 <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>
24571 <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>
24572 !! end
24573
24574 !!test
24575 Padleft and padright as substr
24576 !! wikitext
24577 {{padleft:|3|abcde}}
24578 {{padright:|3|abcde}}
24579 !! html/php
24580 <p>abc
24581 abc
24582 </p>
24583 !! html/parsoid
24584 <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>
24585 <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>
24586 !! end
24587
24588 !! test
24589 Padleft and padright with non-numerical length (T180403)
24590 !! wikitext
24591 {{padleft:abcdef|junk}}
24592 {{padright:abcdef|junk}}
24593 !! html/php
24594 <p>abcdef
24595 abcdef
24596 </p>
24597 !! end
24598
24599 !!test
24600 Special parser function
24601 !! wikitext
24602 {{#special:RandomPage}}
24603 {{#special:BaDtItLe}}
24604 {{#special:Foobar}}
24605 !! html
24606 <p>Special:Random
24607 Special:Badtitle
24608 Special:Foobar
24609 </p>
24610 !! end
24611
24612 !!test
24613 T36939 - Case insensitive link parsing ([HttP://])
24614 !! wikitext
24615 [HttP://MediaWiki.Org/]
24616 !! html/php
24617 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24618 </p>
24619 !! html/parsoid
24620 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24621 !! end
24622
24623 !!test
24624 T36939 - Case insensitive link parsing ([HttP:// title])
24625 !! wikitext
24626 [HttP://MediaWiki.Org/ MediaWiki]
24627 !! html
24628 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24629 </p>
24630 !! end
24631
24632 !!test
24633 T36939 - Case insensitive link parsing (HttP://)
24634 !! wikitext
24635 HttP://MediaWiki.Org/
24636 !! html/php
24637 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24638 </p>
24639 !! html/parsoid
24640 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24641 !! end
24642
24643 !!test
24644 Disable TOC
24645 !! options
24646 notoc
24647 !! wikitext
24648 Lead
24649 ==Section 1==
24650 ==Section 2==
24651 ==Section 3==
24652 ==Section 4==
24653 ==Section 5==
24654 !! html
24655 <p>Lead
24656 </p>
24657
24658 <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>
24659 <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>
24660 <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>
24661 <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>
24662 <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>
24663
24664 !! end
24665
24666
24667 ###
24668 ### Parsoid-specific tests
24669 ### Parsoid-PHP parser incompatibilities
24670 ###
24671 !!test
24672 1. SOL-sensitive wikitext tokens as template-args
24673 !!options
24674 parsoid=wt2html,wt2wt
24675 !! wikitext
24676 {{echo|*a}}
24677 {{echo|#a}}
24678 {{echo|:a}}
24679 !! html
24680 <span about="#mwt1" typeof="mw:Transclusion">
24681 </span><ul about="#mwt1"><li>a</li>
24682 </ul>
24683 <span about="#mwt2" typeof="mw:Transclusion">
24684 </span><ol about="#mwt2"><li>a</li>
24685 </ol>
24686 <span about="#mwt3" typeof="mw:Transclusion">
24687 </span><dl about="#mwt3"><dd>a</dd>
24688 </dl>
24689 !!end
24690
24691 #### -----------------------------------------------------------------
24692 #### Parsoid-specific functionality tests
24693 #### -----------------------------------------------------------------
24694
24695 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24696 # We know wt2wt will fail, but we expect selser to pass.
24697 # Due to the nature of our testing, wt2wt and selser tests will enter the
24698 # blacklist and we'll catch selser regressions based on changes to the
24699 # blacklist entries for selser tests.
24700 !! test
24701 1. Bad treebuilder fixup of formatting elt is cleaned up
24702 !! options
24703 parsoid=wt2html,wt2wt
24704 !! wikitext
24705 {|
24706 |
24707 <small>
24708 [[Image:Foobar.jpg|right|Test]]
24709 </small>
24710 |}
24711 !! html/parsoid
24712 <table>
24713 <tbody><tr><td>
24714 <small>
24715 <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>
24716 </small>
24717 </td></tr>
24718 </tbody></table>
24719 !! end
24720
24721 !! test
24722 2. Bad treebuilder fixup of formatting elt is cleaned up
24723 !! options
24724 parsoid=wt2html,wt2wt
24725 !! wikitext
24726 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24727
24728 <small>[[Image:Foobar.jpg|right|300px]]</small>
24729 !! html/parsoid
24730
24731 <p><b>foo</b></p>
24732 <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><b>caption</b></figcaption></figure>
24733 <p><b>bar</b></p>
24734 <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>
24735 !! end
24736
24737 !! test
24738 3. Bad treebuilder fixup of formatting elt is cleaned up
24739 !! options
24740 parsoid=wt2html,wt2wt
24741 !! wikitext
24742 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24743 !! html/parsoid
24744 <p><small><b>foo</b></small></p>
24745 <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><small><b>caption</b></small></figcaption></figure>
24746 <p><small><b>bar</b></small></p>
24747 !! end
24748
24749 !! test
24750 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24751 !! options
24752 parsoid=wt2html,wt2wt
24753 !! wikitext
24754 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24755 !! html/parsoid
24756 <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>
24757 !! end
24758
24759 #### ----------------------------------------------------------------
24760 #### Parsoid-only testing of Parsoid's impl of LST
24761 #### Not implemented yet, see
24762 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24763 #### ----------------------------------------------------------------
24764
24765 ## We still need to support serializing the older format while content is stored.
24766 !! test
24767 LST Sections: Backwards compatibility
24768 !! options
24769 parsoid={
24770 "suppressErrors": true,
24771 "modes": ["html2wt"]
24772 }
24773 !! wikitext
24774 <section begin="2011-05-16" />
24775 <section end="2014-04-10 (MW 1.23wmf22)" />
24776 !! html/parsoid
24777 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24778 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24779 !! end
24780
24781 !! test
24782 LST Sections: Newfangled approach
24783 !! wikitext
24784 <section begin="2011-05-16" />
24785 <section end="2014-04-10 (MW 1.23wmf22)" />
24786 !! html/parsoid
24787 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24788 </span>
24789 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24790 </span></p>
24791 !! end
24792
24793 #--------- Test stripping of empty nodes in template content ----------
24794
24795 !! test
24796 Empty LI and TR nodes should be stripped from template content
24797 !! wikitext
24798 {{EmptyLITest}}
24799 {{EmptyTRTest}}
24800 !! html/parsoid
24801 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24802 <li>a</li>
24803 <li>b</li>
24804 </ul>
24805 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24806 <tbody>
24807 <tr>
24808 <td>foo</td>
24809 </tr>
24810 <tr>
24811 <td>bar</td>
24812 </tr>
24813 </tbody>
24814 </table>
24815 !! end
24816
24817 !! test
24818 Empty LI and TR nodes should not be stripped from top-level content
24819 !! wikitext
24820 * a
24821 *
24822 * b
24823
24824 {|
24825 |-
24826 |-
24827 |foo
24828 |}
24829 !! html/parsoid
24830 <ul>
24831 <li> a</li>
24832 <li class='mw-empty-elt'></li>
24833 <li> b</li>
24834 </ul>
24835 <table>
24836 <tbody>
24837 <tr class='mw-empty-elt'></tr>
24838 <tr>
24839 <td>foo</td>
24840 </tr>
24841 </tbody>
24842 </table>
24843 !! end
24844
24845 !! test
24846 Empty TR nodes should not be stripped if they have any attributes set
24847 !! wikitext
24848 {{EmptyTRWithHTMLAttrTest}}
24849 !! html/parsoid
24850 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24851 <tr align='center'></tr>
24852 <tr><td>foo</td></tr>
24853 <tr align='center'></tr>
24854 <tr><td>bar</td></tr>
24855 </table>
24856 !! end
24857
24858 #### ----------------------------------------------------------------
24859 #### The following section of tests are primarily to test
24860 #### wikitext escaping capabilities of Parsoid. Given that
24861 #### escaping can be done any number of ways, the wikitext (input)
24862 #### is always adjusted to reflect how Parsoid adds nowiki
24863 #### escape tags.
24864 ####
24865 #### We are marking several tests as parsoid-only since the
24866 #### HTML in the result section is different from what the
24867 #### PHP parser generates for it.
24868 #### ----------------------------------------------------------------
24869
24870
24871 #### --------------- Headings ---------------
24872 #### 0. Unnested
24873 #### 1. Nested inside html <h1>=foo=</h1>
24874 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24875 #### 3. Nested inside html with wikitext split by html tags
24876 #### 4. No escape needed
24877 #### 5. Empty headings <h1></h1>
24878 #### 6. Heading chars in SOL context
24879 #### ----------------------------------------
24880 !! test
24881 Headings: 0. Unnested
24882 !! options
24883 parsoid=html2wt
24884 !! html/parsoid
24885 <p>=foo=</p>
24886
24887 <p> =foo=
24888 <!--cmt-->
24889 =foo=</p>
24890
24891 <p>=foo<i>a</i>=</p>
24892 !! wikitext
24893 <nowiki>=foo=</nowiki>
24894
24895 <nowiki> </nowiki>=foo=
24896 <!--cmt-->
24897 <nowiki>=foo=</nowiki>
24898
24899 =foo''a''<nowiki>=</nowiki>
24900 !!end
24901
24902 # New headings and existing headings are handled differently
24903 !! test
24904 Headings: 1. Nested inside html
24905 !! options
24906 parsoid=html2wt
24907 !! html/parsoid
24908 <h1>=foo=</h1>
24909 <h2>=foo=</h2>
24910 <h3>=foo=</h3>
24911
24912 <h1 data-parsoid=''>=foo=</h1>
24913 <h2 data-parsoid=''>=foo=</h2>
24914 <h3 data-parsoid=''>=foo=</h3>
24915 <h4 data-parsoid=''>=foo=</h4>
24916 <h5 data-parsoid=''>=foo=</h5>
24917 <h6 data-parsoid=''>=foo=</h6>
24918 !! wikitext
24919 = =foo= =
24920
24921 == =foo= ==
24922
24923 === =foo= ===
24924
24925 =<nowiki>=foo=</nowiki>=
24926 ==<nowiki>=foo=</nowiki>==
24927 ===<nowiki>=foo=</nowiki>===
24928 ====<nowiki>=foo=</nowiki>====
24929 =====<nowiki>=foo=</nowiki>=====
24930 ======<nowiki>=foo=</nowiki>======
24931
24932 !!end
24933
24934 !! test
24935 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24936 !! options
24937 parsoid=html2wt
24938 !! html/parsoid
24939 <h1>foo</h1>*bar
24940 <h1>foo</h1>=bar
24941 <h1>foo</h1>=bar=
24942 !! wikitext
24943 = foo =
24944 <nowiki>*</nowiki>bar
24945
24946 = foo =
24947 =bar
24948
24949 = foo =
24950 <nowiki>=bar=</nowiki>
24951 !!end
24952
24953 !! test
24954 Headings: 3. Nested inside html with wikitext split by html tags
24955 !! options
24956 parsoid=html2wt
24957 !! html/parsoid
24958 <h1>=<b>bold</b>foo=</h1>
24959 !! wikitext
24960 = ='''bold'''foo= =
24961 !!end
24962
24963 !! test
24964 Headings: 4a. No escaping needed (testing just h1 and h2)
24965 !! options
24966 parsoid=html2wt
24967 !! html/parsoid
24968 <h1>=foo</h1>
24969 <h1>foo=</h1>
24970 <h1> =foo= </h1>
24971 <h1>=foo= bar</h1>
24972 <h2>=foo</h2>
24973 <h2>foo=</h2>
24974 <h1>=</h1>
24975 <h1><i>=</i>foo=</h1>
24976 !! wikitext
24977 = =foo =
24978
24979 = foo= =
24980
24981 = =foo= =
24982
24983 = =foo= bar =
24984
24985 == =foo ==
24986
24987 == foo= ==
24988
24989 = = =
24990
24991 = ''=''foo= =
24992 !!end
24993
24994 !! test
24995 Headings: 4b. No escaping needed (inside p-tags)
24996 !! options
24997 parsoid=html2wt
24998 !! html/parsoid
24999 <p>=foo= x
25000 =foo= <s></s>
25001 </p>
25002 !! wikitext
25003 =foo= x
25004 =foo= <s></s>
25005 !! html/php
25006 <p>=foo= x
25007 =foo= <s></s>
25008 </p>
25009 !!end
25010
25011 !! test
25012 Headings: 4c. Short headings (1)
25013 !! options
25014 parsoid=html2wt
25015 !! html/parsoid
25016 <p>===
25017 </p>
25018 !! wikitext
25019 <nowiki>===</nowiki>
25020 !! html/php
25021 <p>===
25022 </p>
25023 !! end
25024
25025 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
25026 !! test
25027 Headings: 4d. Short headings (2)
25028 !! options
25029 parsoid=wt2html,html2html
25030 !! wikitext
25031 =
25032 ==
25033 ===
25034 ====
25035 =====
25036 !! html/php
25037 <p>=
25038 ==
25039 </p>
25040 <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>
25041 <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>
25042 <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>
25043
25044 !! html/parsoid
25045 <p>=
25046 ==</p>
25047 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25048 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25049 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25050 !! end
25051
25052 !! test
25053 Headings: 5. Empty headings
25054 !! options
25055 parsoid=html2wt
25056 !! html/parsoid
25057 <h1 data-parsoid='{}'></h1>
25058
25059 <h2 data-parsoid='{}'></h2>
25060
25061 <h3 data-parsoid='{}'></h3>
25062
25063 <h4 data-parsoid='{}'></h4>
25064
25065 <h5 data-parsoid='{}'></h5>
25066
25067 <h6 data-parsoid='{}'></h6>
25068 !! wikitext
25069 =<nowiki/>=
25070
25071 ==<nowiki/>==
25072
25073 ===<nowiki/>===
25074
25075 ====<nowiki/>====
25076
25077 =====<nowiki/>=====
25078
25079 ======<nowiki/>======
25080 !!end
25081
25082 !! test
25083 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25084 !! options
25085 parsoid=html2wt
25086 !! html/parsoid
25087 <p>=a=</p>
25088
25089 <p>=a=</p>
25090
25091 <p>=a=</p>
25092 !! wikitext
25093 <nowiki>=a=</nowiki>
25094
25095 <nowiki>=a=</nowiki>
25096
25097 <nowiki>=a=</nowiki>
25098 !!end
25099
25100 !! test
25101 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25102 !! options
25103 parsoid=html2wt
25104 !! html/parsoid
25105 <p>=a=
25106 b</p>
25107
25108 <p>=a=
25109 b</p>
25110
25111 <p>=a=
25112 b</p>
25113 !! wikitext
25114 <nowiki>=a=</nowiki>
25115 b
25116
25117 <nowiki>=a=</nowiki>
25118 b
25119
25120 <nowiki>=a=</nowiki>
25121 b
25122 !!end
25123
25124 !! test
25125 Headings: 6c. Heading chars in SOL context (leading newline break)
25126 !! options
25127 parsoid=html2wt
25128 !! html/parsoid
25129 <p>a
25130 =b=</p>
25131 !! wikitext
25132 a
25133 <nowiki>=b=</nowiki>
25134 !!end
25135
25136 !! test
25137 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25138 !! options
25139 parsoid=html2wt
25140 !! html/parsoid
25141 <!--c0--><p>=a=</p>
25142
25143 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25144 !! wikitext
25145 <!--c0--><nowiki>=a=</nowiki>
25146
25147 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25148 !!end
25149
25150 !! test
25151 Headings: 6d. Heading chars in SOL context (No escaping needed)
25152 !! options
25153 parsoid=html2wt
25154 !! html/parsoid
25155 =a=<div>b</div>
25156 !! wikitext
25157 =a=<div>b</div>
25158 !!end
25159
25160 !! test
25161 Headings: 7. Insert a newline between new content and headings
25162 !! options
25163 parsoid=html2wt
25164 !! html/parsoid
25165 <h2>NEW</h2>
25166 <p>new</p>
25167 <h2 data-parsoid='{}'>A</h2>
25168 <p data-parsoid='{}'>a</p>
25169 !! wikitext
25170 == NEW ==
25171 new
25172
25173 ==A==
25174 a
25175
25176 !! end
25177
25178 !! test
25179 Headings: Used as horizontal rule
25180 !! config
25181 wgFragmentMode=[ 'html5', 'legacy' ]
25182 !! options
25183 parsoid=wt2html
25184 !! wikitext
25185 ===============
25186 !! html/php
25187 <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>
25188
25189 !! html/parsoid
25190 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25191 !! end
25192
25193 #### --------------- Lists ---------------
25194 #### 0. Outside nests (*foo, etc.)
25195 #### 1. Nested inside html <ul><li>*foo</li></ul>
25196 #### 2. Inside definition lists
25197 #### 3. Only bullets at start should be escaped
25198 #### 4. No escapes needed
25199 #### 5. No unnecessary escapes
25200 #### 6. Escape bullets in SOL position
25201 #### 7. Escape bullets in a multi-line context
25202 #### ----------------------------------------
25203
25204 !! test
25205 Lists: 0. Outside nests
25206 !! options
25207 parsoid=html2wt
25208 !! html/parsoid
25209 <p>*foo</p>
25210
25211 <p>#foo</p>
25212
25213 <p>;Foo:bar</p>
25214 !! wikitext
25215 <nowiki>*</nowiki>foo
25216
25217 <nowiki>#</nowiki>foo
25218
25219 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25220 !!end
25221
25222 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25223 ## to test wikitext escaping, and insignificant whitespace diffs
25224 ## cause PHP parser tests to barf
25225 !! test
25226 Lists: 1. Nested inside html (No unnecessary escapes)
25227 !! options
25228 parsoid=html2wt
25229 !! html/parsoid
25230 <ul>
25231 <li>*foo</li>
25232 <li>#foo</li>
25233 <li>:foo</li>
25234 <li>;foo</li>
25235 <li data-parsoid='{}'>*foo</li>
25236 <li data-parsoid='{}'>#foo</li>
25237 <li data-parsoid='{}'>:foo</li>
25238 <li data-parsoid='{}'>;foo</li>
25239 </ul>
25240
25241 <ol>
25242 <li>*foo</li>
25243 <li>#foo</li>
25244 <li>:foo</li>
25245 <li>;foo</li>
25246 <li data-parsoid='{}'>*foo</li>
25247 <li data-parsoid='{}'>#foo</li>
25248 <li data-parsoid='{}'>:foo</li>
25249 <li data-parsoid='{}'>;foo</li>
25250 </ol>
25251 !! wikitext
25252 * *foo
25253 * #foo
25254 * :foo
25255 * ;foo
25256 *<nowiki>*foo</nowiki>
25257 *<nowiki>#foo</nowiki>
25258 *<nowiki>:foo</nowiki>
25259 *<nowiki>;foo</nowiki>
25260
25261 # *foo
25262 # #foo
25263 # :foo
25264 # ;foo
25265 #<nowiki>*foo</nowiki>
25266 #<nowiki>#foo</nowiki>
25267 #<nowiki>:foo</nowiki>
25268 #<nowiki>;foo</nowiki>
25269 !!end
25270
25271 !! test
25272 Lists: 2. Inside definition lists
25273 !! options
25274 parsoid=html2wt
25275 !! html/parsoid
25276 <dl><dt>;foo</dt></dl>
25277 <dl><dt>:foo</dt></dl>
25278 <dl><dt>:foo</dt>
25279 <dd>bar</dd></dl>
25280 <dl><dd>:foo</dd></dl>
25281 !! wikitext
25282 ; ;foo
25283
25284 ; <nowiki>:foo</nowiki>
25285
25286 ; <nowiki>:foo</nowiki>
25287 : bar
25288
25289 : :foo
25290 !!end
25291
25292 !! test
25293 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25294 !! options
25295 parsoid=html2wt
25296 !! html/parsoid
25297 <ul>
25298 <li>*foo*bar</li>
25299 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25300 </ul>
25301 !! wikitext
25302 * *foo*bar
25303 *<nowiki>*foo</nowiki>''it''*bar
25304 !!end
25305
25306 !! test
25307 Lists: 4. No escapes needed
25308 !! options
25309 parsoid=html2wt
25310 !! html/parsoid
25311 <ul>
25312 <li>foo*bar
25313 </li>
25314 </ul>
25315 <ul>
25316 <li><i>foo</i>*bar
25317 </li>
25318 </ul>
25319 <ul>
25320 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25321 </li>
25322 </ul>
25323 <ul>
25324 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25325 </li>
25326 </ul>
25327 !! wikitext
25328 *foo*bar
25329
25330 *''foo''*bar
25331
25332 *[[Foo]]: bar
25333
25334 *[[Foo]]*bar
25335 !!end
25336
25337 !! test
25338 Lists: 5. No unnecessary escapes
25339 !! options
25340 parsoid=html2wt
25341 !! html/parsoid
25342 <ul><li> bar <span>[[foo]]</span></li></ul>
25343 <ul><li> =bar <span>[[foo]]</span></li></ul>
25344 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25345 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25346 <ul><li> =bar <span>foo]]</span>=</li></ul>
25347 <ul><li> <s></s>: a</li></ul>
25348 <ul><li> <i>* foo</i></li></ul>
25349
25350 !! wikitext
25351 * bar <span><nowiki>[[foo]]</nowiki></span>
25352
25353 * =bar <span><nowiki>[[foo]]</nowiki></span>
25354
25355 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25356
25357 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25358
25359 * =bar <span>foo]]</span>=
25360
25361 * <s></s>: a
25362
25363 * ''* foo''
25364 !!end
25365
25366 !! test
25367 Lists: 6. Escape bullets in SOL position
25368 !! options
25369 parsoid=html2wt
25370 !! html/parsoid
25371 <p><!--cmt-->*foo</p>
25372 !! wikitext
25373 <!--cmt--><nowiki>*</nowiki>foo
25374 !!end
25375
25376 !! test
25377 Lists: 7. Escape bullets in a multi-line context
25378 !! options
25379 parsoid=html2wt
25380 !! html/parsoid
25381 <p>a
25382 *b
25383 </p>
25384 !! wikitext
25385 a
25386 <nowiki>*</nowiki>b
25387 !!end
25388
25389 !! test
25390 Lists: 8. Escape colons only if not present in tags
25391 !! options
25392 parsoid=html2wt
25393 !! html/parsoid
25394 <dl><dt>a:b<i>c:d</i></dt></dl>
25395 !! wikitext
25396 ; <nowiki>a:b</nowiki>''c:d''
25397 !! end
25398
25399 #### --------------- HRs ---------------
25400 #### 1. Single line
25401 #### -----------------------------------
25402
25403 !! test
25404 HRs: 1. Single line
25405 !! options
25406 parsoid=html2wt
25407 !! html/parsoid
25408 <hr />----
25409 <hr />=foo=
25410 <hr />*foo
25411 !! wikitext
25412 ----<nowiki>----</nowiki>
25413 ----=foo=
25414 ----*foo
25415 !! end
25416
25417 #### --------------- Tables ---------------
25418 #### 1a. Simple example
25419 #### 1b. No escaping needed (!foo)
25420 #### 1c. No escaping needed (|foo)
25421 #### 1d. No escaping needed (|}foo)
25422 ####
25423 #### 2a. Nested in td (<td>foo|bar</td>)
25424 #### 2b. Nested in td (<td>foo||bar</td>)
25425 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25426 ####
25427 #### 3a. Nested in th (<th>foo!bar</th>)
25428 #### 3b. Nested in th (<th>foo!!bar</th>)
25429 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25430 ####
25431 #### 4a. Escape -
25432 #### 4b. Escape +
25433 #### 4c. No escaping needed
25434 #### --------------------------------------
25435
25436 !! test
25437 Tables: 1a. Simple example
25438 !! options
25439 parsoid=html2wt
25440 !! html/parsoid
25441 <p>{|
25442 |}
25443 </p>
25444 !! wikitext
25445 <nowiki>{|</nowiki>
25446 |}
25447 !! end
25448
25449 !! test
25450 Tables: 1b. No escaping needed
25451 !! options
25452 parsoid=html2wt
25453 !! html/parsoid
25454 <p>!foo
25455 </p>
25456 !! wikitext
25457 !foo
25458 !! end
25459
25460 !! test
25461 Tables: 1c. No escaping needed
25462 !! options
25463 parsoid=html2wt
25464 !! html/parsoid
25465 <p>|foo
25466 </p>
25467 !! wikitext
25468 |foo
25469 !! end
25470
25471 !! test
25472 Tables: 1d. No escaping needed
25473 !! options
25474 parsoid=html2wt
25475 !! html/parsoid
25476 <p>|}foo
25477 </p>
25478 !! wikitext
25479 |}foo
25480 !! end
25481
25482 !! test
25483 Tables: 2a. Nested in td
25484 !! options
25485 parsoid=html2wt
25486 !! html/parsoid
25487 <table><tbody><tr>
25488 <td>foo|bar</td></tr>
25489 <tr><td>x<div>a|b</div></td>
25490 </tbody></table>
25491 !! wikitext
25492 {|
25493 |<nowiki>foo|bar</nowiki>
25494 |-
25495 |x<div><nowiki>a|b</nowiki></div>
25496 |}
25497 !! html/php+tidy
25498 <table>
25499 <tbody><tr>
25500 <td>foo|bar
25501 </td></tr>
25502 <tr>
25503 <td>x<div>a|b</div>
25504 </td></tr></tbody></table>
25505 !! end
25506
25507 !! test
25508 Tables: 2b. Nested in td
25509 !! options
25510 parsoid=html2wt
25511 !! html/parsoid
25512 <table><tbody><tr>
25513 <td>foo||bar</td>
25514 <td>a<i>b||c</i></td>
25515 <td>a<i><div>b||c</div></i></td>
25516 </tr></tbody></table>
25517 !! wikitext
25518 {|
25519 |<nowiki>foo||bar</nowiki>
25520 |a''<nowiki>b||c</nowiki>''
25521 |a''<div><nowiki>b||c</nowiki></div>''
25522 |}
25523 !! html/php
25524 <table>
25525 <tr>
25526 <td>foo||bar
25527 </td>
25528 <td>a<i>b||c</i>
25529 </td>
25530 <td>a<i><div>b||c</div></i>
25531 </td></tr></table>
25532
25533 !! end
25534
25535 !! test
25536 Tables: 2c. Nested in td -- no escaping needed
25537 !! options
25538 parsoid=html2wt
25539 !! html/*
25540 <table>
25541 <tr>
25542 <td>foo!!bar
25543 </td></tr></table>
25544
25545 !! wikitext
25546 {|
25547 |foo!!bar
25548 |}
25549 !! end
25550
25551 !! test
25552 Tables: 3a. Nested in th
25553 !! options
25554 parsoid=html2wt
25555 !! html/*
25556 <table>
25557 <tr>
25558 <th>foo!bar
25559 </th></tr></table>
25560
25561 !! wikitext
25562 {|
25563 !foo!bar
25564 |}
25565 !! end
25566
25567 !! test
25568 Tables: 3b. Nested in th
25569 !! options
25570 parsoid=html2wt
25571 !! html/parsoid
25572 <table><tbody>
25573 <tr><th>foo!!bar</th>
25574 <th><i>foo|bar</i></th>
25575 <th><i>foo!!bar</i></th>
25576 <th><i><span>foo!!bar</span></i></th>
25577 </tr></tbody></table>
25578 !! wikitext
25579 {|
25580 !<nowiki>foo!!bar</nowiki>
25581 !''<nowiki>foo|bar</nowiki>''
25582 !''<nowiki>foo!!bar</nowiki>''
25583 !''<span><nowiki>foo!!bar</nowiki></span>''
25584 |}
25585 !! html/php
25586 <table>
25587 <tr>
25588 <th>foo!!bar
25589 </th>
25590 <th><i>foo|bar</i>
25591 </th>
25592 <th><i>foo!!bar</i>
25593 </th>
25594 <th><i><span>foo!!bar</span></i>
25595 </th></tr></table>
25596
25597 !! end
25598
25599 !! test
25600 Tables: 3c. Nested in th
25601 !! options
25602 parsoid=html2wt
25603 !! html/parsoid
25604 <table><tbody>
25605 <tr><th>foo||bar</th>
25606 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25607 </tr></tbody></table>
25608 !! wikitext
25609 {|
25610 !<nowiki>foo||bar</nowiki>
25611 !<nowiki>foo||bar</nowiki>
25612 |}
25613 !! html/php
25614 <table>
25615 <tr>
25616 <th>foo||bar
25617 </th>
25618 <th>foo||bar
25619 </th></tr></table>
25620
25621 !! end
25622
25623 !! test
25624 Tables: 4a. Escape -
25625 !! options
25626 parsoid=html2wt
25627 !! html/*
25628 <table>
25629 <tr>
25630 <th>-bar
25631 </th></tr>
25632 <tr>
25633 <td>-bar
25634 </td></tr></table>
25635
25636 !! wikitext
25637 {|
25638 !-bar
25639 |-
25640 |<nowiki>-bar</nowiki>
25641 |}
25642 !! end
25643
25644 !! test
25645 Tables: 4b. Escape +
25646 !! options
25647 parsoid=html2wt
25648 !! html/*
25649 <table>
25650 <tr>
25651 <th>+bar
25652 </th></tr>
25653 <tr>
25654 <td>+bar
25655 </td></tr></table>
25656
25657 !! wikitext
25658 {|
25659 !+bar
25660 |-
25661 |<nowiki>+bar</nowiki>
25662 |}
25663 !! end
25664
25665 !! test
25666 Tables: 4c. No escaping needed
25667 !! options
25668 parsoid=html2wt
25669 !! html/parsoid
25670 <table><tbody>
25671 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25672 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25673 <tr><td>foo
25674 <p>bar|baz
25675 +bar
25676 -bar</p></td></tr>
25677 <tr><td>x
25678 <div>a|b</div></td>
25679 </tbody></table>
25680 !! wikitext
25681 {|
25682 |foo-bar
25683 |foo+bar
25684 |-
25685 |''foo''-bar
25686 |''foo''+bar
25687 |-
25688 |foo
25689 bar|baz
25690 +bar
25691 -bar
25692 |-
25693 |x
25694 <div>a|b</div>
25695 |}
25696 !! html/php
25697 <table>
25698 <tr>
25699 <td>foo-bar
25700 </td>
25701 <td>foo+bar
25702 </td></tr>
25703 <tr>
25704 <td><i>foo</i>-bar
25705 </td>
25706 <td><i>foo</i>+bar
25707 </td></tr>
25708 <tr>
25709 <td>foo
25710 <p>bar|baz
25711 +bar
25712 -bar
25713 </p>
25714 </td></tr>
25715 <tr>
25716 <td>x
25717 <div>a|b</div>
25718 </td></tr></table>
25719
25720 !! end
25721
25722 !! test
25723 Tables: 4d. No escaping needed
25724 !! options
25725 parsoid=html2wt
25726 !! html/parsoid
25727 <table>
25728 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25729 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25730 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25731 </tbody></table>
25732 !! wikitext
25733 {|
25734 |[[Foo]]-bar
25735 ||+1
25736 ||-2
25737 |}
25738 !! html/php
25739 <table>
25740 <tr>
25741 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25742 </td>
25743 <td>+1
25744 </td>
25745 <td>-2
25746 </td></tr></table>
25747
25748 !! end
25749
25750 !! test
25751 T97430: Don't emit empty nowiki pairs around marker meta tags
25752 !! options
25753 parsoid=html2wt
25754 !! html/parsoid
25755 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25756 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25757 !! wikitext
25758 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25759 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25760 !! end
25761
25762 !! test
25763 Unclosed xmlish element in table line shouldn't eat end delimiters
25764 !! options
25765 parsoid=html2wt
25766 !! html/parsoid
25767 <table>
25768 <tbody><tr><td> &lt;foo</td>
25769 <td> bar></td></tr>
25770 </tbody></table>
25771 !! wikitext
25772 {|
25773 | <foo
25774 | bar>
25775 |}
25776 !! html/php
25777 <table>
25778 <tr>
25779 <td>&lt;foo
25780 </td>
25781 <td>bar&gt;
25782 </td></tr></table>
25783
25784 !! end
25785
25786 #### --------------- Links ----------------
25787 #### 1. Quote marks in link text
25788 #### 2. Wikilinks: Escapes needed
25789 #### 3. Wikilinks: No escapes needed
25790 #### 4. Extlinks: Escapes needed
25791 #### 5. Extlinks: No escapes needed
25792 #### --------------------------------------
25793 !! test
25794 Links 1. WikiLinks: No escapes needed
25795 !! options
25796 parsoid=html2wt
25797 !! html/parsoid
25798 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25799 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25800 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25801 !! wikitext
25802 [[Foo|Foo''boo'']]
25803 [[Foo|[Foobar]]]
25804 [[Foo|x [Foobar] x]]
25805 !! html/php
25806 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25807 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25808 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25809 </p>
25810 !! end
25811
25812 !! test
25813 Links 2. WikiLinks: Escapes needed
25814 !! options
25815 parsoid=html2wt
25816 !! html/parsoid
25817 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25818 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25819 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25820 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25821 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25822 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25823 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25824 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25825 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25826 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25827 !! wikitext
25828 [[Foo|<nowiki>Foobar]</nowiki>]]
25829 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25830 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25831 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25832 [[Foo|<nowiki>|Bar</nowiki>]]
25833 [[Foo|<nowiki>]]bar</nowiki>]]
25834 [[Foo|<nowiki>[[bar</nowiki>]]
25835 [[Foo|<nowiki>x [[ y</nowiki>]]
25836 [[Foo|<nowiki>x ]] y</nowiki>]]
25837 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25838 !! html/php
25839 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25840 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25841 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25842 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25843 <a href="/wiki/Foo" title="Foo">|Bar</a>
25844 <a href="/wiki/Foo" title="Foo">]]bar</a>
25845 <a href="/wiki/Foo" title="Foo">[[bar</a>
25846 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25847 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25848 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25849 </p>
25850 !! end
25851
25852 !! test
25853 Links 3. WikiLinks: No escapes needed
25854 !! options
25855 parsoid=html2wt
25856 !! html/parsoid
25857 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25858 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25859 !! wikitext
25860 [[Foo|[Foobar]]
25861 [[Foo|foo|bar]]
25862 !! html/php
25863 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25864 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25865 </p>
25866 !! end
25867
25868 !! test
25869 Links 4. ExtLinks: Escapes needed
25870 !! options
25871 parsoid=html2wt
25872 !! html/parsoid
25873 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25874 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25875 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25876 <p>[http://google.com]</p>
25877 <p>[http://google.com google]</p>
25878 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25879 <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>
25880 !! wikitext
25881 [http://google.com <nowiki>[google]</nowiki>]
25882 [http://google.com <nowiki>google]</nowiki>]
25883 [http://google.com <nowiki>goog] le</nowiki>]
25884
25885 <nowiki>[http://google.com]</nowiki>
25886
25887 <nowiki>[http://google.com google]</nowiki>
25888
25889 [http://google.com<nowiki>]</nowiki>
25890
25891 [{{echo|http://google.com}}<nowiki>]</nowiki>
25892 !! html/php
25893 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25894 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25895 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25896 </p><p>[http://google.com]
25897 </p><p>[http://google.com google]
25898 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25899 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25900 </p>
25901 !! end
25902
25903 !! test
25904 Links 5. ExtLinks: No escapes needed
25905 !! options
25906 parsoid=html2wt
25907 !! html/parsoid
25908 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25909 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25910 !! wikitext
25911 [http://google.com [google]
25912
25913 [[http://google.com]]
25914 !! html/php
25915 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25916 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25917 </p>
25918 !! end
25919
25920 !! test
25921 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25922 !! options
25923 parsoid=html2wt
25924 !! html/parsoid
25925 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25926 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25927 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25928 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25929 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25930 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25931 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25932 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25933 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25934 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25935 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25936 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25937 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25938 </p>
25939 !! wikitext
25940 x<nowiki/>http://example.com<nowiki/>y
25941 http://example.com<nowiki/>?x
25942 http://example.com<nowiki/>&x
25943 http://example.com<nowiki/>'x
25944 http://example.com<nowiki/>,x
25945 http://example.com<nowiki/>.x
25946 http://example.com<nowiki/>;x
25947 http://example.com<nowiki/>:x
25948 http://example.com<nowiki/>;x
25949 http://example.com<nowiki/>!x
25950 http://example.com<nowiki/>=x
25951 http://example.com<nowiki/>(x)
25952 http://example.com(x<nowiki/>)
25953 !! end
25954
25955 !! test
25956 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25957 !! options
25958 parsoid=html2wt
25959 !! html/parsoid
25960 <p>x
25961 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25962 y
25963 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25964 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25965 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25966 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25967 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25968 </p>
25969 !! wikitext
25970 x
25971 http://example.com
25972 y
25973 "http://example.com"
25974 (http://example.com)
25975 (http://example.com) foo
25976 http://example.com,
25977 http://example.com, foo
25978 !! html/php
25979 <p>x
25980 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25981 y
25982 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25983 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25984 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25985 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25986 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25987 </p>
25988 !! end
25989
25990 !! test
25991 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25992 !! options
25993 parsoid=html2wt
25994 !! html/parsoid
25995 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
25996 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
25997 !! wikitext
25998 http://example.com.,;:!?\
25999 -http://example.com:
26000 !! html/php
26001 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
26002 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
26003 </p>
26004 !! end
26005
26006 !! test
26007 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
26008 !! options
26009 parsoid=html2wt
26010 !! html/parsoid
26011 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
26012 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
26013 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
26014 !! wikitext
26015 RFC 123<nowiki/>4
26016 RFC 123<nowiki/>y
26017 X<nowiki/>RFC 123<nowiki/>y
26018 !! end
26019
26020 !! test
26021 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
26022 !! options
26023 parsoid=html2wt
26024 !! html/parsoid
26025 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
26026 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
26027 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
26028 </p>
26029 !! wikitext
26030 RFC 123?foo
26031 RFC 123&foo
26032 -RFC 123-
26033 !! html/php
26034 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26035 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26036 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26037 </p>
26038 !! end
26039
26040 !! test
26041 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26042 !! options
26043 parsoid=html2wt
26044 !! html/parsoid
26045 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26046 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26047 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26048 !! wikitext
26049 PMID 123<nowiki/>4
26050 PMID 123<nowiki/>y
26051 X<nowiki/>PMID 123<nowiki/>y
26052 !! end
26053
26054 !! test
26055 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26056 !! options
26057 parsoid=html2wt
26058 !! html/parsoid
26059 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26060 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26061 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26062 </p>
26063 !! wikitext
26064 PMID 123?foo
26065 PMID 123&foo
26066 -PMID 123-
26067 !! html/php
26068 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26069 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26070 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26071 </p>
26072 !! end
26073
26074 !! test
26075 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26076 !! options
26077 parsoid=html2wt
26078 !! html/parsoid
26079 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26080 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26081 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26082 </p>
26083 !! wikitext
26084 ISBN 1234567890<nowiki/>1
26085 ISBN 1234567890<nowiki/>x
26086 a<nowiki/>ISBN 1234567890<nowiki/>b
26087 !! end
26088
26089 !! test
26090 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26091 !! options
26092 parsoid=html2wt
26093 !! html/parsoid
26094 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26095 !! wikitext
26096 -ISBN 1234567890's
26097 !! html/php
26098 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26099 </p>
26100 !! end
26101
26102 !! test
26103 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26104 !! options
26105 parsoid=html2wt
26106 !! html/*
26107 <p>this is not a link: http://example.com
26108 </p>
26109 !! wikitext
26110 this is not a link: <nowiki>http://example.com</nowiki>
26111 !! end
26112
26113 !! test
26114 Links 15. Link trails can't become link prefixes.
26115 !! options
26116 language=is
26117 parsoid=html2wt
26118 !! html/parsoid
26119 <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>
26120 !! wikitext
26121 [[Söfnuður]]-[[00]]
26122 !! html/php
26123 <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>
26124 </p>
26125 !! end
26126
26127 #### --------------- Quotes ---------------
26128 #### 1. Quotes inside <b> and <i>
26129 #### 2. Link fragments separated by <i> and <b> tags
26130 #### 3. Link fragments inside <i> and <b>
26131 #### 4. No escaping needed
26132 #### --------------------------------------
26133 !! test
26134 1a. Quotes inside <b> and <i>
26135 !! options
26136 parsoid=html2wt
26137 !! html/*
26138 <p><i>'foo'</i>
26139 <i>''foo''</i>
26140 <i>'''foo'''</i>
26141 <i>foo</i>'s
26142 <b>'foo'</b>
26143 <b>''foo''</b>
26144 <b>'''foo'''</b>
26145 <b>foo'<i>bar'</i>baz</b>
26146 <b>foo</b>'s
26147 '<i>foo</i>
26148 <i>foo</i>'
26149 <i>foo'</i>'
26150 '<i>foo</i>'
26151 '<b>foo</b>
26152 <b>foo</b>'
26153 '<b>foo</b>'
26154 <i>fools'<span> errand</span></i>
26155 <i><span>fool</span>'s errand</i>
26156 '<i>foo</i> bar '<i>baz</i>
26157 a|!*#-:;+-~[]{}b'<i>x</i>
26158 </p>
26159 !! wikitext
26160 ''<nowiki/>'foo'''
26161 ''<nowiki>''foo''</nowiki>''
26162 ''<nowiki>'''foo'''</nowiki>''
26163 ''foo''<nowiki/>'s
26164 '''<nowiki/>'foo''''
26165 '''<nowiki>''foo''</nowiki>'''
26166 '''<nowiki>'''foo'''</nowiki>'''
26167 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26168 '''foo'''<nowiki/>'s
26169 '''foo''
26170 ''foo''<nowiki/>'
26171 ''foo'''<nowiki/>'
26172 '''foo''<nowiki/>'
26173 ''''foo'''
26174 '''foo'''<nowiki/>'
26175 ''''foo'''<nowiki/>'
26176 ''fools'<span> errand</span>''
26177 ''<span>fool</span>'s errand''
26178 '<nowiki/>''foo'' bar '''baz''
26179 a|!*#-:;+-~[]{}b'''x''
26180 !! end
26181
26182 !! test
26183 1b. Quotes inside <b> and <i> with other tags on same line
26184 !! options
26185 parsoid=html2wt
26186 !! html/parsoid
26187 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26188 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26189 <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>
26190 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26191 '<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>
26192 '<i>foo</i> <div title="name">test</div>
26193 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26194 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26195 <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>
26196 </ol>
26197 !! wikitext
26198 '''a'' foo ''[[bar]]''
26199 ''a''' foo ''[[bar]]''
26200 ''a''' foo '''{{echo|[[bar]]}}'''
26201 [[foo]] x'''[[bar]]''
26202 '''foo'' <ref>test</ref>
26203 '''foo'' <div title="name">test</div>
26204 '''foo'' and <br> bar
26205 <references />
26206 !! end
26207
26208 !! test
26209 2. Link fragments separated by <i> and <b> tags
26210 !! options
26211 parsoid=html2wt
26212 !! html/parsoid
26213 <p>[[<i>foo</i>hello]]</p>
26214 <p>[[<b>foo</b>hello]]</p>
26215 !! wikitext
26216 [[''foo''<nowiki>hello]]</nowiki>
26217
26218 [['''foo'''<nowiki>hello]]</nowiki>
26219 !! end
26220
26221 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26222 # this is one of the shortcomings of this format
26223 !! test
26224 3. Link fragments inside <i> and <b>
26225 !! options
26226 parsoid=html2wt
26227 !! html/parsoid
26228 <p><i>[[foo</i>]]</p>
26229 <p><b>[[foo</b>]]</p>
26230 !! wikitext
26231 ''[[foo''<nowiki>]]</nowiki>
26232
26233 '''[[foo'''<nowiki>]]</nowiki>
26234 !! end
26235
26236 !! test
26237 4. No escaping needed
26238 !! options
26239 parsoid=html2wt
26240 !! html/parsoid
26241 <p>'<span><i>bar</i></span>'
26242 '<span><b>bar</b></span>'
26243 'a:b'foo
26244 </p>
26245 !! wikitext
26246 '<span>''bar''</span>'
26247 '<span>'''bar'''</span>'
26248 'a:b'foo
26249 !! end
26250
26251 #### ----------- Paragraphs ---------------
26252 #### 1. No unnecessary escapes
26253 #### --------------------------------------
26254
26255 !! test
26256 1. No unnecessary escapes
26257 !! options
26258 parsoid=html2wt
26259 !! html/parsoid
26260 <p>bar <span>[[foo]]</span>
26261 </p><p>=bar <span>[[foo]]</span>
26262 </p><p>[[bar <span>[[foo]]</span>
26263 </p><p>]]bar <span>[[foo]]</span>
26264 </p><p>=bar <span>foo]]</span>=
26265 </p>
26266 !! wikitext
26267 bar <span><nowiki>[[foo]]</nowiki></span>
26268
26269 =bar <span><nowiki>[[foo]]</nowiki></span>
26270
26271 [[bar <span><nowiki>[[foo]]</nowiki></span>
26272
26273 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26274
26275 =bar <span>foo]]</span><nowiki>=</nowiki>
26276 !!end
26277
26278 #### ----------------------- PRE --------------------------
26279 #### 1. Leading whitespace in SOL context should be escaped
26280 #### ------------------------------------------------------
26281 !! test
26282 1. Leading whitespace in SOL context should be escaped
26283 !! options
26284 parsoid=html2wt
26285 !! html/parsoid
26286 <p> a</p>
26287
26288 <p> a</p>
26289
26290 <p> a(tab)</p>
26291
26292 <p> a
26293 <!--cmt-->
26294 a</p>
26295
26296 <p>a
26297 b</p>
26298
26299 <p>a
26300 b</p>
26301
26302 <p>a
26303 b</p>
26304 !! wikitext
26305 <nowiki> </nowiki>a
26306
26307 <nowiki> </nowiki> a
26308
26309 a(tab)
26310
26311 <nowiki> </nowiki> a
26312 <!--cmt-->
26313 <nowiki> </nowiki>a
26314
26315 a
26316 <nowiki> </nowiki>b
26317
26318 a
26319 b
26320
26321 a
26322 b
26323 !! html/php
26324 <p> a
26325 </p><p> a
26326 </p><p> a(tab)
26327 </p><p> a
26328 a
26329 </p><p>a
26330 b
26331 </p><p>a
26332 b
26333 </p><p>a
26334 b
26335 </p>
26336 !! end
26337
26338 !! test
26339 2. Leading whitespace in non-indent-pre contexts should not be escaped
26340 !! options
26341 parsoid=html2wt
26342 !! html/parsoid
26343 <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>
26344 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26345 <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>
26346 b</span></li>
26347 </ol>
26348 !! wikitext
26349 foo <ref>''a''
26350 b</ref>
26351 <references />
26352 !! end
26353
26354 !! test
26355 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26356 !! options
26357 parsoid=html2wt
26358 !! html/parsoid
26359 <blockquote>
26360 <p>
26361 a
26362 <span>b</span>
26363 c</p>
26364 </blockquote>
26365 !! wikitext
26366 <blockquote>
26367 a
26368 <span>b</span>
26369 c
26370 </blockquote>
26371 !! end
26372
26373 !! test
26374 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26375 !! options
26376 parsoid=html2wt
26377 !! html/parsoid
26378 <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>
26379 !! wikitext
26380 [[File:Foobar.jpg|thumb|caption]]
26381 !! end
26382
26383 !! test
26384 5. Nowiki escaping should account for indent-pres
26385 !! options
26386 parsoid=html2wt
26387 !! html/parsoid
26388 <pre>==foo==</pre>
26389 !! wikitext
26390 ==foo==
26391 !! end
26392
26393 !!test
26394 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26395 !! options
26396 parsoid=html2wt
26397 !! html/parsoid
26398 <pre>
26399 * foo
26400 * bar
26401 </pre>
26402 !! wikitext
26403 * foo
26404 * bar
26405 !! end
26406
26407 #### --------------- Behavior Switches --------------------
26408
26409 !! test
26410 1. Valid behavior switches should be escaped
26411 !! options
26412 parsoid=html2wt
26413 !! html/parsoid
26414 __TOC__
26415 <i>__TOC__</i>
26416 !! wikitext
26417 <nowiki>__TOC__</nowiki>
26418 ''<nowiki>__TOC__</nowiki>''
26419 !! end
26420
26421 !! test
26422 2. Invalid behavior switches should not be escaped
26423 !! options
26424 parsoid=html2wt
26425 !! html/parsoid
26426 __TOO__
26427 __|__
26428 !! wikitext
26429 __TOO__
26430 __|__
26431 !! end
26432
26433 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26434 !! test
26435 Behavior switches should be SOL-transparent
26436 !! options
26437 parsoid=html2wt
26438 !! html/parsoid
26439 <meta property="mw:PageProp/toc" />
26440
26441 <!-- this one's bogus -->
26442 <pre>__TOO__</pre>
26443
26444 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26445
26446 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26447 !! wikitext
26448 __TOC__
26449
26450 <!-- this one's bogus -->
26451 __TOO__
26452
26453 __TOC__ foo
26454
26455 __TOC__
26456 bar
26457 !! end
26458
26459 #### --------------- HTML tags ---------------
26460 #### 1. a tags
26461 #### 2. other tags
26462 #### 3. multi-line html tag
26463 #### 4. extension tags
26464 #### -----------------------------------------
26465 !! test
26466 1. a tags
26467 !! options
26468 parsoid=html2wt
26469 !! html/parsoid
26470 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26471 !! wikitext
26472 <a href="http://google.com">google</a>
26473 !! end
26474
26475 !! test
26476 2. other tags
26477 !! options
26478 parsoid=html2wt
26479 !! html/parsoid
26480 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26481 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26482 <li> &lt;td&gt;</li></ul>
26483
26484 !! wikitext
26485 * <nowiki><div>foo</div></nowiki>
26486 * <nowiki><div style="color:red">foo</div></nowiki>
26487 * <nowiki><td></nowiki>
26488 !! end
26489
26490 !! test
26491 3. multi-line html tag
26492 !! options
26493 parsoid=html2wt
26494 !! html/parsoid
26495 <p>&lt;div
26496 &gt;foo&lt;/div
26497 &gt;
26498 </p>
26499 !! wikitext
26500 <nowiki><div
26501 >foo</div
26502 ></nowiki>
26503 !! end
26504
26505 !! test
26506 4. extension tags
26507 !! options
26508 parsoid=html2wt
26509 !! html/parsoid
26510 <p>&lt;ref&gt;foo&lt;/ref&gt;
26511 </p><p>&lt;ref&gt;bar
26512 </p><p>baz&lt;/ref&gt;
26513 </p>
26514 !! wikitext
26515 <nowiki><ref>foo</ref></nowiki>
26516
26517 <nowiki><ref>bar</nowiki>
26518
26519 baz<nowiki></ref></nowiki>
26520 !! end
26521
26522 #### --------------- Others ---------------
26523 !! test
26524 Escaping nowikis
26525 !! options
26526 parsoid=html2wt
26527 !! html/parsoid
26528 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26529 </p>
26530 !! wikitext
26531 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26532 !! end
26533
26534 ## The quote-char in the input is necessary for triggering the bug
26535 !! test
26536 (T54035) Nowiki-escaping should not get tripped by " :" in text
26537 !! options
26538 parsoid=html2wt
26539 !! html/parsoid
26540 <p>foo's bar :</p>
26541 !! wikitext
26542 foo's bar :
26543 !! end
26544
26545 #----------- End of wikitext escaping tests --------------
26546
26547 !! test
26548
26549 Tag-like HTML structures are passed through as text
26550 !! wikitext
26551 <x y>
26552
26553 <x.y>
26554
26555 <x-y>
26556
26557 1>2
26558
26559 x<y
26560
26561 a>b
26562
26563 1<d e>f
26564 !! html
26565 <p>&lt;x y&gt;
26566 </p><p>&lt;x.y&gt;
26567 </p><p>&lt;x-y&gt;
26568 </p><p>1&gt;2
26569 </p><p>x&lt;y
26570 </p><p>a&gt;b
26571 </p><p>1&lt;d e&gt;f
26572 </p>
26573 !! end
26574
26575 !! test
26576 HTML tag with necessary entities in attributes
26577 !! wikitext
26578 <span title="&amp;amp;">foo</span>
26579 !! html
26580 <p><span title="&amp;amp;">foo</span>
26581 </p>
26582 !! end
26583
26584 !! test
26585 HTML tag with 'unnecessary' entity encoding in attributes
26586 !! wikitext
26587 <span title="&amp;">foo</span>
26588 !! html
26589 <p><span title="&amp;">foo</span>
26590 </p>
26591 !! end
26592
26593 !! test
26594 HTML tag with broken attribute value quoting
26595 !! options
26596 parsoid=wt2html,html2html
26597 !! wikitext
26598 <span title="Hello world>Foo</span>
26599 !! html/php
26600 <p><span title="Hello world">Foo</span>
26601 </p>
26602 !! html/parsoid
26603 <p><span title="Hello world">Foo</span></p>
26604 !! end
26605
26606 !! test
26607 Self-closed tag with broken attribute value quoting
26608 !! options
26609 parsoid=wt2html,html2html
26610 !! wikitext
26611 <div title="Hello world />Foo
26612 !! html/php+tidy
26613 <div title="Hello world"></div><p>Foo
26614 </p>
26615 !! html/parsoid
26616 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26617 !! end
26618
26619 !! test
26620 Table with broken attribute value quoting
26621 !! options
26622 parsoid=wt2html,html2html
26623 !! wikitext
26624 {|
26625 | title="Hello world|Foo
26626 |}
26627 !! html/php
26628 <table>
26629 <tr>
26630 <td title="Hello world">Foo
26631 </td></tr></table>
26632
26633 !! html/parsoid
26634 <table>
26635 <tr>
26636 <td title="Hello world">Foo
26637 </td></tr></table>
26638
26639 !! end
26640
26641 !! test
26642 Table with broken attribute value quoting on consecutive lines
26643 !! options
26644 parsoid=wt2html,html2html
26645 !! wikitext
26646 {|
26647 | title="Hello world|Foo
26648 | style="color:red|Bar
26649 |}
26650 !! html/php
26651 <table>
26652 <tr>
26653 <td title="Hello world">Foo
26654 </td>
26655 <td style="color:red">Bar
26656 </td></tr></table>
26657
26658 !! html/parsoid
26659 <table><tbody>
26660 <tr>
26661 <td title="Hello world">Foo
26662 </td><td style="color: red">Bar
26663 </td></tr></tbody></table>
26664
26665 !! end
26666
26667 !!test
26668 Accept empty td cell attribute
26669 !! wikitext
26670 {|
26671 | align="center" |foo|| |
26672 |}
26673 !! html
26674 <table>
26675 <tr>
26676 <td align="center">foo</td>
26677 <td>
26678 </td></tr></table>
26679
26680 !!end
26681
26682 !!test
26683 Non-empty attributes in th-cells
26684 !! wikitext
26685 {|
26686 !Foo!! style="color: red" |Bar
26687 |}
26688 !! html
26689 <table>
26690 <tr>
26691 <th>Foo</th>
26692 <th style="color: red">Bar
26693 </th></tr></table>
26694
26695 !!end
26696
26697 !!test
26698 Accept empty attributes in th-cells
26699 !! wikitext
26700 {|
26701 !|foo!!|bar
26702 |}
26703 !! html
26704 <table>
26705 <tr>
26706 <th>foo</th>
26707 <th>bar
26708 </th></tr></table>
26709
26710 !!end
26711
26712 !!test
26713 Empty table rows go away
26714 !! wikitext
26715 {|
26716 |Hello
26717 |there
26718 |- class="foo"
26719 |-
26720 |}
26721 !! html
26722 <table>
26723 <tr>
26724 <td>Hello
26725 </td>
26726 <td>there
26727 </td></tr>
26728
26729 </table>
26730
26731 !! end
26732
26733 ###
26734 ### Parsoid-centric tests for testing RTing of inter-element separators
26735 ### Edge cases not tested by existing parser tests and specific to
26736 ### Parsoid-specific serialization strategies.
26737 ###
26738
26739 !!test
26740 RT-ed inter-element separators should be valid separators
26741 !! wikitext
26742 {|
26743 |- [[foo]]
26744 |}
26745 !! html/php
26746 <table>
26747
26748 </table>
26749
26750 !! html/parsoid
26751 <table>
26752 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26753 </tbody></table>
26754 !!end
26755
26756 # Parsoid-only test of a DOM pass
26757 !!test
26758 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26759 !! wikitext
26760 {|
26761 |<small>foo
26762 bar
26763 |}
26764
26765 {|
26766 |<small>foo<small>
26767 |}
26768 !! html/parsoid
26769 <table>
26770 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26771 <p>bar</p></small></td></tr>
26772 </tbody></table>
26773
26774 <table>
26775 <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>
26776 </tbody></table>
26777 !!end
26778
26779 # Note that the "style" attribute is really a template parameter here.
26780 # The = would have to be {{=}} if you wanted the literal.
26781 !!test
26782 Empty TD followed by TD with tpl-generated attribute
26783 !! wikitext
26784 {|
26785 |-
26786 |
26787 |{{echo|style='color:red'}}|foo
26788 |}
26789 !! html
26790 <table>
26791
26792 <tr>
26793 <td>
26794 </td>
26795 <td>foo
26796 </td></tr></table>
26797
26798 !!end
26799
26800 !!test
26801 Indented table with an empty td
26802 !! wikitext
26803 {|
26804 |-
26805 |
26806 |foo
26807 |}
26808 !! html
26809 <table>
26810
26811 <tr>
26812 <td>
26813 </td>
26814 <td>foo
26815 </td></tr></table>
26816
26817 !!end
26818
26819 ## We have some newline diffs RT-ing this edge case
26820 ## and it is not important enough -- we seem to be emitting
26821 ## at most 2 newlines after a </tr> and this is unrelated to
26822 ## the issue from T85627 that this is testing.
26823 !!test
26824 Indented table with blank lines in between (T85627)
26825 !! options
26826 parsoid=wt2html
26827 !! wikitext
26828 {|
26829 |foo
26830
26831
26832 |}
26833 !! html
26834 <table>
26835
26836 <tr>
26837 <td>foo
26838 </td></tr></table>
26839
26840 !!end
26841
26842 !!test
26843 Indented block & table
26844 !! wikitext
26845 <div>foo</div>
26846 {|
26847 |foo
26848 |}
26849 !! html/php
26850 <div>foo</div>
26851 <table>
26852 <tr>
26853 <td>foo
26854 </td></tr></table>
26855
26856 !! html/parsoid
26857 <div data-parsoid='{"stx":"html"}'>foo</div>
26858 <table><tbody>
26859 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26860 </tbody></table>
26861 !!end
26862
26863 !! test
26864 Indent and comment before table row
26865 !! wikitext
26866 {|
26867 <!--hi-->|-
26868 |there
26869 |}
26870 !! html/php
26871 <table>
26872
26873 <tr>
26874 <td>there
26875 </td></tr></table>
26876
26877 !! html/parsoid
26878 <table>
26879 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26880 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26881 </tbody></table>
26882 !! end
26883
26884 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26885 !!test
26886 Empty TR followed by a template-generated TR
26887 !!options
26888 parsoid
26889 !! wikitext
26890 {|
26891 |-
26892 {{echo|<tr><td>foo</td></tr>}}
26893 |}
26894 !! html
26895 <table>
26896 <tbody>
26897 <tr class='mw-empty-elt'></tr>
26898 <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}}]}'>
26899 <td>foo</td></tr>
26900 </tbody></table>
26901 !!end
26902
26903 ## PHP and parsoid output differ for this, and since this is primarily
26904 ## for testing Parsoid's serializer, marking this Parsoid only
26905 !!test
26906 Empty TR followed by mixed-ws-comment line should RT correctly
26907 !!options
26908 parsoid
26909 !! wikitext
26910 {|
26911 |-
26912 <!--c-->
26913 |-
26914 <!--c--> <!--d-->
26915 |}
26916 !! html
26917 <table>
26918 <tbody>
26919 <tr class='mw-empty-elt'></tr>
26920 <!--c-->
26921 <tr>
26922 <!--c--> </tr><!--d-->
26923 </tbody></table>
26924
26925 !!end
26926
26927 !!test
26928 Multi-line image caption generated by templates with/without trailing newlines
26929 !! wikitext
26930 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26931 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26932 !! html/parsoid
26933 <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>
26934 <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>
26935 !!end
26936
26937 !! test
26938 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26939 !! options
26940 parsoid=html2wt
26941 !! html/parsoid
26942 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
26943
26944 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26945 !! wikitext
26946 <includeonly>foo</includeonly>
26947 new para
26948
26949 [[Category:Foo]]
26950
26951 = new heading =
26952 !! end
26953
26954 ## PHP emits broken html for this, and since this is primarily
26955 ## a Parsoid serializer test, marking this Parsoid only
26956 !!test
26957 Improperly nested inline or quotes tags with whitespace in between
26958 !! wikitext
26959 <span> <s>x</span> </s>
26960 ''' ''x''' ''
26961 !! html/parsoid
26962 <p><span> <s>x</s></span><s> </s>
26963 <b> <i>x</i></b><i> </i>
26964 </p>
26965 !!end
26966
26967 !!test
26968 Encapsulate protected attributes from wt
26969 !! wikitext
26970 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26971
26972 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26973 | ok
26974 |}
26975 !! html/parsoid
26976 <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>
26977
26978 <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">
26979 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26980 </tbody></table>
26981 !!end
26982
26983 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26984 ## Having nested or stray pre tags results in the attempt to add duplicates,
26985 ## causing an assertion fail. This test tries to prevent that situation.
26986 !!test
26987 Ensure ParagraphWrapper can deal with stray closing pre tags
26988 !!options
26989 parsoid=wt2html
26990 !! wikitext
26991 plain text</pre>
26992 !! html/parsoid
26993 plain text
26994 !!end
26995
26996 !!test
26997 1. Ensure fostered text content is wrapped in element nodes
26998 !!options
26999 parsoid=wt2html
27000 !! wikitext
27001 <table>hi</table><table>ho</table>
27002 !! html/parsoid
27003 <p>hi</p>
27004 <table></table>
27005 <p>ho</p>
27006 <table></table>
27007 !!end
27008
27009 !!test
27010 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
27011 !!options
27012 parsoid=wt2html,wt2wt
27013 !! wikitext
27014 <table>
27015 <tr> || ||
27016 <td> a
27017 </table>
27018 !! html/parsoid
27019 <p> || ||
27020 </p><table>
27021 <tbody><tr><td> a</td></tr>
27022 </tbody></table>
27023 !!end
27024
27025 !!test
27026 Encapsulation properly handles null DSR information from foster box
27027 !!options
27028 parsoid=wt2html,wt2wt
27029 !! wikitext
27030 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
27031 !! html/parsoid
27032 <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;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
27033 !!end
27034
27035 !!test
27036 1. Encapsulate foster-parented transclusion content
27037 !!options
27038 parsoid=wt2wt,wt2html
27039 !! wikitext
27040 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27041 !! html/parsoid
27042 <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;foo<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
27043 <tbody>
27044 <tr>
27045 <td>bar</td>
27046 </tr>
27047 </tbody>
27048 </table>
27049 !!end
27050
27051 !!test
27052 2. Encapsulate foster-parented transclusion content
27053 !!options
27054 parsoid=wt2wt,wt2html
27055 !! wikitext
27056 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27057 !! html/parsoid
27058 <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>
27059 <table>
27060 <tbody>
27061 <tr>
27062 <td>bar</td>
27063 </tr>
27064 </tbody>
27065 </table>
27066 !!end
27067
27068 !!test
27069 3. Encapsulate foster-parented transclusion content
27070 !!options
27071 parsoid=wt2wt,wt2html
27072 !! wikitext
27073 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27074 !! html/parsoid
27075 <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;]}">
27076 <p>foo</p>
27077 </div>
27078 <table>
27079 <tbody>
27080 <tr>
27081 <td>bar</td>
27082 </tr>
27083 </tbody>
27084 </table>
27085 !!end
27086
27087 !!test
27088 4. Encapsulate foster-parented transclusion content
27089 !!options
27090 parsoid=wt2wt,wt2html
27091 !! wikitext
27092 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27093 !! html/parsoid
27094 <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;]}">
27095 <p>foo</p>
27096 </div>
27097 <table>
27098 <tbody>
27099 <tr>
27100 <td>bar</td>
27101 </tr>
27102 </tbody>
27103 </table>
27104 !!end
27105
27106 !!test
27107 5. Encapsulate foster-parented transclusion content
27108 !!options
27109 parsoid=wt2wt,wt2html
27110 !! wikitext
27111 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27112 !! html/parsoid
27113 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><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></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
27114 <table>
27115 <tbody>
27116 <tr>
27117 <td>
27118 <div>
27119 <p>foo</p>
27120 </div>
27121 </td>
27122 </tr>
27123 </tbody>
27124 </table>
27125 !!end
27126
27127 !!test
27128 6. Encapsulate foster-parented transclusion content
27129 !!options
27130 parsoid=wt2wt,wt2html
27131 !! wikitext
27132 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27133 !! html/parsoid
27134 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><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></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
27135 <table>
27136 <tbody>
27137 <tr>
27138 <td>
27139 <div>
27140 <p>foo</p>
27141 </div>
27142 </td>
27143 </tr>
27144 </tbody>
27145 </table>
27146 <p>ok</p>
27147 !!end
27148
27149 !!test
27150 7. Encapsulate foster-parented transclusion content
27151 !!options
27152 parsoid=wt2wt,wt2html
27153 !! wikitext
27154 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27155 !! html/parsoid
27156 <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>
27157 <table>
27158 <tbody>
27159 <tr>
27160 <td>bar</td>
27161 </tr>
27162 </tbody>
27163 </table>
27164 !!end
27165
27166 # Note that the wt is broken on purpose: the = should be {{=}} if you
27167 # don't want it to be a template parameter key.
27168 !!test
27169 8. Encapsulate foster-parented transclusion content
27170 !!options
27171 parsoid=wt2wt,wt2html
27172 !! wikitext
27173 {{echo|a
27174 }}{|{{echo|style='color:red'}}
27175 |-
27176 |b
27177 |}
27178 !! html/parsoid
27179 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27180 <span> </span>
27181 <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
27182 <table>
27183 <tbody>
27184 <tr>
27185 <td>b</td>
27186 </tr>
27187 </tbody>
27188 </table>
27189 !!end
27190
27191 !!test
27192 9. Encapsulate foster-parented transclusion content
27193 !!options
27194 parsoid=wt2wt,wt2html
27195 !! wikitext
27196 <table>{{echo|hi</table>hello}}
27197 !! html/parsoid
27198 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
27199 !!end
27200
27201 !!test
27202 Table in fosterable position
27203 !!options
27204 parsoid=wt2html
27205 !! wikitext
27206 {{OpenTable}}
27207 <div>
27208 {|
27209 |}
27210 </div>
27211 |}
27212 !! html/parsoid
27213 <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">
27214 </span>
27215 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27216
27217 <table>
27218 </table>
27219 !!end
27220
27221 # Parsoid only for T66747
27222 !! test
27223 Properly encapsulate empty-content transclusions in fosterable positions
27224 !! wikitext
27225 <table>
27226 {{#if:|
27227 <td>foo</td>
27228 }}
27229 </table>
27230 !! html/parsoid
27231 <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"}]]}'>
27232
27233 </table>
27234 !! end
27235
27236 !! test
27237 Always encapsulate foster box when template range is expanded to table
27238 !! options
27239 parsoid=wt2wt
27240 !! wikitext
27241 {|
27242 hello
27243 {{OpenTable}}
27244 |}
27245 !! html/parsoid
27246
27247 !! end
27248
27249 !! test
27250 T115289: Unclosed table
27251 !! wikitext
27252 {{echo|<table>}}<!--c-->[[Category:Two]]
27253 !! html/parsoid
27254 <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>
27255 !! end
27256
27257 !! test
27258 T115289: Don't migrate newlines out of tables with fostered content
27259 !! wikitext
27260 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27261 !! html/parsoid
27262 <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>
27263 !! end
27264
27265 !! test
27266 T73074: More fostering fun
27267 !! wikitext
27268 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27269 !! html/parsoid
27270 <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>
27271 !! end
27272
27273 !!test
27274 Support <object> element with .data attribute
27275 !!options
27276 parsoid=html2wt
27277 !! html/parsoid
27278 <object data="test.swf"></object>
27279 !! wikitext
27280 <object data="test.swf"></object>
27281 !!end
27282
27283 !! test
27284 Don't block XML namespace declaration
27285 !! wikitext
27286 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27287 !! html/php
27288 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27289 </p>
27290 !! html/parsoid
27291 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27292 !! end
27293
27294 # -----------------------------------------------------------------
27295 # The following section of tests are primarily to spec requirements
27296 # around Parsoid's serialization (old, new, edited content)
27297 #
27298 # All these tests are marked Parsoid html2wt and html2html only
27299 # ----------------------------------------------------------------
27300
27301 !! test
27302 Ignore rel attribute in a-tags during serialization to url-links
27303 !! options
27304 parsoid=html2wt
27305 !! html/parsoid
27306 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27307 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27308 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27309 !! wikitext
27310 http://en.wikipedia.org/wiki/Foobar
27311 http://en.wikipedia.org/wiki/Foobar
27312 http://en.wikipedia.org/wiki/Foobar
27313 !! end
27314
27315 # 'mi' is a localinterwiki prefix as well as a language
27316 !! test
27317 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27318 !! options
27319 parsoid=html2wt
27320 !! html/parsoid
27321 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27322 !! wikitext
27323 [[Foo]]
27324 !! end
27325
27326 !! test
27327 Parsoid should accept interwiki shortcuts
27328 !! options
27329 parsoid=html2wt
27330 !! html/parsoid
27331 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27332 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27333 <a href='./fr:Foo'>Foo</a></p>
27334 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27335 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27336 <a href='fr%3AFoo'>Foo</a></p>
27337 <p><a href='FR%3AFoo'>Foo</a>
27338 <a href='./FR:Foo'>Foo</a></p>
27339 !! wikitext
27340 [[:fr:Foo|Foo]]
27341 [[:fr:Foo|Foo]]
27342 [[:fr:Foo|Foo]]
27343
27344 [[:fr:Foo|Foo]]
27345 [[:fr:Foo|Foo]]
27346 [[:fr:Foo|Foo]]
27347
27348 [[:fr:Foo|Foo]]
27349 [[:fr:Foo|Foo]]
27350 !! end
27351
27352 !! test
27353 Parsoid should not accept invalid interwiki shortcuts
27354 !! options
27355 parsoid=html2wt
27356 !! html/parsoid
27357 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27358 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27359 <a href='news:Foo'>Foo</a></p>
27360 !! wikitext
27361 [news:Foo Foo]
27362 [news:Foo Foo]
27363 [news:Foo Foo]
27364 !! end
27365
27366 # See T93839
27367 !! test
27368 New wikilinks should be serialized properly
27369 !! options
27370 parsoid=html2wt
27371 !! html/parsoid
27372 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27373 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27374 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27375 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27376 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27377 !! wikitext
27378 [[Foo]]
27379 [[Foo]]
27380 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27381 http://en.wikipedia.org/wiki/Foo
27382 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27383 !! end
27384
27385 !! test
27386 New wiki links (href variations)
27387 !! options
27388 parsoid=html2wt
27389 !! html/parsoid
27390 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27391 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27392 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27393 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27394 !! wikitext
27395 [[Foo_bar]]
27396 [[Foo_bar]]
27397 [[Foo_bar]]
27398 [[Toxine bactérienne]]
27399 !! end
27400
27401 !! test
27402 New wiki links (content string variations)
27403 !! options
27404 parsoid=html2wt
27405 !! html/parsoid
27406 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27407 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27408 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27409 !! wikitext
27410 [[Foo_bar]]
27411 [[Foo bar]]
27412 [[Foo_bar|./Foo_bar]]
27413 !! end
27414
27415 !! test
27416 New category links (href variations)
27417 !! options
27418 parsoid=html2wt
27419 !! html/parsoid
27420 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27421 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27422 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27423 !! wikitext
27424 [[Category:Toxine bactérienne]]
27425 [[Category:Toxine bactérienne]]
27426 [[Category:Toxine bactérienne]]
27427 !! end
27428
27429 !! test
27430 New sol transparent links don't need indent-pre nowiki protection
27431 !! options
27432 parsoid=html2wt
27433 language=de
27434 !! html/parsoid
27435 <link rel="mw:PageProp/redirect" href="./Main_Page">
27436 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27437 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27438 !! wikitext
27439 #WEITERLEITUNG [[Main Page]]
27440 <!-- this is good --> [[Category:Good]]
27441 <!-- this is great --> [[Kategorie:Great]]
27442 !! end
27443
27444 !! test
27445 New interlanguage links (href variations)
27446 !! options
27447 parsoid=html2wt
27448 !! html/parsoid
27449 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27450 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27451 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27452 !! wikitext
27453 [[es:Toxine bactérienne]]
27454 [[es:Toxine_bactérienne]]
27455 [[es:Toxine_bactérienne]]
27456 !! end
27457
27458 !! test
27459 Image: Modifying size of an image (1)
27460 !! options
27461 parsoid={
27462 "modes": ["wt2wt"],
27463 "changes": [
27464 ["img[height]", "attr", "height", "22"],
27465 ["img[width]", "attr", "width", "200"]
27466 ]
27467 }
27468 !! wikitext
27469 [[Image:Foobar.jpg|230x230px]]
27470 !! wikitext/edited
27471 [[Image:Foobar.jpg|200x200px]]
27472 !!end
27473
27474 !! test
27475 Image: Modifying size of an image (2)
27476 !! options
27477 parsoid={
27478 "modes": ["wt2wt"],
27479 "changes": [
27480 ["img[height]", "attr", "height", "100"],
27481 ["img[width]", "attr", "width", "500"]
27482 ]
27483 }
27484 !! wikitext
27485 [[Image:Foobar.jpg|230x230px]]
27486 !! wikitext/edited
27487 [[Image:Foobar.jpg|500x500px]]
27488 !!end
27489
27490 # Change in size is ignored so long as class='mw-default-size'
27491 !! test
27492 Image: Modifying size of an image (3)
27493 !! options
27494 parsoid={
27495 "modes": ["wt2wt"],
27496 "changes": [
27497 ["figure[class]", "removeClass", "mw-default-size"],
27498 ["figure img", "attr", "height", "19"],
27499 ["figure img", "attr", "width", "170"]
27500 ]
27501 }
27502 !! wikitext
27503 [[Image:Foobar.jpg|thumb]]
27504 !! wikitext/edited
27505 [[Image:Foobar.jpg|thumb|170x170px]]
27506 !!end
27507
27508 !! test
27509 Image: Modifying alignment of an image (T50665)
27510 !! options
27511 parsoid={
27512 "modes": ["wt2wt"],
27513 "changes": [
27514 ["figure[class]", "removeClass", "mw-halign-right"],
27515 ["figure[class]", "addClass", "mw-halign-left"]
27516 ]
27517 }
27518 !! wikitext
27519 [[Image:Foobar.jpg|thumb|caption|right]]
27520 !! wikitext/edited
27521 [[Image:Foobar.jpg|thumb|caption|left]]
27522 !! end
27523
27524 !! test
27525 Image: Modifying mw-default-size of an frameless image (T64805)
27526 !! options
27527 parsoid={
27528 "modes": ["wt2wt"],
27529 "changes": [
27530 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27531 ]
27532 }
27533 !! wikitext
27534 [[Image:Foobar.jpg|frameless|right]]
27535 !! wikitext/edited
27536 [[Image:Foobar.jpg|frameless|right|220x220px]]
27537 !! end
27538
27539 !! test
27540 Image: Modifying valign of an image (T51221)
27541 !! options
27542 parsoid={
27543 "modes": ["wt2wt"],
27544 "changes": [
27545 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27546 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27547 ]
27548 }
27549 !! wikitext
27550 [[File:Foobar.jpg|20px|middle]]
27551 !! wikitext/edited
27552 [[File:Foobar.jpg|20px|text-top]]
27553 !! end
27554
27555 !! test
27556 Image: Modifying alt attribute of an image (T58400)
27557 !! options
27558 parsoid={
27559 "modes": ["wt2wt"],
27560 "changes": [
27561 ["img[alt]", "attr", "alt", "some alternate edited text"]
27562 ]
27563 }
27564 !! wikitext
27565 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27566 !! wikitext/edited
27567 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27568 !!end
27569
27570 !! test
27571 Image: Modifying caption of an image
27572 !! options
27573 parsoid={
27574 "modes": ["wt2wt"],
27575 "changes": [
27576 ["figcaption", "text", "new caption"]
27577 ]
27578 }
27579 !! wikitext
27580 [[Image:Foobar.jpg|thumb|original caption]]
27581 !! wikitext/edited
27582 [[Image:Foobar.jpg|thumb|new caption]]
27583 !!end
27584
27585 !! test
27586 Image: empty alt attribute (T50924)
27587 !! options
27588 parsoid
27589 !! wikitext
27590 [[File:Foobar.jpg|thumb|alt=|bar]]
27591 !! html
27592 <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>
27593 !! end
27594
27595 !! test
27596 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27597 !! options
27598 parsoid=html2wt
27599 language=ar
27600 disabled
27601 !! html/parsoid
27602 <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>
27603 !! wikitext
27604 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27605 !! end
27606
27607 !! test
27608 Image: Block level image should have \n before and after
27609 !! wikitext
27610 123
27611 [[File:Foobar.jpg|right|thumb|150x150px]]
27612 456
27613 !! html/parsoid
27614 <p>123</p>
27615 <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>
27616 <p>456</p>
27617 !! end
27618
27619 !! test
27620 Image: New block level image should have \n before and after (existing content)
27621 !! wikitext
27622 123
27623 [[File:Foobar.jpg|right|thumb|150x150px]]
27624 456
27625 !! html/parsoid
27626 <p>123</p>
27627 <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>
27628 <p>456</p>
27629 !! end
27630
27631 !! test
27632 Image: upright option (parsoid)
27633 !! wikitext
27634 [[File:Foobar.jpg|thumb|upright|caption]]
27635 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27636 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27637 !! html/parsoid
27638 <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>
27639 <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>
27640 <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>
27641 !! end
27642
27643 !! test
27644 Image: upright option is ignored on inline and frame images (parsoid)
27645 !! wikitext
27646 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27647 !! html/parsoid
27648 <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>
27649 !! end
27650
27651 !! test
27652 Image: in template parameter with empty parameter
27653 !! wikitext
27654 {{echo|[[File:Foobar.jpg|link=]]}}
27655 !! html/parsoid
27656 <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>
27657 !! end
27658
27659 !! test
27660 Image: from basic HTML (1)
27661 !! options
27662 parsoid=html2wt
27663 !! html/parsoid
27664 <span typeof="mw:Image">
27665 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27666 </span>
27667 !! wikitext
27668 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27669 !! end
27670
27671 !! test
27672 Image: from basic HTML (2)
27673 !! options
27674 parsoid=html2wt
27675 !! html/parsoid
27676 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27677 !! wikitext
27678 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27679 !! end
27680
27681 !! test
27682 Image: from basic HTML (3)
27683 !! options
27684 parsoid=html2wt
27685 !! html/parsoid
27686 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27687 !! wikitext
27688 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27689 !! end
27690
27691 !! test
27692 Image: from basic HTML (4)
27693 !! options
27694 parsoid=html2wt
27695 !! html/parsoid
27696 <img src="./File:Foobar.jpg">
27697 !! wikitext
27698 [[File:Foobar.jpg|link=]]
27699 !! end
27700
27701 !! test
27702 Image: Invalid title as link
27703 !! wikitext
27704 [[File:Foobar.jpg|link=<]]
27705 !! html/php
27706 <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>
27707 </p>
27708 !! html/parsoid
27709 <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>
27710 !! end
27711
27712 !! test
27713 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27714 !! options
27715 parsoid=html2wt
27716 !! html/parsoid
27717 <ul>
27718 <li><p>foo</p></li>
27719 </ul>
27720 !! wikitext
27721 * foo
27722 !! end
27723
27724 !! test
27725 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27726 !! options
27727 parsoid=html2wt
27728 !! html/parsoid
27729 <ul> <li>foo</li></ul>
27730 !! wikitext
27731 * foo
27732 !! end
27733
27734 !! test
27735 Don't strip leading whitespace when handling indent-pre suppressing tags
27736 !! options
27737 parsoid=html2wt
27738 !! html/parsoid
27739 <table>
27740 <tr><td> indented row</td></tr>
27741 </table>
27742 <blockquote><p>
27743 <b>This is very bold of you!</b>
27744 </p>
27745 <table><tr><td>
27746 indented cell (no pre-wrapping!)
27747 </td></tr></table>
27748 </blockquote>
27749 <p>foo</p>
27750 <div>bar</div>
27751 !! wikitext
27752 {|
27753 | indented row
27754 |}
27755 <blockquote>
27756 '''This is very bold of you!'''
27757
27758 {|
27759 |
27760 indented cell (no pre-wrapping!)
27761 |}
27762 </blockquote>
27763 foo
27764 <div>bar</div>
27765 !! end
27766
27767 !! test
27768 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27769 !! options
27770 parsoid=html2wt
27771 !! html/parsoid
27772 <p>foo</p>
27773 <span>bar</span>
27774
27775 <span>foo2
27776 </span>bar2
27777
27778 <div>foo</div>
27779 <span>bar</span>
27780
27781 <div>
27782 <span>foo</span>
27783 </div>
27784 !! wikitext
27785 foo
27786
27787 <span>bar</span>
27788
27789 <span>foo2
27790 <nowiki> </nowiki></span>bar2
27791
27792 <div>foo</div>
27793 <nowiki> </nowiki><span>bar</span>
27794
27795 <div>
27796 <nowiki> </nowiki><span>foo</span>
27797 </div>
27798 !! end
27799
27800 !! test
27801 Lists: Dont insert newlines in a serialized list item.
27802 !! options
27803 parsoid=html2wt
27804 !! html/parsoid
27805 <ul><li>a<br>b</li><li>c</li></ul>
27806 !! wikitext
27807 * a<br />b
27808 * c
27809 !! end
27810
27811 !! test
27812 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27813 !! options
27814 parsoid={
27815 "modes": ["html2wt"],
27816 "scrubWikitext": false
27817 }
27818 !! html/parsoid
27819 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27820 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27821
27822 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27823 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27824
27825 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27826
27827 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27828 !! wikitext
27829 == hello there [[Category:A1]] ==
27830
27831 == [[Category:A2]] hi pal ==
27832
27833 == <!--foo--> [[Category:A3]] how goes it ==
27834
27835 == it goes well [[Category:A4]] <!--bar--> ==
27836
27837 ==howdy [[Category:A5]]==
27838
27839 == __TOC__ ok ==
27840 !! end
27841
27842 !! test
27843 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27844 !! options
27845 parsoid={
27846 "modes": ["html2wt"],
27847 "scrubWikitext": true
27848 }
27849 !! html/parsoid
27850 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27851 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27852
27853 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27854 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27855
27856 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27857 !! wikitext
27858 == hello there ==
27859 [[Category:A1]]
27860 [[Category:A2]]
27861
27862 == hi pal ==
27863
27864 <!--foo--> [[Category:A3]]
27865
27866 == how goes it ==
27867
27868 == it goes well ==
27869 [[Category:A4]] <!--bar-->
27870
27871 __TOC__
27872
27873 == ok ==
27874 !! end
27875
27876 !! test
27877 Headings: Don't hoist metas that come from templates
27878 !! options
27879 parsoid={
27880 "modes": ["html2wt"],
27881 "scrubWikitext": true
27882 }
27883 !! html/parsoid
27884 <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>
27885 !! wikitext
27886 == {{echo|foo [[Category:Foo]]}} ==
27887 !! end
27888
27889 !! test
27890 Headings: Category in ref isn't hoisted
27891 !! options
27892 parsoid={
27893 "modes": ["html2wt"],
27894 "scrubWikitext": true
27895 }
27896 !! html/parsoid
27897 <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>
27898
27899 <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>
27900 !! wikitext
27901 == foo <ref>bar
27902 [[Category:Baz]] </ref> ==
27903
27904 <references />
27905 !! end
27906
27907 !! test
27908 Parsoid: Serialize positional parameters with = in them as named parameter
27909 !! options
27910 parsoid=html2wt
27911 !! html/parsoid
27912 <p about="#mwt1" typeof="mw:Transclusion"
27913 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27914
27915 <p about="#mwt1" typeof="mw:Transclusion"
27916 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27917
27918 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27919 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27920 <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>
27921 !! wikitext
27922 {{echo|1=f=oo}}
27923
27924 {{echo|1=f=oo|2=bar}}
27925
27926 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27927 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27928 {{echo|<nowiki>f=oo</nowiki>|bar}}
27929 !! end
27930
27931 !! test
27932 Parsoid: Serialize positional parameters with = in extlink as named parameter
27933 !! options
27934 parsoid=html2wt
27935 !! html/parsoid
27936 <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>
27937 !! wikitext
27938 {{echo|1=http://stuff?is=ok}}
27939 !! end
27940
27941 !! test
27942 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27943 !! options
27944 parsoid=html2wt
27945 !! html/parsoid
27946 <div>a<p>b</p></div>
27947 <div>a
27948 <p>b</p></div>
27949 <div>
27950 a
27951 <p>b</p></div>
27952 !! wikitext
27953 <div>a
27954 b
27955 </div>
27956 <div>a
27957 b
27958 </div>
27959 <div>
27960 a
27961
27962 b
27963 </div>
27964 !! end
27965
27966 !! test
27967 Substrings resembling wikitext in hrefs should not get nowiki escapes
27968 !! options
27969 parsoid=html2wt
27970 !! html/parsoid
27971 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27972 !! wikitext
27973 [[Foo''bar''baz]]
27974 !! end
27975
27976 !! test
27977 Enforce single-line context in the serializer
27978 !! options
27979 parsoid=html2wt
27980 !! html/parsoid
27981 <h2>testing
27982 123</h2>
27983
27984 <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">
27985 </span><span about="#mwt1">you</span> </h2>
27986
27987 <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>
27988
27989 <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
27990 there</span></li></ol>
27991
27992 <ul><li>asd
27993 sdf</li></ul>
27994
27995 <ul><li>foo
27996 bar
27997 baz</li>
27998 <li>foo <b>bar</b>
27999 baz</li></ul>
28000
28001 <dl><dt>hi
28002 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
28003 ho</dd></dl>
28004
28005 <dl><dd> <table>
28006 <tbody><tr><td> ha
28007 ha
28008 ha</td></tr>
28009 </tbody></table></dd></dl>
28010 !! wikitext
28011 == testing 123 ==
28012
28013 == hi {{bogus|there
28014 you}} ==
28015
28016 == foo <ref>hello
28017 there</ref> ==
28018
28019 <references />
28020
28021 * asd sdf
28022
28023 * foo bar baz
28024 * foo '''bar''' baz
28025
28026 ; hi ho : hi ho
28027
28028 : {|
28029 | ha
28030 ha
28031 ha
28032 |}
28033 !! end
28034
28035 !! test
28036 Serialize new placeholder space without spans
28037 !! options
28038 parsoid=html2wt
28039 !! html/parsoid
28040 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28041
28042 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28043
28044 <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>
28045 !! wikitext
28046 foo : bar
28047
28048 foo : bar
28049
28050 <ref>foo : bar</ref>ok
28051 !! end
28052
28053
28054 #-----------------------
28055 # Tag minimization tests
28056 #-----------------------
28057
28058 !! test
28059 1. I/B quote minimization: wikitext-only tags should be combined
28060 !! options
28061 parsoid=html2wt
28062 !! html/parsoid
28063 <p><i>A</i><i>B</i></p>
28064 <p><b>A</b><b>B</b></p>
28065 <p><i>A</i><b><i>B</i></b></p>
28066 <p><b>A</b><i><b>B</b></i></p>
28067 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28068 <p><i><b>A</b></i><i><b>B</b></i></p>
28069 <p><i><b>A</b></i><b><i>B</i></b></p>
28070 <p><b><i>A</i></b><i><b>B</b></i></p>
28071 !! wikitext
28072 ''AB''
28073
28074 '''AB'''
28075
28076 ''A'''B'''''
28077
28078 '''A''B'''''
28079
28080 '''A''BC''D'''
28081
28082 '''''AB'''''
28083
28084 '''''AB'''''
28085
28086 '''''AB'''''
28087 !! end
28088
28089 !! test
28090 2. I/B quote minimization: wikitext and html tags should not be combined
28091 !! options
28092 parsoid=html2wt
28093 !! html/parsoid
28094 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28095 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28096 !! wikitext
28097 ''A''<i>B</i>
28098
28099 ''A''<nowiki/>'''<i>B</i>'''
28100 !! end
28101
28102 !! test
28103 3. I/B quote minimization: templated content stops minimization
28104 !! options
28105 parsoid=html2wt
28106 !! html/parsoid
28107 <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>
28108 <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>
28109 !! wikitext
28110 ''A''{{echo|''B''}}
28111
28112 ''A''{{echo|'''''B'''''}}
28113 !! end
28114
28115 !! test
28116 4. I/B quote minimization: new content should be mimimized with adjacent old content
28117 !! options
28118 parsoid=html2wt
28119 !! html/parsoid
28120 <p><i>A</i><i>B</i></p>
28121 <p><b>A</b><b>B</b></p>
28122 <p><i>A</i><b><i>B</i></b></p>
28123 !! wikitext
28124 ''AB''
28125
28126 '''AB'''
28127
28128 ''A'''B'''''
28129 !! end
28130
28131 !! test
28132 5a. Merge adjacent quote nodes if they've been edited
28133 !! options
28134 parsoid={
28135 "modes": ["wt2wt", "selser"],
28136 "changes": [
28137 ["p", "contents", "remove", ":contains('b')"]
28138 ]
28139 }
28140 !! wikitext
28141 ''a''b''c''
28142 !! wikitext/edited
28143 ''ac''
28144 !! end
28145
28146 !! test
28147 5b. Merge adjacent quote nodes if they've been edited
28148 !! options
28149 parsoid={
28150 "modes": ["wt2wt", "selser"],
28151 "changes": [
28152 ["#x", "remove"]
28153 ]
28154 }
28155 !! wikitext
28156 ''a''<span id="x">b</span>''c''
28157 !! wikitext/edited
28158 ''ac''
28159 !! end
28160
28161 !! test
28162 1. Merge adjacent link nodes as long as at least one element is new
28163 !! options
28164 parsoid={
28165 "modes": ["html2wt"],
28166 "scrubWikitext": true
28167 }
28168 !! html/parsoid
28169 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28170 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28171 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28172 !! wikitext
28173 [[Football]]
28174 [[Football]]
28175 [[Football|Foot]][[Football|ball]]
28176 !! end
28177
28178 !! test
28179 2. Merge adjacent link nodes and enable additional normalizations
28180 !! options
28181 parsoid={
28182 "modes": ["html2wt"],
28183 "scrubWikitext": true
28184 }
28185 !! html/parsoid
28186 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28187 !! wikitext
28188 [[Football|''Football'']]
28189 !! end
28190
28191 !! test
28192 3. Don't merge adjacent link nodes if scrubWikitext is false
28193 !! options
28194 parsoid={
28195 "modes": ["html2wt"],
28196 "scrubWikitext": false
28197 }
28198 !! html/parsoid
28199 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28200 !! wikitext
28201 [[Football|Foot]][[Football|ball]]
28202 !! end
28203
28204 #------------------------------
28205 # End of tag minimization tests
28206 #------------------------------
28207
28208 !!test
28209 T56262: New entities
28210 !! options
28211 parsoid=html2wt
28212 !! html/parsoid
28213 <span typeof="mw:Entity">&nbsp;</span>
28214 !! wikitext
28215 &nbsp;
28216 !! end
28217
28218 ## Note that there is no wikitext output for 'unknownproperty' ##
28219 ## Unknown magic words are silently dropped ##
28220
28221 !! test
28222 Magic words
28223 !! options
28224 parsoid=html2wt
28225 !! html/parsoid
28226 <meta property='mw:PageProp/toc' />
28227 <meta property='mw:PageProp/notoc' />
28228 <meta property='mw:PageProp/forcetoc' />
28229 <meta property='mw:PageProp/index' />
28230 <meta property='mw:PageProp/noindex' />
28231 <meta property='mw:PageProp/nogallery' />
28232 <meta property='mw:PageProp/noeditsection' />
28233 <meta property='mw:PageProp/notitleconvert' />
28234 <meta property='mw:PageProp/nocontentconvert' />
28235 <meta property='mw:PageProp/unknownproperty' />
28236 !! wikitext
28237 __TOC__
28238 __NOTOC__
28239 __FORCETOC__
28240 __INDEX__
28241 __NOINDEX__
28242 __NOGALLERY__
28243 __NOEDITSECTION__
28244 __NOTITLECONVERT__
28245 __NOCONTENTCONVERT__
28246 !! end
28247
28248 !! test
28249 Consecutive <pre>s should not get merged
28250 !! options
28251 parsoid=html2wt,html2html
28252 !! html/parsoid
28253 <pre>a</pre><pre>b</pre>
28254
28255 <pre>c
28256 </pre><pre>
28257 d</pre>
28258
28259 <pre>e
28260
28261 </pre><pre>
28262
28263 f</pre>
28264 !! wikitext
28265 a
28266
28267 b
28268
28269 c
28270
28271 d
28272
28273 e
28274
28275
28276
28277 f
28278 !! end
28279
28280 !! test
28281 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28282 !! options
28283 parsoid=html2wt
28284 !! html/parsoid
28285 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28286 !! wikitext
28287 [[Special:BookSources/1234567890|ISBN 1234567895]]
28288 !! end
28289
28290 !! test
28291 Edited RFC links not serializable as RFC links should serialize as extlinks
28292 !! options
28293 parsoid=html2wt
28294 !! html/parsoid
28295 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28296 !! wikitext
28297 [https://tools.ietf.org/html/rfc123 New RFC]
28298 !! end
28299
28300 !! test
28301 Edited PMID links not serializable as PMID links should serialize as extlinks
28302 !! options
28303 parsoid=html2wt
28304 !! html/parsoid
28305 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28306 !! wikitext
28307 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28308 !! end
28309
28310 !! test
28311 WTS of autolinks with trailing/surrounding context
28312 !! options
28313 parsoid=html2wt
28314 !! html/parsoid
28315 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28316 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28317 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28318 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28319 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28320 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28321 !! wikitext
28322 http://cscott.net'''foo'''
28323
28324 http://cscott.net<b>foo</b>
28325
28326 '''http://cscott.net'''
28327
28328 '''http://cscott.net '''
28329
28330 '''http://cscott.net<nowiki/>x'''
28331
28332 http://cscott.net<nowiki/>x
28333 !! end
28334
28335 !! test
28336 WTS of autolinks with nowikis (round-trip)
28337 !! wikitext
28338 x<nowiki/>http://cscott.net<nowiki/>x
28339 !! html/parsoid
28340 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28341 !! end
28342
28343 # this is the "easy" test because it leaves in place all the
28344 # data-parsoid information indicating this is an autolink
28345 !! test
28346 WTS of autolinks with escapes (editing)
28347 !! options
28348 parsoid={
28349 "modes": ["wt2wt"],
28350 "changes": [
28351 [ "span", "remove" ]
28352 ]
28353 }
28354 !! wikitext
28355 x<nowiki/>http://cscott.net<nowiki/>x
28356 !! wikitext/edited
28357 x<nowiki/>http://cscott.net<nowiki/>x
28358 !! end
28359
28360 !! test
28361 WTS of edited autolink-like text (T103364)
28362 !! options
28363 parsoid={
28364 "modes": ["wt2wt"],
28365 "changes": [
28366 [ "span[typeof]", "removeAttr", "typeof" ]
28367 ]
28368 }
28369 !! wikitext
28370 Not a link: <nowiki>http://example.com</nowiki>.
28371 !! wikitext/edited
28372 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28373 !! end
28374
28375 !! test
28376 WTS of newly-authored autolink-like text (T103364)
28377 !! options
28378 parsoid=html2wt
28379 !! html/parsoid
28380 <p>http://example.com is not a link.</p>
28381 !! wikitext
28382 <nowiki>http://example.com</nowiki> is not a link.
28383 !! end
28384
28385 !! test
28386 WTS of autolink-like text after an autolink (T108563)
28387 !! options
28388 parsoid=html2wt
28389 !! html/parsoid
28390 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28391 !! wikitext
28392 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28393 !! end
28394
28395 !! test
28396 Magic links inside links (not autolinked)
28397 !! wikitext
28398 [[Foo|http://example.com]]
28399 [[Foo|RFC 1234]]
28400 [[Foo|PMID 1234]]
28401 [[Foo|ISBN 123456789x]]
28402
28403 [http://foo.com http://example.com]
28404 [http://foo.com RFC 1234]
28405 [http://foo.com PMID 1234]
28406 [http://foo.com ISBN 123456789x]
28407 !! html+tidy
28408 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28409 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28410 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28411 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28412 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28413 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28414 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28415 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28416 </p>
28417 !! html/parsoid
28418 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28419 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28420 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28421 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28422
28423 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28424 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28425 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28426 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28427 !! end
28428
28429 !! test
28430 Magic links inside image captions (autolinked)
28431 !! wikitext
28432 [[File:Foobar.jpg|thumb|http://example.com]]
28433 [[File:Foobar.jpg|thumb|RFC 1234]]
28434 [[File:Foobar.jpg|thumb|PMID 1234]]
28435 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28436 !! html+tidy
28437 <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>
28438 <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>
28439 <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>
28440 <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>
28441 !! html/parsoid
28442 <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>
28443 <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 text">RFC 1234</a></figcaption></figure>
28444 <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 text">PMID 1234</a></figcaption></figure>
28445 <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>
28446 !! end
28447
28448 !! test
28449 WTS of magic word text (T109371)
28450 !! options
28451 parsoid=html2wt
28452 !! html/parsoid
28453 <p>RFC 1234</p>
28454 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28455 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28456 !! wikitext
28457 <nowiki>RFC 1234</nowiki>
28458
28459 [http://foo.com RFC 1234]
28460
28461 [[Foo|RFC 1234]]
28462 !! end
28463
28464 !! test
28465 Edited Redirect link should emit a non-piped wikitext link
28466 !! options
28467 parsoid=html2wt
28468 !! html/parsoid
28469 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28470 !! wikitext
28471 #REDIRECT [[Bar]]
28472 !! end
28473
28474 !! test
28475 T75121: Infer extension name from typeOf if data-mw is not present
28476 !! options
28477 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28478 !! html/parsoid
28479 <div typeOf="mw:Extension/foo"></div>
28480 !! wikitext
28481 <foo />
28482 !! end
28483
28484 # Note that the <p> wrapping isn't present in PHP parser output
28485 # The important thing for this test is that P-wrapping doesn't
28486 # interfere with the <nowiki> protection for leading - in <td>
28487 # (which isn't necessary for <th>).
28488 !! test
28489 T88318: p-wrapped dash in table.
28490 !! options
28491 parsoid=html2wt,wt2wt
28492 !! html/parsoid
28493 <table><tbody>
28494 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28495 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28496 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28497 </tbody></table>
28498 !! wikitext
28499 {|
28500 !-
28501 !-
28502 |-
28503 |<nowiki>-</nowiki>
28504 |<nowiki>- </nowiki>
28505 |-
28506 |<small>-</small>
28507 |<br />
28508 -
28509 |<br />
28510 -
28511 |}
28512 !! html/php+tidy
28513 <table>
28514 <tbody><tr>
28515 <th>-
28516 </th>
28517 <th>-
28518 </th></tr>
28519 <tr>
28520 <td>-
28521 </td>
28522 <td>-
28523 </td></tr>
28524 <tr>
28525 <td><small>-</small>
28526 </td>
28527 <td><br />
28528 <p>-
28529 </p>
28530 </td>
28531 <td><br />
28532 <p>-
28533 </p>
28534 </td></tr></tbody></table>
28535 !! end
28536
28537 !! test
28538 T149209: WTS: Handle newlines in table cells properly
28539 !! options
28540 parsoid=html2wt
28541 !! html/parsoid
28542 <table>
28543 <tbody>
28544 <tr><td>a
28545 b
28546 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28547 <tr><td><p>x</p>
28548 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28549 </tbody></table>
28550 <table>
28551 <tbody>
28552 <tr><th>a
28553 b
28554 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28555 <tr><th><p>x</h>
28556 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28557 </tbody></table>
28558 !! wikitext
28559 {|
28560 |a
28561 b
28562 |c
28563 |-
28564 |x
28565 {{!}}y
28566 |}
28567 {|
28568 !a
28569 b
28570 !c
28571 |-
28572 !x
28573 !y
28574 |}
28575 !! end
28576
28577 !! test
28578 T149209: Selser: Handle newlines in table cells properly
28579 !! options
28580 parsoid={
28581 "modes": ["selser"],
28582 "changes": [
28583 [ "#h1", "html", "a\nb\n" ],
28584 [ "#h2", "html", "a\nb\n" ],
28585 [ "#c1", "html", "a\nb\n" ],
28586 [ "#c2", "html", "<p>a</p>" ],
28587 [ "#c3", "html", "<p>a</p>" ],
28588 [ "#c4", "html", "edit-me<p>a</p>" ]
28589 ]
28590 }
28591 !! wikitext
28592 {|
28593 ! id="h1" |edit-me!!1
28594 |-
28595 ! id="h2" |edit-me||2
28596 |-
28597 | id="c1" |edit-me||3
28598 |-
28599 | id="c2" |edit-me||4
28600 |-
28601 | id="c3" |edit-me||p||q||r
28602 |-
28603 | id="c4" |edit-me||p||q||r
28604 |}
28605 !! wikitext/edited
28606 {|
28607 ! id="h1" |a
28608 b
28609 !1
28610 |-
28611 ! id="h2" |a
28612 b
28613 !2
28614 |-
28615 | id="c1" |a
28616 b
28617 |3
28618 |-
28619 | id="c2" |a
28620 |4
28621 |-
28622 | id="c3" |a
28623 |p||q||r
28624 |-
28625 | id="c4" |edit-me
28626 a
28627 |p||q||r
28628 |}
28629 !! end
28630
28631 !! test
28632 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28633 !! options
28634 parsoid=html2wt
28635 !! html/parsoid
28636 <table id='mwAb'>
28637 <td id='mwAc'>foo</td>
28638 <td id='serialize-this'>bar</td>
28639 </table>
28640 !! wikitext
28641 {|
28642 |foo
28643 | id="serialize-this" |bar
28644 |}
28645 !! end
28646
28647 !! test
28648 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28649 !! options
28650 parsoid=html2wt
28651 !! html/parsoid
28652 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28653 !! wikitext
28654 <div id="hello">ok</div>
28655 !! end
28656
28657 !! test
28658 WTS change modes
28659 !! options
28660 parsoid={
28661 "modes": ["wt2wt"],
28662 "changes": [
28663 [ "#xyz", "before", "<b>before</b> stuff " ],
28664 [ "#xyz", "after", " stuff <i>after</i>" ],
28665 [ "#xyz", "html", "x <b>y</b> z" ]
28666 ]
28667 }
28668 !! wikitext
28669 <span id="xyz">hello</span>
28670 !! wikitext/edited
28671 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28672 !! end
28673
28674 !! test
28675 Never serialize a-tag as html, regardless of what data-parsoid has to say
28676 !! options
28677 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28678 !! html/parsoid
28679 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28680 !! wikitext
28681 [[Foo]]
28682 !! end
28683
28684 ## SSS FIXME: This is broken output nevertheless.
28685 ## What might be a reasonable non-broken output for this?
28686 ## This is an edge case unlikely to be seen in production
28687 ## that I am not wasting more time on this right now.
28688 !! test
28689 Never serialize a-tag as html, no matter what attributes it has
28690 !! options
28691 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28692 !! html/parsoid
28693 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28694 !! wikitext
28695 [http://boo.org http://boohoo.org]
28696 !! end
28697
28698 # Misnested is an indication that selser can reuse the source but these have
28699 # shown to sneak through on occasion. See T101768.
28700 # The original wikitext here is: [http://test.com [[one]] two three]
28701 !! test
28702 Strip span tags added to mark misnested links
28703 !! options
28704 parsoid=html2wt
28705 !! html/parsoid
28706 <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>
28707 !! wikitext
28708 [http://test.com][[one]] two three
28709 !! end
28710
28711 !! test
28712 Catch regression when unpacking misnested links
28713 !! options
28714 parsoid=wt2html
28715 !! wikitext
28716 {{echo|hi}}[http://example.com [[ho]]]
28717 !! html/parsoid
28718 <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>
28719 !! end
28720
28721 !! test
28722 Catch regression when unpacking with trailing content
28723 !! wikitext
28724 {{echo|Foo <references/> bar}}
28725 !! html/parsoid
28726 <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>
28727 !! end
28728
28729 !! test
28730 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28731 !! options
28732 parsoid=html2wt
28733 !! html/parsoid
28734 <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|}"]}'>
28735 <tbody><tr><td>d
28736 </td></tr>
28737 </tbody></table>
28738 !! wikitext
28739 {{echo|a}}
28740 {|{{echo|c
28741 {{!}}d
28742 }}
28743 |}
28744 !! end
28745
28746 ## This test verifies the presence and computation of this attribute indirectly
28747 ## by making an edit and ensuring that the serialization is correct (which it would be
28748 ## only if firstWikitextNode is properly set).
28749 !! test
28750 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28751 !! options
28752 parsoid= {
28753 "modes": ["wt2wt"],
28754 "changes": [
28755 [ "div#x", "remove" ],
28756 [ "div", "before", "<div>new</div>" ]
28757 ]
28758 }
28759 !! wikitext
28760 <div id="x">foo</div>
28761 {|
28762 {{echo|<div>boo</div>
28763 {{!}}b}}
28764 |c
28765 |}
28766 !! wikitext/edited
28767
28768 <div>new</div>
28769 {|
28770 {{echo|<div>boo</div>
28771 {{!}}b}}
28772 |c
28773 |}
28774 !! end
28775
28776 # --------------------------------------------
28777 # Tests spec'ing wikitext serialization norms |
28778 # --------------------------------------------
28779
28780 !! test
28781 Serialize multi-line indent-pre starting with wikitext syntax
28782 !! options
28783 parsoid=html2wt
28784 !! html/parsoid
28785 <pre>* 1
28786 ** 2
28787 * 3</pre>
28788 !! wikitext
28789 * 1
28790 ** 2
28791 * 3
28792 !! end
28793
28794 !! test
28795 1. Categories should always be serialized on their own line
28796 !! options
28797 parsoid=html2wt
28798 !! html/parsoid
28799 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28800 !! wikitext
28801 foo
28802 [[Category:Foo]]
28803 bar
28804 !! end
28805
28806 !! test
28807 2. Categories that are part of templates should not introduce a line break
28808 !! wikitext
28809 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28810 !! html/parsoid
28811 <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>
28812 !! end
28813
28814 # Careful while editing these next 2 tests. There are \u200f characters
28815 # before and after the <link> tags in the HTML and following some
28816 # of the categories in wikitext
28817 # Do not remove these characters in edits.
28818 #
28819 # As part of the serialization, these bidi characters will get stripped.
28820 !! test
28821 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28822 !! options
28823 parsoid={
28824 "modes": ["html2wt"],
28825 "scrubWikitext": true
28826 }
28827 !! html/parsoid
28828 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28829 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28830 !! wikitext
28831 [[קטגוריה:טקסים]]
28832 [[קטגוריה: שיטות משפט]]
28833 !! end
28834
28835 !! test
28836 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28837 !! options
28838 parsoid={
28839 "modes": ["html2wt"],
28840 "scrubWikitext": true
28841 }
28842 !! html/parsoid
28843 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28844 !! wikitext
28845 [[קטגוריה:טקסים]]
28846 ‏y
28847 !! end
28848
28849 !! test
28850 Lists: Add space after bullets
28851 !! options
28852 parsoid=html2wt
28853 !! html/parsoid
28854 <ul>
28855 <li>foo</li>
28856 <li> bar</li>
28857 <li><span> baz</span></li>
28858 </ul>
28859 !! wikitext
28860 * foo
28861 * bar
28862 * <span> baz</span>
28863 !! end
28864
28865 !! test
28866 1. Headings: Add space before/after == (T53744)
28867 !! options
28868 parsoid=html2wt
28869 !! html/parsoid
28870 <h2>foo</h2>
28871 <h2> bar</h2>
28872 <h2>baz </h2>
28873 <h2><span> baz</span></h2>
28874 !! wikitext
28875 == foo ==
28876
28877 == bar ==
28878
28879 == baz ==
28880
28881 == <span> baz</span> ==
28882 !! end
28883
28884 !! test
28885 2. Headings: Add space before/after == even after hoisted content
28886 !! options
28887 parsoid={
28888 "modes": ["html2wt"],
28889 "scrubWikitext": true
28890 }
28891 !! html/parsoid
28892 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28893 !! wikitext
28894 [[Category:A2]]
28895
28896 == ok ==
28897 !! end
28898
28899 !! test
28900 1. Headings: suppress newly created empty headings
28901 !! options
28902 parsoid={
28903 "modes": ["html2wt"],
28904 "scrubWikitext": true
28905 }
28906 !! html/parsoid
28907 <h2></h2>
28908 !! wikitext
28909 !! end
28910
28911 !! test
28912 2. Headings: don't suppress empty headings if scrubWikitext is false
28913 !! options
28914 parsoid=html2wt
28915 !! html/parsoid
28916 <h2></h2>
28917 !! wikitext
28918 ==<nowiki/>==
28919 !! end
28920
28921 !! test
28922 3. Headings: suppress empty headings on edits
28923 !! options
28924 parsoid={
28925 "modes": ["selser"],
28926 "scrubWikitext": true,
28927 "changes": [
28928 [ "#x", "remove"]
28929 ]
28930 }
28931 !! wikitext
28932 ==<span id="x">foo</span>==
28933 !! wikitext/edited
28934 !! end
28935
28936 !! test
28937 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28938 !! options
28939 parsoid={
28940 "modes": ["html2wt"],
28941 "scrubWikitext": true
28942 }
28943 !! html/parsoid
28944 <h2>foo<br/>bar</h2>
28945 <h2>foo <span><br/>bar</span> baz</h2>
28946 !! wikitext
28947 == foo bar ==
28948
28949 == foo <span> bar</span> baz ==
28950 !! end
28951
28952 !! test
28953 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28954 !! options
28955 parsoid={
28956 "modes": ["html2wt"],
28957 "scrubWikitext": false
28958 }
28959 !! html/parsoid
28960 <h2>foo<br/>bar</h2>
28961 !! wikitext
28962 == foo<br /> bar ==
28963 !! end
28964
28965 !! test
28966 1. WT Quote Tags: suppress newly created empty style tags
28967 !! options
28968 parsoid={
28969 "modes": ["html2wt"],
28970 "scrubWikitext": true
28971 }
28972 !! html/parsoid
28973 <i></i><b></b>
28974 !! wikitext
28975 !! end
28976
28977 !! test
28978 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28979 !! options
28980 parsoid=html2wt
28981 !! html/parsoid
28982 <i></i><b></b>
28983 !! wikitext
28984 ''<nowiki/>'''''<nowiki/>'''
28985 !! end
28986
28987 !! test
28988 3. WT Quote Tags: suppress empty style tags on edits
28989 !! options
28990 parsoid={
28991 "modes": ["selser"],
28992 "scrubWikitext": true,
28993 "changes": [
28994 [ "#x", "remove"]
28995 ]
28996 }
28997 !! wikitext
28998 '''<span id="x">foo</span>'''
28999 !! wikitext/edited
29000 !! end
29001
29002 !! test
29003 1. Anchors: suppress newly created empty anchors
29004 !! options
29005 parsoid={
29006 "modes": ["html2wt"],
29007 "scrubWikitext": true
29008 }
29009 !! html/parsoid
29010 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29011 !! wikitext
29012 !! end
29013
29014 !! test
29015 2. Anchors: don't suppress empty anchors if scrubWikitext is false
29016 !! options
29017 parsoid={
29018 "modes": ["html2wt"],
29019 "scrubWikitext": false
29020 }
29021 !! html/parsoid
29022 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
29023 !! wikitext
29024 [[Test|<nowiki/>]]
29025 !! end
29026
29027 !! test
29028 3. Anchors: suppress empty anchors on edits
29029 !! options
29030 parsoid={
29031 "modes": ["selser"],
29032 "scrubWikitext": true,
29033 "changes": [
29034 [ "#x", "remove"]
29035 ]
29036 }
29037 !! wikitext
29038 [[Test|<span id="x">foo</span>]]
29039 !! wikitext/edited
29040 !! end
29041
29042 !! test
29043 3a. Anchors: do not suppress numbered extlinks
29044 !! options
29045 parsoid={
29046 "modes": ["wt2wt"],
29047 "scrubWikitext": true
29048 }
29049 !! wikitext
29050 [http://foo.com]
29051 !! html/parsoid
29052 <a rel="mw:ExtLink" href="http://foo.com"></a>
29053 !! end
29054
29055 !! test
29056 3b. Anchors: do not suppress numbered extlinks
29057 !! options
29058 parsoid={
29059 "modes": ["wt2wt"],
29060 "scrubWikitext": true,
29061 "changes": [
29062 [ "#x", "remove"]
29063 ]
29064 }
29065 !! wikitext
29066 [http://foo.com <span id="x">foo</span>]
29067 !! wikitext/edited
29068 [http://foo.com]
29069 !! end
29070
29071 !!test
29072 Normalizations should be restricted to edited content
29073 !!options
29074 parsoid={
29075 "modes": ["selser"],
29076 "scrubWikitext": true,
29077 "changes": [
29078 [ "h1", "before", "<i></i>"]
29079 ]
29080 }
29081 !!wikitext
29082 a
29083 = =
29084 b
29085 !!wikitext/edited
29086 a
29087 = =
29088 b
29089 !!end
29090
29091 !! test
29092 1. Multiple normalizations (html2wt)
29093 !! options
29094 parsoid={
29095 "modes": ["html2wt"],
29096 "scrubWikitext": true
29097 }
29098 !! html
29099 <h2><i></i></h2>
29100 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29101 </a><b><i></i></b>x</p>
29102 !! wikitext
29103
29104 [[foo]]
29105 x
29106
29107 !! end
29108
29109 !! test
29110 2. Multiple normalizations (selser)
29111 !! options
29112 parsoid={
29113 "modes": ["selser"],
29114 "scrubWikitext": true,
29115 "changes": [
29116 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29117 ]
29118 }
29119 !! wikitext
29120 <span id="x">foo</span>
29121 !! wikitext/edited
29122 <span id="x">foo</span>
29123
29124 x
29125 !! end
29126
29127 !! test
29128 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29129 !! options
29130 parsoid={
29131 "modes": ["html2wt"],
29132 "scrubWikitext": true
29133 }
29134 !! html/parsoid
29135 <p> hi</p>
29136 <p> hello</p>
29137 !! wikitext
29138 hi
29139
29140 hello
29141 !! end
29142
29143 !! test
29144 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29145 !! options
29146 parsoid=html2wt
29147 !! html/parsoid
29148 <p> hi</p>
29149 <p> hello</p>
29150 !! wikitext
29151 <nowiki> </nowiki>hi
29152
29153 <nowiki> </nowiki> hello
29154 !! end
29155
29156 !! test
29157 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29158 !! options
29159 parsoid={
29160 "modes": ["html2wt"],
29161 "scrubWikitext": true
29162 }
29163 !! html/parsoid
29164 <p>Foo
29165 bar
29166 baz</p>
29167
29168 <table><tr><td>Foo
29169 bar
29170 baz bang</td></tr></table>
29171
29172 <p><!--boo--> foo
29173 bar</p>
29174
29175 <p> foo
29176 bar<span>boo</span></p>
29177 !! wikitext
29178 Foo
29179 bar
29180 baz
29181
29182 {|
29183 |Foo
29184 bar
29185 baz bang
29186 |}
29187
29188 <!--boo-->foo
29189 bar
29190
29191 foo
29192 bar<span>boo</span>
29193 !! end
29194
29195 !! test
29196 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29197 !! options
29198 parsoid={
29199 "modes": ["selser"],
29200 "scrubWikitext": true,
29201 "changes": [
29202 [ "p", "html", " a\n b" ]
29203 ]
29204 }
29205 !! wikitext
29206 xyz
29207 !! wikitext/edited
29208 a
29209 b
29210 !! end
29211
29212 !! test
29213 1. New links that end in spaces
29214 !! options
29215 parsoid={
29216 "modes": ["html2wt"],
29217 "scrubWikitext": false
29218 }
29219 !! html/parsoid
29220 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29221 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29222 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29223 !! wikitext
29224 [[Berlin ]]<nowiki/>is the capital of Germany.
29225
29226 [[Foo ]]'''bar'''
29227
29228 [[Boston ]] is a city.
29229 !! end
29230
29231 !! test
29232 2. New links that end in spaces
29233 !! options
29234 parsoid={
29235 "modes": ["html2wt"],
29236 "scrubWikitext": true
29237 }
29238 !! html/parsoid
29239 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29240 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29241 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29242 !! wikitext
29243 [[Berlin]] is the capital of Germany.
29244
29245 [[Foo]] '''bar'''
29246
29247 [[Boston]] is a city.
29248 !! end
29249
29250 !! test
29251 1. Table cells with escapable prefixes
29252 !! options
29253 parsoid={
29254 "modes": ["html2wt"],
29255 "scrubWikitext": false
29256 }
29257 !! html
29258 <table>
29259 <tr><td>a</td></tr>
29260 <tr><td>-</td></tr>
29261 <tr><td>+</td></tr>
29262 </table>
29263 !! wikitext
29264 {|
29265 |a
29266 |-
29267 |<nowiki>-</nowiki>
29268 |-
29269 |<nowiki>+</nowiki>
29270 |}
29271 !! end
29272
29273 !! test
29274 2. Table cells with escapable prefixes
29275 !! options
29276 parsoid={
29277 "modes": ["html2wt"],
29278 "scrubWikitext": true
29279 }
29280 !! html
29281 <table>
29282 <tr><td>a</td></tr>
29283 <tr><td>-</td></tr>
29284 <tr><td>+</td></tr>
29285 </table>
29286 !! wikitext
29287 {|
29288 |a
29289 |-
29290 | -
29291 |-
29292 | +
29293 |}
29294 !! end
29295
29296 !! test
29297 3a. Table cells with escapable prefixes after edits
29298 !! options
29299 parsoid={
29300 "modes": ["selser"],
29301 "scrubWikitext": true,
29302 "changes": [
29303 [ "table tbody tr:first-child td:first-child", "remove"]
29304 ]
29305 }
29306 !! wikitext
29307 {|
29308 |a||-
29309 |}
29310 !! wikitext/edited
29311 {|
29312 | -
29313 |}
29314 !! end
29315
29316 !! test
29317 3b. Table cells with escapable prefixes after edits
29318 !! options
29319 parsoid={
29320 "modes": ["selser"],
29321 "scrubWikitext": true,
29322 "changes": [
29323 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29324 [ "#x", "remove" ]
29325 ]
29326 }
29327 !! wikitext
29328 {|
29329 |pqr
29330 |<span id="x">foo</span>+
29331 |}
29332 !! wikitext/edited
29333 {|
29334 | -
29335 | +
29336 |}
29337 !! end
29338
29339 # FIXME: This test will fail because
29340 # normalization doesn't realize that the id attribute
29341 # will eliminate the escapable scenario
29342 !! test
29343 4a. Table cells without escapable prefixes after edits
29344 !! options
29345 parsoid={
29346 "modes": ["selser"],
29347 "scrubWikitext": true,
29348 "changes": [
29349 [ "#x", "html", "-" ]
29350 ]
29351 }
29352 !! wikitext
29353 {|
29354 | id="x" |abcd
29355 |}
29356 !! wikitext/edited
29357 {|
29358 | id="x" |-
29359 |}
29360 !! end
29361
29362 ## This tests normalizer's ability to discriminate between
29363 ## cells having identical content.
29364 !! test
29365 4b. Table cells without escapable prefixes after edits
29366 !! options
29367 parsoid={
29368 "modes": ["selser"],
29369 "scrubWikitext": true,
29370 "changes": [
29371 [ "td", "html", "-" ]
29372 ]
29373 }
29374 !! wikitext
29375 {|
29376 |a||b
29377 |}
29378 !! wikitext/edited
29379 {|
29380 | -||-
29381 |}
29382 !! end
29383
29384 ## This tests normalizer's ability to not be tripped by
29385 ## comments (and whitespace)
29386 !! test
29387 4c. Table cells without escapable prefixes after edits
29388 !! options
29389 parsoid={
29390 "modes": ["selser"],
29391 "scrubWikitext": true,
29392 "changes": [
29393 [ "table tbody tr td:first-child", "remove" ]
29394 ]
29395 }
29396 !! wikitext
29397 {|
29398 |-
29399 <!--foo--> |a||-
29400 |}
29401 !! wikitext/edited
29402 {|
29403 |-
29404 <!--foo--> | -
29405 |}
29406 !! end
29407
29408 ## This tests normalizer's ability to handle HTML cells
29409 !! test
29410 4d. Table cells without escapable prefixes after edits
29411 !! options
29412 parsoid={
29413 "modes": ["selser"],
29414 "scrubWikitext": true,
29415 "changes": [
29416 [ "td", "html", "-" ]
29417 ]
29418 }
29419 !! wikitext
29420 <table>
29421 <tr><td>a</td></tr>
29422 </table>
29423 !! wikitext/edited
29424 <table>
29425 <tr><td>-</td></tr>
29426 </table>
29427 !! end
29428
29429 ## T111151 Remove font elements without attributes
29430 !! test
29431 5a. font tags without attributes should be dropped in scrubWikitext mode
29432 !! options
29433 parsoid={
29434 "modes": ["html2wt"],
29435 "scrubWikitext": true
29436 }
29437 !! html
29438 <font>foo</font>
29439 <font><font>bar</font></font>
29440 <font class="x">boo</font>
29441 !! wikitext
29442 foo
29443 bar
29444 <font class="x">boo</font>
29445 !! end
29446
29447 !! test
29448 5b. font tags should not be dropped without scrubWikitext being enabled
29449 !! options
29450 parsoid={
29451 "modes": ["html2wt"],
29452 "scrubWikitext": false
29453 }
29454 !! html
29455 <font>foo</font>
29456 !! wikitext
29457 <font>foo</font>
29458 !! end
29459
29460 !! test
29461 Escape nowiki DOM elements
29462 !! options
29463 parsoid=html2wt
29464 !! html/parsoid
29465 <nowiki><i>foo</i></nowiki>
29466 !! wikitext
29467 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29468 !! end
29469
29470 # This is meant to be an interim fix while we go about figuring out
29471 # how to not introduce these trailing <nowiki/>s in the first place.
29472 !! test
29473 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29474 !! options
29475 parsoid=html2wt
29476 !! html/parsoid
29477 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29478 y</p>
29479 <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>
29480 <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>
29481 !! wikitext
29482 x
29483 y
29484
29485 {{echo|
29486 1 = <nowiki/>}}
29487
29488 {{echo|
29489 1 = <nowiki/>
29490 }}
29491 !! end
29492
29493 !! test
29494 New list is serialized on newlines
29495 !! options
29496 parsoid=html2wt
29497 !! html/parsoid
29498 <p>The quick brown fox jumps over the lazy dog.</p><ul>
29499 <li>Yesterday</li>
29500 <li>Today</li>
29501 <li>Tomorrow</li>
29502 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
29503 !! wikitext
29504 The quick brown fox jumps over the lazy dog.
29505
29506 * Yesterday
29507 * Today
29508 * Tomorrow
29509
29510 The quick onyx goblin jumps over the lazy dwarf.
29511 !! end
29512
29513 !! test
29514 New lists in formatting elements serialized w/o newlines
29515 !! options
29516 parsoid=html2wt
29517 !! html/parsoid
29518 <small>
29519
29520 <ul>
29521 <li>123</li>
29522 </ul>
29523
29524 </small>
29525
29526 <small><ul><li>hi</li></ul></small>
29527 !! wikitext
29528 <small>
29529 * 123
29530 </small>
29531
29532 <small>
29533 * hi
29534 </small>
29535 !! end
29536
29537 !! test
29538 New list in table doesn't need newlines
29539 !! options
29540 parsoid=html2wt
29541 !! html/parsoid
29542 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
29543 !! wikitext
29544 {|
29545 |
29546 * test
29547 * 123
29548 |}
29549 !! end
29550
29551 # ---------------------------------------------------
29552 # End of tests spec'ing wikitext serialization norms |
29553 # ---------------------------------------------------
29554
29555 # T104032
29556 !! test
29557 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29558 !! options
29559 parsoid=html2wt
29560 !! html/parsoid
29561 a<p>b</p>
29562 <b>c</b><p>d</p>
29563 <table><tr>
29564 <td>a<p>b</p></td>
29565 <td><b>c</b><p>d</p></td>
29566 </tr></table>
29567 !! wikitext
29568 a
29569
29570 b
29571
29572 '''c'''
29573
29574 d
29575 {|
29576 |a
29577 b
29578 |'''c'''
29579 d
29580 |}
29581 !! end
29582
29583 !! test
29584 Anchor without href scenarios
29585 !! options
29586 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29587 !! html/parsoid
29588 <a class="bc"></a>
29589 <a class="no">dice</a>
29590 <a name="foo"></a>
29591 !! wikitext
29592
29593 dice
29594 <span name="foo"></span>
29595 !! end
29596
29597 !! test
29598 New transclusion added after a list should be serialized after the list
29599 !! options
29600 parsoid=html2wt
29601 !! html/parsoid
29602 <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>
29603 !! wikitext
29604 * a
29605 {{echo|foo}}
29606 !! end
29607
29608 # -----------------------------------------------------------------
29609 # End of section for Parsoid-only html2wt tests for serialization
29610 # of new content
29611 # -----------------------------------------------------------------
29612
29613 # -----------------------------------------------------------------
29614 # The following section of tests are primarily to spec behavior of
29615 # the selective serializer. All these tests have manual selser
29616 # changes. The automated selser changes for all tests handle the
29617 # wide variation of changes, but these tests here capture specs
29618 # deterministically.
29619 # ----------------------------------------------------------------
29620
29621 ## T90517
29622 !! test
29623 Selser: New comments should not be lost
29624 !! options
29625 parsoid={
29626 "modes": ["selser"],
29627 "changes": [
29628 [ "#a", "after", "<!--c1-->" ],
29629 [ "#b", "before", "<!--c2-->" ]
29630 ]
29631 }
29632 !! wikitext
29633 <span id="a">a</span>
29634
29635 <span id="b">b</span>
29636 !! wikitext/edited
29637 <span id="a">a</span><!--c1-->
29638
29639 <!--c2--><span id="b">b</span>
29640 !! end
29641
29642 ## T89383
29643 !! test
29644 Selser: Check for validity of DSR before using it
29645 !! options
29646 parsoid={
29647 "modes": ["selser"],
29648 "changes": [
29649 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29650 ]
29651 }
29652 !! wikitext
29653 <span id="a">a</span>
29654 !! wikitext/edited
29655 {{DISPLAYTITLE:foo}}
29656 <span id="a">a</span>
29657 !! end
29658
29659 !! test
29660 1. DOMDiff: Changes to <ref> content should be looked up using id
29661 !! options
29662 parsoid={
29663 "modes": ["selser"],
29664 "changes": [
29665 ["#X", "after", "bar"],
29666 ["#Y", "after", "baz"]
29667 ]
29668 }
29669 !! wikitext
29670 X <ref><span id="X">foo</span></ref>
29671 Y <ref name="a" />
29672 <references>
29673 <ref name="a"><span id="Y">foo</span></ref>
29674 </references>
29675 !! wikitext/edited
29676 X <ref><span id="X">foo</span>bar</ref>
29677 Y <ref name="a" />
29678 <references>
29679 <ref name="a"><span id="Y">foo</span>baz</ref>
29680 </references>
29681 !! end
29682
29683 !! test
29684 2. DOMDiff: Changes to <ref> content should be looked up using id
29685 !! options
29686 parsoid={
29687 "modes": ["selser"],
29688 "changes": [
29689 ["#Z", "after", "bar"]
29690 ]
29691 }
29692 !! wikitext
29693 A <ref>foo bar for a</ref>
29694 B <ref group="X" name="b" />
29695
29696 <references />
29697
29698 <references group="X">
29699 <ref name="b"><span id="Z">foo</span></ref>
29700 </references>
29701 !! wikitext/edited
29702 A <ref>foo bar for a</ref>
29703 B <ref group="X" name="b" />
29704
29705 <references />
29706
29707 <references group="X">
29708 <ref name="b"><span id="Z">foo</span>bar</ref>
29709 </references>
29710 !! end
29711
29712 !! test
29713 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29714 !! options
29715 parsoid={
29716 "modes": ["selser"],
29717 "changes": [
29718 [ "div:first-child", "text", "bar" ]
29719 ]
29720 }
29721 !! wikitext
29722 <div style="{{1x|color:red;}}%">foo</div>
29723 !! wikitext/edited
29724 <div style="{{1x|color:red;}}%">bar</div>
29725 !! end
29726
29727 !! test
29728 Empty LI (T49673)
29729 !! wikitext
29730 *a
29731 *
29732 *
29733 *b
29734 !! html+tidy
29735 <ul><li>a</li>
29736 <li class="mw-empty-elt"></li>
29737 <li class="mw-empty-elt"></li>
29738 <li>b</li></ul>
29739 !! end
29740
29741 !! test
29742 Thumbnail output
29743 !! wikitext
29744 [[File:Thumb.png|thumb]]
29745 !! html/php+tidy
29746 <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>
29747 !! html/parsoid
29748 <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>
29749 !! end
29750
29751 !! test
29752 unclosed internal link XSS (T137264)
29753 !! wikitext
29754 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29755 !! html/php
29756 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29757 </p>
29758 !! html/parsoid
29759 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29760 !! end
29761
29762 !! test
29763 Validating that <style> isn't eaten by tidy (T167349)
29764 !! options
29765 styletag=1
29766 !! wikitext
29767 <div class="foo">
29768 <style>.foo::before { content: "<foo>"; }</style>
29769 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29770 </div>
29771 !! html/php+tidy
29772 <div class="foo">
29773 <style>.foo::before { content: "<foo>"; }</style>
29774 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29775 </div>
29776 !! end
29777
29778 !! test
29779 Validating that <style> isn't wrapped in a paragraph (T186965)
29780 !! options
29781 styletag=1
29782 !! wikitext
29783 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29784
29785 <style>.foo::before { content: "<foo>"; }</style>
29786
29787 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29788
29789 But if it's on a line with other content, let it be wrapped.
29790
29791 <style>.foo::before { content: "<foo>"; }</style> bar
29792
29793 foo <style>.foo::before { content: "<foo>"; }</style>
29794
29795 foo <style>.foo::before { content: "<foo>"; }</style> bar
29796
29797 And the same if we have non-paragraph-breaking whitespace
29798
29799 foo
29800 <style>.foo::before { content: "<foo>"; }</style>
29801 bar
29802 !! html/php
29803 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29804 </p>
29805 <style>.foo::before { content: "<foo>"; }</style>
29806 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29807 <p>But if it's on a line with other content, let it be wrapped.
29808 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29809 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29810 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29811 </p><p>And the same if we have non-paragraph-breaking whitespace
29812 </p><p>foo
29813 <style>.foo::before { content: "<foo>"; }</style>
29814 bar
29815 </p>
29816 !! end
29817
29818 !! test
29819 Validating that <link> isn't wrapped in a paragraph (T186965)
29820 !! options
29821 styletag=1
29822 !! wikitext
29823 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29824
29825 <link rel="foo" href="bar"/>
29826
29827 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29828
29829 But if it's on a line with other content, let it be wrapped.
29830
29831 <link rel="foo" href="bar"/> bar
29832
29833 foo <link rel="foo" href="bar"/>
29834
29835 foo <link rel="foo" href="bar"/> bar
29836
29837 And the same if we have non-paragraph-breaking whitespace
29838
29839 foo
29840 <link rel="foo" href="bar"/>
29841 bar
29842 !! html/php
29843 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29844 </p>
29845 <link rel="foo" href="bar"/>
29846 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29847 <p>But if it's on a line with other content, let it be wrapped.
29848 </p><p><link rel="foo" href="bar"/> bar
29849 </p><p>foo <link rel="foo" href="bar"/>
29850 </p><p>foo <link rel="foo" href="bar"/> bar
29851 </p><p>And the same if we have non-paragraph-breaking whitespace
29852 </p><p>foo
29853 <link rel="foo" href="bar"/>
29854 bar
29855 </p>
29856 !! end
29857
29858 !! test
29859 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29860 !! config
29861 wgFragmentMode=[ 'html5', 'legacy' ]
29862 !! wikitext
29863 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29864 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29865 !! html/php
29866 <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>
29867 <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>
29868 </p>
29869 !! html/parsoid
29870 <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>
29871 <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>
29872 !! end
29873
29874 !! test
29875 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29876 !! config
29877 wgFragmentMode=[ 'legacy' ]
29878 !! wikitext
29879 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29880 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29881 !! html/php
29882 <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>
29883 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29884 </p>
29885 !! end
29886
29887 !! test
29888 Decoding of HTML entities in embedded HTML tags
29889 !! wikitext
29890 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29891 !! html/php
29892 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29893
29894 !! html/parsoid
29895 <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>
29896 !! end
29897
29898 !! test
29899 Decoding of HTML entities in indicator names for IDs (T104196)
29900 !! options
29901 parsoid=wt2html,html2html
29902 showindicators
29903 !! wikitext
29904 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29905 !! html/php
29906 1&2&3&amp;4&amp;amp;5=Indicator
29907
29908 !! html/parsoid
29909 <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>
29910 !! end
29911
29912 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29913 !! test
29914 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29915 !! options
29916 showindicators
29917 !! wikitext
29918 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29919 !! html/php
29920 1&2&3&amp;4&amp;amp;5=Indicator
29921
29922 !! html/parsoid
29923 <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>
29924 !! end
29925
29926 # This fragment mode is what Parsoid supports.
29927 !! test
29928 HTML5 ids: fallback to legacy
29929 !! config
29930 wgFragmentMode=[ 'html5', 'legacy' ]
29931 !! wikitext
29932 ==Foo bar==
29933
29934 ==foo Bar==
29935
29936 ==Тест==
29937
29938 ==Тест==
29939
29940 ==тест==
29941
29942 ==Hey < # " > % : '==
29943 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29944
29945 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29946
29947 <!-- These two links should produce identical HTML -->
29948 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29949
29950 !! html/php
29951 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29952 <ul>
29953 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29954 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29955 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29956 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29957 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29958 <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>
29959 </ul>
29960 </div>
29961
29962 <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>
29963 <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>
29964 <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>
29965 <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>
29966 <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>
29967 <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>
29968 <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>
29969 </p><p>💩 <span id="💩"></span>
29970 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29971 </p>
29972 !! html/parsoid
29973 <h2 id="Foo_bar">Foo bar</h2>
29974
29975 <h2 id="foo_Bar_2">foo Bar</h2>
29976
29977 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29978
29979 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29980
29981 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29982
29983 <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>
29984 <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>
29985
29986 <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>
29987
29988 <!-- These two links should produce identical HTML -->
29989 <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>
29990 !! end
29991
29992 # Parsoid doesn't support this mode
29993 !! test
29994 HTML5 ids: legacy with a fallback to modern
29995 !! config
29996 wgFragmentMode=[ 'legacy', 'html5' ]
29997 !! wikitext
29998 ==Foo bar==
29999
30000 ==foo Bar==
30001
30002 ==Тест==
30003
30004 ==Тест==
30005
30006 ==тест==
30007
30008 ==Hey < # " > % : '==
30009 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30010
30011 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30012
30013 <!-- These two links should produce identical HTML -->
30014 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30015
30016 !! html/php
30017 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30018 <ul>
30019 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30020 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30021 <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>
30022 <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>
30023 <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>
30024 <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>
30025 </ul>
30026 </div>
30027
30028 <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>
30029 <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>
30030 <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>
30031 <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>
30032 <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>
30033 <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>
30034 <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>
30035 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30036 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30037 </p>
30038 !! end
30039
30040 # Parsoid doesn't support this mode.
30041 !! test
30042 HTML5 ids: no legacy
30043 !! config
30044 wgFragmentMode=[ 'html5' ]
30045 !! wikitext
30046 ==Foo bar==
30047
30048 ==foo Bar==
30049
30050 ==Тест==
30051
30052 ==Тест==
30053
30054 ==тест==
30055
30056 ==Hey < # " > % : '==
30057 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30058
30059 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30060
30061 <!-- These two links should produce identical HTML -->
30062 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30063
30064 !! html/php
30065 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30066 <ul>
30067 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30068 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30069 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30070 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30071 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30072 <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>
30073 </ul>
30074 </div>
30075
30076 <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>
30077 <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>
30078 <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>
30079 <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>
30080 <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>
30081 <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>
30082 <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>
30083 </p><p>💩 <span id="💩"></span>
30084 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30085 </p>
30086 !! end
30087
30088 !! test
30089 T90902: Normalize weird characters in section IDs
30090 !! config
30091 wgFragmentMode=[ 'html5', 'legacy' ]
30092 !! wikitext
30093 ==Foo&nbsp;bar==
30094 [[#Foo&nbsp;bar]]
30095
30096 !! html/php
30097 <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>
30098 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30099 </p>
30100 !! html/parsoid
30101 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30102 <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>
30103 !! end
30104
30105 !! test
30106 T51672: Test for brackets in attributes of elements in external link texts
30107 !! wikitext
30108 [http://example.com/ link <span title="title with [brackets]">span</span>]
30109 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30110
30111 !! html/php
30112 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30113 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30114 </p>
30115 !! html/parsoid
30116 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30117 <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>
30118 !! end
30119
30120 !! test
30121 T72875: Test for brackets in attributes of elements in internal link texts
30122 !! wikitext
30123 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30124 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30125
30126 !! html/php
30127 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30128 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30129 </p>
30130 !! html/parsoid
30131 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30132 <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>
30133 !! end
30134
30135 !! test
30136 T179544: {{anchorencode:}} output should be always usable in links
30137 !! config
30138 wgFragmentMode=[ 'html5' ]
30139 !! wikitext
30140 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30141 !! html/php
30142 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30143 </p>
30144 !! html/parsoid
30145 <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>
30146 !! end
30147
30148 ## ------------------------------
30149 ## Parsoid section-wrapping tests
30150 ## ------------------------------
30151 !! test
30152 Section wrapping for well-nested sections (no leading content)
30153 !! options
30154 parsoid={
30155 "wrapSections": true
30156 }
30157 !! wikitext
30158 =1=
30159 a
30160
30161 =2=
30162 b
30163
30164 ==2.1==
30165 c
30166
30167 ==2.2==
30168 d
30169
30170 ===2.2.1===
30171 e
30172
30173 =3=
30174 f
30175 !! html/parsoid
30176 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30177 <p>a</p>
30178
30179 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30180 <p>b</p>
30181
30182 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30183 <p>c</p>
30184
30185 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30186 <p>d</p>
30187
30188 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30189 <p>e</p>
30190
30191 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30192 <p>f</p>
30193
30194 </section>
30195 !! end
30196
30197 !! test
30198 Section wrapping for well-nested sections (with leading content)
30199 !! options
30200 parsoid={
30201 "wrapSections": true
30202 }
30203 !! wikitext
30204 Para 1.
30205
30206 Para 2 with a <div>nested in it</div>
30207
30208 Para 3.
30209
30210 =1=
30211 a
30212
30213 =2=
30214 b
30215
30216 ==2.1==
30217 c
30218 !! html/parsoid
30219 <section data-mw-section-id="0"><p>Para 1.</p>
30220
30221 <p>Para 2 with a </p><div>nested in it</div>
30222
30223 <p>Para 3.</p>
30224
30225 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30226 <p>a</p>
30227
30228 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30229 <p>b</p>
30230
30231 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30232 <p>c</p>
30233
30234 </section></section>
30235 !! end
30236
30237 !! test
30238 Section wrapping with template-generated sections (good nesting 1)
30239 !! options
30240 parsoid={
30241 "wrapSections": true
30242 }
30243 !! wikitext
30244 =1=
30245 a
30246
30247 {{echo|1=
30248 ==1.1==
30249 b
30250 }}
30251
30252 ==1.2==
30253 c
30254
30255 =2=
30256 d
30257 !! html/parsoid
30258 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30259 <p>a</p>
30260
30261 <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">
30262 </span><p about="#mwt1">b</p>
30263 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30264 <p>c</p>
30265
30266 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30267 <p>d</p></section>
30268 !! end
30269
30270 # In this example, the template scope is mildly expanded to incorporate the
30271 # trailing newline after the transclusion since that is part of section 1.1.1
30272 !! test
30273 Section wrapping with template-generated sections (good nesting 2)
30274 !! options
30275 parsoid={
30276 "wrapSections": true,
30277 "modes": ["wt2html", "wt2wt"]
30278 }
30279 !! wikitext
30280 =1=
30281 a
30282
30283 {{echo|1=
30284 ==1.1==
30285 b
30286 ===1.1.1===
30287 d
30288 }}
30289 =2=
30290 e
30291 !! html/parsoid
30292 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30293 <p>a</p>
30294
30295 <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">
30296 </span><p about="#mwt1">b</p><span about="#mwt1">
30297 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30298 </span><p about="#mwt1">d</p><span about="#mwt1">
30299 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30300 <p>e</p></section>
30301 !! end
30302
30303 # In this example, the template scope is mildly expanded to incorporate the
30304 # trailing newline after the transclusion since that is part of section 1.2.1
30305 !! test
30306 Section wrapping with template-generated sections (good nesting 3)
30307 !! options
30308 parsoid={
30309 "wrapSections": true,
30310 "modes": ["wt2html", "wt2wt"]
30311 }
30312 !! wikitext
30313 =1=
30314 a
30315
30316 {{echo|1=
30317 x
30318 ==1.1==
30319 b
30320 ==1.2==
30321 c
30322 ===1.2.1===
30323 d
30324 }}
30325 =2=
30326 e
30327 !! html/parsoid
30328 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30329 <p>a</p>
30330
30331 <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">
30332 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30333 </span><p about="#mwt1">b</p><span about="#mwt1">
30334 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30335 </span><p about="#mwt1">c</p><span about="#mwt1">
30336 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30337 </span><p about="#mwt1">d</p><span about="#mwt1">
30338 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30339 <p>e</p></section>
30340 !! end
30341
30342 # Because of section-wrapping and template-wrapping interactions,
30343 # the scope of the template is expanded so that the template markup
30344 # is valid in the presence of <section> tags.
30345 # This exercises the s1 is null scenario in the wrapSections code
30346 !! test
30347 Section wrapping with template-generated sections (bad nesting 1)
30348 !! options
30349 parsoid={
30350 "wrapSections": true
30351 }
30352 !! wikitext
30353 <div>
30354 a
30355
30356 {{echo|
30357 =1=
30358 b
30359 }}
30360
30361 c
30362 </div>
30363 !! html/parsoid
30364 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30365 <p>a</p>
30366
30367 <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"]}'>
30368 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30369 </span><p about="#mwt1">b
30370 </p><span about="#mwt1">
30371
30372 </span><p about="#mwt1">c</p><span about="#mwt1">
30373 </span></section></div></section>
30374 !! end
30375
30376 # Because of section-wrapping and template-wrapping interactions,
30377 # the scope of the template is expanded so that the template markup
30378 # is valid in the presence of <section> tags.
30379 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30380 !! test
30381 Section wrapping with template-generated sections (bad nesting 2)
30382 !! options
30383 parsoid={
30384 "wrapSections": true
30385 }
30386 !! wikitext
30387 =1=
30388 a
30389
30390 {{echo|1=
30391 =2=
30392 b
30393 ==2.1==
30394 c
30395 }}
30396
30397 d
30398
30399 =3=
30400 e
30401 !! html/parsoid
30402 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30403 <p>a</p>
30404
30405 </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">
30406 </span><p about="#mwt1">b</p><span about="#mwt1">
30407 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30408 </span><p about="#mwt1">c</p><span about="#mwt1">
30409
30410 </span><p about="#mwt1">d</p><span about="#mwt1">
30411
30412 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30413 <p>e</p></section>
30414 !! end
30415
30416 # Because of section-wrapping and template-wrapping interactions,
30417 # additional template wrappers are added to <section> tags
30418 # so that template wrapping semantics are valid whether section
30419 # tags are retained or stripped. But, the template scope can expand
30420 # greatly when accounting for section tags.
30421 # This exercises the s1 and s2 are in different subtrees scenario
30422 !! test
30423 Section wrapping with template-generated sections (bad nesting 3)
30424 !! options
30425 parsoid={
30426 "wrapSections": true,
30427 "modes": ["wt2html", "wt2wt"]
30428 }
30429 !! wikitext
30430 =1=
30431 a
30432
30433 {{echo|1=
30434 ==1.2==
30435 b
30436 =2=
30437 c
30438 }}
30439
30440 d
30441
30442 =3=
30443 e
30444 !! html/parsoid
30445 <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>
30446 <p>a</p>
30447
30448 <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">
30449 </span><p about="#mwt1">b</p><span about="#mwt1">
30450 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30451 </span><p about="#mwt1">c</p>
30452
30453 <p>d</p>
30454 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30455 <p>e</p></section>
30456 !! end
30457
30458 !! test
30459 Section wrapping with uneditable lead section + div wrapping multiple sections
30460 !! options
30461 parsoid={
30462 "wrapSections": true
30463 }
30464 !! wikitext
30465 foo
30466
30467 <div style="border:1px solid red;">
30468 =1=
30469 a
30470
30471 ==1.1==
30472 b
30473
30474 =2=
30475 c
30476 </div>
30477
30478 =3=
30479 d
30480
30481 ==3.1==
30482 e
30483 !! html/parsoid
30484 <section data-mw-section-id="-1"><p>foo</p>
30485
30486 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30487 <section data-mw-section-id="1"><h1 id="1">1</h1>
30488 <p>a</p>
30489
30490 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30491 <p>b</p>
30492
30493 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30494 <p>c</p>
30495 </section></div>
30496
30497 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30498 <p>d</p>
30499
30500 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30501 <p>e</p>
30502 </section></section>
30503 !! end
30504
30505 !! test
30506 Section wrapping with editable lead section + div overlapping multiple sections
30507 !! options
30508 parsoid={
30509 "wrapSections": true
30510 }
30511 !! wikitext
30512 foo
30513
30514 =1=
30515 a
30516 <div style="border:1px solid red;">
30517 b
30518
30519 ==1.1==
30520 c
30521
30522 =2=
30523 d
30524 </div>
30525 e
30526
30527 =3=
30528 f
30529
30530 ==3.1==
30531 g
30532 !! html/parsoid
30533 <section data-mw-section-id="0"><p>foo</p>
30534
30535 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30536 <p>a</p>
30537 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30538 <p>b</p>
30539
30540 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30541 <p>c</p>
30542
30543 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30544 <p>d</p>
30545 </section></div>
30546 <p>e</p>
30547
30548 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30549 <p>f</p>
30550
30551 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30552 <p>g</p>
30553 </section></section>
30554 !! end
30555
30556 !! test
30557 HTML header tags should not be wrapped in section tags
30558 !! options
30559 parsoid={
30560 "wrapSections": true
30561 }
30562 !! wikitext
30563 foo
30564
30565 <h1>a</h1>
30566
30567 =b=
30568
30569 <h1>c</h1>
30570
30571 =d=
30572 !! html/parsoid
30573 <section data-mw-section-id="0"><p>foo</p>
30574
30575 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30576
30577 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30578
30579 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30580
30581 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30582 !! end
30583
30584 !! test
30585 Lead section containing only whitespace and comments.
30586 !! options
30587 parsoid={
30588 "wrapSections": true
30589 }
30590 !! wikitext
30591
30592 <!-- this is a comment, presumably significant to editors -->
30593 =1=
30594 a
30595
30596 =2=
30597 b
30598 !! html/parsoid
30599 <section data-mw-section-id="0" data-parsoid="{}">
30600 <!-- this is a comment, presumably significant to editors -->
30601 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30602 <p>a</p>
30603
30604 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30605 <p>b</p></section>
30606 !! end
30607
30608 !! test
30609 Pseudo-sections emitted by templates should have id -2
30610 !! options
30611 parsoid={
30612 "wrapSections": true
30613 }
30614 !! wikitext
30615 foo
30616 {{echo|<div>
30617 ==a==
30618 ==b==
30619 </div>
30620 }}
30621 !! html/parsoid
30622 <section data-mw-section-id="-1"><p>foo</p>
30623 </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}}]}'>
30624 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30625 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30626 </section></div><span about="#mwt1">
30627 </span></section>
30628 !! end
30629
30630 ##########################################################################
30631 Tests demonstrating white-space insensitivity in input wikitext
30632 for wikitext headings, wikitext list items, and wikitext table captions,
30633 headings, and cells. HTML versions of the same should preserve whitespace.
30634 ##########################################################################
30635 !! test
30636 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30637 !! wikitext
30638 __NOTOC__
30639 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
30640 == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
30641 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30642 ; <!--term to define--> term : <!--term's definition--> definition
30643 {|
30644 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30645 |-
30646 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30647 |-
30648 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30649 |-
30650 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30651 |-
30652 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30653 |}
30654 : {|
30655 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30656 |} foo <!--c1-->
30657 !! html/php+tidy
30658 <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>
30659 <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>
30660 <ul><li>List item</li></ul>
30661 <dl><dt>term&#160;</dt>
30662 <dd>definition</dd></dl>
30663 <table>
30664 <caption>Table Caption
30665 </caption>
30666 <tbody><tr>
30667 <th>Table Heading 1</th>
30668 <th>Table Heading 2
30669 </th></tr>
30670 <tr>
30671 <td>Table Cell 1</td>
30672 <td>Table Cell 2
30673 </td></tr>
30674 <tr>
30675 <td>class="foo"</td>
30676 <td>Table Cell 3
30677 </td></tr>
30678 <tr>
30679 <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
30680 </td></tr></tbody></table>
30681 <dl><dd><table>
30682 <tbody><tr>
30683 <td>Table Cell 1</td>
30684 <td>Table Cell 2
30685 </td></tr></tbody></table> foo</dd></dl>
30686 !! end
30687
30688 # Looks like <caption> is not accepted in HTML
30689 !! test
30690 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30691 !! wikitext
30692 __NOTOC__
30693 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
30694 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30695 <table>
30696 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30697 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30698 </table>
30699 !! html/php+tidy
30700 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
30701 <ul><li> List item </li></ul>
30702 <table>
30703 <tbody><tr><th> Table Heading </th><th></th></tr>
30704 <tr><td> Table Cell </td><th></th></tr>
30705 </tbody></table>
30706 !! end
30707
30708 !! test
30709 Do not trim whitespace in links and quotes
30710 !! wikitext
30711 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30712 [[Foo| some text ]]
30713 !! html/php+tidy
30714 <p>foo <i> italic </i> and <b> bold </b>
30715 <a href="/wiki/Foo" title="Foo"> some text </a>
30716 </p>
30717 !! end
30718
30719 !! test
30720 Remove p tags surrounding a single element in a figcaption
30721 !! options
30722 parsoid=html2wt
30723 !! wikitext
30724 [[File:Foobar.jpg|right|200x200px|Caption]]
30725 !! html/parsoid
30726 <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>
30727 !! end
30728
30729 !! test
30730 Selser preserves lack of newline before list and allows newline after the list
30731 !! options
30732 parsoid={
30733 "modes": ["selser"],
30734 "scrubWikitext": true,
30735 "changes": [
30736 [ "ul", "after", "<p>footer</p>" ]
30737 ]
30738 }
30739 !! wikitext
30740 header
30741 *foo
30742 *bar
30743 !! wikitext/edited
30744 header
30745 *foo
30746 *bar
30747
30748 footer
30749 !! end
30750
30751
30752 !! test
30753 Selser does not introduce newlines between unedited paragraph preceding the list
30754 !! options
30755 parsoid={
30756 "modes": ["selser"],
30757 "changes": [
30758 [ "table tbody tr td p:last-child", "empty" ]
30759 ]
30760 }
30761 !! wikitext
30762 {|
30763 |
30764 header
30765 *foo
30766 *bar
30767 footer
30768 |}
30769 !! wikitext/edited
30770 {|
30771 |
30772 header
30773 *foo
30774 *bar
30775
30776 |}
30777 !! end
30778
30779 !! test
30780 Selser does not introduce newlines between unedited paragraph following the list
30781 !! options
30782 parsoid={
30783 "modes": ["selser"],
30784 "changes": [
30785 [ "table tbody tr td p:first-child", "empty" ]
30786 ]
30787 }
30788 !! wikitext
30789 {|
30790 |
30791 header
30792 *foo
30793 *bar
30794 footer
30795 |}
30796 !! wikitext/edited
30797 {|
30798 |
30799
30800 *foo
30801 *bar
30802 footer
30803 |}
30804 !! end
30805
30806 !! test
30807 Remove a list item but do not insert newline above list
30808 !! options
30809 parsoid={
30810 "modes": ["selser"],
30811 "changes": [
30812 [ "ul li:last-child", "remove" ]
30813 ]
30814 }
30815 !! wikitext
30816 header
30817 *foo
30818 *bar
30819 footer
30820 !! wikitext/edited
30821 header
30822 *foo
30823 footer
30824 !! end