Sync up with Parsoid parserTests.txt
[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 ###
18317 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
18318 ###
18319
18320 !! test
18321 Parser hook: static parser hook not inside a comment
18322 !! wikitext
18323 <statictag>hello, world</statictag>
18324
18325 <statictag action="flush" />
18326 !! html/php
18327 <p><br />
18328 hello, world
18329 </p>
18330 !! html/parsoid
18331 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
18332 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
18333 !! end
18334
18335 !! test
18336 Parser hook: static parser hook inside a comment
18337 !! wikitext
18338 <!-- <statictag>hello, world</statictag> -->
18339 <statictag action="flush" />
18340 !! html/php
18341 <p><br />
18342 </p>
18343 !! html/parsoid
18344 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
18345 <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
18346 !! end
18347
18348 # Nested template calls; this case was broken by Parser.php rev 1.506,
18349 # since reverted.
18350
18351 !! article
18352 Template:One-parameter
18353 !! text
18354 (My parameter is: {{{1}}})
18355 !! endarticle
18356
18357 !! article
18358 Template:Map-one-parameter
18359 !! text
18360 {{{{{1}}}|{{{2}}}}}
18361 !! endarticle
18362
18363 !! test
18364 Nested template calls
18365 !! wikitext
18366 {{Map-one-parameter|One-parameter|param}}
18367 !! html
18368 <p>(My parameter is: param)
18369 </p>
18370 !! end
18371
18372
18373 ###
18374 ### Sanitizer
18375 ###
18376
18377 # Remex wraps empty tag runs with p-tags.
18378 # Parsoid strips them out during p-wrapping.
18379 !! test
18380 Sanitizer: Closing of open tags
18381 !! wikitext
18382 <s></s><table></table>
18383 !! html/php+tidy
18384 <p><s></s></p><table></table>
18385 !! html/parsoid
18386 <s></s><table></table>
18387 !! end
18388
18389 !! test
18390 Sanitizer: Closing of open but not closed tags
18391 !! wikitext
18392 <s>foo
18393 !! html
18394 <p><s>foo</s>
18395 </p>
18396 !! end
18397
18398 !! test
18399 Sanitizer: Closing of closed but not open tags
18400 !! options
18401 parsoid=wt2html
18402 !! wikitext
18403 </s>
18404 !! html/php+tidy
18405 <p class="mw-empty-elt">
18406 </p>
18407 !! html/parsoid
18408 !! end
18409
18410 !! test
18411 Sanitizer: Closing of closed but not open table tags
18412 !! options
18413 parsoid=wt2html
18414 !! wikitext
18415 Table not started</td></tr></table>
18416 !! html+tidy
18417 <p>Table not started
18418 </p>
18419 !! end
18420
18421 !! test
18422 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
18423 !! config
18424 wgFragmentMode=[ 'html5', 'legacy' ]
18425 !! wikitext
18426 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18427 !! html/php
18428 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
18429 </p>
18430 !! html/parsoid
18431 <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>
18432 !! end
18433
18434 !! test
18435 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
18436 !! config
18437 wgFragmentMode=[ 'legacy' ]
18438 !! wikitext
18439 <span id="æ: v">byte</span>[[#æ: v|backlink]]
18440 !! html/php
18441 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
18442 </p>
18443 !! end
18444
18445 # In HTML5, the restrictions are that id must contain at least one character,
18446 # and must not contain any space characters.
18447 !! test
18448 Sanitizer: Validating the contents of the id attribute (T6515)
18449 !! options
18450 disabled
18451 !! wikitext
18452 <br id="" /><br id="a space" />
18453 !! html
18454 Something ...
18455 !! end
18456
18457 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
18458 !! test
18459 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
18460 !! options
18461 disabled
18462 !! wikitext
18463 <br id="foo" /><br id="foo" />
18464 !! html
18465 Something need to be done. foo-2 ?
18466 !! end
18467
18468 !! test
18469 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
18470 !! wikitext
18471 <div itemscope>
18472 <meta itemprop="hello" content="world">
18473 <meta http-equiv="refresh" content="5">
18474 <meta itemprop="hello" http-equiv="refresh" content="5">
18475 <link itemprop="hello" href="{{SERVER}}">
18476 <link rel="stylesheet" href="{{SERVER}}">
18477 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
18478 </div>
18479 !! html
18480 <div itemscope="">
18481 <p> <meta itemprop="hello" content="world" />
18482 &lt;meta http-equiv="refresh" content="5"&gt;
18483 <meta itemprop="hello" content="5" />
18484 <link itemprop="hello" href="http&#58;//example.org" />
18485 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
18486 <link itemprop="hello" href="http&#58;//example.org" />
18487 </p>
18488 </div>
18489
18490 !! end
18491
18492 !! test
18493 Sanitizer: Strip comments from CSS attributes
18494 !! options
18495 parsoid=wt2html,wt2wt
18496 !! wikitext
18497 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
18498 !! html/php
18499 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
18500 </p>
18501 !! html/parsoid
18502 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
18503 !! end
18504
18505 !! test
18506 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
18507 !! wikitext
18508 [[meatball:Soft"Security]]
18509 !! html/php
18510 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
18511 </p>
18512 !! html/parsoid
18513 <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>
18514 !! end
18515
18516 !! test
18517 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
18518 !! wikitext
18519 [[meatball:Foo<Bar]]
18520 [[meatball:Foo>Bar]]
18521 [[meatball:Foo&lt;bar]]
18522 [[meatball:Foo&gt;bar]]
18523 !! html/php
18524 <p>[[meatball:Foo&lt;Bar]]
18525 [[meatball:Foo&gt;Bar]]
18526 [[meatball:Foo&lt;bar]]
18527 [[meatball:Foo&gt;bar]]
18528 </p>
18529 !! html/parsoid
18530 <p>[[meatball:Foo&lt;Bar]]
18531 [[meatball:Foo>Bar]]
18532 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
18533 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
18534 !! end
18535
18536 !! test
18537 Language converter: output gets cut off unexpectedly (T7757)
18538 !! options
18539 language=zh
18540 !! wikitext
18541 this bit is safe: }-
18542
18543 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
18544
18545 then we get cut off here: }-
18546
18547 all additional text is vanished
18548 !! html/php
18549 <p>this bit is safe: }-
18550 </p><p>but if we add a conversion instance: xxx
18551 </p><p>then we get cut off here: }-
18552 </p><p>all additional text is vanished
18553 </p>
18554 !! html/parsoid
18555 <p>this bit is safe: }-</p>
18556 <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>
18557 <p>then we get cut off here: }-</p>
18558 <p>all additional text is vanished</p>
18559 !! end
18560
18561 !! test
18562 Language converter glossary rules inside attributes (T119158)
18563 !! options
18564 language=sr variant=sr-el
18565 !! wikitext
18566 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
18567
18568 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
18569 !! html/php
18570 <p>
18571 </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>
18572 </p>
18573 !! html/parsoid
18574 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
18575
18576 <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>
18577 !! end
18578
18579 !! test
18580 Self closed html pairs (T7487)
18581 !! wikitext
18582 <center><font id="bug" />Centered text</center>
18583 <div><font id="bug2" />In div text</div>
18584 !! html+tidy
18585 <center><font id="bug"></font>Centered text</center>
18586 <div><font id="bug2"></font>In div text</div>
18587 !! end
18588
18589 !! test
18590 Punctuation: nbsp before exclamation
18591 !! wikitext
18592 C'est grave !
18593 !! html
18594 <p>C'est grave&#160;!
18595 </p>
18596 !! end
18597
18598 !! test
18599 Punctuation: CSS !important (T13874)
18600 !! wikitext
18601 <div style="width:50% !important">important</div>
18602 !! html
18603 <div style="width:50% !important">important</div>
18604
18605 !!end
18606
18607 !! test
18608 Punctuation: CSS ! important (T13874; with space after)
18609 !! wikitext
18610 <div style="width:50% ! important">important</div>
18611 !! html
18612 <div style="width:50% ! important">important</div>
18613
18614 !!end
18615
18616 !! test
18617 HTML bullet list, closed tags (T7497)
18618 !! wikitext
18619 <ul>
18620 <li>One</li>
18621 <li>Two</li>
18622 </ul>
18623 !! html/php
18624 <ul>
18625 <li>One</li>
18626 <li>Two</li>
18627 </ul>
18628
18629 !! html/parsoid
18630 <ul data-parsoid='{"stx":"html"}'>
18631 <li data-parsoid='{"stx":"html"}'>One</li>
18632 <li data-parsoid='{"stx":"html"}'>Two</li>
18633 </ul>
18634
18635 !! end
18636
18637 !! test
18638 HTML bullet list, unclosed tags (T7497)
18639 !! wikitext
18640 <ul>
18641 <li>One
18642 <li>Two
18643 </ul>
18644 !! html/php+tidy
18645 <ul>
18646 <li>One
18647 </li><li>Two
18648 </li></ul>
18649 !! html/parsoid
18650 <ul data-parsoid='{"stx":"html"}'>
18651 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18652 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18653 </ul>
18654
18655 !! end
18656
18657 !! test
18658 HTML ordered list, closed tags (T7497)
18659 !! wikitext
18660 <ol>
18661 <li>One</li>
18662 <li>Two</li>
18663 </ol>
18664 !! html/php
18665 <ol>
18666 <li>One</li>
18667 <li>Two</li>
18668 </ol>
18669
18670 !! html/parsoid
18671 <ol data-parsoid='{"stx":"html"}'>
18672 <li data-parsoid='{"stx":"html"}'>One</li>
18673 <li data-parsoid='{"stx":"html"}'>Two</li>
18674 </ol>
18675
18676 !! end
18677
18678 !! test
18679 HTML ordered list, unclosed tags (T7497)
18680 !! options
18681 !! wikitext
18682 <ol>
18683 <li>One
18684 <li>Two
18685 </ol>
18686 !! html/php+tidy
18687 <ol>
18688 <li>One
18689 </li><li>Two
18690 </li></ol>
18691 !! html/parsoid
18692 <ol data-parsoid='{"stx":"html"}'>
18693 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
18694 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
18695 </ol>
18696
18697 !! end
18698
18699 !! test
18700 HTML nested bullet list, closed tags (T7497)
18701 !! wikitext
18702 <ul>
18703 <li>One</li>
18704 <li>Two:
18705 <ul>
18706 <li>Sub-one</li>
18707 <li>Sub-two</li>
18708 </ul>
18709 </li>
18710 </ul>
18711 !! html/php
18712 <ul>
18713 <li>One</li>
18714 <li>Two:
18715 <ul>
18716 <li>Sub-one</li>
18717 <li>Sub-two</li>
18718 </ul>
18719 </li>
18720 </ul>
18721
18722 !! html/parsoid
18723 <ul data-parsoid='{"stx":"html"}'>
18724 <li data-parsoid='{"stx":"html"}'>One</li>
18725 <li data-parsoid='{"stx":"html"}'>Two:
18726 <ul data-parsoid='{"stx":"html"}'>
18727 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
18728 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
18729 </ul>
18730 </li>
18731 </ul>
18732 !! end
18733
18734 !! test
18735 HTML nested bullet list, open tags (T7497)
18736 !! wikitext
18737 <ul>
18738 <li>One
18739 <li>Two:
18740 <ul>
18741 <li>Sub-one
18742 <li>Sub-two
18743 </ul>
18744 </ul>
18745 !! html+tidy
18746 <ul>
18747 <li>One
18748 </li><li>Two:
18749 <ul>
18750 <li>Sub-one
18751 </li><li>Sub-two
18752 </li></ul>
18753 </li></ul>
18754 !! end
18755
18756 !! test
18757 HTML nested ordered list, closed tags (T7497)
18758 !! wikitext
18759 <ol>
18760 <li>One</li>
18761 <li>Two:
18762 <ol>
18763 <li>Sub-one</li>
18764 <li>Sub-two</li>
18765 </ol>
18766 </li>
18767 </ol>
18768 !! html
18769 <ol>
18770 <li>One</li>
18771 <li>Two:
18772 <ol>
18773 <li>Sub-one</li>
18774 <li>Sub-two</li>
18775 </ol>
18776 </li>
18777 </ol>
18778
18779 !! end
18780
18781 !! test
18782 HTML nested ordered list, open tags (T7497)
18783 !! wikitext
18784 <ol>
18785 <li>One
18786 <li>Two:
18787 <ol>
18788 <li>Sub-one
18789 <li>Sub-two
18790 </ol>
18791 </ol>
18792 !! html/php
18793 <ol>
18794 <li>One
18795 <li>Two:
18796 <ol>
18797 <li>Sub-one
18798 <li>Sub-two
18799 </ol>
18800 </ol>
18801
18802 !! html/parsoid
18803 <ol>
18804 <li>One
18805 </li>
18806 <li>Two:
18807 <ol>
18808 <li>Sub-one
18809 </li>
18810 <li>Sub-two
18811 </li>
18812 </ol>
18813 </li>
18814 </ol>
18815
18816 !! end
18817
18818 !! test
18819 HTML ordered list item with parameters oddity
18820 !! wikitext
18821 <ol><li id="fragment">One</li>
18822 </ol>
18823 !! html
18824 <ol><li id="fragment">One</li>
18825 </ol>
18826
18827 !! end
18828
18829 # parsoid doesn't explicitly mark autonumbered links, see T55505
18830 !!test
18831 T7918: autonumbering
18832 !! wikitext
18833 [http://first/] [http://second] [ftp://ftp]
18834
18835 ftp://inlineftp
18836
18837 [mailto:enclosed@mail.tld With target]
18838
18839 [mailto:enclosed@mail.tld]
18840
18841 mailto:inline@mail.tld
18842 !! html/php
18843 <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>
18844 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
18845 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
18846 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
18847 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
18848 </p>
18849 !! html/parsoid
18850 <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>
18851 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
18852 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
18853 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
18854 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
18855 !! end
18856
18857
18858 #
18859 # Security and HTML correctness
18860 # From Nick Jenkins' fuzz testing
18861 #
18862
18863 !! test
18864 Fuzz testing: Parser13
18865 !! wikitext
18866 {|
18867 | http://a|
18868 !! html
18869 <table>
18870 <tr>
18871 <td>
18872 </td>
18873 </tr>
18874 </table>
18875
18876 !! end
18877
18878 # Note that Parsoid output differs from the PHP parser here: the PHP
18879 # parser breaks the URL for the magic word, while in Parsoid the URL
18880 # production takes precedence.
18881 !! test
18882 Fuzz testing: Parser14
18883 !! wikitext
18884 ==onmouseover===
18885 http://__TOC__
18886 !! html/php
18887 <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>
18888 http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18889 <ul>
18890 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18891 </ul>
18892 </div>
18893
18894
18895 !! html/php+tidy
18896 <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>
18897 http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
18898 <ul>
18899 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
18900 </ul>
18901 </div>
18902 !! html/parsoid
18903 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
18904 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
18905 !! end
18906
18907 !! test
18908 Fuzz testing: Parser14-table
18909 !! options
18910 parsoid=wt2html,html2html
18911 !! wikitext
18912 ==a==
18913 {| STYLE=__TOC__
18914 !! html
18915 <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>
18916 <table style="&#95;_TOC&#95;_">
18917 <tr><td></td></tr>
18918 </table>
18919
18920 !! html+tidy
18921 <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>
18922 <table style="__TOC__">
18923 <tr>
18924 <td></td>
18925 </tr>
18926 </table>
18927 !! html/parsoid
18928 <h2 id="a">a</h2>
18929 <table style="__TOC__"></table>
18930 !! end
18931
18932 # Known to produce bogus xml (extra </td>)
18933 # Don't add the html/php section since it generates broken HTML
18934 !! test
18935 Fuzz testing: Parser16
18936 !! wikitext
18937 {|
18938 !https://||||||
18939 !! html+tidy
18940 <table>
18941 <tbody><tr>
18942 <th>https://</th>
18943 <th></th>
18944 <th></th>
18945 <th>
18946
18947 </th></tr>
18948 </tbody></table>
18949 !! end
18950
18951 !! test
18952 Fuzz testing: Parser21
18953 !! wikitext
18954 {|
18955 !irc://{{ftp://a" onmouseover="alert('hello world');"
18956 |
18957 !! html
18958 <table>
18959 <tr>
18960 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
18961 </th>
18962 <td>
18963 </td>
18964 </tr>
18965 </table>
18966
18967 !! end
18968
18969 !! test
18970 Fuzz testing: Parser22
18971 !! wikitext
18972 http://===r:::https://b
18973
18974 {|
18975 !! html
18976 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
18977 </p>
18978 <table>
18979 <tr><td></td></tr>
18980 </table>
18981
18982 !! end
18983
18984 # Known to produce bad XML for now
18985 !! test
18986 Fuzz testing: Parser24
18987 !! options
18988 parsoid=wt2html
18989 !! wikitext
18990 {|
18991 {{{|
18992 <u CLASS=
18993 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
18994 <br style="onmouseover='alert(document.cookie);' " />
18995
18996 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
18997 |
18998 !! html/php
18999 <table>
19000 {{{|
19001 <u class="&#124;">}}}} &gt;
19002 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19003
19004 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19005 <tr>
19006 <td></u>
19007 </td>
19008 </tr>
19009 </table>
19010
19011 !! html/parsoid
19012 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
19013 <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>"}'/>}}}} >
19014 <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}'>
19015
19016
19017
19018 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
19019 !! end
19020
19021 # Note: the current result listed for this is not what the original one was,
19022 # but the original bug was JavaScript injection, which is fixed in any case.
19023 # It's not clear that the original result listed was any more correct than the
19024 # current one. Original result:
19025 # <p>{{{|
19026 # </p>
19027 # <li class="&#124;&#124;">
19028 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19029 !!test
19030 Fuzz testing: Parser25 (T8055)
19031 !! wikitext
19032 {{{
19033 |
19034 <LI CLASS=||
19035 >
19036 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19037 !! html/php
19038 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19039 </p>
19040 !! html/parsoid
19041 <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"]}'>
19042 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19043 !! end
19044
19045 !!test
19046 Fuzz testing: URL adjacent extension (with space, clean)
19047 !! wikitext
19048 http://example.com <nowiki>junk</nowiki>
19049 !! html/php
19050 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19051 </p>
19052 !! html/parsoid
19053 <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>
19054 !! end
19055
19056 !!test
19057 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19058 !! wikitext
19059 http://example.com<nowiki>junk</nowiki>
19060 !! html/php
19061 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19062 </p>
19063 !! html/parsoid
19064 <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>
19065 !! end
19066
19067 !! test
19068 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19069 !! wikitext
19070 http://example.com<pre>junk</pre>
19071 !! html/php
19072 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19073
19074 !! html/php+tidy
19075 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19076 !! html/parsoid
19077 <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>
19078 !! end
19079
19080 !! test
19081 Fuzz testing: image with bogus manual thumbnail
19082 !! wikitext
19083 [[Image:foobar.jpg|thumbnail= ]]
19084 !! html/php
19085 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19086
19087 !! html/parsoid
19088 <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>
19089 !! end
19090
19091 # Parsoid will emit the newline literally in wt2wt; see next test case.
19092 !! test
19093 Fuzz testing: encoded newline in generated HTML replacements (T8577)
19094 !! options
19095 parsoid=wt2html
19096 !! wikitext
19097 <pre dir="&#10;"></pre>
19098 !! html/php
19099 <pre dir="&#10;"></pre>
19100
19101 !! html/parsoid
19102 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19103 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19104 !! end
19105
19106 !! test
19107 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
19108 !! options
19109 parsoid=html2wt
19110 !! html/parsoid
19111 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
19112 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
19113 !! wikitext
19114 <pre dir="
19115 "></pre>
19116 !! html/php
19117 <pre dir=""></pre>
19118
19119 !! end
19120
19121 !! test
19122 Templates in extension attributes are not expanded
19123 !! wikitext
19124 <pre dir="{{echo|ltr}}"></pre>
19125 !! html/php
19126 <pre dir="{{echo|ltr}}"></pre>
19127
19128 !! html/parsoid
19129 <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
19130 !! end
19131
19132 !! test
19133 Parsing optional HTML elements (T8171)
19134 !! options
19135 !! wikitext
19136 <table>
19137 <tr>
19138 <td> Some tabular data</td>
19139 <td> More tabular data ...
19140 <td> And yet som tabular data</td>
19141 </tr>
19142 </table>
19143 !! html
19144 <table>
19145 <tr>
19146 <td> Some tabular data</td>
19147 <td> More tabular data ...
19148 </td><td> And yet som tabular data</td>
19149 </tr>
19150 </table>
19151
19152 !! end
19153
19154 !! test
19155 Correct handling of <td>, <tr> (T8171)
19156 !! options
19157 !! wikitext
19158 <table>
19159 <tr>
19160 <td> Some tabular data</td>
19161 <td> More tabular data ...</td>
19162 <td> And yet som tabular data</td>
19163 </tr>
19164 </table>
19165 !! html
19166 <table>
19167 <tr>
19168 <td> Some tabular data</td>
19169 <td> More tabular data ...</td>
19170 <td> And yet som tabular data</td>
19171 </tr>
19172 </table>
19173
19174 !! end
19175
19176
19177 !! test
19178 Parsing crashing regression (fr:JavaScript)
19179 !! wikitext
19180 </body></x>
19181 !! html
19182 <p>&lt;/body&gt;&lt;/x&gt;
19183 </p>
19184 !! end
19185
19186 !! test
19187 Inline wiki vs wiki block nesting
19188 !! wikitext
19189 '''Bold paragraph
19190
19191 New wiki paragraph
19192 !! html
19193 <p><b>Bold paragraph</b>
19194 </p><p>New wiki paragraph
19195 </p>
19196 !! end
19197
19198 # FIXME: The current php output is documented
19199 # and desired output is the parsoid target.
19200 !! test
19201 Inline HTML vs wiki block nesting
19202 !! wikitext
19203 <b>Bold paragraph
19204
19205 New wiki paragraph
19206 !! html/php
19207 <p><b>Bold paragraph
19208 </p><p>New wiki paragraph</b>
19209 </p>
19210 !! html/parsoid
19211 <p><b>Bold paragraph</b>
19212 </p><p>New wiki paragraph
19213 </p>
19214 !! end
19215
19216 # Original result was this:
19217 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
19218 # </p>
19219 # While that might be marginally more intuitive, maybe, the six-apostrophe
19220 # construct is clearly pathological and the result stated here (which is what
19221 # the parser actually does) is about as reasonable as anything.
19222 !!test
19223 Mixing markup for italics and bold
19224 !! options
19225 !! wikitext
19226 '''bold''''''bold''bolditalics'''''
19227 !! html
19228 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
19229 </p>
19230 !! end
19231
19232
19233 !! article
19234 Xyzzyx
19235 !! text
19236 Article for special page transclusion test
19237 !! endarticle
19238
19239 !! test
19240 Special page transclusion
19241 !! options
19242 !! wikitext
19243 {{Special:Prefixindex/Xyzzyx}}
19244 !! html
19245 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19246 </ul>
19247
19248 !! end
19249
19250 !! test
19251 Special page transclusion twice (T7021)
19252 !! options
19253 !! wikitext
19254 {{Special:Prefixindex/Xyzzyx}}
19255 {{Special:Prefixindex/Xyzzyx}}
19256 !! html
19257 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19258 </ul>
19259 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
19260 </ul>
19261
19262 !! end
19263
19264 !! test
19265 Transclusion of default MediaWiki message
19266 !! wikitext
19267 {{MediaWiki:Mainpage}}
19268 !! html
19269 <p>Main Page
19270 </p>
19271 !! end
19272
19273 !! test
19274 Transclusion of nonexistent MediaWiki message
19275 !! wikitext
19276 {{MediaWiki:Mainpagexxx}}
19277 !! html
19278 <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>
19279 </p>
19280 !! end
19281
19282 !! test
19283 Transclusion of MediaWiki message with underscore
19284 !! wikitext
19285 {{MediaWiki:history_short}}
19286 !! html
19287 <p>History
19288 </p>
19289 !! end
19290
19291 !! test
19292 Transclusion of MediaWiki message with space
19293 !! wikitext
19294 {{MediaWiki:history short}}
19295 !! html
19296 <p>History
19297 </p>
19298 !! end
19299
19300 !! test
19301 Invalid header with following text
19302 !! wikitext
19303 = x = y
19304 !! html
19305 <p>= x = y
19306 </p>
19307 !! end
19308
19309
19310 !! test
19311 Section extraction test (section 0)
19312 !! options
19313 section=0
19314 !! wikitext
19315 start
19316 ==a==
19317 ===aa===
19318 ====aaa====
19319 ==b==
19320 ===ba===
19321 ===bb===
19322 ====bba====
19323 ===bc===
19324 ==c==
19325 ===ca===
19326 !! html/php
19327 start
19328 !! end
19329
19330 !! test
19331 Section extraction test (section 1)
19332 !! options
19333 section=1
19334 !! wikitext
19335 start
19336 ==a==
19337 ===aa===
19338 ====aaa====
19339 ==b==
19340 ===ba===
19341 ===bb===
19342 ====bba====
19343 ===bc===
19344 ==c==
19345 ===ca===
19346 !! html/php
19347 ==a==
19348 ===aa===
19349 ====aaa====
19350 !! end
19351
19352 !! test
19353 Section extraction test (section 2)
19354 !! options
19355 section=2
19356 !! wikitext
19357 start
19358 ==a==
19359 ===aa===
19360 ====aaa====
19361 ==b==
19362 ===ba===
19363 ===bb===
19364 ====bba====
19365 ===bc===
19366 ==c==
19367 ===ca===
19368 !! html/php
19369 ===aa===
19370 ====aaa====
19371 !! end
19372
19373 !! test
19374 Section extraction test (section 3)
19375 !! options
19376 section=3
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 ====aaa====
19391 !! end
19392
19393 !! test
19394 Section extraction test (section 4)
19395 !! options
19396 section=4
19397 !! wikitext
19398 start
19399 ==a==
19400 ===aa===
19401 ====aaa====
19402 ==b==
19403 ===ba===
19404 ===bb===
19405 ====bba====
19406 ===bc===
19407 ==c==
19408 ===ca===
19409 !! html/php
19410 ==b==
19411 ===ba===
19412 ===bb===
19413 ====bba====
19414 ===bc===
19415 !! end
19416
19417 !! test
19418 Section extraction test (section 5)
19419 !! options
19420 section=5
19421 !! wikitext
19422 start
19423 ==a==
19424 ===aa===
19425 ====aaa====
19426 ==b==
19427 ===ba===
19428 ===bb===
19429 ====bba====
19430 ===bc===
19431 ==c==
19432 ===ca===
19433 !! html/php
19434 ===ba===
19435 !! end
19436
19437 !! test
19438 Section extraction test (section 6)
19439 !! options
19440 section=6
19441 !! wikitext
19442 start
19443 ==a==
19444 ===aa===
19445 ====aaa====
19446 ==b==
19447 ===ba===
19448 ===bb===
19449 ====bba====
19450 ===bc===
19451 ==c==
19452 ===ca===
19453 !! html/php
19454 ===bb===
19455 ====bba====
19456 !! end
19457
19458 !! test
19459 Section extraction test (section 7)
19460 !! options
19461 section=7
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 ====bba====
19476 !! end
19477
19478 !! test
19479 Section extraction test (section 8)
19480 !! options
19481 section=8
19482 !! wikitext
19483 start
19484 ==a==
19485 ===aa===
19486 ====aaa====
19487 ==b==
19488 ===ba===
19489 ===bb===
19490 ====bba====
19491 ===bc===
19492 ==c==
19493 ===ca===
19494 !! html/php
19495 ===bc===
19496 !! end
19497
19498 !! test
19499 Section extraction test (section 9)
19500 !! options
19501 section=9
19502 !! wikitext
19503 start
19504 ==a==
19505 ===aa===
19506 ====aaa====
19507 ==b==
19508 ===ba===
19509 ===bb===
19510 ====bba====
19511 ===bc===
19512 ==c==
19513 ===ca===
19514 !! html/php
19515 ==c==
19516 ===ca===
19517 !! end
19518
19519 !! test
19520 Section extraction test (section 10)
19521 !! options
19522 section=10
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 ===ca===
19537 !! end
19538
19539 !! test
19540 Section extraction test (nonexistent section 11)
19541 !! options
19542 section=11
19543 !! wikitext
19544 start
19545 ==a==
19546 ===aa===
19547 ====aaa====
19548 ==b==
19549 ===ba===
19550 ===bb===
19551 ====bba====
19552 ===bc===
19553 ==c==
19554 ===ca===
19555 !! html/php
19556 !! end
19557
19558 !! test
19559 Section extraction test with bogus heading (section 1)
19560 !! options
19561 section=1
19562 !! wikitext
19563 ==a==
19564 ==bogus== not a legal section
19565 ==b==
19566 !! html/php
19567 ==a==
19568 ==bogus== not a legal section
19569 !! end
19570
19571 !! test
19572 Section extraction test with bogus heading (section 2)
19573 !! options
19574 section=2
19575 !! wikitext
19576 ==a==
19577 ==bogus== not a legal section
19578 ==b==
19579 !! html/php
19580 ==b==
19581 !! end
19582
19583 !! test
19584 Section extraction test with comment after heading (section 1)
19585 !! options
19586 section=1
19587 !! wikitext
19588 ==a==
19589 ==b== <!-- -->
19590 ==c==
19591 !! html/php
19592 ==a==
19593 !! end
19594
19595 !! test
19596 Section extraction test with comment after heading (section 2)
19597 !! options
19598 section=2
19599 !! wikitext
19600 ==a==
19601 ==b== <!-- -->
19602 ==c==
19603 !! html/php
19604 ==b== <!-- -->
19605 !! end
19606
19607 !! test
19608 Section extraction test with bogus <nowiki> heading (section 1)
19609 !! options
19610 section=1
19611 !! wikitext
19612 ==a==
19613 ==bogus== <nowiki>not a legal section</nowiki>
19614 ==b==
19615 !! html/php
19616 ==a==
19617 ==bogus== <nowiki>not a legal section</nowiki>
19618 !! end
19619
19620 !! test
19621 Section extraction test with bogus <nowiki> heading (section 2)
19622 !! options
19623 section=2
19624 !! wikitext
19625 ==a==
19626 ==bogus== <nowiki>not a legal section</nowiki>
19627 ==b==
19628 !! html/php
19629 ==b==
19630 !! end
19631
19632 # Formerly testing for T4587, now resolved by the use of unmarked sections
19633 # instead of respecting commented sections
19634 !! test
19635 Section extraction prefixed by comment (section 1)
19636 !! options
19637 section=1
19638 !! wikitext
19639 <!-- -->==sec1==
19640 ==sec2==
19641 !! html/php
19642 ==sec2==
19643 !!end
19644
19645 !! test
19646 Section extraction prefixed by comment (section 2)
19647 !! options
19648 section=2
19649 !! wikitext
19650 <!-- -->==sec1==
19651 ==sec2==
19652 !! html/php
19653
19654 !!end
19655
19656 # Formerly testing for T4607, now resolved by the use of unmarked sections
19657 # instead of respecting HTML-style headings
19658 !! test
19659 Section extraction, mixed wiki and html (section 1)
19660 !! options
19661 section=1
19662 !! wikitext
19663 <h2>unmarked</h2>
19664 unmarked
19665 ==1==
19666 one
19667 ==2==
19668 two
19669 !! html/php
19670 ==1==
19671 one
19672 !! end
19673
19674 !! test
19675 Section extraction, mixed wiki and html (section 2)
19676 !! options
19677 section=2
19678 !! wikitext
19679 <h2>unmarked</h2>
19680 unmarked
19681 ==1==
19682 one
19683 ==2==
19684 two
19685 !! html/php
19686 ==2==
19687 two
19688 !! end
19689
19690
19691 # Formerly testing for T5342
19692 !! test
19693 Section extraction, heading surrounded by <noinclude>
19694 !! options
19695 section=1
19696 !! wikitext
19697 <noinclude>==unmarked==</noinclude>
19698 ==marked==
19699 !! html/php
19700 ==marked==
19701 !!end
19702
19703 # Test behavior of T21910
19704 !! test
19705 Sectiion with all-equals
19706 !! options
19707 section=2
19708 !! wikitext
19709 ===
19710 The line above must have a trailing space
19711 === <!--
19712 --> <!-- -->
19713 But just in case it doesn't...
19714 !! html/php
19715 === <!--
19716 --> <!-- -->
19717 But just in case it doesn't...
19718 !! end
19719
19720 !! test
19721 Section replacement test (section 0)
19722 !! options
19723 replace=0,"xxx"
19724 !! wikitext
19725 start
19726 ==a==
19727 ===aa===
19728 ====aaa====
19729 ==b==
19730 ===ba===
19731 ===bb===
19732 ====bba====
19733 ===bc===
19734 ==c==
19735 ===ca===
19736 !! html/php
19737 xxx
19738
19739 ==a==
19740 ===aa===
19741 ====aaa====
19742 ==b==
19743 ===ba===
19744 ===bb===
19745 ====bba====
19746 ===bc===
19747 ==c==
19748 ===ca===
19749 !! end
19750
19751 !! test
19752 Section replacement test (section 1)
19753 !! options
19754 replace=1,"xxx"
19755 !! wikitext
19756 start
19757 ==a==
19758 ===aa===
19759 ====aaa====
19760 ==b==
19761 ===ba===
19762 ===bb===
19763 ====bba====
19764 ===bc===
19765 ==c==
19766 ===ca===
19767 !! html/php
19768 start
19769 xxx
19770
19771 ==b==
19772 ===ba===
19773 ===bb===
19774 ====bba====
19775 ===bc===
19776 ==c==
19777 ===ca===
19778 !! end
19779
19780 !! test
19781 Section replacement test (section 2)
19782 !! options
19783 replace=2,"xxx"
19784 !! wikitext
19785 start
19786 ==a==
19787 ===aa===
19788 ====aaa====
19789 ==b==
19790 ===ba===
19791 ===bb===
19792 ====bba====
19793 ===bc===
19794 ==c==
19795 ===ca===
19796 !! html/php
19797 start
19798 ==a==
19799 xxx
19800
19801 ==b==
19802 ===ba===
19803 ===bb===
19804 ====bba====
19805 ===bc===
19806 ==c==
19807 ===ca===
19808 !! end
19809
19810 !! test
19811 Section replacement test (section 3)
19812 !! options
19813 replace=3,"xxx"
19814 !! wikitext
19815 start
19816 ==a==
19817 ===aa===
19818 ====aaa====
19819 ==b==
19820 ===ba===
19821 ===bb===
19822 ====bba====
19823 ===bc===
19824 ==c==
19825 ===ca===
19826 !! html/php
19827 start
19828 ==a==
19829 ===aa===
19830 xxx
19831
19832 ==b==
19833 ===ba===
19834 ===bb===
19835 ====bba====
19836 ===bc===
19837 ==c==
19838 ===ca===
19839 !! end
19840
19841 !! test
19842 Section replacement test (section 4)
19843 !! options
19844 replace=4,"xxx"
19845 !! wikitext
19846 start
19847 ==a==
19848 ===aa===
19849 ====aaa====
19850 ==b==
19851 ===ba===
19852 ===bb===
19853 ====bba====
19854 ===bc===
19855 ==c==
19856 ===ca===
19857 !! html/php
19858 start
19859 ==a==
19860 ===aa===
19861 ====aaa====
19862 xxx
19863
19864 ==c==
19865 ===ca===
19866 !! end
19867
19868 !! test
19869 Section replacement test (section 5)
19870 !! options
19871 replace=5,"xxx"
19872 !! wikitext
19873 start
19874 ==a==
19875 ===aa===
19876 ====aaa====
19877 ==b==
19878 ===ba===
19879 ===bb===
19880 ====bba====
19881 ===bc===
19882 ==c==
19883 ===ca===
19884 !! html/php
19885 start
19886 ==a==
19887 ===aa===
19888 ====aaa====
19889 ==b==
19890 xxx
19891
19892 ===bb===
19893 ====bba====
19894 ===bc===
19895 ==c==
19896 ===ca===
19897 !! end
19898
19899 !! test
19900 Section replacement test (section 6)
19901 !! options
19902 replace=6,"xxx"
19903 !! wikitext
19904 start
19905 ==a==
19906 ===aa===
19907 ====aaa====
19908 ==b==
19909 ===ba===
19910 ===bb===
19911 ====bba====
19912 ===bc===
19913 ==c==
19914 ===ca===
19915 !! html/php
19916 start
19917 ==a==
19918 ===aa===
19919 ====aaa====
19920 ==b==
19921 ===ba===
19922 xxx
19923
19924 ===bc===
19925 ==c==
19926 ===ca===
19927 !! end
19928
19929 !! test
19930 Section replacement test (section 7)
19931 !! options
19932 replace=7,"xxx"
19933 !! wikitext
19934 start
19935 ==a==
19936 ===aa===
19937 ====aaa====
19938 ==b==
19939 ===ba===
19940 ===bb===
19941 ====bba====
19942 ===bc===
19943 ==c==
19944 ===ca===
19945 !! html/php
19946 start
19947 ==a==
19948 ===aa===
19949 ====aaa====
19950 ==b==
19951 ===ba===
19952 ===bb===
19953 xxx
19954
19955 ===bc===
19956 ==c==
19957 ===ca===
19958 !! end
19959
19960 !! test
19961 Section replacement test (section 8)
19962 !! options
19963 replace=8,"xxx"
19964 !! wikitext
19965 start
19966 ==a==
19967 ===aa===
19968 ====aaa====
19969 ==b==
19970 ===ba===
19971 ===bb===
19972 ====bba====
19973 ===bc===
19974 ==c==
19975 ===ca===
19976 !! html/php
19977 start
19978 ==a==
19979 ===aa===
19980 ====aaa====
19981 ==b==
19982 ===ba===
19983 ===bb===
19984 ====bba====
19985 xxx
19986
19987 ==c==
19988 ===ca===
19989 !!end
19990
19991 !! test
19992 Section replacement test (section 9)
19993 !! options
19994 replace=9,"xxx"
19995 !! wikitext
19996 start
19997 ==a==
19998 ===aa===
19999 ====aaa====
20000 ==b==
20001 ===ba===
20002 ===bb===
20003 ====bba====
20004 ===bc===
20005 ==c==
20006 ===ca===
20007 !! html/php
20008 start
20009 ==a==
20010 ===aa===
20011 ====aaa====
20012 ==b==
20013 ===ba===
20014 ===bb===
20015 ====bba====
20016 ===bc===
20017 xxx
20018 !! end
20019
20020 !! test
20021 Section replacement test (section 10)
20022 !! options
20023 replace=10,"xxx"
20024 !! wikitext
20025 start
20026 ==a==
20027 ===aa===
20028 ====aaa====
20029 ==b==
20030 ===ba===
20031 ===bb===
20032 ====bba====
20033 ===bc===
20034 ==c==
20035 ===ca===
20036 !! html/php
20037 start
20038 ==a==
20039 ===aa===
20040 ====aaa====
20041 ==b==
20042 ===ba===
20043 ===bb===
20044 ====bba====
20045 ===bc===
20046 ==c==
20047 xxx
20048 !! end
20049
20050 !! test
20051 Section replacement test with initial whitespace (T15728)
20052 !! options
20053 replace=2,"xxx"
20054 !! wikitext
20055 Preformatted initial line
20056 ==a==
20057 ===a===
20058 !! html/php
20059 Preformatted initial line
20060 ==a==
20061 xxx
20062 !! end
20063
20064
20065 !! test
20066 Section extraction, heading followed by pre with 20 spaces (T8398)
20067 !! options
20068 section=1
20069 !! wikitext
20070 ==a==
20071 a
20072 !! html/php
20073 ==a==
20074 a
20075 !! end
20076
20077 !! test
20078 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20079 !! options
20080 section=1
20081 !! wikitext
20082 ==a==
20083 a
20084 !! html/php
20085 ==a==
20086 a
20087 !! end
20088
20089
20090 !! test
20091 Section extraction, <pre> around bogus header (T12309)
20092 !! options
20093 section=2
20094 !! wikitext
20095 == Section One ==
20096 <pre>
20097 =======
20098 </pre>
20099
20100 == Section Two ==
20101 stuff
20102 !! html/php
20103 == Section Two ==
20104 stuff
20105 !! end
20106
20107 !! test
20108 Section replacement, <pre> around bogus header (T12309)
20109 !! options
20110 replace=2,"xxx"
20111 !! wikitext
20112 == Section One ==
20113 <pre>
20114 =======
20115 </pre>
20116
20117 == Section Two ==
20118 stuff
20119 !! html/php
20120 == Section One ==
20121 <pre>
20122 =======
20123 </pre>
20124
20125 xxx
20126 !! end
20127
20128 !! test
20129 Handling of &#x0A; in URLs
20130 !! wikitext
20131 *irc://&#x0A;a
20132 !! html/php
20133 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20134
20135 !! html/parsoid
20136 <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>
20137 !! end
20138
20139 !! test
20140 Handling of %0A in URLs
20141 !! wikitext
20142 *irc://%0Aa
20143 !! html/php
20144 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20145
20146 !! html/parsoid
20147 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
20148 !! end
20149
20150 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
20151 !! test
20152 5 quotes, code coverage +1 line
20153 !! options
20154 parsoid=wt2html
20155 !! wikitext
20156 '''''
20157 !! html/php
20158 !! html/parsoid
20159 <b><i></i></b>
20160 !! end
20161
20162 # same html as previous, but wikitext adjusted to match parsoid html2wt
20163 # note that wt2html and html2html will put the <i> before the <b>
20164 !! test
20165 5 quotes, code coverage +1 line w/ nowiki (1)
20166 !! options
20167 parsoid=wt2wt,html2wt
20168 !! wikitext
20169 '''''<nowiki/>'''''
20170 !! html/php
20171 <p><i></i>
20172 </p>
20173 !! html/parsoid
20174 <p><b><i></i></b></p>
20175 !! end
20176
20177 # same as previous, just swapping the <i> and <b>
20178 !! test
20179 5 quotes, code coverage +1 line w/ nowiki (2)
20180 !! wikitext
20181 '''''<nowiki/>'''''
20182 !! html/php
20183 <p><i></i>
20184 </p>
20185 !! html/parsoid
20186 <p><i><b></b></i></p>
20187 !! end
20188
20189 !! test
20190 Special:Search page linking.
20191 !! wikitext
20192 {{Special:search}}
20193 !! html
20194 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
20195 </p>
20196 !! end
20197
20198 !! test
20199 {{!}} is a magic word
20200 !! wikitext
20201 {{!}} is a magic word there and {{!}} is still a magic word here
20202 | is not a magic word here but {{!}} is still a magic word here
20203 !! html/php
20204 <p>| is a magic word there and | is still a magic word here
20205 | is not a magic word here but | is still a magic word here
20206 </p>
20207 !! html/parsoid
20208 <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
20209 | 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>
20210 !! end
20211
20212 !! test
20213 Say the magic word
20214 !! options
20215 title=[[Parser test]]
20216 !! wikitext
20217 *{{PAGENAME}}
20218 *{{PAGENAMEE}}
20219 *{{FULLPAGENAME}}
20220 *{{FULLPAGENAMEE}}
20221 *{{BASEPAGENAME}}
20222 *{{BASEPAGENAMEE}}
20223 *{{SUBPAGENAME}}
20224 *{{SUBPAGENAMEE}}
20225 *{{ROOTPAGENAME}}
20226 *{{ROOTPAGENAMEE}}
20227 *{{TALKPAGENAME}}
20228 *{{TALKPAGENAMEE}}
20229 *{{SUBJECTPAGENAME}}
20230 *{{SUBJECTPAGENAMEE}}
20231 *{{NAMESPACEE}}
20232 *{{NAMESPACE}}
20233 *{{NAMESPACENUMBER}}
20234 *{{TALKSPACE}}
20235 *{{TALKSPACEE}}
20236 *{{SUBJECTSPACE}}
20237 *{{SUBJECTSPACEE}}
20238 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
20239 !! html
20240 <ul><li>Parser test</li>
20241 <li>Parser_test</li>
20242 <li>Parser test</li>
20243 <li>Parser_test</li>
20244 <li>Parser test</li>
20245 <li>Parser_test</li>
20246 <li>Parser test</li>
20247 <li>Parser_test</li>
20248 <li>Parser test</li>
20249 <li>Parser_test</li>
20250 <li>Talk:Parser test</li>
20251 <li>Talk:Parser_test</li>
20252 <li>Parser test</li>
20253 <li>Parser_test</li>
20254 <li></li>
20255 <li></li>
20256 <li>0</li>
20257 <li>Talk</li>
20258 <li>Talk</li>
20259 <li></li>
20260 <li></li>
20261 <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>
20262
20263 !! end
20264 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
20265
20266 !! test
20267 Gallery with valid attributes
20268 !! wikitext
20269 <gallery type="123" summary="345">
20270 File:File:Foobar.jpg
20271 </gallery>
20272 !! html/php
20273 <ul class="gallery mw-gallery-traditional" type="123">
20274 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20275 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
20276 <div class="gallerytext">
20277 </div>
20278 </div></li>
20279 </ul>
20280
20281 !! html/parsoid
20282 <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"}}'>
20283 <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>
20284 </ul>
20285 !! end
20286
20287 ## Parsoid thinks the "centre" here is a property, not a caption.
20288 !! test
20289 Gallery
20290 !! options
20291 parsoid={
20292 "modes": ["wt2html"],
20293 "nativeGallery": true
20294 }
20295 !! wikitext
20296 <gallery>
20297 image1.png |
20298 image2.gif|||||
20299
20300 image3|
20301 image4 |300px| centre
20302 image5.svg| http://///////
20303 [[x|xx]]]]
20304 * image6
20305 </gallery>
20306 !! html/php
20307 <ul class="gallery mw-gallery-traditional">
20308 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20309 <div class="thumb" style="height: 150px;">Image1.png</div>
20310 <div class="gallerytext">
20311 </div>
20312 </div></li>
20313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20314 <div class="thumb" style="height: 150px;">Image2.gif</div>
20315 <div class="gallerytext">
20316 </div>
20317 </div></li>
20318 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20319 <div class="thumb" style="height: 150px;">Image3</div>
20320 <div class="gallerytext">
20321 </div>
20322 </div></li>
20323 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20324 <div class="thumb" style="height: 150px;">Image4</div>
20325 <div class="gallerytext">
20326 <pre>centre
20327 </pre>
20328 </div>
20329 </div></li>
20330 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20331 <div class="thumb" style="height: 150px;">Image5.svg</div>
20332 <div class="gallerytext">
20333 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
20334 </p>
20335 </div>
20336 </div></li>
20337 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20338 <div class="thumb" style="height: 150px;">* image6</div>
20339 <div class="gallerytext">
20340 </div>
20341 </div></li>
20342 </ul>
20343
20344 !! html/parsoid
20345 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20346 <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>
20347 <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>
20348 <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>
20349 <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>
20350 <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>
20351 <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>
20352 </ul>
20353 !! end
20354
20355 !! test
20356 Gallery (with options, html)
20357 !! options
20358 parsoid={
20359 "modes": ["wt2html", "html2html"],
20360 "nativeGallery": true
20361 }
20362 !! wikitext
20363 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20364 File:Nonexistent.jpg|caption
20365 File:Nonexistent.jpg
20366 image:foobar.jpg|some '''caption''' [[Main Page]]
20367 image:foobar.jpg
20368 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20369 </gallery>
20370 !! html/php
20371 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20372 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20373 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20374 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20375 <div class="gallerytext">
20376 <p>caption
20377 </p>
20378 </div>
20379 </div></li>
20380 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20381 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20382 <div class="gallerytext">
20383 </div>
20384 </div></li>
20385 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20386 <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>
20387 <div class="gallerytext">
20388 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20389 </p>
20390 </div>
20391 </div></li>
20392 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20393 <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>
20394 <div class="gallerytext">
20395 </div>
20396 </div></li>
20397 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20398 <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>
20399 <div class="gallerytext">
20400 <p>blabla.
20401 </p>
20402 </div>
20403 </div></li>
20404 </ul>
20405
20406 !! html/parsoid
20407 <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":{}}'>
20408 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20409 <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>
20410 <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>
20411 <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>
20412 <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>
20413 <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>
20414 </ul>
20415 !! end
20416
20417 !! test
20418 Gallery (with options, extsrc)
20419 !! options
20420 parsoid={
20421 "nativeGallery": false
20422 }
20423 !! wikitext
20424 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
20425 File:Nonexistent.jpg|caption
20426 File:Nonexistent.jpg
20427 image:foobar.jpg|some '''caption''' [[Main Page]]
20428 image:foobar.jpg
20429 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
20430 </gallery>
20431 !! html/php
20432 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
20433 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
20434 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20435 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20436 <div class="gallerytext">
20437 <p>caption
20438 </p>
20439 </div>
20440 </div></li>
20441 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20442 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
20443 <div class="gallerytext">
20444 </div>
20445 </div></li>
20446 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20447 <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>
20448 <div class="gallerytext">
20449 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20450 </p>
20451 </div>
20452 </div></li>
20453 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20454 <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>
20455 <div class="gallerytext">
20456 </div>
20457 </div></li>
20458 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20459 <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>
20460 <div class="gallerytext">
20461 <p>blabla.
20462 </p>
20463 </div>
20464 </div></li>
20465 </ul>
20466
20467 !! html/parsoid
20468 <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"}}'>
20469 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
20470 <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>
20471 <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>
20472 <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>
20473 <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>
20474 <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>
20475 </ul>
20476 !! end
20477
20478 !! test
20479 Gallery (without px units)
20480 !! wikitext
20481 <gallery widths="70" heights="40">
20482 File:Foobar.jpg
20483 </gallery>
20484 !! html/php
20485 <ul class="gallery mw-gallery-traditional">
20486 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
20487 <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>
20488 <div class="gallerytext">
20489 </div>
20490 </div></li>
20491 </ul>
20492
20493 !! html/parsoid
20494 <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"}}'>
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 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>
20496 </ul>
20497 !! end
20498
20499 !! test
20500 Gallery (with invalid units)
20501 !! wikitext
20502 <gallery widths="70em" heights="40em">
20503 File:Foobar.jpg
20504 </gallery>
20505 !! html/php
20506 <ul class="gallery mw-gallery-traditional">
20507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20508 <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>
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":"70em","heights":"40em"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
20516 <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>
20517 </ul>
20518 !! end
20519
20520 !! test
20521 Gallery with link that has fragment
20522 !! options
20523 parsoid={
20524 "modes": ["wt2html", "html2html"],
20525 "nativeGallery": true
20526 }
20527 !! wikitext
20528 <gallery>
20529 image:foobar.jpg|link=Main_Page
20530 image:foobar.jpg|link=Main_Page#section
20531 image:foobar.jpg|link=Main Page#section|caption
20532 </gallery>
20533 !! html/php
20534 <ul class="gallery mw-gallery-traditional">
20535 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20536 <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>
20537 <div class="gallerytext">
20538 </div>
20539 </div></li>
20540 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20541 <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>
20542 <div class="gallerytext">
20543 </div>
20544 </div></li>
20545 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20546 <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>
20547 <div class="gallerytext">
20548 <p>caption
20549 </p>
20550 </div>
20551 </div></li>
20552 </ul>
20553
20554 !! html/parsoid
20555 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20556 <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>
20557 <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>
20558 <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>
20559 </ul>
20560 !! end
20561
20562 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
20563 !! test
20564 Gallery with template inside caption
20565 !! options
20566 parsoid={
20567 "nativeGallery": true
20568 }
20569 !! wikitext
20570 <gallery caption="{{echo|hi}}">
20571 File:Foobar.jpg|{{echo|ho}}
20572 </gallery>
20573 !! html/php
20574 <ul class="gallery mw-gallery-traditional">
20575 <li class='gallerycaption'>{{echo|hi}}</li>
20576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20577 <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>
20578 <div class="gallerytext">
20579 <p>ho
20580 </p>
20581 </div>
20582 </div></li>
20583 </ul>
20584
20585 !! html/parsoid
20586 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20587 <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>
20588 <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>
20589 </ul>
20590 !! end
20591
20592 !! test
20593 Gallery with wikitext inside caption
20594 !! options
20595 parsoid={
20596 "nativeGallery": true
20597 }
20598 !! wikitext
20599 <gallery>
20600 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
20601 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
20602 </gallery>
20603 !! html/php
20604 <ul class="gallery mw-gallery-traditional">
20605 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20606 <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>
20607 <div class="gallerytext">
20608 <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>
20609 </p>
20610 </div>
20611 </div></li>
20612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20613 <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>
20614 <div class="gallerytext">
20615 <p>This is a test template
20616 </p>
20617 </div>
20618 </div></li>
20619 </ul>
20620
20621 !! html/parsoid
20622 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20623 <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>
20624 <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>
20625 </ul>
20626 !! end
20627
20628 !! test
20629 Gallery (with showfilename option)
20630 !! options
20631 parsoid={
20632 "nativeGallery": true
20633 }
20634 !! wikitext
20635 <gallery showfilename="">
20636 File:Nonexistent.jpg|caption
20637 File:Nonexistent.jpg
20638 File:Foobar.jpg|some '''caption''' [[Main Page]]
20639 File:Foobar.jpg
20640 </gallery>
20641 !! html/php
20642 <ul class="gallery mw-gallery-traditional">
20643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20644 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20645 <div class="gallerytext">
20646 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20647 caption
20648 </p>
20649 </div>
20650 </div></li>
20651 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20652 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20653 <div class="gallerytext">
20654 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
20655 </p>
20656 </div>
20657 </div></li>
20658 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20659 <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>
20660 <div class="gallerytext">
20661 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20662 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20663 </p>
20664 </div>
20665 </div></li>
20666 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20667 <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>
20668 <div class="gallerytext">
20669 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
20670 </p>
20671 </div>
20672 </div></li>
20673 </ul>
20674
20675 !! html/parsoid
20676 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
20677 <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>
20678 <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>
20679 <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>
20680 <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>
20681 </ul>
20682 !! end
20683
20684 ## Should Parsoid be preserving these variations? See T151367
20685 !! test
20686 Gallery (with namespace-less filenames)
20687 !! options
20688 parsoid={
20689 "modes": ["wt2html", "html2html"],
20690 "nativeGallery": true
20691 }
20692 !! wikitext
20693 <gallery>
20694 File:Nonexistent.jpg
20695 Nonexistent.jpg
20696 image:foobar.jpg
20697 foobar.jpg
20698 </gallery>
20699 !! html/php
20700 <ul class="gallery mw-gallery-traditional">
20701 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20702 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20703 <div class="gallerytext">
20704 </div>
20705 </div></li>
20706 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20707 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
20708 <div class="gallerytext">
20709 </div>
20710 </div></li>
20711 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20712 <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>
20713 <div class="gallerytext">
20714 </div>
20715 </div></li>
20716 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20717 <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>
20718 <div class="gallerytext">
20719 </div>
20720 </div></li>
20721 </ul>
20722
20723 !! html/parsoid
20724 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20725 <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>
20726 <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>
20727 <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>
20728 <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>
20729 </ul>
20730 !! end
20731
20732 !! test
20733 Gallery override link with wikilink (T36852)
20734 !! options
20735 parsoid={
20736 "nativeGallery": true
20737 }
20738 !! wikitext
20739 <gallery>
20740 File:Foobar.jpg|alt=galleryalt|link=Wikilink
20741 </gallery>
20742 !! html/php
20743 <ul class="gallery mw-gallery-traditional">
20744 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20745 <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>
20746 <div class="gallerytext">
20747 </div>
20748 </div></li>
20749 </ul>
20750
20751 !! html/parsoid
20752 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20753 <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>
20754 </ul>
20755 !! end
20756
20757 !! test
20758 Gallery override link with absolute external link (T36852)
20759 !! options
20760 parsoid={
20761 "nativeGallery": true
20762 }
20763 !! wikitext
20764 <gallery>
20765 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
20766 </gallery>
20767 !! html/php
20768 <ul class="gallery mw-gallery-traditional">
20769 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20770 <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>
20771 <div class="gallerytext">
20772 </div>
20773 </div></li>
20774 </ul>
20775
20776 !! html/parsoid
20777 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20778 <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>
20779 </ul>
20780 !! end
20781
20782 !! test
20783 Gallery override link with absolute external link with LanguageConverter
20784 !! options
20785 language=zh
20786 !! wikitext
20787 <gallery>
20788 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20789 </gallery>
20790 !! html/php
20791 <ul class="gallery mw-gallery-traditional">
20792 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20793 <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>
20794 <div class="gallerytext">
20795 <p>caption
20796 </p>
20797 </div>
20798 </div></li>
20799 </ul>
20800
20801 !! html/parsoid
20802 <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"}}'>
20803 <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>
20804 </ul>
20805 !! end
20806
20807 !! test
20808 Gallery override link with malicious javascript (T36852)
20809 !! options
20810 parsoid={
20811 "modes": ["wt2html", "html2html"],
20812 "nativeGallery": true
20813 }
20814 !! wikitext
20815 <gallery>
20816 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20817 </gallery>
20818 !! html/php
20819 <ul class="gallery mw-gallery-traditional">
20820 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20821 <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>
20822 <div class="gallerytext">
20823 </div>
20824 </div></li>
20825 </ul>
20826
20827 !! html/parsoid
20828 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20829 <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>
20830 </ul>
20831 !! end
20832
20833 # Note that parsoid uses the invalid link as a caption, PHP does not.
20834 !! test
20835 Gallery with invalid title as link (T45964)
20836 !! options
20837 parsoid={
20838 "modes": ["wt2html", "html2html"],
20839 "nativeGallery": true
20840 }
20841 !! wikitext
20842 <gallery>
20843 File:Foobar.jpg|link=<
20844 </gallery>
20845 !! html/php
20846 <ul class="gallery mw-gallery-traditional">
20847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20848 <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>
20849 <div class="gallerytext">
20850 </div>
20851 </div></li>
20852 </ul>
20853
20854 !! html/parsoid
20855 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
20856 <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>
20857 </ul>
20858 !! end
20859
20860 !! test
20861 Serialize gallery without attrs in data-mw
20862 !! options
20863 parsoid={
20864 "modes": ["html2wt"],
20865 "nativeGallery": true
20866 }
20867 !! html/parsoid
20868 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
20869 <li class="gallerycaption">123</li>
20870 <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>
20871 </ul>
20872 !! wikitext
20873 <gallery caption="123">
20874 File:Test.png
20875 </gallery>
20876 !! end
20877
20878 !! test
20879 Gallery with class and style attributes
20880 !! options
20881 parsoid={
20882 "nativeGallery": true
20883 }
20884 !! wikitext
20885 <gallery class="center" style="text-align: center;">
20886 File:Foobar.jpg
20887 </gallery>
20888 !! html/php
20889 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
20890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20891 <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>
20892 <div class="gallerytext">
20893 </div>
20894 </div></li>
20895 </ul>
20896
20897 !! html/parsoid
20898 <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":{}}'>
20899 <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>
20900 </ul>
20901 !! end
20902
20903 !! test
20904 Gallery in slideshow mode
20905 !! options
20906 parsoid={
20907 "nativeGallery": true
20908 }
20909 !! wikitext
20910 <gallery mode="slideshow" showthumbnails="">
20911 File:Foobar.jpg
20912 </gallery>
20913 !! html/php
20914 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
20915 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20916 <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>
20917 <div class="gallerytext">
20918 </div>
20919 </div></li>
20920 </ul>
20921
20922 !! html/parsoid
20923 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
20924 <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>
20925 </ul>
20926 !! end
20927
20928 !! test
20929 HTML Hex character encoding (spells the word "JavaScript")
20930 !! options
20931 parsoid=wt2html,wt2wt,html2html
20932 !! wikitext
20933 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
20934 !! html/php
20935 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
20936 </p>
20937 !! html/parsoid
20938 <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>
20939 !! end
20940
20941 !! test
20942 HTML Hex character encoding bogus encoding (T28437 regression check)
20943 !! wikitext
20944 &#xsee;&#XSEE;
20945 !! html
20946 <p>&amp;#xsee;&amp;#XSEE;
20947 </p>
20948 !! end
20949
20950 !! test
20951 HTML Hex character encoding mixed case
20952 !! options
20953 parsoid=wt2html,wt2wt,html2html
20954 !! wikitext
20955 &#xEE;&#Xee;
20956 !! html/php
20957 <p>&#xee;&#xee;
20958 </p>
20959 !! html/parsoid
20960 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
20961 !! end
20962
20963 # See: https://www.w3.org/TR/html5/syntax.html#character-references
20964 # Note that U+000C (form feed) is not a valid XML character, so
20965 # it is banned even though allowed in HTML5.
20966 !! test
20967 Illegal character references (T106578)
20968 !! wikitext
20969 ; Null: &#00;
20970 ; FF: &#xC;
20971 ; CR: &#xD;
20972 ; Control (low): &#8;
20973 ; Control (high): &#x7F; &#x9F;
20974 ; Surrogate: &#xD83D;&#xDCA9;
20975 ; This is an okay astral character: &#x1F4A9;
20976 !! html+tidy
20977 <dl><dt>Null</dt>
20978 <dd>&amp;#00;</dd>
20979 <dt>FF</dt>
20980 <dd>&amp;#xC;</dd>
20981 <dt>CR</dt>
20982 <dd>&amp;#xD;</dd>
20983 <dt>Control (low)</dt>
20984 <dd>&amp;#8;</dd>
20985 <dt>Control (high)</dt>
20986 <dd>&amp;#x7F; &amp;#x9F;</dd>
20987 <dt>Surrogate</dt>
20988 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
20989 <dt>This is an okay astral character</dt>
20990 <dd>&#x1f4a9;</dd></dl>
20991 !! end
20992
20993 !! test
20994 __FORCETOC__ override
20995 !! wikitext
20996 __NEWSECTIONLINK__
20997 __FORCETOC__
20998 !! html/php
20999 <p><br />
21000 </p>
21001 !! end
21002
21003 !! test
21004 ISBN code coverage
21005 !! wikitext
21006 ISBN 978-0-1234-56&#x20;789
21007 !! html/php
21008 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21009 </p>
21010 !! html/parsoid
21011 <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>
21012 !! end
21013
21014 !! test
21015 ISBN followed by 5 spaces
21016 !! wikitext
21017 ISBN
21018 !! html
21019 <p>ISBN
21020 </p>
21021 !! end
21022
21023 !! test
21024 Double ISBN
21025 !! wikitext
21026 ISBN ISBN 1234567890
21027 !! html/php
21028 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21029 </p>
21030 !! html/parsoid
21031 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21032 !! end
21033
21034 # Uppercase X and lowercase x as well
21035 !! test
21036 ISBN with an X
21037 !! wikitext
21038 ISBN 3-462-04561-X
21039 ISBN 3-462-04561-x
21040 ISBN 080442957X
21041 ISBN 080442957x
21042 ISBN 978080442957X
21043 ISBN 978080442957x
21044 !! html/php
21045 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21046 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21047 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21048 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21049 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21050 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21051 </p>
21052 !! html/parsoid
21053 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21054 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21055 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21056 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21057 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21058 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21059 !! end
21060
21061 !! test
21062 ISBN with empty prefix (parsoid test)
21063 !! wikitext
21064 ISBN 1234567890
21065 !! html/php
21066 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21067 </p>
21068 !! html/parsoid
21069 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21070 !! end
21071
21072 !! test
21073 T24905: <abbr> followed by ISBN followed by </a>
21074 !! wikitext
21075 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21076 !! html/php
21077 <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>
21078 </p>
21079 !! html/parsoid
21080 <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>
21081 !! end
21082
21083 !! test
21084 Double RFC
21085 !! wikitext
21086 RFC RFC 1234
21087 !! html
21088 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
21089 </p>
21090 !! end
21091
21092 !! test
21093 Double RFC with a wiki link
21094 !! wikitext
21095 RFC [[RFC 1234]]
21096 !! html
21097 <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>
21098 </p>
21099 !! end
21100
21101 !! test
21102 RFC code coverage
21103 !! wikitext
21104 RFC 983&#x20;987
21105 !! html/php
21106 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
21107 </p>
21108 !! html/parsoid
21109 <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>
21110 !! end
21111
21112 !! test
21113 Centre-aligned image
21114 !! wikitext
21115 [[Image:foobar.jpg|centre]]
21116 !! html/php
21117 <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>
21118
21119 !! html/parsoid
21120 <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>
21121 !! end
21122
21123 !! test
21124 None-aligned image
21125 !! wikitext
21126 [[Image:foobar.jpg|none]]
21127 !! html/php
21128 <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>
21129
21130 !! html/parsoid
21131 <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>
21132 !! end
21133
21134 !! test
21135 Width + Height sized image (using px) (height is ignored)
21136 !! wikitext
21137 [[Image:foobar.jpg|640x480px]]
21138 !! html/php
21139 <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>
21140 </p>
21141 !! html/parsoid
21142 <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>
21143 !! end
21144
21145 !! test
21146 Width-sized image (using px, no following whitespace)
21147 !! wikitext
21148 [[Image:foobar.jpg|640px]]
21149 !! html/php
21150 <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>
21151 </p>
21152 !! html/parsoid
21153 <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>
21154 !! end
21155
21156 !! test
21157 Width-sized image (using px, with following whitespace - test regression from r39467)
21158 !! wikitext
21159 [[Image:foobar.jpg|640px ]]
21160 !! html/php
21161 <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>
21162 </p>
21163 !! html/parsoid
21164 <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>
21165 !!end
21166
21167 !! test
21168 Width-sized image (using px, with preceding whitespace - test regression from r39467)
21169 !! wikitext
21170 [[Image:foobar.jpg| 640px]]
21171 !! html/php
21172 <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>
21173 </p>
21174 !! html/parsoid
21175 <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>
21176 !! end
21177
21178 !! test
21179 Image with page parameter
21180 !! options
21181 djvu
21182 !! wikitext
21183 [[File:LoremIpsum.djvu|page=2]]
21184 !! html/php
21185 <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>
21186 </p>
21187 !! html/parsoid
21188 <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>
21189 !! end
21190
21191 !! test
21192 Another italics / bold test
21193 !! wikitext
21194 ''' ''x'
21195 !! html
21196 <pre>'<i> </i>x'
21197 </pre>
21198 !!end
21199
21200 # FIXME: The php output seems broken. It's interleaving some open/close tags.
21201 !! test
21202 dt/dd/dl test
21203 !! wikitext
21204 :;;;::
21205 !! html/php
21206 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
21207
21208 !! html/parsoid
21209 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
21210
21211 !!end
21212
21213 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
21214 !! test
21215 Images with the "|" character in the comment
21216 !! wikitext
21217 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
21218 !! html/php
21219 <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>
21220
21221 !! html/parsoid
21222 <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>
21223 !! end
21224
21225 !! test
21226 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
21227 !! wikitext
21228 <html><script>alert(1);</script></html>
21229 !! html
21230 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
21231 </p>
21232 !! end
21233
21234 !! test
21235 HTML with raw HTML ($wgRawHtml==true)
21236 !! options
21237 wgRawHtml=1
21238 !! wikitext
21239 <html><script>alert(1);</script></html>
21240 !! html/php
21241 <p><script>alert(1);</script>
21242 </p>
21243 !! end
21244
21245 !! test
21246 Parents of subpages, one level up
21247 !! options
21248 subpage title=[[Subpage test/L1/L2/L3]]
21249 !! wikitext
21250 [[../|L2]]
21251 !! html
21252 <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>
21253 </p>
21254 !! end
21255
21256
21257 !! test
21258 Parents of subpages, one level up, not named
21259 !! options
21260 subpage title=[[Subpage test/L1/L2/L3]]
21261 !! wikitext
21262 [[../]]
21263 !! html
21264 <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>
21265 </p>
21266 !! end
21267
21268
21269
21270 !! test
21271 Parents of subpages, two levels up
21272 !! options
21273 subpage title=[[Subpage test/L1/L2/L3]]
21274 !! wikitext
21275 [[../../|L1]]2
21276
21277 [[../../|L1]]l
21278 !! html
21279 <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
21280 </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>
21281 </p>
21282 !! end
21283
21284 !! test
21285 Parents of subpages, two levels up, without trailing slash or name.
21286 !! options
21287 subpage title=[[Subpage test/L1/L2/L3]]
21288 !! wikitext
21289 [[../..]]
21290 !! html
21291 <p>[[../..]]
21292 </p>
21293 !! end
21294
21295 !! test
21296 Parents of subpages, two levels up, with lots of extra trailing slashes.
21297 !! options
21298 subpage title=[[Subpage test/L1/L2/L3]]
21299 !! wikitext
21300 [[../../////]]
21301 !! html
21302 <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>
21303 </p>
21304 !! end
21305
21306 !! article
21307 Subpage test/L1/L2/L3Sibling
21308 !! text
21309 Sibling article
21310 !! endarticle
21311
21312 !! test
21313 Transclusion of a sibling page (one level up)
21314 !! options
21315 subpage title=[[Subpage test/L1/L2/L3]]
21316 !! wikitext
21317 {{../L3Sibling}}
21318 !! html
21319 <p>Sibling article
21320 </p>
21321 !! end
21322
21323 !! test
21324 Transclusion of a child page
21325 !! options
21326 subpage title=[[Subpage test/L1/L2]]
21327 !! wikitext
21328 {{/L3Sibling}}
21329 !! html
21330 <p>Sibling article
21331 </p>
21332 !! end
21333
21334 # This is wt2html only in Parsoid because we add <nowiki>
21335 # because of {{..}} and we don't expect to fix that to
21336 # eliminate the nowikis selective for {{..}} markup.
21337 !! test
21338 Non-transclusion because of too many up levels
21339 !! options
21340 subpage title=[[Subpage test/L1/L2/L3]]
21341 parsoid=wt2html
21342 !! wikitext
21343 {{../../../../More than parent}}
21344 !! html/php
21345 <p>{{../../../../More than parent}}
21346 </p>
21347 !! html/parsoid
21348 <p>{{../../../../More than parent}}</p>
21349 !! end
21350
21351 !! test
21352 Definition list code coverage
21353 !! wikitext
21354 ;title : def
21355 ;title : def
21356 ;title: def
21357 !! html/php
21358 <dl><dt>title &#160;</dt>
21359 <dd>def</dd>
21360 <dt>title&#160;</dt>
21361 <dd>def</dd>
21362 <dt>title</dt>
21363 <dd>def</dd></dl>
21364
21365 !! html/parsoid
21366 <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21367 <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
21368 <dt>title</dt><dd> def</dd></dl>
21369 !! end
21370
21371 !! test
21372 Don't fall for the self-closing div
21373 !! wikitext
21374 <div>hello world</div/>
21375 !! html
21376 <div>hello world</div>
21377
21378 !! end
21379
21380 !! test
21381 MSGNW magic word
21382 !! wikitext
21383 {{MSGNW:msg}}
21384 !! html/php
21385 <p>&#91;&#91;:Template:Msg&#93;&#93;
21386 </p>
21387 !! end
21388
21389 !! test
21390 RAW magic word
21391 !! wikitext
21392 {{RAW:QUERTY}}
21393 !! html
21394 <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>
21395 </p>
21396 !! end
21397
21398 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
21399 !! test
21400 Always escape literal '>' in output, not just after '<'
21401 !! wikitext
21402 ><>
21403 !! html
21404 <p>&gt;&lt;&gt;
21405 </p>
21406 !! end
21407
21408 !! test
21409 Template caching
21410 !! wikitext
21411 {{Test}}
21412 {{Test}}
21413 !! html
21414 <p>This is a test template
21415 This is a test template
21416 </p>
21417 !! end
21418
21419
21420 !! article
21421 MediaWiki:Fake
21422 !! text
21423 ==header==
21424 !! endarticle
21425
21426 !! test
21427 Inclusion of !userCanEdit() content
21428 !! wikitext
21429 {{MediaWiki:Fake}}
21430 !! html
21431 <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>
21432
21433 !! end
21434
21435
21436 !! test
21437 Out-of-order TOC heading levels
21438 !! wikitext
21439 ==2==
21440 ======6======
21441 ===3===
21442 =1=
21443 =====5=====
21444 ==2==
21445 !! html
21446 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
21447 <ul>
21448 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
21449 <ul>
21450 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
21451 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
21452 </ul>
21453 </li>
21454 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
21455 <ul>
21456 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
21457 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
21458 </ul>
21459 </li>
21460 </ul>
21461 </div>
21462
21463 <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>
21464 <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>
21465 <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>
21466 <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>
21467 <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>
21468 <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>
21469
21470 !! end
21471
21472
21473 !! test
21474 ISBN with a dummy number
21475 !! wikitext
21476 ISBN ---
21477 !! html
21478 <p>ISBN ---
21479 </p>
21480 !! end
21481
21482
21483 !! test
21484 ISBN with space-delimited number
21485 !! wikitext
21486 ISBN 92 9017 032 8
21487 !! html/php
21488 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
21489 </p>
21490 !! html/parsoid
21491 <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>
21492 !! end
21493
21494
21495 !! test
21496 ISBN with multiple spaces, no number
21497 !! wikitext
21498 ISBN foo
21499 !! html
21500 <p>ISBN foo
21501 </p>
21502 !! end
21503
21504
21505 !! test
21506 ISBN length
21507 !! wikitext
21508 ISBN 123456789
21509
21510 ISBN 1234567890
21511
21512 ISBN 12345678901
21513 !! html/php
21514 <p>ISBN 123456789
21515 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21516 </p><p>ISBN 12345678901
21517 </p>
21518 !! html/parsoid
21519 <p>ISBN 123456789</p>
21520
21521 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21522
21523 <p>ISBN 12345678901</p>
21524 !! end
21525
21526
21527 !! test
21528 ISBN with trailing year (T9110)
21529 !! wikitext
21530 ISBN 1-234-56789-0 - 2006
21531
21532 ISBN 1 234 56789 0 - 2006
21533 !! html/php
21534 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
21535 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
21536 </p>
21537 !! html/parsoid
21538 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
21539
21540 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
21541 !! end
21542
21543
21544 !! test
21545 anchorencode
21546 !! config
21547 wgFragmentMode=[ 'html5', 'legacy' ]
21548 !! wikitext
21549 {{anchorencode:foo bar©#%n}}
21550 !! html/php
21551 <p>foo_bar©#%n
21552 </p>
21553 !! html/parsoid
21554 <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>
21555 !! end
21556
21557 !! test
21558 anchorencode (legacy)
21559 !! config
21560 wgFragmentMode=[ 'legacy' ]
21561 !! wikitext
21562 {{anchorencode:foo bar©#%n}}
21563 !! html/php
21564 <p>foo_bar.C2.A9.23.25n
21565 </p>
21566 !! end
21567
21568 !! test
21569 anchorencode trims spaces
21570 !! config
21571 wgFragmentMode=[ 'html5', 'legacy' ]
21572 !! wikitext
21573 {{anchorencode: __pretty__please__}}
21574 !! html/php
21575 <p>pretty_please
21576 </p>
21577 !! html/parsoid
21578 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
21579 !! end
21580
21581 !! test
21582 anchorencode deals with links
21583 !! config
21584 wgFragmentMode=[ 'html5', 'legacy' ]
21585 !! wikitext
21586 {{anchorencode: [[hello|world]] [[hi]]}}
21587 !! html/php
21588 <p>world_hi
21589 </p>
21590 !! html/parsoid
21591 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
21592 !! end
21593
21594 !! test
21595 anchorencode deals with templates
21596 !! config
21597 wgFragmentMode=[ 'html5', 'legacy' ]
21598 !! wikitext
21599 {{anchorencode: {{Foo}} x}}
21600 !! html/php
21601 <p>FOO_x
21602 </p>
21603 !! html/parsoid
21604 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
21605 !! end
21606
21607 !! test
21608 anchorencode encodes like the TOC generator: (T20431)
21609 !! config
21610 wgFragmentMode=[ 'html5', 'legacy' ]
21611 !! wikitext
21612 ===_ +:.3A%3A _ &&amp;]] x===
21613 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
21614 __NOEDITSECTION__
21615 !! html/php
21616 <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>
21617 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
21618 </p>
21619 !! html/parsoid
21620 <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>
21621 <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>
21622 <meta property="mw:PageProp/noeditsection"/>
21623 !! end
21624
21625 !! test
21626 anchorencode encodes like the TOC generator: (T20431) (legacy)
21627 !! config
21628 wgFragmentMode=[ 'legacy' ]
21629 !! wikitext
21630 ===_ +:.3A%3A&&amp;]]===
21631 {{anchorencode: _ +:.3A%3A&&amp;]] }}
21632 __NOEDITSECTION__
21633 !! html/php
21634 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
21635 <p>.2B:.3A.253A.26.26.5D.5D
21636 </p>
21637 !! end
21638
21639 !! test
21640 T8200: blockquotes and paragraph formatting
21641 !! wikitext
21642 <blockquote>
21643 foo
21644 </blockquote>
21645
21646 bar
21647
21648 baz
21649 !! html
21650 <blockquote>
21651 <p>foo
21652 </p>
21653 </blockquote>
21654 <p>bar
21655 </p>
21656 <pre>baz
21657 </pre>
21658 !! end
21659
21660 !! test
21661 T10293: Use of center tag ruins paragraph formatting
21662 !! wikitext
21663 <center>
21664 foo
21665 </center>
21666
21667 bar
21668
21669 baz
21670 !! html
21671 <center>
21672 <p>foo
21673 </p>
21674 </center>
21675 <p>bar
21676 </p>
21677 <pre>baz
21678 </pre>
21679 !! end
21680
21681 !!test
21682 Parsing of overlapping (improperly nested) inline html tags
21683 !! wikitext
21684 <span><s>x</span></s>
21685 !! html/php
21686 <p><span><s>x&lt;/span&gt;</s></span>
21687 </p>
21688 !! html/parsoid
21689 <p><span><s>x</s></span>
21690 </p>
21691 !!end
21692
21693 ###
21694 ### Language variants related tests
21695 ###
21696
21697 # Parsoid does not mark self-links.
21698 # Parsoid does not convert links; PHP will do any necessary redirects.
21699
21700 !! test
21701 Self-link in language variants
21702 !! options
21703 title=[[Dunav]] language=sr
21704 !! wikitext
21705 Both [[Dunav]] and [[Дунав]] are names for this river.
21706 !! html/php
21707 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
21708 </p>
21709 !! html/parsoid
21710 <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>
21711 !! end
21712
21713 !! article
21714 Дуна
21715 !! text
21716 content
21717 !! endarticle
21718
21719 !! test
21720 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
21721 !! options
21722 title=[[Duna]] language=sr
21723 !! wikitext
21724 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
21725 !! html/php
21726 <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.
21727 </p>
21728 !! html/parsoid
21729 <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>
21730 !! end
21731
21732 !! test
21733 Link to a section of a variant of this title shouldn't be parsed as self-link
21734 !! options
21735 title=[[Duna]] language=sr
21736 !! wikitext
21737 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
21738 !! html/php
21739 <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.
21740 </p>
21741 !! html/parsoid
21742 <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>
21743 !! end
21744
21745 !! test
21746 Link to pages in language variants
21747 !! options
21748 language=sr
21749 !! wikitext
21750 Main Page can be written as [[Маин Паге]]
21751 !! html/php
21752 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
21753 </p>
21754 !! html/parsoid
21755 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
21756 !! end
21757
21758
21759 !! test
21760 Multiple links to pages in language variants
21761 !! options
21762 language=sr
21763 !! wikitext
21764 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
21765 !! html/php
21766 <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>.
21767 </p>
21768 !! html/parsoid
21769 <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>
21770 !! end
21771
21772
21773 !! test
21774 Simple template in language variants
21775 !! options
21776 language=sr
21777 !! wikitext
21778 {{тест}}
21779 !! html/php
21780 <p>This is a test template
21781 </p>
21782 !! end
21783
21784
21785 !! test
21786 Template with explicit namespace in language variants
21787 !! options
21788 language=sr
21789 !! wikitext
21790 {{Template:тест}}
21791 !! html/php
21792 <p>This is a test template
21793 </p>
21794 !! end
21795
21796
21797 !! test
21798 Basic test for template parameter in language variants
21799 !! options
21800 language=sr
21801 !! wikitext
21802 {{парамтест|param=foo}}
21803 !! html/php
21804 <p>This is a test template with parameter foo
21805 </p>
21806 !! end
21807
21808 !! test
21809 Simple category in language variants
21810 !! options
21811 language=sr cat
21812 !! wikitext
21813 [[Category:МедиаWики Усер'с Гуиде]]
21814 !! html/php
21815 cat=МедиаWики_Усер'с_Гуиде sort=
21816 !! html/parsoid
21817 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
21818 !! end
21819
21820 !! article
21821 Category:分类
21822 !! text
21823 blah
21824 !! endarticle
21825
21826 !! article
21827 Category:分類
21828 !! text
21829 blah
21830 !! endarticle
21831
21832 ## We used to, but no longer wt2wt this test since the default serializer
21833 ## will normalize all categories to serialize on their own line.
21834 ## This wikitext usage is going to be fairly uncommon in production and
21835 ## selser will take care of preserving formatting in those scenarios.
21836 !! test
21837 Don't convert blue categorylinks to another variant (T35210)
21838 !! options
21839 cat
21840 language=zh
21841 parsoid=wt2html
21842 !! wikitext
21843 [[A]][[Category:分类]]
21844 !! html/php
21845 cat=分类 sort=
21846 !! html/parsoid
21847 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
21848 <link rel="mw:PageProp/Category" href="./Category:分类"/>
21849 !! end
21850
21851 !! test
21852 Stripping -{}- tags (language variants)
21853 !! options
21854 language=sr
21855 !! wikitext
21856 Latin proverb: -{Ne nuntium necare}-
21857 !! html/php
21858 <p>Latin proverb: Ne nuntium necare
21859 </p>
21860 !! html/parsoid
21861 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21862 !! end
21863
21864
21865 !! test
21866 Prevent conversion with -{}- tags (language variants)
21867 !! options
21868 language=sr variant=sr-ec
21869 !! wikitext
21870 Latinski: -{Ne nuntium necare}-
21871 !! html/php
21872 <p>Латински: Ne nuntium necare
21873 </p>
21874 !! html/parsoid
21875 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21876 !! end
21877
21878
21879 !! test
21880 Prevent conversion of text with -{}- tags (language variants)
21881 !! options
21882 language=sr variant=sr-ec
21883 !! wikitext
21884 Latinski: -{Ne nuntium necare}-
21885 !! html/php
21886 <p>Латински: Ne nuntium necare
21887 </p>
21888 !! html/parsoid
21889 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
21890 !! end
21891
21892
21893 !! test
21894 Prevent conversion of links with -{}- tags (language variants)
21895 !! options
21896 language=sr variant=sr-ec
21897 !! wikitext
21898 -{[[Main Page]]}-
21899 !! html/php
21900 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21901 </p>
21902 !! html/parsoid
21903 <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>
21904 !! end
21905
21906
21907 !! test
21908 -{}- tags within headlines (within html for parserConvert())
21909 !! config
21910 wgFragmentMode=[ 'html5', 'legacy' ]
21911 !! options
21912 language=sr variant=sr-ec
21913 !! wikitext
21914 ==-{Naslov}-==
21915
21916 Note that even an unprotected headline ID is not affected by language
21917 conversion:
21918
21919 ==Latinski==
21920 !! html/php
21921 <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>
21922 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
21923 цонверсион:
21924 </p>
21925 <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>
21926
21927 !! html/parsoid
21928 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
21929
21930 <p>Note that even an unprotected headline ID is not affected by language
21931 conversion:</p>
21932
21933 <h2 id="Latinski">Latinski</h2>
21934 !! end
21935
21936 !! test
21937 Explicit definition of language variant alternatives
21938 !! options
21939 language=zh variant=zh-tw
21940 !! wikitext
21941 -{zh:China;zh-tw:Taiwan}-, not China
21942 !! html/php
21943 <p>Taiwan, not China
21944 </p>
21945 !! html/parsoid
21946 <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>
21947 !! end
21948
21949 !! test
21950 Filter syntax for language variants
21951 !! options
21952 language=zh variant=zh-tw
21953 !! wikitext
21954 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
21955 !! html/php
21956 <p>fooblog, WEBJOURNAL, WEBLOGquux
21957 </p>
21958 !! html/parsoid
21959 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
21960 !! end
21961
21962 # Note that Parsoid post-processing for language variants needs to
21963 # update the `title` attribute here, based on the mw:ExpandedAttrs property
21964 !! test
21965 Conversion around HTML tags
21966 !! options
21967 language=sr variant=sr-ec
21968 !! wikitext
21969 -{H|span=>sr-ec:script;title=>sr-ec:src}-
21970 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
21971 !! html/php
21972 <p>
21973 <span title="ЛаCтин">ски</span>
21974 </p>
21975 !! html/parsoid
21976 <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"}]}'/>
21977 <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>
21978 !! end
21979
21980 !! test
21981 Explicit session-wise two-way language variant mapping (A flag and - flag)
21982 !! options
21983 language=zh variant=zh-tw
21984 !! wikitext
21985 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
21986
21987 Taiwan is not China.
21988
21989 But -{A|zh:China; zh-tw:Taiwan}- is China,
21990
21991 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
21992
21993 and -{China}- is China.
21994 !! html/php
21995 <p>This is Taiwan, but we'll forget that now.
21996 </p><p>Taiwan is not China.
21997 </p><p>But Taiwan is Taiwan,
21998 </p><p>(This should be stripped!)
21999 </p><p>and China is China.
22000 </p>
22001 !! html/parsoid
22002 <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>
22003 <p>Taiwan is not China.</p>
22004 <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>
22005 <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>
22006 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22007 !! end
22008
22009 !! test
22010 Explicit session-wise one-way language variant mapping (A flag and - flag)
22011 !! options
22012 language=zh variant=zh-tw
22013 !! wikitext
22014 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22015
22016 COUNTRY is China or Taiwan.
22017
22018 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22019
22020 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22021
22022 and -{COUNTRY}- is COUNTRY.
22023 !! html/php
22024 <p>This is Taiwan, but we'll forget that now.
22025 </p><p>COUNTRY is China or Taiwan.
22026 </p><p>But Taiwan is Taiwan,
22027 </p><p>(This should be stripped!)
22028 </p><p>and COUNTRY is COUNTRY.
22029 </p>
22030 !! html/parsoid
22031 <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>
22032 <p>COUNTRY is China or Taiwan.</p>
22033 <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>
22034 <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>
22035 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22036 !! end
22037
22038 !! test
22039 Explicit session-wise two-way language variant mapping (H flag for hide)
22040 !! options
22041 language=zh variant=zh-tw
22042 !! wikitext
22043 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22044
22045 Taiwan is China.
22046 !! html/php
22047 <p>(This should be stripped!)
22048 </p><p>Taiwan is Taiwan.
22049 </p>
22050 !! html/parsoid
22051 <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>
22052 <p>Taiwan is China.</p>
22053 !! end
22054
22055 !! test
22056 Explicit session-wise one-way language variant mapping (H flag for hide)
22057 !! options
22058 language=zh variant=zh-tw
22059 !! wikitext
22060 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22061
22062 COUNTRY is Taiwan or China.
22063 !! html/php
22064 <p>(This should be stripped!)
22065 </p><p>Taiwan is Taiwan or China.
22066 </p>
22067 !! html/parsoid
22068 <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>
22069 <p>COUNTRY is Taiwan or China.</p>
22070 !! end
22071
22072 ## Note that parsoid test runner does not support 'showtitle' option.
22073 !! test
22074 Adding explicit conversion rule for title (T flag)
22075 !! options
22076 language=zh variant=zh-tw showtitle
22077 !! wikitext
22078 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
22079
22080 Taiwan is China.
22081 !! html/php
22082 Taiwan
22083 <p>Should be stripped!
22084 </p><p>Taiwan is China.
22085 </p>
22086 !! html/parsoid
22087 <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>
22088 <p>Taiwan is China.</p>
22089 !! end
22090
22091 !! test
22092 Code coverage: T combined with H flag
22093 !! options
22094 language=zh variant=zh-tw showtitle
22095 !! wikitext
22096 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
22097
22098 Taiwan is China.
22099 !! html/php
22100 Taiwan
22101 <p>Should be stripped!
22102 </p><p>Taiwan is Taiwan.
22103 </p>
22104 !! html/parsoid
22105 <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>
22106 <p>Taiwan is China.</p>
22107 !! end
22108
22109 !! test
22110 Code coverage: T with no variants
22111 !! options
22112 language=zh variant=zh-tw showtitle
22113 !! wikitext
22114 -{H|zh:China; zh-tw:Taiwan}-
22115 Taiwan is China.-{T|Taiwan is China}-
22116 !! html/php
22117 Taiwan is China
22118 <p>
22119 Taiwan is Taiwan.
22120 </p>
22121 !! html/parsoid
22122 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22123 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
22124 !! end
22125
22126 !! test
22127 Code coverage: rules with no variants
22128 !! options
22129 language=zh variant=zh-tw
22130 !! wikitext
22131 -{H|zh:China; zh-tw:Taiwan}-
22132 Taiwan is China.
22133 -{H|China}-
22134 Taiwan is China.
22135 !! html/php
22136 <p>
22137 Taiwan is Taiwan.
22138
22139 Taiwan is China.
22140 </p>
22141 !! html/parsoid
22142 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
22143 Taiwan is China.
22144 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
22145 Taiwan is China.</p>
22146 !! end
22147
22148
22149 !! test
22150 Code coverage: D flag for conversion rule
22151 !! options
22152 language=zh variant=zh-tw
22153 !! wikitext
22154 -{D|zh-cn:XA; zh-tw:YA}-
22155 -{A;D|zh-cn:XB; zh-tw:YB}-
22156 -{D;H|zh-cn:XC; zh-tw:YC}-
22157
22158 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
22159
22160 -{D|0=>zh-tw:1}-
22161 -{A;D|2=>zh-tw:3}-
22162 -{D;H|4=>zh-tw:5}-
22163
22164 XA XB XC YA YB YC FOO BAR BAT 012345
22165 !! html/php
22166 <p>大陆:XA;台灣:YA;
22167
22168 大陆:XC;台灣:YC;
22169 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
22170 </p><p>0⇒台灣:1;
22171
22172 4⇒台灣:5;
22173 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
22174 </p>
22175 !! html/parsoid
22176 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
22177 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
22178 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
22179 <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>
22180 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
22181 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
22182 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
22183 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
22184 !! end
22185
22186 !! test
22187 Code coverage: N flag for conversion rule
22188 !! options
22189 language=zh variant=zh-cn
22190 !! wikitext
22191 -{N|zh-cn}-
22192
22193 -{N|zh-tw}-
22194
22195 -{N|sr-ec}-
22196 !! html/php
22197 <p>大陆
22198 </p><p>台灣
22199 </p><p>српски (ћирилица)‎
22200 </p>
22201 !! html/parsoid
22202 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
22203 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
22204 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
22205 !! end
22206
22207 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
22208 !! test
22209 Code coverage: N flag for conversion rule (wt2html only)
22210 !! options
22211 language=zh variant=zh-cn
22212 parsoid=wt2html,html2html
22213 !! wikitext
22214 -{D;N|en}-
22215 !! html/php
22216 <p>English
22217 </p>
22218 !! html/parsoid
22219 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
22220 !! end
22221
22222 !! test
22223 Testing that changing the language variant here in the tests actually works
22224 !! options
22225 language=zh variant=zh showtitle
22226 !! wikitext
22227 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22228 !! html/php
22229 China
22230 <p>Should be stripped!
22231 </p>
22232 !! html/parsoid
22233 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
22234 !! end
22235
22236 !! test
22237 Recursive conversion of alt and title attrs shouldn't clear converter state
22238 !! options
22239 language=zh variant=zh-cn
22240 showtitle
22241 !! wikitext
22242 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
22243 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
22244 !! html/php
22245 China
22246 <p>
22247 Should be stripped<span title="Exclamation">!</span>
22248 </p>
22249 !! html/parsoid
22250 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
22251 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>
22252 !! end
22253
22254 !! test
22255 T26072: more test on conversion rule for title
22256 !! options
22257 language=zh variant=zh-tw showtitle
22258 !! wikitext
22259 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
22260
22261 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
22262 !! html/php
22263 Taiwan
22264 <p>This should be stripped!
22265 </p><p>This won't take interferes with the title rule.
22266 </p>
22267 !! html/parsoid
22268 <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>
22269 <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>
22270 !! end
22271
22272 !! test
22273 Partly disable title conversion if variant == main language code
22274 !! options
22275 language=zh variant=zh title=[[ZH]] showtitle
22276 !! wikitext
22277 -{T|zh-cn:CN;zh-tw:TW}-
22278 !! html/php
22279 ZH
22280 <p>
22281 </p>
22282 !! html/parsoid
22283 <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>
22284 !! end
22285
22286 !! test
22287 Partly disable title conversion if variant == main language code, more
22288 !! options
22289 language=zh variant=zh title=[[ZH]] showtitle
22290 !! wikitext
22291 -{T|TW}-
22292 !! html/php
22293 ZH
22294 <p>
22295 </p>
22296 !! html/parsoid
22297 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
22298 !! end
22299
22300 !! test
22301 Raw output of variant escape tags (R flag)
22302 !! options
22303 language=zh variant=zh-tw
22304 !! wikitext
22305 Raw: -{R|zh:China;zh-tw:Taiwan}-
22306 !! html/php
22307 <p>Raw: zh:China;zh-tw:Taiwan
22308 </p>
22309 !! html/parsoid
22310 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
22311 !! end
22312
22313 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
22314 !! test
22315 Raw output of variant escape tags (R flag) (wt2html only)
22316 !! options
22317 language=zh variant=zh-tw
22318 parsoid=wt2html,html2html
22319 !! wikitext
22320 -{Variant}- -{D|syntax}- -{D;R|options}-
22321 !! html/php
22322 <p>Variant syntax options
22323 </p>
22324 !! html/parsoid
22325 <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>
22326 !! end
22327
22328 !! test
22329 Nested markup inside raw output of variant escape tags (R flag)
22330 !! options
22331 language=zh variant=zh-tw
22332 !! wikitext
22333 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
22334 !! html/php
22335 <p>Nested raw: nested Taiwan nested
22336 </p>
22337 !! html/parsoid
22338 <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>
22339 !! end
22340
22341 !! test
22342 Nested markup and spaces inside raw output of variant escape tags (R flag)
22343 !! options
22344 language=zh variant=zh-tw
22345 !! wikitext
22346 X-{ outer -{ inner }- outer }-X
22347 !! html/php
22348 <p>X outer inner outer X
22349 </p>
22350 !! html/parsoid
22351 <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>
22352 !! end
22353
22354 !! test
22355 Templates inside raw output of variant escape tags (R flag)
22356 !! options
22357 language=zh variant=zh-tw
22358 !! wikitext
22359 Nested raw: -{R|nested {{echo|hi}} templates}-
22360 !! html/php
22361 <p>Nested raw: nested hi templates
22362 </p>
22363 !! html/parsoid
22364 <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>
22365 !! end
22366
22367 !! test
22368 Strings evaluating false shouldn't be ignored by Language converter (T51072)
22369 !! options
22370 language=zh variant=zh-cn
22371 !! wikitext
22372 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
22373 !! html/php
22374 <p>0
22375 </p>
22376 !! html/parsoid
22377 <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>
22378 !! end
22379
22380 !! test
22381 Conversion rules from [numeric-only string] to [something else] (T48634)
22382 !! options
22383 language=zh variant=zh-cn
22384 !! wikitext
22385 -{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
22386 !! html/php
22387 <p>D12345EE12345
22388 </p>
22389 !! html/parsoid
22390 <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>
22391 !! end
22392
22393 !! test
22394 Two-way converter rule entries with an empty value should be ignored (T53551)
22395 !! options
22396 language=zh variant=zh-cn
22397 !! wikitext
22398 -{H|zh-cn:foo;zh-tw:;}-foobar
22399 !! html/php
22400 <p>foobar
22401 </p>
22402 !! html/parsoid
22403 <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>
22404 !! end
22405
22406 !! test
22407 One-way converter rule entries with an empty "from" string should be ignored (T53551)
22408 !! options
22409 language=zh variant=zh-cn
22410 !! wikitext
22411 -{H|=>zh-cn:foo;}-foobar
22412 !! html/php
22413 <p>foobar
22414 </p>
22415 !! html/parsoid
22416 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
22417 !! end
22418
22419 !! test
22420 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
22421 !! options
22422 language=zh variant=zh-cn
22423 !! wikitext
22424 -{H|}-foobar
22425 !! html/php
22426 <p>foobar
22427 </p>
22428 !! html/parsoid
22429 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
22430 !! end
22431
22432 !! test
22433 Nested using of manual convert syntax
22434 !! options
22435 language=zh variant=zh-hk
22436 !! wikitext
22437 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
22438 !! html/php
22439 <p>Nested: Hello Hong Kong!
22440 </p>
22441 !! html/parsoid
22442 <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>
22443 !! end
22444
22445 !! test
22446 HTML markups with conversion syntax in attribs, nested in other conversion blocks
22447 !! options
22448 language=zh variant=zh-cn
22449 !! wikitext
22450 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
22451 !! html/php
22452 <p><span title="X">A</span>
22453 </p>
22454 !! html/parsoid
22455 <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>
22456 !! end
22457
22458 !! test
22459 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
22460 !! options
22461 language=zh variant=zh-cn
22462 !! wikitext
22463 -{<span title="-{X}-">A</span>}-
22464 !! html/php+disabled
22465 <p><span title="X">A</span>
22466 </p>
22467 !! html/parsoid
22468 <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>
22469 !! end
22470
22471 # Parsoid and PHP disagree on how to parse this example: Parsoid
22472 # insists that the content of a language converter element be a valid
22473 # DOM fragment or attribute string
22474 !! test
22475 Language converter markup with block content
22476 !! options
22477 language=zh variant=zh-cn
22478 !! wikitext
22479 <span>a-{b<div>c}-d
22480
22481 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
22482
22483 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
22484 !! html/php+tidy
22485 <span>ab<div>cd
22486 <span>ab<div>cd
22487 <span>ad
22488 </span></div></span></div></span>
22489 !! html/parsoid
22490 <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>
22491
22492 <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>
22493
22494 <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>
22495 !! end
22496
22497 !! test
22498 LanguageConverter selser (1)
22499 !! options
22500 language=zh variant=zh-cn
22501 parsoid={
22502 "modes": ["wt2wt", "selser"],
22503 "changes": [
22504 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22505 ]
22506 }
22507 !! wikitext
22508 -{raw}-
22509 !! wikitext/edited
22510 -{edited}-
22511 !! end
22512
22513 !! test
22514 LanguageConverter selser (2)
22515 !! options
22516 language=zh variant=zh-cn
22517 parsoid={
22518 "modes": ["wt2wt", "selser"],
22519 "changes": [
22520 ["span[class='x']", "contents", "text", "-{foo}-"],
22521 ["a", "contents", "text", "-{"],
22522 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
22523 ]
22524 }
22525 !! wikitext
22526 <span class="x">TEXT1</span>
22527 [http://example.com TEXT2]
22528 [[Foo|TEXT3]]
22529 {{echo|TEXT4}}
22530 !! wikitext/edited
22531 <span class="x"><nowiki>-{foo}-</nowiki></span>
22532 [http://example.com -{]
22533 [[Foo|<nowiki>-{</nowiki>]]
22534 {{1x|<nowiki>-{</nowiki>}}
22535 !! end
22536
22537 # Tests LanguageVariantText in ConstrainedText
22538 !! test
22539 LanguageConverter selser (3)
22540 !! options
22541 language=zh variant=zh-cn
22542 parsoid={
22543 "modes": ["wt2wt", "selser"],
22544 "changes": [
22545 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
22546 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
22547 ]
22548 }
22549 !! wikitext
22550 {|
22551 |-
22552 |<span>Foo</span>
22553 |}
22554 !! wikitext/edited
22555 {|
22556 |-
22557 |<nowiki/>-{edited}-
22558 |}
22559 !! end
22560
22561 # Tests LanguageVariantText._fromSelSer
22562 !! test
22563 LanguageConverter selser (4)
22564 !! options
22565 language=zh variant=zh-cn
22566 parsoid={
22567 "modes": ["wt2wt", "selser"],
22568 "changes": [
22569 ["td > span.x", "remove"]
22570 ]
22571 }
22572 !! wikitext
22573 {|
22574 |-
22575 |<span class="x">Foo</span>-{Bar}-
22576 ||<span class="x">Foo</span>-{Bar}-
22577 |}
22578 !! wikitext/edited
22579 {|
22580 |-
22581 |<nowiki/>-{Bar}-
22582 ||-{Bar}-
22583 |}
22584 !! end
22585
22586 # Since Parsoid is starting to emit canonical wikitext for links,
22587 # [http://example.com http://example.com] will not RT back to that
22588 # form anymore.
22589 # Parsoid does not language-convert links (it is done in a
22590 # post-processing step)
22591 !! test
22592 Proper conversion of text in external links
22593 !! options
22594 language=sr variant=sr-ec
22595 parsoid=wt2html
22596 !! wikitext
22597 http://www.google.com
22598 gopher://www.google.com
22599 [http://www.google.com http://www.google.com]
22600 [gopher://www.google.com gopher://www.google.com]
22601 [https://www.google.com irc://www.google.com]
22602 [ftp://www.google.com www.google.com/ftp://dir]
22603 [//www.google.com www.google.com]
22604 !! html/php
22605 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
22606 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22607 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
22608 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
22609 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
22610 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
22611 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
22612 </p>
22613 !! html/parsoid
22614 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22615 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22616 <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
22617 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
22618 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
22619 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
22620 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
22621 !! end
22622
22623 !! test
22624 Do not convert roman numbers to language variants
22625 !! options
22626 language=sr variant=sr-ec
22627 !! wikitext
22628 Fridrih IV je car.
22629 !! html/php
22630 <p>Фридрих IV је цар.
22631 </p>
22632 !! html/parsoid
22633 <p>Fridrih IV je car.</p>
22634 !! end
22635
22636 !! test
22637 Unclosed language converter markup "-{"
22638 !! options
22639 language=sr
22640 !! wikitext
22641 -{T|hello
22642 !! html
22643 <p>-{T|hello
22644 </p>
22645 !! end
22646
22647 !! test
22648 Don't convert raw rule "-{R|=&gt;}-" to "=>"
22649 !! options
22650 language=sr
22651 !! wikitext
22652 -{R|=&gt;}-
22653 !! html/php
22654 <p>=&gt;
22655 </p>
22656 !! html/parsoid
22657 <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>
22658 !!end
22659
22660 !! test
22661 Don't break link parsing if language converter markup is in the caption.
22662 !! options
22663 language=sr variant=sr-ec
22664 !! wikitext
22665 [[Main Page|-{R|main page}-]]
22666 !! html/php
22667 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
22668 </p>
22669 !! html/parsoid
22670 <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>
22671 !! end
22672
22673 !! test
22674 T146304: Don't break template parsing if language converter markup is in the parameter.
22675 !! options
22676 language=sr variant=sr-ec
22677 !! wikitext
22678 {{echo|-{R|foo}-}}
22679 !! html/php
22680 <p>foo
22681 </p>
22682 !! html/parsoid
22683 <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>
22684 !! end
22685
22686 !! test
22687 T146305: Don't break image parsing if language converter markup is in the caption.
22688 !! options
22689 language=sr
22690 !! wikitext
22691 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
22692 !! html/php
22693 <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>
22694
22695 !! html/parsoid
22696 <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>
22697 !! end
22698
22699 !! test
22700 T146305: Don't break image parsing if nested language converter markup is in the caption.
22701 !! options
22702 language=zh variant=zh-cn
22703 !! wikitext
22704 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
22705 !! html/php
22706 <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>
22707
22708 !! html/parsoid
22709 <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>
22710 !! end
22711
22712 # XXX html2wt disabled because rich markup in alt is not preserved.
22713 !! test
22714 Don't break gallery if language converter markup is inside.
22715 !! options
22716 language=zh
22717 !! wikitext
22718 <gallery>
22719 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
22720 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
22721 </gallery>
22722 !! html/php
22723 <ul class="gallery mw-gallery-traditional">
22724 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22725 <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>
22726 <div class="gallerytext">
22727 <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>
22728 </p>
22729 </div>
22730 </div></li>
22731 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22732 <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>
22733 <div class="gallerytext">
22734 <p>This is a test template
22735 </p>
22736 </div>
22737 </div></li>
22738 </ul>
22739
22740 !! html/parsoid
22741 <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"}}'>
22742 <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>
22743 <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>
22744 </ul>
22745 !! end
22746
22747 !! test
22748 T153135: Don't break list handling if language converter markup is in the item.
22749 !! options
22750 language=zh variant=zh-cn
22751 !! wikitext
22752 ;-{zh-cn:AAA;zh-tw:BBB}-
22753 ;-{R|foo:bar}-
22754 !! html/php
22755 <dl><dt>AAA</dt>
22756 <dt>foo:bar</dt></dl>
22757
22758 !! html/parsoid
22759 <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>
22760 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
22761 </dl>
22762 !! end
22763
22764 // Note that parsoid does not protect colons unless language converter
22765 // markup is properly nested, because it is a backtracking parser.
22766 !! test
22767 T153135: Unclosed markup in definition list (code coverage)
22768 !! options
22769 language=zh variant=zh-cn
22770 !! wikitext
22771 ;<b>foo:bar
22772 ;-{zh-cn:AAA
22773 !! html/php+tidy
22774 <dl><dt><b>foo:bar</b></dt><b>
22775 <dt>-{zh-cn:AAA</dt></b></dl><p><b>
22776 </b></p>
22777 !! html/parsoid
22778 <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}'>
22779 <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
22780 <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
22781 </b></dl>
22782 !! end
22783
22784 !! test
22785 T153135: Nested language converter markup in definition list (code coverage)
22786 !! options
22787 language=zh variant=zh-cn
22788 !! wikitext
22789 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
22790 !! html/php
22791 <dl><dt>AAA foo:bar bat:baz</dt>
22792 <dd>def</dd></dl>
22793
22794 !! html/parsoid
22795 <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>
22796 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
22797 </dl>
22798 !! end
22799
22800 # html2wt mode disabled due to <nowiki> insertion.
22801 !! test
22802 T153140: Don't break table handling if language converter markup is in the cell.
22803 !! options
22804 language=sr variant=sr-ec
22805 parsoid=wt2html,wt2wt,html2html
22806 !! wikitext
22807 {|
22808 |-
22809 | -{R|B}-
22810 |}
22811 !! html/php
22812 <table>
22813
22814 <tr>
22815 <td>B
22816 </td></tr></table>
22817
22818 !! html/parsoid
22819 <table>
22820 <tbody>
22821 <tr>
22822 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
22823 </tr>
22824 </tbody>
22825 </table>
22826 !! end
22827
22828 !! test
22829 Language converter tricky html2wt cases (1)
22830 !! options
22831 language=sr
22832 parsoid=html2wt,wt2wt
22833 !! html/parsoid
22834 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
22835 !! wikitext
22836 -{<nowiki>}-</nowiki>}-
22837 !! html/php
22838 <p>&#125;-
22839 </p>
22840 !! end
22841
22842 !! test
22843 Language converter tricky html2wt cases (2)
22844 !! options
22845 language=sr
22846 parsoid=html2wt,wt2wt
22847 !! html/parsoid
22848 <p>-{foo}-</p>
22849 !! wikitext
22850 <nowiki>-{foo}-</nowiki>
22851 !! html/php
22852 <p>-&#123;foo&#125;-
22853 </p>
22854 !! end
22855
22856 !! test
22857 Language converter tricky html2wt cases (3)
22858 !! options
22859 language=sr
22860 parsoid=html2wt,wt2wt
22861 !! html/parsoid
22862 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
22863 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
22864 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
22865 !! wikitext
22866 -{R||}-
22867
22868 -{R|R|raw}-
22869
22870 -{<nowiki>-{foo}-</nowiki>}-
22871 !! html/php
22872 <p>|
22873 </p><p>R|raw
22874 </p><p>-&#123;foo&#125;-
22875 </p>
22876 !! end
22877
22878 !! test
22879 Language converter tricky html2wt cases (4)
22880 !! options
22881 language=sr
22882 parsoid=html2wt,wt2wt
22883 !! html/parsoid
22884 <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>
22885 !! wikitext
22886 -{R|{{echo|hey}}}-
22887 !! html/php
22888 <p>hey
22889 </p>
22890 !! end
22891
22892 # Note that the <nowiki> escaping added by parsoid for source text,
22893 # destination text, and language names only works on the PHP side
22894 # for *destination text*. (HTML entity escaping wouldn't work
22895 # any better.) This is probably a bug, at least for source texts.
22896 # (For language names PHP uses a precise regexp based on the languages
22897 # it currently knows have variants, which is fragile since this set
22898 # can grow/shrink over time.)
22899 !! test
22900 Language converter tricky html2wt cases (5)
22901 !! options
22902 language=zh variant=zh-cn
22903 !! html/parsoid
22904 <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>
22905 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
22906 <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>
22907 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
22908 <p>a:b=>c xyz</p>
22909 !! wikitext
22910 -{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
22911
22912 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
22913
22914 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
22915
22916 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
22917
22918 a:b=>c xyz
22919 !! html/php+disabled
22920 <p>foobat;xyz=&gt;zh-cn:abc
22921 </p><p>A
22922 </p><p>0;zh-tw:bar
22923 </p><p>abc
22924 </p><p>a:b=&gt;c 0;zh-tw:bar
22925 </p>
22926 !! end
22927
22928 !! test
22929 T179579: Nowiki and lc interaction
22930 !! options
22931 parsoid=wt2html
22932 language=sr
22933 !! wikitext
22934 -{</nowiki>123}-
22935
22936 -{123<nowiki>|</nowiki>456}-
22937 !! html/parsoid
22938 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
22939
22940 <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>
22941 !! end
22942
22943 !! test
22944 T2529: Uncovered bullet
22945 !! wikitext
22946 *Foo {{bullet}}
22947 !! html
22948 <ul><li>Foo</li>
22949 <li>Bar</li></ul>
22950
22951 !! end
22952
22953 !! test
22954 T2529: Uncovered bullet in a deeply nested list
22955 !! wikitext
22956 *******Foo {{bullet}}
22957 !! html
22958 <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>
22959 <li>Bar</li></ul>
22960
22961 !! end
22962
22963 !! test
22964 T2529: Uncovered table already at line-start
22965 !! wikitext
22966 x
22967
22968 {{table}}
22969 y
22970 !! html
22971 <p>x
22972 </p>
22973 <table>
22974 <tr>
22975 <td>1</td>
22976 <td>2
22977 </td></tr>
22978 <tr>
22979 <td>3</td>
22980 <td>4
22981 </td></tr></table>
22982 <p>y
22983 </p>
22984 !! end
22985
22986 !! test
22987 T2529: Uncovered bullet in parser function result
22988 !! wikitext
22989 *Foo {{lc:{{bullet}} }}
22990 !! html
22991 <ul><li>Foo</li>
22992 <li>bar</li></ul>
22993
22994 !! end
22995
22996 !! test
22997 T7678: Double-parsed template argument
22998 !! wikitext
22999 {{lc:{{{1}}}|hello}}
23000 !! html
23001 <p>{{{1}}}
23002 </p>
23003 !! end
23004
23005 !! test
23006 T7678: Double-parsed template invocation
23007 !! wikitext
23008 {{lc:{{paramtest {{!}} param = hello }} }}
23009 !! html
23010 <p>{{paramtest | param = hello }}
23011 </p>
23012 !! end
23013
23014 !! test
23015 Case insensitivity of parser functions for non-ASCII characters (T10143)
23016 !! options
23017 language=cs
23018 title=[[Main Page]]
23019 !! wikitext
23020 {{PRVNÍVELKÉ:ěščř}}
23021 {{prvnívelké:ěščř}}
23022 {{PRVNÍMALÉ:ěščř}}
23023 {{prvnímalé:ěščř}}
23024 {{MALÁ:ěščř}}
23025 {{malá:ěščř}}
23026 {{VELKÁ:ěščř}}
23027 {{velká:ěščř}}
23028 !! html
23029 <p>Ěščř
23030 Ěščř
23031 ěščř
23032 ěščř
23033 ěščř
23034 ěščř
23035 ĚŠČŘ
23036 ĚŠČŘ
23037 </p>
23038 !! end
23039
23040 !! test
23041 Morwen/13: Unclosed link followed by heading
23042 !! wikitext
23043 [[link
23044 ==heading==
23045 !! html
23046 <p>[[link
23047 </p>
23048 <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>
23049
23050 !! end
23051
23052 !! test
23053 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23054 !! wikitext
23055 {{foo|
23056 =heading=
23057 !! html
23058 <p>{{foo|
23059 </p>
23060 <h1><span class="mw-headline" id="heading">heading</span></h1>
23061
23062 !! end
23063
23064 !! test
23065 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23066 !! wikitext
23067 {{foo|
23068 ==heading==
23069 !! html
23070 <p>{{foo|
23071 </p>
23072 <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>
23073
23074 !! end
23075
23076 !! test
23077 Tildes in comments
23078 !! options
23079 pst
23080 !! wikitext
23081 <!-- ~~~~ -->
23082 !! html/php
23083 <!-- ~~~~ -->
23084 !! end
23085
23086 !! test
23087 Paragraphs inside divs (no extra line breaks)
23088 !! wikitext
23089 <div>Line one
23090
23091 Line two</div>
23092 !! html
23093 <div>Line one
23094 Line two</div>
23095
23096 !! end
23097
23098 !! test
23099 Paragraphs inside divs (extra line break on open)
23100 !! wikitext
23101 <div>
23102 Line one
23103
23104 Line two</div>
23105 !! html
23106 <div>
23107 <p>Line one
23108 </p>
23109 Line two</div>
23110
23111 !! end
23112
23113 !! test
23114 Paragraphs inside divs (extra line break on close)
23115 !! wikitext
23116 <div>Line one
23117
23118 Line two
23119 </div>
23120 !! html
23121 <div>Line one
23122 <p>Line two
23123 </p>
23124 </div>
23125
23126 !! end
23127
23128 !! test
23129 Paragraphs inside divs (extra line break on open and close)
23130 !! wikitext
23131 <div>
23132 Line one
23133
23134 Line two
23135 </div>
23136 !! html
23137 <div>
23138 <p>Line one
23139 </p><p>Line two
23140 </p>
23141 </div>
23142
23143 !! end
23144
23145 # doBlockLevels screws up this output and Remex cleans up as much as it can.
23146 # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
23147 !! test
23148 Nesting tags, paragraphs on lines which begin with <div>
23149 !! wikitext
23150 <div></div><strong>A
23151 B</strong>
23152 !! html/php+tidy
23153 <div></div><p><strong>A
23154 </strong></p><strong></strong><p><strong>B</strong>
23155 </p>
23156 !! html/parsoid
23157 <div></div>
23158 <p><strong>A
23159 B</strong>
23160 </p>
23161 !! end
23162
23163 # T8200: <blockquote> should behave like <div> with respect to line breaks
23164 !! test
23165 T8200: paragraphs inside blockquotes (no extra line breaks)
23166 !! wikitext
23167 <blockquote>Line one
23168
23169 Line two</blockquote>
23170 !! html
23171 <blockquote>Line one
23172 Line two</blockquote>
23173
23174 !! html+tidy
23175 <blockquote><p>Line one
23176 Line two</p></blockquote>
23177 !! end
23178
23179 !! test
23180 T8200: paragraphs inside blockquotes (extra line break on open)
23181 !! wikitext
23182 <blockquote>
23183 Line one
23184
23185 Line two</blockquote>
23186 !! html
23187 <blockquote>
23188 <p>Line one
23189 </p>
23190 Line two</blockquote>
23191
23192 !! html+tidy
23193 <blockquote>
23194 <p>Line one
23195 </p><p>
23196 Line two</p></blockquote>
23197 !! end
23198
23199 # Parsoid's output is broken on this because of Tidy-compatibility cruft
23200 !! test
23201 T8200: paragraphs inside blockquotes (extra line break on close)
23202 !! wikitext
23203 <blockquote>Line one
23204
23205 Line two
23206 </blockquote>
23207 !! html
23208 <blockquote>Line one
23209 <p>Line two
23210 </p>
23211 </blockquote>
23212
23213 !! html+tidy
23214 <blockquote><p>Line one
23215 </p><p>Line two
23216 </p>
23217 </blockquote>
23218 !! end
23219
23220 !! test
23221 T8200: paragraphs inside blockquotes (extra line break on open and close)
23222 !! wikitext
23223 <blockquote>
23224 Line one
23225
23226 Line two
23227 </blockquote>
23228 !! html
23229 <blockquote>
23230 <p>Line one
23231 </p><p>Line two
23232 </p>
23233 </blockquote>
23234
23235 !! end
23236
23237 # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
23238 !! test
23239 Paragraphs inside blockquotes/divs (no extra line breaks)
23240 !! wikitext
23241 <blockquote><div>Line one
23242
23243 Line two</div></blockquote>
23244 !! html
23245 <blockquote><div>Line one
23246 Line two</div></blockquote>
23247
23248 !! end
23249
23250 !! test
23251 Paragraphs inside blockquotes/divs (extra line break on open)
23252 !! wikitext
23253 <blockquote><div>
23254 Line one
23255
23256 Line two</div></blockquote>
23257 !! html
23258 <blockquote><div>
23259 <p>Line one
23260 </p>
23261 Line two</div></blockquote>
23262
23263 !! end
23264
23265 !! test
23266 Paragraphs inside blockquotes/divs (extra line break on close)
23267 !! wikitext
23268 <blockquote><div>Line one
23269
23270 Line two
23271 </div></blockquote>
23272 !! html
23273 <blockquote><div>Line one
23274 <p>Line two
23275 </p>
23276 </div></blockquote>
23277
23278 !! end
23279
23280 !! test
23281 Paragraphs inside blockquotes/divs (extra line break on open and close)
23282 !! wikitext
23283 <blockquote><div>
23284 Line one
23285
23286 Line two
23287 </div></blockquote>
23288 !! html
23289 <blockquote><div>
23290 <p>Line one
23291 </p><p>Line two
23292 </p>
23293 </div></blockquote>
23294
23295 !! end
23296
23297 !! test
23298 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
23299 !! options
23300 wgLinkHolderBatchSize=0
23301 !! wikitext
23302 [[meatball:1]]
23303 [[meatball:2]]
23304 [[meatball:3]]
23305 !! html
23306 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
23307 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
23308 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
23309 </p>
23310 !! end
23311
23312 !! test
23313 Free external link invading image caption
23314 !! wikitext
23315 [[Image:Foobar.jpg|thumb|http://x|hello]]
23316 !! html/php
23317 <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>
23318
23319 !! html/parsoid
23320 <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>
23321 !! end
23322
23323 !! test
23324 T17196: localised external link numbers
23325 !! options
23326 language=fa
23327 !! wikitext
23328 [http://en.wikipedia.org/]
23329 !! html/php
23330 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
23331 </p>
23332 !! html/parsoid
23333 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
23334 !! end
23335
23336 !! test
23337 Multibyte character in padleft
23338 !! wikitext
23339 {{padleft:-Hello|7|Æ}}
23340 !! html/php
23341 <p>Æ-Hello
23342 </p>
23343 !! html/parsoid
23344 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
23345 !! end
23346
23347 !! test
23348 Multibyte character in padright
23349 !! wikitext
23350 {{padright:Hello-|7|Æ}}
23351 !! html/php
23352 <p>Hello-Æ
23353 </p>
23354 !! html/parsoid
23355 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
23356 !! end
23357
23358 !!test
23359 formatdate parser function
23360 !! wikitext
23361 {{#formatdate:2009-03-24}}
23362 !! html
23363 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
23364 </p>
23365 !! end
23366
23367 !!test
23368 formatdate parser function, with default format
23369 !! wikitext
23370 {{#formatdate:2009-03-24|mdy}}
23371 !! html
23372 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
23373 </p>
23374 !! end
23375
23376 !! test
23377 Spacing of numbers in formatted dates
23378 !! wikitext
23379 {{#formatdate:January 15}}
23380 !! html
23381 <p><span class="mw-formatted-date" title="01-15">January 15</span>
23382 </p>
23383 !! end
23384
23385 !! test
23386 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
23387 !! options
23388 language=nl title=[[MediaWiki:Common.css]]
23389 !! wikitext
23390 {{#formatdate:2009-03-24|dmy}}
23391 !! html
23392 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
23393 </p>
23394 !! end
23395
23396 #
23397 #
23398 #
23399
23400 #
23401 # Edit comments
23402 #
23403
23404 !! test
23405 Edit comment with link
23406 !! options
23407 comment
23408 !! wikitext
23409 I like the [[Main Page]] a lot
23410 !! html/php
23411 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
23412 !!end
23413
23414 !! test
23415 Edit comment with link and link text
23416 !! options
23417 comment
23418 !! wikitext
23419 I like the [[Main Page|best pages]] a lot
23420 !! html/php
23421 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23422 !!end
23423
23424 !! test
23425 Edit comment with link and link text with suffix
23426 !! options
23427 comment
23428 !! wikitext
23429 I like the [[Main Page|best page]]s a lot
23430 !! html/php
23431 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
23432 !!end
23433
23434 !! test
23435 Edit comment with section link (non-local, eg in history list)
23436 !! options
23437 comment title=[[Main Page]]
23438 !! wikitext
23439 /* External links */ removed bogus entries
23440 !! html/php
23441 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23442 !!end
23443
23444 !! test
23445 Edit comment with section link and text before it (non-local, eg in history list)
23446 !! options
23447 comment title=[[Main Page]]
23448 !! wikitext
23449 pre-comment text /* External links */ removed bogus entries
23450 !! html/php
23451 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>
23452 !!end
23453
23454 !! test
23455 Edit comment with section link (local, eg in diff view)
23456 !! options
23457 comment local title=[[Main Page]]
23458 !! wikitext
23459 /* External links */ removed bogus entries
23460 !! html/php
23461 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
23462 !!end
23463
23464 !! test
23465 Edit comment with subpage link (T16080)
23466 !! options
23467 comment
23468 subpage
23469 title=[[Subpage test]]
23470 !! wikitext
23471 Poked at a [[/subpage]] here...
23472 !! html/php
23473 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
23474 !!end
23475
23476 !! test
23477 Edit comment with subpage link and link text (T16080)
23478 !! options
23479 comment
23480 subpage
23481 title=[[Subpage test]]
23482 !! wikitext
23483 Poked at a [[/subpage|neat little page]] here...
23484 !! html/php
23485 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
23486 !!end
23487
23488 !! test
23489 Edit comment with bogus subpage link in non-subpage NS (T16080)
23490 !! options
23491 comment
23492 title=[[Subpage test]]
23493 !! wikitext
23494 Poked at a [[/subpage]] here...
23495 !! html/php
23496 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...
23497 !!end
23498
23499 !! test
23500 Edit comment with bare anchor link (local, as on diff)
23501 !! options
23502 comment
23503 local
23504 title=[[Main Page]]
23505 !! wikitext
23506 [[#section]]
23507 !! html/php
23508 <a href="#section">#section</a>
23509 !! end
23510
23511 !! test
23512 Edit comment with bare anchor link (non-local, as on history)
23513 !! options
23514 comment
23515 title=[[Main Page]]
23516 !! wikitext
23517 [[#section]]
23518 !! html/php
23519 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
23520 !! end
23521
23522 !! test
23523 Anchor starting with underscore
23524 !! options
23525 title=[[Foo]]
23526 !! wikitext
23527 [[#_ref|One]]
23528 !! html/php
23529 <p><a href="#_ref">One</a>
23530 </p>
23531 !! html/parsoid
23532 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
23533 !! end
23534
23535 !! test
23536 Id starting with underscore
23537 !! wikitext
23538 <div id="_ref"></div>
23539 !! html/*
23540 <div id="_ref"></div>
23541
23542 !! end
23543
23544 !! test
23545 Edit comment with link with more than one pipe (T99346)
23546 !! options
23547 comment
23548 !! wikitext
23549 [[Main Page|Many|pipes]]
23550 !! html/php
23551 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
23552 !! end
23553
23554 !! test
23555 Complex edit comment with link with more than one pipe (T99346)
23556 !! options
23557 comment
23558 !! wikitext
23559 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
23560 !! html/php
23561 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;
23562 !! end
23563
23564 !! test
23565 Space normalisation on autocomment (T24784)
23566 !! options
23567 comment
23568 title=[[Main Page]]
23569 !! wikitext
23570 /* __hello__world__ */
23571 !! html/php
23572 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
23573 !! end
23574
23575 !! test
23576 percent-encoding and + signs in comments (T28410)
23577 !! options
23578 comment
23579 !! wikitext
23580 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
23581 !! html/php
23582 <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>
23583 !! end
23584
23585 # Parsoid doesn't support this yet: see T75581
23586 # but it *should* omit the 'src' attribute if the image is bad.
23587 # PHP side of tests was disabled in
23588 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
23589 # because of issues in the PHP parserTests infrastructure
23590 # (but the output below is indeed what the PHP side emits)
23591 !! test
23592 Bad images - basic functionality
23593 !! wikitext
23594 [[File:Bad.jpg]]
23595 !! html/php+disabled
23596 !! html/parsoid
23597 <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>
23598 !! end
23599
23600 !! test
23601 Bad images - T18039: text after bad image disappears
23602 !! wikitext
23603 Foo bar
23604 [[File:Bad.jpg]]
23605 Bar foo
23606 !! html/php+disabled
23607 <p>Foo bar
23608 </p><p>Bar foo
23609 </p>
23610 !! html/parsoid
23611 <p>Foo bar
23612 <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>
23613 Bar foo</p>
23614 !! end
23615
23616 !! test
23617 Verify that displaytitle works (T24501) no displaytitle
23618 !! options
23619 showtitle
23620 !! config
23621 wgAllowDisplayTitle=true
23622 wgRestrictDisplayTitle=false
23623 !! wikitext
23624 this is not the the title
23625 !! html/php
23626 Parser test
23627 <p>this is not the the title
23628 </p>
23629 !! end
23630
23631 !! test
23632 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
23633 !! options
23634 showtitle
23635 title=[[Screen]]
23636 !! config
23637 wgAllowDisplayTitle=true
23638 wgRestrictDisplayTitle=false
23639 !! wikitext
23640 this is not the the title
23641 {{DISPLAYTITLE:whatever}}
23642 !! html/php
23643 whatever
23644 <p>this is not the the title
23645 </p>
23646 !! end
23647
23648 !! test
23649 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
23650 !! options
23651 showtitle
23652 title=[[Screen]]
23653 !! config
23654 wgAllowDisplayTitle=true
23655 wgRestrictDisplayTitle=true
23656 !! wikitext
23657 this is not the the title
23658 {{DISPLAYTITLE:whatever}}
23659 !! html/php
23660 Screen
23661 <p>this is not the the title
23662 </p>
23663 !! end
23664
23665 !! test
23666 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
23667 !! options
23668 showtitle
23669 title=[[Screen]]
23670 !! config
23671 wgAllowDisplayTitle=true
23672 wgRestrictDisplayTitle=true
23673 !! wikitext
23674 this is not the the title
23675 {{DISPLAYTITLE:screen}}
23676 !! html/php
23677 screen
23678 <p>this is not the the title
23679 </p>
23680 !! end
23681
23682 !! test
23683 Verify that displaytitle works (T24501) AllowDisplayTitle=false
23684 !! options
23685 showtitle
23686 title=[[Screen]]
23687 !! config
23688 wgAllowDisplayTitle=false
23689 !! wikitext
23690 this is not the the title
23691 {{DISPLAYTITLE:screen}}
23692 !! html/php
23693 Screen
23694 <p>this is not the the title
23695 <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>
23696 </p>
23697 !! end
23698
23699 !! test
23700 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
23701 !! options
23702 showtitle
23703 title=[[Screen]]
23704 !! config
23705 wgAllowDisplayTitle=false
23706 !! wikitext
23707 this is not the the title
23708 !! html/php
23709 Screen
23710 <p>this is not the the title
23711 </p>
23712 !! end
23713
23714 !! test
23715 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
23716 !! options
23717 showtitle
23718 title=[[Screen]]
23719 !! config
23720 wgAllowDisplayTitle=true
23721 wgRestrictDisplayTitle=true
23722 !! wikitext
23723 this is not the the title
23724 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
23725 !! html/php
23726 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
23727 <p>this is not the the title
23728 </p>
23729 !! end
23730
23731 !! test
23732 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
23733 !! options
23734 showtitle
23735 title=[[Screen]]
23736 !! config
23737 wgAllowDisplayTitle=true
23738 wgRestrictDisplayTitle=true
23739 !! wikitext
23740 this is not the the title
23741 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
23742 !! html/php
23743 <span style="color: red;">s</span>creen
23744 <p>this is not the the title
23745 </p>
23746 !! end
23747
23748 !! test
23749 Page status indicators: Empty name is invalid
23750 !! options
23751 showindicators
23752 !! wikitext
23753 <indicator name=" "></indicator>
23754 <indicator></indicator>
23755 !! html/php
23756 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23757 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
23758 </p>
23759 !! end
23760
23761 !! test
23762 Page status indicators: Weird syntaxes that are okay
23763 !! options
23764 showindicators
23765 !! wikitext
23766 <indicator name="empty" />
23767 <indicator name="name"></indicator>
23768 !! html/php
23769 empty=
23770 name=
23771 <p><br />
23772 </p>
23773 !! end
23774
23775 !! test
23776 Page status indicators: Torture test
23777 !! options
23778 showindicators
23779 !! wikitext
23780 <indicator name="01">hello world</indicator>
23781 <indicator name="02">[[Main Page]]</indicator>
23782 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
23783 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
23784 <indicator name="05">*foo
23785 *bar</indicator>
23786 <indicator name="06"><nowiki>foo</nowiki></indicator>
23787 <indicator name="07"> Preformatted</indicator>
23788 <indicator name="08"><div>Broken tag</indicator>
23789 <indicator name="09">{| class=wikitable
23790 |cell
23791 |}</indicator>
23792 <indicator name="10">Two
23793
23794 paragraphs</indicator>
23795 !! html/php
23796 01=hello world
23797 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23798 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" />
23799 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>
23800 05=<ul><li>foo</li>
23801 <li>bar</li></ul>
23802
23803 06=foo
23804 07=<pre>Preformatted
23805 </pre>
23806 08=<div>Broken tag</div>
23807
23808 09=<table class="wikitable">
23809 <tr>
23810 <td>cell
23811 </td></tr></table>
23812
23813 10=<p>Two
23814 </p><p>paragraphs
23815 </p>
23816 <p><br />
23817 </p><p><br />
23818 </p><p><br />
23819 </p><p><br />
23820 </p><p><br />
23821 </p>
23822 !! end
23823
23824 !! test
23825 preload: check <noinclude> and <includeonly>
23826 !! options
23827 preload
23828 !! wikitext
23829 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
23830 !! html/php
23831 Hello kind world.
23832 !! end
23833
23834 !! test
23835 preload: check <onlyinclude>
23836 !! options
23837 preload
23838 !! wikitext
23839 Goodbye <onlyinclude>Hello world</onlyinclude>
23840 !! html/php
23841 Hello world
23842 !! end
23843
23844 !! test
23845 preload: can pass tags through if we want to
23846 !! options
23847 preload
23848 !! wikitext
23849 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
23850 !! html/php
23851 <includeonly>Hello world</includeonly>
23852 !! end
23853
23854 !! test
23855 preload: check that it doesn't try to do tricks
23856 !! options
23857 preload
23858 !! wikitext
23859 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23860 !! html/php
23861 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
23862 !! end
23863
23864 !! test
23865 Play a bit with r67090 and T5158
23866 !! wikitext
23867 <div style="width:50% !important">&nbsp;</div>
23868 <div style="width:50%&nbsp;!important">&nbsp;</div>
23869 <div style="width:50%&#160;!important">&nbsp;</div>
23870 <div style="border : solid;">&nbsp;</div>
23871 !! html/php
23872 <div style="width:50% !important">&#160;</div>
23873 <div style="width:50% !important">&#160;</div>
23874 <div style="width:50% !important">&#160;</div>
23875 <div style="border&#160;: solid;">&#160;</div>
23876
23877 !! html/parsoid
23878 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23879 <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>
23880 <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>
23881 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
23882
23883 !! end
23884
23885 !! test
23886 HTML5 data attributes
23887 !! wikitext
23888 <span data-foo="bar">Baz</span>
23889 <p data-abc-def_hij="">Quuz</p>
23890 !! html/php
23891 <p><span data-foo="bar">Baz</span>
23892 </p>
23893 <p data-abc-def_hij="">Quuz</p>
23894
23895 !! html/parsoid
23896 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
23897 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
23898 !! end
23899
23900 !! test
23901 Strip reserved data attributes
23902 !! wikitext
23903 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
23904 !! html/php
23905 <div data-ok="fred">d</div>
23906
23907 !! html/parsoid
23908 <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>
23909 !! end
23910
23911 !! test
23912 percent-encoding and + signs in internal links (T28410)
23913 !! wikitext
23914 [[User:+%]] [[Page+title%]]
23915 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
23916 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
23917 [[%33%45]] [[%33%45+]]
23918 !! html/php
23919 <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>
23920 <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>
23921 <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>
23922 <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>
23923 </p>
23924 !! html/parsoid
23925 <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>
23926 <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>
23927 <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>
23928 <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>
23929 !! end
23930
23931 !! test
23932 Special characters in embedded file links (T29679)
23933 !! wikitext
23934 [[File:Contains & ampersand.jpg]]
23935 [[File:Does not exist.jpg|Title with & ampersand]]
23936 !! html/php
23937 <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>
23938 <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>
23939 </p>
23940 !! html/parsoid
23941 <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>
23942 <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>
23943 !! end
23944
23945 !! test
23946 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
23947 !! wikitext
23948 Text&apos;s been normalized?
23949 !! html
23950 <p>Text&#39;s been normalized?
23951 </p>
23952 !! end
23953
23954 !! test
23955 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
23956 !! wikitext
23957 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
23958 !! html
23959 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
23960 </p>
23961 !! end
23962
23963 !! test
23964 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
23965 !! wikitext
23966 [http://www.example.org/ ideograms]
23967 !! html
23968 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
23969 </p>
23970 !! end
23971
23972 !! test
23973 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
23974 !! wikitext
23975 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
23976 !! html
23977 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
23978 </p>
23979 !! end
23980
23981 !! article
23982 Mediawiki:loop1
23983 !! text
23984 {{Identical|A}}
23985 !! endarticle
23986
23987 !! article
23988 Mediawiki:loop2
23989 !! text
23990 {{Identical|B}}
23991 !! endarticle
23992
23993 !! article
23994 Template:Identical
23995 !! text
23996 {{int:loop1}}
23997 {{int:loop2}}
23998 !! endarticle
23999
24000 !! test
24001 T33098 Template which includes system messages which includes the template
24002 !! wikitext
24003 {{Identical}}
24004 !! html
24005 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24006 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24007 </p>
24008 !! end
24009
24010 !! test
24011 T33490 Turkish: ucfirst 'blah'
24012 !! options
24013 language=tr
24014 !! wikitext
24015 {{ucfirst:blah}}
24016 !! html
24017 <p>Blah
24018 </p>
24019 !! end
24020
24021 !! test
24022 T33490 Turkish: ucfirst 'ix'
24023 !! options
24024 language=tr
24025 !! wikitext
24026 {{ucfirst:ix}}
24027 !! html
24028 <p>İx
24029 </p>
24030 !! end
24031
24032 !! test
24033 T33490 Turkish: lcfirst 'BLAH'
24034 !! options
24035 language=tr
24036 !! wikitext
24037 {{lcfirst:BLAH}}
24038 !! html
24039 <p>bLAH
24040 </p>
24041 !! end
24042
24043 !! test
24044 T33490 Turkish: ucfırst (with a dotless i)
24045 !! options
24046 language=tr
24047 !! wikitext
24048 {{ucfırst:blah}}
24049 !! html
24050 <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>
24051 </p>
24052 !! end
24053
24054 !! test
24055 T33490 ucfırst (with a dotless i) with English language
24056 !! options
24057 language=en
24058 !! wikitext
24059 {{ucfırst:blah}}
24060 !! html
24061 <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>
24062 </p>
24063 !! end
24064
24065 # Note that Parsoid doesn't emit an explicit TOC.
24066 # Note also that the html2wt direction tends to emit an extra newline
24067 # between the __TOC__ magicword and the first heading unless *both*
24068 # the <meta> and the <h2> have a data-parsoid attribute set (even if
24069 # it's "{}").
24070
24071 !! test
24072 T28375: TOC with italics
24073 !! options
24074 title=[[Main Page]]
24075 !! wikitext
24076 __TOC__
24077 ==''Lost'' episodes==
24078 !! html/php
24079 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24080 <ul>
24081 <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>
24082 </ul>
24083 </div>
24084
24085 <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>
24086
24087 !! html/parsoid
24088 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24089 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
24090 !! end
24091
24092 !! test
24093 T28375: TOC with bold
24094 !! options
24095 title=[[Main Page]]
24096 !! wikitext
24097 __TOC__
24098 =='''should be bold''' then normal text==
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="#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>
24103 </ul>
24104 </div>
24105
24106 <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>
24107
24108 !! html/parsoid
24109 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24110 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
24111 !! end
24112
24113 !! test
24114 T35845: Headings become cursive in TOC when they contain an image
24115 !! options
24116 title=[[Main Page]]
24117 !! wikitext
24118 __TOC__
24119 ==Image [[Image:foobar.jpg]]==
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="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
24124 </ul>
24125 </div>
24126
24127 <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>
24128
24129 !! html/parsoid
24130 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24131 <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>
24132 !! end
24133
24134 !! test
24135 T35845 (2): Headings become bold in TOC when they contain a blockquote
24136 !! options
24137 title=[[Main Page]]
24138 !! wikitext
24139 __TOC__
24140 ==<blockquote>Quote</blockquote>==
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="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24145 </ul>
24146 </div>
24147
24148 <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>
24149
24150 !! html/php+tidy
24151 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24152 <ul>
24153 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
24154 </ul>
24155 </div>
24156
24157 <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>
24158 !! html/parsoid
24159 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24160 <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
24161 !! end
24162
24163 !! test
24164 Unclosed tags in TOC
24165 !! config
24166 wgFragmentMode=[ 'html5', 'legacy' ]
24167 !! options
24168 title=[[Main Page]]
24169 !! wikitext
24170 __TOC__
24171 ==Proof: 2 < 3==
24172 <small>Hanc marginis exiguitas non caperet.</small>
24173 QED
24174 !! html/php
24175 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24176 <ul>
24177 <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>
24178 </ul>
24179 </div>
24180
24181 <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>
24182 <p><small>Hanc marginis exiguitas non caperet.</small>
24183 QED
24184 </p>
24185 !! html/parsoid
24186 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24187 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
24188 <p><small>Hanc marginis exiguitas non caperet.</small>
24189 QED</p>
24190 !! end
24191
24192 !! test
24193 Multiple tags in TOC
24194 !! wikitext
24195 __TOC__
24196 ==<i>Foo</i> <b>Bar</b>==
24197
24198 ==<i>Foo</i> <blockquote>Bar</blockquote>==
24199 !! html/php
24200 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24201 <ul>
24202 <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>
24203 <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>
24204 </ul>
24205 </div>
24206
24207 <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>
24208 <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>
24209
24210 !! html/php+tidy
24211 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24212 <ul>
24213 <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>
24214 <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>
24215 </ul>
24216 </div>
24217
24218 <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>
24219 <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>
24220 !! html/parsoid
24221 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24222 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
24223
24224 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
24225 !! end
24226
24227 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
24228 # html5 tag parsing.
24229 !! test
24230 Tags with parameters in TOC
24231 !! options
24232 parsoid=wt2html
24233 !! wikitext
24234 __TOC__
24235 ==<sup class="in-h2">Hello</sup>==
24236
24237 ==<sup class="a > b">Evilbye</sup>==
24238 !! html/php
24239 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24240 <ul>
24241 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
24242 <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>
24243 </ul>
24244 </div>
24245
24246 <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>
24247 <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>
24248
24249 !! html/parsoid
24250 <meta property="mw:PageProp/toc" />
24251 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
24252
24253 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
24254 !! end
24255
24256 !! test
24257 span tags with directionality in TOC
24258 !! wikitext
24259 __TOC__
24260 ==<span dir="ltr">C++</span>==
24261
24262 ==<span dir="rtl">זבנג!</span>==
24263
24264 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
24265
24266 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
24267
24268 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
24269 !! html/php
24270 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24271 <ul>
24272 <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>
24273 <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>
24274 <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>
24275 <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>
24276 <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>
24277 </ul>
24278 </div>
24279
24280 <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>
24281 <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>
24282 <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>
24283 <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>
24284 <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>
24285
24286 !! html/parsoid
24287 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24288 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
24289 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
24290 <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>
24291 <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>
24292 <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>
24293 !! end
24294
24295 !! test
24296 T74884: bdi element in ToC
24297 !! wikitext
24298 __TOC__
24299 ==<bdi>test</bdi>==
24300 !! html/php
24301 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24302 <ul>
24303 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
24304 </ul>
24305 </div>
24306
24307 <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>
24308
24309 !! html/parsoid
24310 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24311 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
24312 !! end
24313
24314 !! test
24315 T35715: s/strike element in ToC
24316 !! wikitext
24317 __TOC__
24318 ==<s>test</s> test <strike>test</strike>==
24319 !! html/php
24320 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24321 <ul>
24322 <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>
24323 </ul>
24324 </div>
24325
24326 <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>
24327
24328 !! html/parsoid
24329 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24330 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
24331 !! end
24332
24333 !! test
24334 Empty <p> tag in TOC, removed by Sanitizer (T92892)
24335 !! wikitext
24336 __TOC__
24337 ==x==
24338 !! html/php
24339 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
24340 <ul>
24341 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
24342 </ul>
24343 </div>
24344
24345 <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>
24346
24347 !! html/parsoid
24348 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
24349 <h2 id="x" data-parsoid='{}'>x</h2>
24350 !! end
24351
24352 !! article
24353 MediaWiki:T34057
24354 !! text
24355 == {{int:headline_sample}} ==
24356 !! endarticle
24357
24358 !! test
24359 T34057: Title needed when expanding <h> nodes.
24360 !! options
24361 title=[[Main Page]]
24362 !! wikitext
24363 {{int:T34057}}
24364 !! html
24365 <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>
24366
24367 !! end
24368
24369 !! test
24370 Strip marker in urlencode
24371 !! wikitext
24372 {{urlencode:x<nowiki/>y}}
24373 {{urlencode:x<nowiki/>y|wiki}}
24374 {{urlencode:x<nowiki/>y|path}}
24375 {{urlencode:x<pre id="one">two</pre>y}}
24376 !! html/php
24377 <p>xy
24378 xy
24379 xy
24380 xy
24381 </p>
24382 !! end
24383
24384 !! test
24385 Strip marker in lc
24386 !! wikitext
24387 {{lc:x<nowiki/>y}}
24388 !! html
24389 <p>xy
24390 </p>
24391 !! end
24392
24393 !! test
24394 Strip marker in uc
24395 !! wikitext
24396 {{uc:x<nowiki/>y}}
24397 !! html
24398 <p>XY
24399 </p>
24400 !! end
24401
24402 !! test
24403 Strip marker in formatNum
24404 !! wikitext
24405 {{formatnum:1<nowiki/>2}}
24406 {{formatnum:1<nowiki/>2|R}}
24407 !! html
24408 <p>12
24409 12
24410 </p>
24411 !! end
24412
24413 !! test
24414 Check noCommafy in formatNum
24415 !! options
24416 language=be-tarask
24417 !! wikitext
24418 {{formatnum:123456.78}}
24419 {{formatnum:123456.78|NOSEP}}
24420 !! html
24421 <p>123 456,78
24422 123456.78
24423 </p>
24424 !! end
24425
24426 !! test
24427 Wrong option for formatNum (T58199)
24428 !! wikitext
24429 {{formatnum:1,234.56|Random}}
24430 {{formatnum:1,234.56|EVERYTHING}}
24431 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
24432 !! html
24433 <p>1,234.56
24434 1,234.56
24435 1,234.56
24436 </p>
24437 !! end
24438
24439 !! test
24440 Strip marker in grammar
24441 !! options
24442 language=fi
24443 !! wikitext
24444 {{grammar:elative|foo<nowiki/>bar}}
24445 !! html
24446 <p>foobarista
24447 </p>
24448 !! end
24449
24450 !! test
24451 Strip marker in padleft
24452 !! wikitext
24453 {{padleft:|2|x<nowiki/>y}}
24454 !! html
24455 <p>xy
24456 </p>
24457 !! end
24458
24459 !! test
24460 Strip marker in padright
24461 !! wikitext
24462 {{padright:|2|x<nowiki/>y}}
24463 !! html
24464 <p>xy
24465 </p>
24466 !! end
24467
24468 !! test
24469 Strip marker in anchorencode
24470 !! wikitext
24471 {{anchorencode:x<nowiki/>y}}
24472 !! html/php
24473 <p>xy
24474 </p>
24475 !! html/parsoid
24476 <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>
24477 !! end
24478
24479 !! test
24480 nowiki inside link inside heading (T20295)
24481 !! wikitext
24482 ==[[foo|x<nowiki>y</nowiki>z]]==
24483 !! html
24484 <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>
24485
24486 !! end
24487
24488 !! test
24489 new support for bdi element (T33817)
24490 !! wikitext
24491 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24492 !! html
24493 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
24494
24495 !!end
24496
24497 !! test
24498 Ignore pipe between table row attributes
24499 !! wikitext
24500 {|
24501 |quux
24502 |- id=foo | style='color: red'
24503 |bar
24504 |}
24505 !! html
24506 <table>
24507 <tr>
24508 <td>quux
24509 </td></tr>
24510 <tr id="foo" style="color: red">
24511 <td>bar
24512 </td></tr></table>
24513
24514 !! end
24515
24516 !!test
24517 Language parser function
24518 !! wikitext
24519 {{#language:ar}}
24520 !! html
24521 <p>العربية
24522 </p>
24523 !! end
24524
24525 !!test
24526 Padleft and padright (default 0-padding)
24527 !! wikitext
24528 {{padleft:xyz|5}}
24529 {{padright:xyz|5}}
24530 !! html/php
24531 <p>00xyz
24532 xyz00
24533 </p>
24534 !! html/parsoid
24535 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
24536 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
24537 !! end
24538
24539 !!test
24540 Padleft and padright (partial fill)
24541 !! wikitext
24542 {{padleft:xyz|6|ab}}
24543 {{padright:xyz|6|ab}}
24544 !! html/php
24545 <p>abaxyz
24546 xyzaba
24547 </p>
24548 !! html/parsoid
24549 <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>
24550 <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>
24551 !! end
24552
24553 !!test
24554 Padleft and padright as substr
24555 !! wikitext
24556 {{padleft:|3|abcde}}
24557 {{padright:|3|abcde}}
24558 !! html/php
24559 <p>abc
24560 abc
24561 </p>
24562 !! html/parsoid
24563 <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>
24564 <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>
24565 !! end
24566
24567 !!test
24568 Special parser function
24569 !! wikitext
24570 {{#special:RandomPage}}
24571 {{#special:BaDtItLe}}
24572 {{#special:Foobar}}
24573 !! html
24574 <p>Special:Random
24575 Special:Badtitle
24576 Special:Foobar
24577 </p>
24578 !! end
24579
24580 !!test
24581 T36939 - Case insensitive link parsing ([HttP://])
24582 !! wikitext
24583 [HttP://MediaWiki.Org/]
24584 !! html/php
24585 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
24586 </p>
24587 !! html/parsoid
24588 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
24589 !! end
24590
24591 !!test
24592 T36939 - Case insensitive link parsing ([HttP:// title])
24593 !! wikitext
24594 [HttP://MediaWiki.Org/ MediaWiki]
24595 !! html
24596 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
24597 </p>
24598 !! end
24599
24600 !!test
24601 T36939 - Case insensitive link parsing (HttP://)
24602 !! wikitext
24603 HttP://MediaWiki.Org/
24604 !! html/php
24605 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
24606 </p>
24607 !! html/parsoid
24608 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
24609 !! end
24610
24611 !!test
24612 Disable TOC
24613 !! options
24614 notoc
24615 !! wikitext
24616 Lead
24617 ==Section 1==
24618 ==Section 2==
24619 ==Section 3==
24620 ==Section 4==
24621 ==Section 5==
24622 !! html
24623 <p>Lead
24624 </p>
24625
24626 <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>
24627 <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>
24628 <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>
24629 <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>
24630 <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>
24631
24632 !! end
24633
24634
24635 ###
24636 ### Parsoid-specific tests
24637 ### Parsoid-PHP parser incompatibilities
24638 ###
24639 !!test
24640 1. SOL-sensitive wikitext tokens as template-args
24641 !!options
24642 parsoid=wt2html,wt2wt
24643 !! wikitext
24644 {{echo|*a}}
24645 {{echo|#a}}
24646 {{echo|:a}}
24647 !! html
24648 <span about="#mwt1" typeof="mw:Transclusion">
24649 </span><ul about="#mwt1"><li>a</li>
24650 </ul>
24651 <span about="#mwt2" typeof="mw:Transclusion">
24652 </span><ol about="#mwt2"><li>a</li>
24653 </ol>
24654 <span about="#mwt3" typeof="mw:Transclusion">
24655 </span><dl about="#mwt3"><dd>a</dd>
24656 </dl>
24657 !!end
24658
24659 #### -----------------------------------------------------------------
24660 #### Parsoid-specific functionality tests
24661 #### -----------------------------------------------------------------
24662
24663 # T65642/T68749: Formatting elt fixup around images is cleaned up.
24664 # We know wt2wt will fail, but we expect selser to pass.
24665 # Due to the nature of our testing, wt2wt and selser tests will enter the
24666 # blacklist and we'll catch selser regressions based on changes to the
24667 # blacklist entries for selser tests.
24668 !! test
24669 1. Bad treebuilder fixup of formatting elt is cleaned up
24670 !! options
24671 parsoid=wt2html,wt2wt
24672 !! wikitext
24673 {|
24674 |
24675 <small>
24676 [[Image:Foobar.jpg|right|Test]]
24677 </small>
24678 |}
24679 !! html/parsoid
24680 <table>
24681 <tbody><tr><td>
24682 <small>
24683 <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>
24684 </small>
24685 </td></tr>
24686 </tbody></table>
24687 !! end
24688
24689 !! test
24690 2. Bad treebuilder fixup of formatting elt is cleaned up
24691 !! options
24692 parsoid=wt2html,wt2wt
24693 !! wikitext
24694 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
24695
24696 <small>[[Image:Foobar.jpg|right|300px]]</small>
24697 !! html/parsoid
24698
24699 <p><b>foo</b></p>
24700 <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>
24701 <p><b>bar</b></p>
24702 <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>
24703 !! end
24704
24705 !! test
24706 3. Bad treebuilder fixup of formatting elt is cleaned up
24707 !! options
24708 parsoid=wt2html,wt2wt
24709 !! wikitext
24710 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
24711 !! html/parsoid
24712 <p><small><b>foo</b></small></p>
24713 <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>
24714 <p><small><b>bar</b></small></p>
24715 !! end
24716
24717 !! test
24718 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
24719 !! options
24720 parsoid=wt2html,wt2wt
24721 !! wikitext
24722 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
24723 !! html/parsoid
24724 <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>
24725 !! end
24726
24727 #### ----------------------------------------------------------------
24728 #### Parsoid-only testing of Parsoid's impl of LST
24729 #### Not implemented yet, see
24730 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
24731 #### ----------------------------------------------------------------
24732
24733 ## We still need to support serializing the older format while content is stored.
24734 !! test
24735 LST Sections: Backwards compatibility
24736 !! options
24737 parsoid={
24738 "suppressErrors": true,
24739 "modes": ["html2wt"]
24740 }
24741 !! wikitext
24742 <section begin="2011-05-16" />
24743 <section end="2014-04-10 (MW 1.23wmf22)" />
24744 !! html/parsoid
24745 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
24746 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
24747 !! end
24748
24749 !! test
24750 LST Sections: Newfangled approach
24751 !! wikitext
24752 <section begin="2011-05-16" />
24753 <section end="2014-04-10 (MW 1.23wmf22)" />
24754 !! html/parsoid
24755 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
24756 </span>
24757 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
24758 </span></p>
24759 !! end
24760
24761 #--------- Test stripping of empty nodes in template content ----------
24762
24763 !! test
24764 Empty LI and TR nodes should be stripped from template content
24765 !! wikitext
24766 {{EmptyLITest}}
24767 {{EmptyTRTest}}
24768 !! html/parsoid
24769 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
24770 <li>a</li>
24771 <li>b</li>
24772 </ul>
24773 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
24774 <tbody>
24775 <tr>
24776 <td>foo</td>
24777 </tr>
24778 <tr>
24779 <td>bar</td>
24780 </tr>
24781 </tbody>
24782 </table>
24783 !! end
24784
24785 !! test
24786 Empty LI and TR nodes should not be stripped from top-level content
24787 !! wikitext
24788 * a
24789 *
24790 * b
24791
24792 {|
24793 |-
24794 |-
24795 |foo
24796 |}
24797 !! html/parsoid
24798 <ul>
24799 <li> a</li>
24800 <li class='mw-empty-elt'></li>
24801 <li> b</li>
24802 </ul>
24803 <table>
24804 <tbody>
24805 <tr class='mw-empty-elt'></tr>
24806 <tr>
24807 <td>foo</td>
24808 </tr>
24809 </tbody>
24810 </table>
24811 !! end
24812
24813 !! test
24814 Empty TR nodes should not be stripped if they have any attributes set
24815 !! wikitext
24816 {{EmptyTRWithHTMLAttrTest}}
24817 !! html/parsoid
24818 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
24819 <tr align='center'></tr>
24820 <tr><td>foo</td></tr>
24821 <tr align='center'></tr>
24822 <tr><td>bar</td></tr>
24823 </table>
24824 !! end
24825
24826 #### ----------------------------------------------------------------
24827 #### The following section of tests are primarily to test
24828 #### wikitext escaping capabilities of Parsoid. Given that
24829 #### escaping can be done any number of ways, the wikitext (input)
24830 #### is always adjusted to reflect how Parsoid adds nowiki
24831 #### escape tags.
24832 ####
24833 #### We are marking several tests as parsoid-only since the
24834 #### HTML in the result section is different from what the
24835 #### PHP parser generates for it.
24836 #### ----------------------------------------------------------------
24837
24838
24839 #### --------------- Headings ---------------
24840 #### 0. Unnested
24841 #### 1. Nested inside html <h1>=foo=</h1>
24842 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
24843 #### 3. Nested inside html with wikitext split by html tags
24844 #### 4. No escape needed
24845 #### 5. Empty headings <h1></h1>
24846 #### 6. Heading chars in SOL context
24847 #### ----------------------------------------
24848 !! test
24849 Headings: 0. Unnested
24850 !! options
24851 parsoid=html2wt
24852 !! html/parsoid
24853 <p>=foo=</p>
24854
24855 <p> =foo=
24856 <!--cmt-->
24857 =foo=</p>
24858
24859 <p>=foo<i>a</i>=</p>
24860 !! wikitext
24861 <nowiki>=foo=</nowiki>
24862
24863 <nowiki> </nowiki>=foo=
24864 <!--cmt-->
24865 <nowiki>=foo=</nowiki>
24866
24867 =foo''a''<nowiki>=</nowiki>
24868 !!end
24869
24870 # New headings and existing headings are handled differently
24871 !! test
24872 Headings: 1. Nested inside html
24873 !! options
24874 parsoid=html2wt
24875 !! html/parsoid
24876 <h1>=foo=</h1>
24877 <h2>=foo=</h2>
24878 <h3>=foo=</h3>
24879
24880 <h1 data-parsoid=''>=foo=</h1>
24881 <h2 data-parsoid=''>=foo=</h2>
24882 <h3 data-parsoid=''>=foo=</h3>
24883 <h4 data-parsoid=''>=foo=</h4>
24884 <h5 data-parsoid=''>=foo=</h5>
24885 <h6 data-parsoid=''>=foo=</h6>
24886 !! wikitext
24887 = =foo= =
24888
24889 == =foo= ==
24890
24891 === =foo= ===
24892
24893 =<nowiki>=foo=</nowiki>=
24894 ==<nowiki>=foo=</nowiki>==
24895 ===<nowiki>=foo=</nowiki>===
24896 ====<nowiki>=foo=</nowiki>====
24897 =====<nowiki>=foo=</nowiki>=====
24898 ======<nowiki>=foo=</nowiki>======
24899
24900 !!end
24901
24902 !! test
24903 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
24904 !! options
24905 parsoid=html2wt
24906 !! html/parsoid
24907 <h1>foo</h1>*bar
24908 <h1>foo</h1>=bar
24909 <h1>foo</h1>=bar=
24910 !! wikitext
24911 = foo =
24912 <nowiki>*</nowiki>bar
24913
24914 = foo =
24915 =bar
24916
24917 = foo =
24918 <nowiki>=bar=</nowiki>
24919 !!end
24920
24921 !! test
24922 Headings: 3. Nested inside html with wikitext split by html tags
24923 !! options
24924 parsoid=html2wt
24925 !! html/parsoid
24926 <h1>=<b>bold</b>foo=</h1>
24927 !! wikitext
24928 = ='''bold'''foo= =
24929 !!end
24930
24931 !! test
24932 Headings: 4a. No escaping needed (testing just h1 and h2)
24933 !! options
24934 parsoid=html2wt
24935 !! html/parsoid
24936 <h1>=foo</h1>
24937 <h1>foo=</h1>
24938 <h1> =foo= </h1>
24939 <h1>=foo= bar</h1>
24940 <h2>=foo</h2>
24941 <h2>foo=</h2>
24942 <h1>=</h1>
24943 <h1><i>=</i>foo=</h1>
24944 !! wikitext
24945 = =foo =
24946
24947 = foo= =
24948
24949 = =foo= =
24950
24951 = =foo= bar =
24952
24953 == =foo ==
24954
24955 == foo= ==
24956
24957 = = =
24958
24959 = ''=''foo= =
24960 !!end
24961
24962 !! test
24963 Headings: 4b. No escaping needed (inside p-tags)
24964 !! options
24965 parsoid=html2wt
24966 !! html/parsoid
24967 <p>=foo= x
24968 =foo= <s></s>
24969 </p>
24970 !! wikitext
24971 =foo= x
24972 =foo= <s></s>
24973 !! html/php
24974 <p>=foo= x
24975 =foo= <s></s>
24976 </p>
24977 !!end
24978
24979 !! test
24980 Headings: 4c. Short headings (1)
24981 !! options
24982 parsoid=html2wt
24983 !! html/parsoid
24984 <p>===
24985 </p>
24986 !! wikitext
24987 <nowiki>===</nowiki>
24988 !! html/php
24989 <p>===
24990 </p>
24991 !! end
24992
24993 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
24994 !! test
24995 Headings: 4d. Short headings (2)
24996 !! options
24997 parsoid=wt2html,html2html
24998 !! wikitext
24999 =
25000 ==
25001 ===
25002 ====
25003 =====
25004 !! html/php
25005 <p>=
25006 ==
25007 </p>
25008 <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>
25009 <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>
25010 <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>
25011
25012 !! html/parsoid
25013 <p>=
25014 ==</p>
25015 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
25016 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
25017 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
25018 !! end
25019
25020 !! test
25021 Headings: 5. Empty headings
25022 !! options
25023 parsoid=html2wt
25024 !! html/parsoid
25025 <h1 data-parsoid='{}'></h1>
25026
25027 <h2 data-parsoid='{}'></h2>
25028
25029 <h3 data-parsoid='{}'></h3>
25030
25031 <h4 data-parsoid='{}'></h4>
25032
25033 <h5 data-parsoid='{}'></h5>
25034
25035 <h6 data-parsoid='{}'></h6>
25036 !! wikitext
25037 =<nowiki/>=
25038
25039 ==<nowiki/>==
25040
25041 ===<nowiki/>===
25042
25043 ====<nowiki/>====
25044
25045 =====<nowiki/>=====
25046
25047 ======<nowiki/>======
25048 !!end
25049
25050 !! test
25051 Headings: 6a. Heading chars in SOL context (with trailing spaces)
25052 !! options
25053 parsoid=html2wt
25054 !! html/parsoid
25055 <p>=a=</p>
25056
25057 <p>=a=</p>
25058
25059 <p>=a=</p>
25060 !! wikitext
25061 <nowiki>=a=</nowiki>
25062
25063 <nowiki>=a=</nowiki>
25064
25065 <nowiki>=a=</nowiki>
25066 !!end
25067
25068 !! test
25069 Headings: 6b. Heading chars in SOL context (with trailing newlines)
25070 !! options
25071 parsoid=html2wt
25072 !! html/parsoid
25073 <p>=a=
25074 b</p>
25075
25076 <p>=a=
25077 b</p>
25078
25079 <p>=a=
25080 b</p>
25081 !! wikitext
25082 <nowiki>=a=</nowiki>
25083 b
25084
25085 <nowiki>=a=</nowiki>
25086 b
25087
25088 <nowiki>=a=</nowiki>
25089 b
25090 !!end
25091
25092 !! test
25093 Headings: 6c. Heading chars in SOL context (leading newline break)
25094 !! options
25095 parsoid=html2wt
25096 !! html/parsoid
25097 <p>a
25098 =b=</p>
25099 !! wikitext
25100 a
25101 <nowiki>=b=</nowiki>
25102 !!end
25103
25104 !! test
25105 Headings: 6d. Heading chars in SOL context (with interspersed comments)
25106 !! options
25107 parsoid=html2wt
25108 !! html/parsoid
25109 <!--c0--><p>=a=</p>
25110
25111 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
25112 !! wikitext
25113 <!--c0--><nowiki>=a=</nowiki>
25114
25115 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
25116 !!end
25117
25118 !! test
25119 Headings: 6d. Heading chars in SOL context (No escaping needed)
25120 !! options
25121 parsoid=html2wt
25122 !! html/parsoid
25123 =a=<div>b</div>
25124 !! wikitext
25125 =a=<div>b</div>
25126 !!end
25127
25128 !! test
25129 Headings: 7. Insert a newline between new content and headings
25130 !! options
25131 parsoid=html2wt
25132 !! html/parsoid
25133 <h2>NEW</h2>
25134 <p>new</p>
25135 <h2 data-parsoid='{}'>A</h2>
25136 <p data-parsoid='{}'>a</p>
25137 !! wikitext
25138 == NEW ==
25139 new
25140
25141 ==A==
25142 a
25143
25144 !! end
25145
25146 !! test
25147 Headings: Used as horizontal rule
25148 !! config
25149 wgFragmentMode=[ 'html5', 'legacy' ]
25150 !! options
25151 parsoid=wt2html
25152 !! wikitext
25153 ===============
25154 !! html/php
25155 <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>
25156
25157 !! html/parsoid
25158 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
25159 !! end
25160
25161 #### --------------- Lists ---------------
25162 #### 0. Outside nests (*foo, etc.)
25163 #### 1. Nested inside html <ul><li>*foo</li></ul>
25164 #### 2. Inside definition lists
25165 #### 3. Only bullets at start should be escaped
25166 #### 4. No escapes needed
25167 #### 5. No unnecessary escapes
25168 #### 6. Escape bullets in SOL position
25169 #### 7. Escape bullets in a multi-line context
25170 #### ----------------------------------------
25171
25172 !! test
25173 Lists: 0. Outside nests
25174 !! options
25175 parsoid=html2wt
25176 !! html/parsoid
25177 <p>*foo</p>
25178
25179 <p>#foo</p>
25180
25181 <p>;Foo:bar</p>
25182 !! wikitext
25183 <nowiki>*</nowiki>foo
25184
25185 <nowiki>#</nowiki>foo
25186
25187 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
25188 !!end
25189
25190 ## Making these next 3 tests Parsoid-only since they are html2wt tests
25191 ## to test wikitext escaping, and insignificant whitespace diffs
25192 ## cause PHP parser tests to barf
25193 !! test
25194 Lists: 1. Nested inside html (No unnecessary escapes)
25195 !! options
25196 parsoid=html2wt
25197 !! html/parsoid
25198 <ul>
25199 <li>*foo</li>
25200 <li>#foo</li>
25201 <li>:foo</li>
25202 <li>;foo</li>
25203 <li data-parsoid='{}'>*foo</li>
25204 <li data-parsoid='{}'>#foo</li>
25205 <li data-parsoid='{}'>:foo</li>
25206 <li data-parsoid='{}'>;foo</li>
25207 </ul>
25208
25209 <ol>
25210 <li>*foo</li>
25211 <li>#foo</li>
25212 <li>:foo</li>
25213 <li>;foo</li>
25214 <li data-parsoid='{}'>*foo</li>
25215 <li data-parsoid='{}'>#foo</li>
25216 <li data-parsoid='{}'>:foo</li>
25217 <li data-parsoid='{}'>;foo</li>
25218 </ol>
25219 !! wikitext
25220 * *foo
25221 * #foo
25222 * :foo
25223 * ;foo
25224 *<nowiki>*foo</nowiki>
25225 *<nowiki>#foo</nowiki>
25226 *<nowiki>:foo</nowiki>
25227 *<nowiki>;foo</nowiki>
25228
25229 # *foo
25230 # #foo
25231 # :foo
25232 # ;foo
25233 #<nowiki>*foo</nowiki>
25234 #<nowiki>#foo</nowiki>
25235 #<nowiki>:foo</nowiki>
25236 #<nowiki>;foo</nowiki>
25237 !!end
25238
25239 !! test
25240 Lists: 2. Inside definition lists
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <dl><dt>;foo</dt></dl>
25245 <dl><dt>:foo</dt></dl>
25246 <dl><dt>:foo</dt>
25247 <dd>bar</dd></dl>
25248 <dl><dd>:foo</dd></dl>
25249 !! wikitext
25250 ; ;foo
25251
25252 ; <nowiki>:foo</nowiki>
25253
25254 ; <nowiki>:foo</nowiki>
25255 : bar
25256
25257 : :foo
25258 !!end
25259
25260 !! test
25261 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
25262 !! options
25263 parsoid=html2wt
25264 !! html/parsoid
25265 <ul>
25266 <li>*foo*bar</li>
25267 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
25268 </ul>
25269 !! wikitext
25270 * *foo*bar
25271 *<nowiki>*foo</nowiki>''it''*bar
25272 !!end
25273
25274 !! test
25275 Lists: 4. No escapes needed
25276 !! options
25277 parsoid=html2wt
25278 !! html/parsoid
25279 <ul>
25280 <li>foo*bar
25281 </li>
25282 </ul>
25283 <ul>
25284 <li><i>foo</i>*bar
25285 </li>
25286 </ul>
25287 <ul>
25288 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
25289 </li>
25290 </ul>
25291 <ul>
25292 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
25293 </li>
25294 </ul>
25295 !! wikitext
25296 *foo*bar
25297
25298 *''foo''*bar
25299
25300 *[[Foo]]: bar
25301
25302 *[[Foo]]*bar
25303 !!end
25304
25305 !! test
25306 Lists: 5. No unnecessary escapes
25307 !! options
25308 parsoid=html2wt
25309 !! html/parsoid
25310 <ul><li> bar <span>[[foo]]</span></li></ul>
25311 <ul><li> =bar <span>[[foo]]</span></li></ul>
25312 <ul><li> [[bar <span>[[foo]]</span></li></ul>
25313 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
25314 <ul><li> =bar <span>foo]]</span>=</li></ul>
25315 <ul><li> <s></s>: a</li></ul>
25316 <ul><li> <i>* foo</i></li></ul>
25317
25318 !! wikitext
25319 * bar <span><nowiki>[[foo]]</nowiki></span>
25320
25321 * =bar <span><nowiki>[[foo]]</nowiki></span>
25322
25323 * [[bar <span><nowiki>[[foo]]</nowiki></span>
25324
25325 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
25326
25327 * =bar <span>foo]]</span>=
25328
25329 * <s></s>: a
25330
25331 * ''* foo''
25332 !!end
25333
25334 !! test
25335 Lists: 6. Escape bullets in SOL position
25336 !! options
25337 parsoid=html2wt
25338 !! html/parsoid
25339 <p><!--cmt-->*foo</p>
25340 !! wikitext
25341 <!--cmt--><nowiki>*</nowiki>foo
25342 !!end
25343
25344 !! test
25345 Lists: 7. Escape bullets in a multi-line context
25346 !! options
25347 parsoid=html2wt
25348 !! html/parsoid
25349 <p>a
25350 *b
25351 </p>
25352 !! wikitext
25353 a
25354 <nowiki>*</nowiki>b
25355 !!end
25356
25357 !! test
25358 Lists: 8. Escape colons only if not present in tags
25359 !! options
25360 parsoid=html2wt
25361 !! html/parsoid
25362 <dl><dt>a:b<i>c:d</i></dt></dl>
25363 !! wikitext
25364 ; <nowiki>a:b</nowiki>''c:d''
25365 !! end
25366
25367 #### --------------- HRs ---------------
25368 #### 1. Single line
25369 #### -----------------------------------
25370
25371 !! test
25372 HRs: 1. Single line
25373 !! options
25374 parsoid=html2wt
25375 !! html/parsoid
25376 <hr />----
25377 <hr />=foo=
25378 <hr />*foo
25379 !! wikitext
25380 ----<nowiki>----</nowiki>
25381 ----=foo=
25382 ----*foo
25383 !! end
25384
25385 #### --------------- Tables ---------------
25386 #### 1a. Simple example
25387 #### 1b. No escaping needed (!foo)
25388 #### 1c. No escaping needed (|foo)
25389 #### 1d. No escaping needed (|}foo)
25390 ####
25391 #### 2a. Nested in td (<td>foo|bar</td>)
25392 #### 2b. Nested in td (<td>foo||bar</td>)
25393 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
25394 ####
25395 #### 3a. Nested in th (<th>foo!bar</th>)
25396 #### 3b. Nested in th (<th>foo!!bar</th>)
25397 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
25398 ####
25399 #### 4a. Escape -
25400 #### 4b. Escape +
25401 #### 4c. No escaping needed
25402 #### --------------------------------------
25403
25404 !! test
25405 Tables: 1a. Simple example
25406 !! options
25407 parsoid=html2wt
25408 !! html/parsoid
25409 <p>{|
25410 |}
25411 </p>
25412 !! wikitext
25413 <nowiki>{|</nowiki>
25414 |}
25415 !! end
25416
25417 !! test
25418 Tables: 1b. No escaping needed
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <p>!foo
25423 </p>
25424 !! wikitext
25425 !foo
25426 !! end
25427
25428 !! test
25429 Tables: 1c. No escaping needed
25430 !! options
25431 parsoid=html2wt
25432 !! html/parsoid
25433 <p>|foo
25434 </p>
25435 !! wikitext
25436 |foo
25437 !! end
25438
25439 !! test
25440 Tables: 1d. No escaping needed
25441 !! options
25442 parsoid=html2wt
25443 !! html/parsoid
25444 <p>|}foo
25445 </p>
25446 !! wikitext
25447 |}foo
25448 !! end
25449
25450 !! test
25451 Tables: 2a. Nested in td
25452 !! options
25453 parsoid=html2wt
25454 !! html/parsoid
25455 <table><tbody><tr>
25456 <td>foo|bar</td></tr>
25457 <tr><td>x<div>a|b</div></td>
25458 </tbody></table>
25459 !! wikitext
25460 {|
25461 |<nowiki>foo|bar</nowiki>
25462 |-
25463 |x<div><nowiki>a|b</nowiki></div>
25464 |}
25465 !! html/php+tidy
25466 <table>
25467 <tbody><tr>
25468 <td>foo|bar
25469 </td></tr>
25470 <tr>
25471 <td>x<div>a|b</div>
25472 </td></tr></tbody></table>
25473 !! end
25474
25475 !! test
25476 Tables: 2b. Nested in td
25477 !! options
25478 parsoid=html2wt
25479 !! html/parsoid
25480 <table><tbody><tr>
25481 <td>foo||bar</td>
25482 <td>a<i>b||c</i></td>
25483 <td>a<i><div>b||c</div></i></td>
25484 </tr></tbody></table>
25485 !! wikitext
25486 {|
25487 |<nowiki>foo||bar</nowiki>
25488 |a''<nowiki>b||c</nowiki>''
25489 |a''<div><nowiki>b||c</nowiki></div>''
25490 |}
25491 !! html/php
25492 <table>
25493 <tr>
25494 <td>foo||bar
25495 </td>
25496 <td>a<i>b||c</i>
25497 </td>
25498 <td>a<i><div>b||c</div></i>
25499 </td></tr></table>
25500
25501 !! end
25502
25503 !! test
25504 Tables: 2c. Nested in td -- no escaping needed
25505 !! options
25506 parsoid=html2wt
25507 !! html/*
25508 <table>
25509 <tr>
25510 <td>foo!!bar
25511 </td></tr></table>
25512
25513 !! wikitext
25514 {|
25515 |foo!!bar
25516 |}
25517 !! end
25518
25519 !! test
25520 Tables: 3a. Nested in th
25521 !! options
25522 parsoid=html2wt
25523 !! html/*
25524 <table>
25525 <tr>
25526 <th>foo!bar
25527 </th></tr></table>
25528
25529 !! wikitext
25530 {|
25531 !foo!bar
25532 |}
25533 !! end
25534
25535 !! test
25536 Tables: 3b. Nested in th
25537 !! options
25538 parsoid=html2wt
25539 !! html/parsoid
25540 <table><tbody>
25541 <tr><th>foo!!bar</th>
25542 <th><i>foo|bar</i></th>
25543 <th><i>foo!!bar</i></th>
25544 <th><i><span>foo!!bar</span></i></th>
25545 </tr></tbody></table>
25546 !! wikitext
25547 {|
25548 !<nowiki>foo!!bar</nowiki>
25549 !''<nowiki>foo|bar</nowiki>''
25550 !''<nowiki>foo!!bar</nowiki>''
25551 !''<span><nowiki>foo!!bar</nowiki></span>''
25552 |}
25553 !! html/php
25554 <table>
25555 <tr>
25556 <th>foo!!bar
25557 </th>
25558 <th><i>foo|bar</i>
25559 </th>
25560 <th><i>foo!!bar</i>
25561 </th>
25562 <th><i><span>foo!!bar</span></i>
25563 </th></tr></table>
25564
25565 !! end
25566
25567 !! test
25568 Tables: 3c. Nested in th
25569 !! options
25570 parsoid=html2wt
25571 !! html/parsoid
25572 <table><tbody>
25573 <tr><th>foo||bar</th>
25574 <th><span typeof="mw:Nowiki">foo||bar</span></th>
25575 </tr></tbody></table>
25576 !! wikitext
25577 {|
25578 !<nowiki>foo||bar</nowiki>
25579 !<nowiki>foo||bar</nowiki>
25580 |}
25581 !! html/php
25582 <table>
25583 <tr>
25584 <th>foo||bar
25585 </th>
25586 <th>foo||bar
25587 </th></tr></table>
25588
25589 !! end
25590
25591 !! test
25592 Tables: 4a. Escape -
25593 !! options
25594 parsoid=html2wt
25595 !! html/*
25596 <table>
25597 <tr>
25598 <th>-bar
25599 </th></tr>
25600 <tr>
25601 <td>-bar
25602 </td></tr></table>
25603
25604 !! wikitext
25605 {|
25606 !-bar
25607 |-
25608 |<nowiki>-bar</nowiki>
25609 |}
25610 !! end
25611
25612 !! test
25613 Tables: 4b. Escape +
25614 !! options
25615 parsoid=html2wt
25616 !! html/*
25617 <table>
25618 <tr>
25619 <th>+bar
25620 </th></tr>
25621 <tr>
25622 <td>+bar
25623 </td></tr></table>
25624
25625 !! wikitext
25626 {|
25627 !+bar
25628 |-
25629 |<nowiki>+bar</nowiki>
25630 |}
25631 !! end
25632
25633 !! test
25634 Tables: 4c. No escaping needed
25635 !! options
25636 parsoid=html2wt
25637 !! html/parsoid
25638 <table><tbody>
25639 <tr><td>foo-bar</td><td>foo+bar</td></tr>
25640 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
25641 <tr><td>foo
25642 <p>bar|baz
25643 +bar
25644 -bar</p></td></tr>
25645 <tr><td>x
25646 <div>a|b</div></td>
25647 </tbody></table>
25648 !! wikitext
25649 {|
25650 |foo-bar
25651 |foo+bar
25652 |-
25653 |''foo''-bar
25654 |''foo''+bar
25655 |-
25656 |foo
25657 bar|baz
25658 +bar
25659 -bar
25660 |-
25661 |x
25662 <div>a|b</div>
25663 |}
25664 !! html/php
25665 <table>
25666 <tr>
25667 <td>foo-bar
25668 </td>
25669 <td>foo+bar
25670 </td></tr>
25671 <tr>
25672 <td><i>foo</i>-bar
25673 </td>
25674 <td><i>foo</i>+bar
25675 </td></tr>
25676 <tr>
25677 <td>foo
25678 <p>bar|baz
25679 +bar
25680 -bar
25681 </p>
25682 </td></tr>
25683 <tr>
25684 <td>x
25685 <div>a|b</div>
25686 </td></tr></table>
25687
25688 !! end
25689
25690 !! test
25691 Tables: 4d. No escaping needed
25692 !! options
25693 parsoid=html2wt
25694 !! html/parsoid
25695 <table>
25696 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
25697 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
25698 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
25699 </tbody></table>
25700 !! wikitext
25701 {|
25702 |[[Foo]]-bar
25703 ||+1
25704 ||-2
25705 |}
25706 !! html/php
25707 <table>
25708 <tr>
25709 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
25710 </td>
25711 <td>+1
25712 </td>
25713 <td>-2
25714 </td></tr></table>
25715
25716 !! end
25717
25718 !! test
25719 T97430: Don't emit empty nowiki pairs around marker meta tags
25720 !! options
25721 parsoid=html2wt
25722 !! html/parsoid
25723 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25724 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
25725 !! wikitext
25726 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
25727 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
25728 !! end
25729
25730 !! test
25731 Unclosed xmlish element in table line shouldn't eat end delimiters
25732 !! options
25733 parsoid=html2wt
25734 !! html/parsoid
25735 <table>
25736 <tbody><tr><td> &lt;foo</td>
25737 <td> bar></td></tr>
25738 </tbody></table>
25739 !! wikitext
25740 {|
25741 | <foo
25742 | bar>
25743 |}
25744 !! html/php
25745 <table>
25746 <tr>
25747 <td>&lt;foo
25748 </td>
25749 <td>bar&gt;
25750 </td></tr></table>
25751
25752 !! end
25753
25754 #### --------------- Links ----------------
25755 #### 1. Quote marks in link text
25756 #### 2. Wikilinks: Escapes needed
25757 #### 3. Wikilinks: No escapes needed
25758 #### 4. Extlinks: Escapes needed
25759 #### 5. Extlinks: No escapes needed
25760 #### --------------------------------------
25761 !! test
25762 Links 1. WikiLinks: No escapes needed
25763 !! options
25764 parsoid=html2wt
25765 !! html/parsoid
25766 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
25767 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
25768 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
25769 !! wikitext
25770 [[Foo|Foo''boo'']]
25771 [[Foo|[Foobar]]]
25772 [[Foo|x [Foobar] x]]
25773 !! html/php
25774 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
25775 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
25776 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
25777 </p>
25778 !! end
25779
25780 !! test
25781 Links 2. WikiLinks: Escapes needed
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
25786 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
25787 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
25788 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
25789 <a href="Foo" rel="mw:WikiLink">|Bar</a>
25790 <a href="Foo" rel="mw:WikiLink">]]bar</a>
25791 <a href="Foo" rel="mw:WikiLink">[[bar</a>
25792 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
25793 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
25794 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
25795 !! wikitext
25796 [[Foo|<nowiki>Foobar]</nowiki>]]
25797 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
25798 [[Foo|<nowiki>[[Bar]]</nowiki>]]
25799 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
25800 [[Foo|<nowiki>|Bar</nowiki>]]
25801 [[Foo|<nowiki>]]bar</nowiki>]]
25802 [[Foo|<nowiki>[[bar</nowiki>]]
25803 [[Foo|<nowiki>x [[ y</nowiki>]]
25804 [[Foo|<nowiki>x ]] y</nowiki>]]
25805 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
25806 !! html/php
25807 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
25808 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
25809 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
25810 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
25811 <a href="/wiki/Foo" title="Foo">|Bar</a>
25812 <a href="/wiki/Foo" title="Foo">]]bar</a>
25813 <a href="/wiki/Foo" title="Foo">[[bar</a>
25814 <a href="/wiki/Foo" title="Foo">x [[ y</a>
25815 <a href="/wiki/Foo" title="Foo">x ]] y</a>
25816 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
25817 </p>
25818 !! end
25819
25820 !! test
25821 Links 3. WikiLinks: No escapes needed
25822 !! options
25823 parsoid=html2wt
25824 !! html/parsoid
25825 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
25826 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
25827 !! wikitext
25828 [[Foo|[Foobar]]
25829 [[Foo|foo|bar]]
25830 !! html/php
25831 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
25832 <a href="/wiki/Foo" title="Foo">foo|bar</a>
25833 </p>
25834 !! end
25835
25836 !! test
25837 Links 4. ExtLinks: Escapes needed
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
25842 <a rel="mw:ExtLink" href="http://google.com">google]</a>
25843 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
25844 <p>[http://google.com]</p>
25845 <p>[http://google.com google]</p>
25846 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
25847 <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>
25848 !! wikitext
25849 [http://google.com <nowiki>[google]</nowiki>]
25850 [http://google.com <nowiki>google]</nowiki>]
25851 [http://google.com <nowiki>goog] le</nowiki>]
25852
25853 <nowiki>[http://google.com]</nowiki>
25854
25855 <nowiki>[http://google.com google]</nowiki>
25856
25857 [http://google.com<nowiki>]</nowiki>
25858
25859 [{{echo|http://google.com}}<nowiki>]</nowiki>
25860 !! html/php
25861 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
25862 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
25863 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
25864 </p><p>[http://google.com]
25865 </p><p>[http://google.com google]
25866 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25867 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
25868 </p>
25869 !! end
25870
25871 !! test
25872 Links 5. ExtLinks: No escapes needed
25873 !! options
25874 parsoid=html2wt
25875 !! html/parsoid
25876 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
25877 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
25878 !! wikitext
25879 [http://google.com [google]
25880
25881 [[http://google.com]]
25882 !! html/php
25883 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
25884 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
25885 </p>
25886 !! end
25887
25888 !! test
25889 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
25890 !! options
25891 parsoid=html2wt
25892 !! html/parsoid
25893 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
25894 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
25895 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
25896 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
25897 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
25898 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
25899 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25900 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
25901 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
25902 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
25903 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
25904 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
25905 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
25906 </p>
25907 !! wikitext
25908 x<nowiki/>http://example.com<nowiki/>y
25909 http://example.com<nowiki/>?x
25910 http://example.com<nowiki/>&x
25911 http://example.com<nowiki/>'x
25912 http://example.com<nowiki/>,x
25913 http://example.com<nowiki/>.x
25914 http://example.com<nowiki/>;x
25915 http://example.com<nowiki/>:x
25916 http://example.com<nowiki/>;x
25917 http://example.com<nowiki/>!x
25918 http://example.com<nowiki/>=x
25919 http://example.com<nowiki/>(x)
25920 http://example.com(x<nowiki/>)
25921 !! end
25922
25923 !! test
25924 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25925 !! options
25926 parsoid=html2wt
25927 !! html/parsoid
25928 <p>x
25929 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
25930 y
25931 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
25932 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
25933 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
25934 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
25935 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
25936 </p>
25937 !! wikitext
25938 x
25939 http://example.com
25940 y
25941 "http://example.com"
25942 (http://example.com)
25943 (http://example.com) foo
25944 http://example.com,
25945 http://example.com, foo
25946 !! html/php
25947 <p>x
25948 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
25949 y
25950 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
25951 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
25952 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
25953 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
25954 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
25955 </p>
25956 !! end
25957
25958 !! test
25959 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
25960 !! options
25961 parsoid=html2wt
25962 !! html/parsoid
25963 <p><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">http://example.com</a>:</p>
25965 !! wikitext
25966 http://example.com.,;:!?\
25967 -http://example.com:
25968 !! html/php
25969 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
25970 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
25971 </p>
25972 !! end
25973
25974 !! test
25975 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
25980 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
25981 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
25982 !! wikitext
25983 RFC 123<nowiki/>4
25984 RFC 123<nowiki/>y
25985 X<nowiki/>RFC 123<nowiki/>y
25986 !! end
25987
25988 !! test
25989 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
25990 !! options
25991 parsoid=html2wt
25992 !! html/parsoid
25993 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
25994 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
25995 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
25996 </p>
25997 !! wikitext
25998 RFC 123?foo
25999 RFC 123&foo
26000 -RFC 123-
26001 !! html/php
26002 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
26003 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
26004 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
26005 </p>
26006 !! end
26007
26008 !! test
26009 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
26010 !! options
26011 parsoid=html2wt
26012 !! html/parsoid
26013 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
26014 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26015 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
26016 !! wikitext
26017 PMID 123<nowiki/>4
26018 PMID 123<nowiki/>y
26019 X<nowiki/>PMID 123<nowiki/>y
26020 !! end
26021
26022 !! test
26023 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
26024 !! options
26025 parsoid=html2wt
26026 !! html/parsoid
26027 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
26028 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
26029 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
26030 </p>
26031 !! wikitext
26032 PMID 123?foo
26033 PMID 123&foo
26034 -PMID 123-
26035 !! html/php
26036 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
26037 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
26038 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
26039 </p>
26040 !! end
26041
26042 !! test
26043 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
26044 !! options
26045 parsoid=html2wt
26046 !! html/parsoid
26047 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
26048 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
26049 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
26050 </p>
26051 !! wikitext
26052 ISBN 1234567890<nowiki/>1
26053 ISBN 1234567890<nowiki/>x
26054 a<nowiki/>ISBN 1234567890<nowiki/>b
26055 !! end
26056
26057 !! test
26058 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
26059 !! options
26060 parsoid=html2wt
26061 !! html/parsoid
26062 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
26063 !! wikitext
26064 -ISBN 1234567890's
26065 !! html/php
26066 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
26067 </p>
26068 !! end
26069
26070 !! test
26071 Links 14. Protect link-like plain text. (Parsoid bug T78425)
26072 !! options
26073 parsoid=html2wt
26074 !! html/*
26075 <p>this is not a link: http://example.com
26076 </p>
26077 !! wikitext
26078 this is not a link: <nowiki>http://example.com</nowiki>
26079 !! end
26080
26081 !! test
26082 Links 15. Link trails can't become link prefixes.
26083 !! options
26084 language=is
26085 parsoid=html2wt
26086 !! html/parsoid
26087 <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>
26088 !! wikitext
26089 [[Söfnuður]]-[[00]]
26090 !! html/php
26091 <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>
26092 </p>
26093 !! end
26094
26095 #### --------------- Quotes ---------------
26096 #### 1. Quotes inside <b> and <i>
26097 #### 2. Link fragments separated by <i> and <b> tags
26098 #### 3. Link fragments inside <i> and <b>
26099 #### 4. No escaping needed
26100 #### --------------------------------------
26101 !! test
26102 1a. Quotes inside <b> and <i>
26103 !! options
26104 parsoid=html2wt
26105 !! html/*
26106 <p><i>'foo'</i>
26107 <i>''foo''</i>
26108 <i>'''foo'''</i>
26109 <i>foo</i>'s
26110 <b>'foo'</b>
26111 <b>''foo''</b>
26112 <b>'''foo'''</b>
26113 <b>foo'<i>bar'</i>baz</b>
26114 <b>foo</b>'s
26115 '<i>foo</i>
26116 <i>foo</i>'
26117 <i>foo'</i>'
26118 '<i>foo</i>'
26119 '<b>foo</b>
26120 <b>foo</b>'
26121 '<b>foo</b>'
26122 <i>fools'<span> errand</span></i>
26123 <i><span>fool</span>'s errand</i>
26124 '<i>foo</i> bar '<i>baz</i>
26125 a|!*#-:;+-~[]{}b'<i>x</i>
26126 </p>
26127 !! wikitext
26128 ''<nowiki/>'foo'''
26129 ''<nowiki>''foo''</nowiki>''
26130 ''<nowiki>'''foo'''</nowiki>''
26131 ''foo''<nowiki/>'s
26132 '''<nowiki/>'foo''''
26133 '''<nowiki>''foo''</nowiki>'''
26134 '''<nowiki>'''foo'''</nowiki>'''
26135 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
26136 '''foo'''<nowiki/>'s
26137 '''foo''
26138 ''foo''<nowiki/>'
26139 ''foo'''<nowiki/>'
26140 '''foo''<nowiki/>'
26141 ''''foo'''
26142 '''foo'''<nowiki/>'
26143 ''''foo'''<nowiki/>'
26144 ''fools'<span> errand</span>''
26145 ''<span>fool</span>'s errand''
26146 '<nowiki/>''foo'' bar '''baz''
26147 a|!*#-:;+-~[]{}b'''x''
26148 !! end
26149
26150 !! test
26151 1b. Quotes inside <b> and <i> with other tags on same line
26152 !! options
26153 parsoid=html2wt
26154 !! html/parsoid
26155 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26156 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
26157 <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>
26158 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
26159 '<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>
26160 '<i>foo</i> <div title="name">test</div>
26161 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
26162 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
26163 <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>
26164 </ol>
26165 !! wikitext
26166 '''a'' foo ''[[bar]]''
26167 ''a''' foo ''[[bar]]''
26168 ''a''' foo '''{{echo|[[bar]]}}'''
26169 [[foo]] x'''[[bar]]''
26170 '''foo'' <ref>test</ref>
26171 '''foo'' <div title="name">test</div>
26172 '''foo'' and <br> bar
26173 <references />
26174 !! end
26175
26176 !! test
26177 2. Link fragments separated by <i> and <b> tags
26178 !! options
26179 parsoid=html2wt
26180 !! html/parsoid
26181 <p>[[<i>foo</i>hello]]</p>
26182 <p>[[<b>foo</b>hello]]</p>
26183 !! wikitext
26184 [[''foo''<nowiki>hello]]</nowiki>
26185
26186 [['''foo'''<nowiki>hello]]</nowiki>
26187 !! end
26188
26189 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
26190 # this is one of the shortcomings of this format
26191 !! test
26192 3. Link fragments inside <i> and <b>
26193 !! options
26194 parsoid=html2wt
26195 !! html/parsoid
26196 <p><i>[[foo</i>]]</p>
26197 <p><b>[[foo</b>]]</p>
26198 !! wikitext
26199 ''[[foo''<nowiki>]]</nowiki>
26200
26201 '''[[foo'''<nowiki>]]</nowiki>
26202 !! end
26203
26204 !! test
26205 4. No escaping needed
26206 !! options
26207 parsoid=html2wt
26208 !! html/parsoid
26209 <p>'<span><i>bar</i></span>'
26210 '<span><b>bar</b></span>'
26211 'a:b'foo
26212 </p>
26213 !! wikitext
26214 '<span>''bar''</span>'
26215 '<span>'''bar'''</span>'
26216 'a:b'foo
26217 !! end
26218
26219 #### ----------- Paragraphs ---------------
26220 #### 1. No unnecessary escapes
26221 #### --------------------------------------
26222
26223 !! test
26224 1. No unnecessary escapes
26225 !! options
26226 parsoid=html2wt
26227 !! html/parsoid
26228 <p>bar <span>[[foo]]</span>
26229 </p><p>=bar <span>[[foo]]</span>
26230 </p><p>[[bar <span>[[foo]]</span>
26231 </p><p>]]bar <span>[[foo]]</span>
26232 </p><p>=bar <span>foo]]</span>=
26233 </p>
26234 !! wikitext
26235 bar <span><nowiki>[[foo]]</nowiki></span>
26236
26237 =bar <span><nowiki>[[foo]]</nowiki></span>
26238
26239 [[bar <span><nowiki>[[foo]]</nowiki></span>
26240
26241 ]]bar <span><nowiki>[[foo]]</nowiki></span>
26242
26243 =bar <span>foo]]</span><nowiki>=</nowiki>
26244 !!end
26245
26246 #### ----------------------- PRE --------------------------
26247 #### 1. Leading whitespace in SOL context should be escaped
26248 #### ------------------------------------------------------
26249 !! test
26250 1. Leading whitespace in SOL context should be escaped
26251 !! options
26252 parsoid=html2wt
26253 !! html/parsoid
26254 <p> a</p>
26255
26256 <p> a</p>
26257
26258 <p> a(tab)</p>
26259
26260 <p> a
26261 <!--cmt-->
26262 a</p>
26263
26264 <p>a
26265 b</p>
26266
26267 <p>a
26268 b</p>
26269
26270 <p>a
26271 b</p>
26272 !! wikitext
26273 <nowiki> </nowiki>a
26274
26275 <nowiki> </nowiki> a
26276
26277 a(tab)
26278
26279 <nowiki> </nowiki> a
26280 <!--cmt-->
26281 <nowiki> </nowiki>a
26282
26283 a
26284 <nowiki> </nowiki>b
26285
26286 a
26287 b
26288
26289 a
26290 b
26291 !! html/php
26292 <p> a
26293 </p><p> a
26294 </p><p> a(tab)
26295 </p><p> a
26296 a
26297 </p><p>a
26298 b
26299 </p><p>a
26300 b
26301 </p><p>a
26302 b
26303 </p>
26304 !! end
26305
26306 !! test
26307 2. Leading whitespace in non-indent-pre contexts should not be escaped
26308 !! options
26309 parsoid=html2wt
26310 !! html/parsoid
26311 <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>
26312 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
26313 <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>
26314 b</span></li>
26315 </ol>
26316 !! wikitext
26317 foo <ref>''a''
26318 b</ref>
26319 <references />
26320 !! end
26321
26322 !! test
26323 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
26324 !! options
26325 parsoid=html2wt
26326 !! html/parsoid
26327 <blockquote>
26328 <p>
26329 a
26330 <span>b</span>
26331 c</p>
26332 </blockquote>
26333 !! wikitext
26334 <blockquote>
26335 a
26336 <span>b</span>
26337 c
26338 </blockquote>
26339 !! end
26340
26341 !! test
26342 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
26343 !! options
26344 parsoid=html2wt
26345 !! html/parsoid
26346 <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>
26347 !! wikitext
26348 [[File:Foobar.jpg|thumb|caption]]
26349 !! end
26350
26351 !! test
26352 5. Nowiki escaping should account for indent-pres
26353 !! options
26354 parsoid=html2wt
26355 !! html/parsoid
26356 <pre>==foo==</pre>
26357 !! wikitext
26358 ==foo==
26359 !! end
26360
26361 !!test
26362 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
26363 !! options
26364 parsoid=html2wt
26365 !! html/parsoid
26366 <pre>
26367 * foo
26368 * bar
26369 </pre>
26370 !! wikitext
26371 * foo
26372 * bar
26373 !! end
26374
26375 #### --------------- Behavior Switches --------------------
26376
26377 !! test
26378 1. Valid behavior switches should be escaped
26379 !! options
26380 parsoid=html2wt
26381 !! html/parsoid
26382 __TOC__
26383 <i>__TOC__</i>
26384 !! wikitext
26385 <nowiki>__TOC__</nowiki>
26386 ''<nowiki>__TOC__</nowiki>''
26387 !! end
26388
26389 !! test
26390 2. Invalid behavior switches should not be escaped
26391 !! options
26392 parsoid=html2wt
26393 !! html/parsoid
26394 __TOO__
26395 __|__
26396 !! wikitext
26397 __TOO__
26398 __|__
26399 !! end
26400
26401 # We use indent-pre as an indirect way to test for sol-transparent behavior.
26402 !! test
26403 Behavior switches should be SOL-transparent
26404 !! options
26405 parsoid=html2wt
26406 !! html/parsoid
26407 <meta property="mw:PageProp/toc" />
26408
26409 <!-- this one's bogus -->
26410 <pre>__TOO__</pre>
26411
26412 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
26413
26414 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
26415 !! wikitext
26416 __TOC__
26417
26418 <!-- this one's bogus -->
26419 __TOO__
26420
26421 __TOC__ foo
26422
26423 __TOC__
26424 bar
26425 !! end
26426
26427 #### --------------- HTML tags ---------------
26428 #### 1. a tags
26429 #### 2. other tags
26430 #### 3. multi-line html tag
26431 #### 4. extension tags
26432 #### -----------------------------------------
26433 !! test
26434 1. a tags
26435 !! options
26436 parsoid=html2wt
26437 !! html/parsoid
26438 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
26439 !! wikitext
26440 <a href="http://google.com">google</a>
26441 !! end
26442
26443 !! test
26444 2. other tags
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
26449 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
26450 <li> &lt;td&gt;</li></ul>
26451
26452 !! wikitext
26453 * <nowiki><div>foo</div></nowiki>
26454 * <nowiki><div style="color:red">foo</div></nowiki>
26455 * <nowiki><td></nowiki>
26456 !! end
26457
26458 !! test
26459 3. multi-line html tag
26460 !! options
26461 parsoid=html2wt
26462 !! html/parsoid
26463 <p>&lt;div
26464 &gt;foo&lt;/div
26465 &gt;
26466 </p>
26467 !! wikitext
26468 <nowiki><div
26469 >foo</div
26470 ></nowiki>
26471 !! end
26472
26473 !! test
26474 4. extension tags
26475 !! options
26476 parsoid=html2wt
26477 !! html/parsoid
26478 <p>&lt;ref&gt;foo&lt;/ref&gt;
26479 </p><p>&lt;ref&gt;bar
26480 </p><p>baz&lt;/ref&gt;
26481 </p>
26482 !! wikitext
26483 <nowiki><ref>foo</ref></nowiki>
26484
26485 <nowiki><ref>bar</nowiki>
26486
26487 baz<nowiki></ref></nowiki>
26488 !! end
26489
26490 #### --------------- Others ---------------
26491 !! test
26492 Escaping nowikis
26493 !! options
26494 parsoid=html2wt
26495 !! html/parsoid
26496 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
26497 </p>
26498 !! wikitext
26499 &lt;nowiki&gt;foo&lt;/nowiki&gt;
26500 !! end
26501
26502 ## The quote-char in the input is necessary for triggering the bug
26503 !! test
26504 (T54035) Nowiki-escaping should not get tripped by " :" in text
26505 !! options
26506 parsoid=html2wt
26507 !! html/parsoid
26508 <p>foo's bar :</p>
26509 !! wikitext
26510 foo's bar :
26511 !! end
26512
26513 #----------- End of wikitext escaping tests --------------
26514
26515 !! test
26516
26517 Tag-like HTML structures are passed through as text
26518 !! wikitext
26519 <x y>
26520
26521 <x.y>
26522
26523 <x-y>
26524
26525 1>2
26526
26527 x<y
26528
26529 a>b
26530
26531 1<d e>f
26532 !! html
26533 <p>&lt;x y&gt;
26534 </p><p>&lt;x.y&gt;
26535 </p><p>&lt;x-y&gt;
26536 </p><p>1&gt;2
26537 </p><p>x&lt;y
26538 </p><p>a&gt;b
26539 </p><p>1&lt;d e&gt;f
26540 </p>
26541 !! end
26542
26543 !! test
26544 HTML tag with necessary entities in attributes
26545 !! wikitext
26546 <span title="&amp;amp;">foo</span>
26547 !! html
26548 <p><span title="&amp;amp;">foo</span>
26549 </p>
26550 !! end
26551
26552 !! test
26553 HTML tag with 'unnecessary' entity encoding in attributes
26554 !! wikitext
26555 <span title="&amp;">foo</span>
26556 !! html
26557 <p><span title="&amp;">foo</span>
26558 </p>
26559 !! end
26560
26561 !! test
26562 HTML tag with broken attribute value quoting
26563 !! options
26564 parsoid=wt2html,html2html
26565 !! wikitext
26566 <span title="Hello world>Foo</span>
26567 !! html/php
26568 <p><span title="Hello world">Foo</span>
26569 </p>
26570 !! html/parsoid
26571 <p><span title="Hello world">Foo</span></p>
26572 !! end
26573
26574 !! test
26575 Self-closed tag with broken attribute value quoting
26576 !! options
26577 parsoid=wt2html,html2html
26578 !! wikitext
26579 <div title="Hello world />Foo
26580 !! html/php+tidy
26581 <div title="Hello world"></div><p>Foo
26582 </p>
26583 !! html/parsoid
26584 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
26585 !! end
26586
26587 !! test
26588 Table with broken attribute value quoting
26589 !! options
26590 parsoid=wt2html,html2html
26591 !! wikitext
26592 {|
26593 | title="Hello world|Foo
26594 |}
26595 !! html/php
26596 <table>
26597 <tr>
26598 <td title="Hello world">Foo
26599 </td></tr></table>
26600
26601 !! html/parsoid
26602 <table>
26603 <tr>
26604 <td title="Hello world">Foo
26605 </td></tr></table>
26606
26607 !! end
26608
26609 !! test
26610 Table with broken attribute value quoting on consecutive lines
26611 !! options
26612 parsoid=wt2html,html2html
26613 !! wikitext
26614 {|
26615 | title="Hello world|Foo
26616 | style="color:red|Bar
26617 |}
26618 !! html/php
26619 <table>
26620 <tr>
26621 <td title="Hello world">Foo
26622 </td>
26623 <td style="color:red">Bar
26624 </td></tr></table>
26625
26626 !! html/parsoid
26627 <table><tbody>
26628 <tr>
26629 <td title="Hello world">Foo
26630 </td><td style="color: red">Bar
26631 </td></tr></tbody></table>
26632
26633 !! end
26634
26635 !!test
26636 Accept empty td cell attribute
26637 !! wikitext
26638 {|
26639 | align="center" |foo|| |
26640 |}
26641 !! html
26642 <table>
26643 <tr>
26644 <td align="center">foo</td>
26645 <td>
26646 </td></tr></table>
26647
26648 !!end
26649
26650 !!test
26651 Non-empty attributes in th-cells
26652 !! wikitext
26653 {|
26654 !Foo!! style="color: red" |Bar
26655 |}
26656 !! html
26657 <table>
26658 <tr>
26659 <th>Foo</th>
26660 <th style="color: red">Bar
26661 </th></tr></table>
26662
26663 !!end
26664
26665 !!test
26666 Accept empty attributes in th-cells
26667 !! wikitext
26668 {|
26669 !|foo!!|bar
26670 |}
26671 !! html
26672 <table>
26673 <tr>
26674 <th>foo</th>
26675 <th>bar
26676 </th></tr></table>
26677
26678 !!end
26679
26680 !!test
26681 Empty table rows go away
26682 !! wikitext
26683 {|
26684 |Hello
26685 |there
26686 |- class="foo"
26687 |-
26688 |}
26689 !! html
26690 <table>
26691 <tr>
26692 <td>Hello
26693 </td>
26694 <td>there
26695 </td></tr>
26696
26697 </table>
26698
26699 !! end
26700
26701 ###
26702 ### Parsoid-centric tests for testing RTing of inter-element separators
26703 ### Edge cases not tested by existing parser tests and specific to
26704 ### Parsoid-specific serialization strategies.
26705 ###
26706
26707 !!test
26708 RT-ed inter-element separators should be valid separators
26709 !! wikitext
26710 {|
26711 |- [[foo]]
26712 |}
26713 !! html/php
26714 <table>
26715
26716 </table>
26717
26718 !! html/parsoid
26719 <table>
26720 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
26721 </tbody></table>
26722 !!end
26723
26724 # Parsoid-only test of a DOM pass
26725 !!test
26726 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
26727 !! wikitext
26728 {|
26729 |<small>foo
26730 bar
26731 |}
26732
26733 {|
26734 |<small>foo<small>
26735 |}
26736 !! html/parsoid
26737 <table>
26738 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
26739 <p>bar</p></small></td></tr>
26740 </tbody></table>
26741
26742 <table>
26743 <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>
26744 </tbody></table>
26745 !!end
26746
26747 # Note that the "style" attribute is really a template parameter here.
26748 # The = would have to be {{=}} if you wanted the literal.
26749 !!test
26750 Empty TD followed by TD with tpl-generated attribute
26751 !! wikitext
26752 {|
26753 |-
26754 |
26755 |{{echo|style='color:red'}}|foo
26756 |}
26757 !! html
26758 <table>
26759
26760 <tr>
26761 <td>
26762 </td>
26763 <td>foo
26764 </td></tr></table>
26765
26766 !!end
26767
26768 !!test
26769 Indented table with an empty td
26770 !! wikitext
26771 {|
26772 |-
26773 |
26774 |foo
26775 |}
26776 !! html
26777 <table>
26778
26779 <tr>
26780 <td>
26781 </td>
26782 <td>foo
26783 </td></tr></table>
26784
26785 !!end
26786
26787 ## We have some newline diffs RT-ing this edge case
26788 ## and it is not important enough -- we seem to be emitting
26789 ## at most 2 newlines after a </tr> and this is unrelated to
26790 ## the issue from T85627 that this is testing.
26791 !!test
26792 Indented table with blank lines in between (T85627)
26793 !! options
26794 parsoid=wt2html
26795 !! wikitext
26796 {|
26797 |foo
26798
26799
26800 |}
26801 !! html
26802 <table>
26803
26804 <tr>
26805 <td>foo
26806 </td></tr></table>
26807
26808 !!end
26809
26810 !!test
26811 Indented block & table
26812 !! wikitext
26813 <div>foo</div>
26814 {|
26815 |foo
26816 |}
26817 !! html/php
26818 <div>foo</div>
26819 <table>
26820 <tr>
26821 <td>foo
26822 </td></tr></table>
26823
26824 !! html/parsoid
26825 <div data-parsoid='{"stx":"html"}'>foo</div>
26826 <table><tbody>
26827 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
26828 </tbody></table>
26829 !!end
26830
26831 !! test
26832 Indent and comment before table row
26833 !! wikitext
26834 {|
26835 <!--hi-->|-
26836 |there
26837 |}
26838 !! html/php
26839 <table>
26840
26841 <tr>
26842 <td>there
26843 </td></tr></table>
26844
26845 !! html/parsoid
26846 <table>
26847 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
26848 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
26849 </tbody></table>
26850 !! end
26851
26852 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
26853 !!test
26854 Empty TR followed by a template-generated TR
26855 !!options
26856 parsoid
26857 !! wikitext
26858 {|
26859 |-
26860 {{echo|<tr><td>foo</td></tr>}}
26861 |}
26862 !! html
26863 <table>
26864 <tbody>
26865 <tr class='mw-empty-elt'></tr>
26866 <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}}]}'>
26867 <td>foo</td></tr>
26868 </tbody></table>
26869 !!end
26870
26871 ## PHP and parsoid output differ for this, and since this is primarily
26872 ## for testing Parsoid's serializer, marking this Parsoid only
26873 !!test
26874 Empty TR followed by mixed-ws-comment line should RT correctly
26875 !!options
26876 parsoid
26877 !! wikitext
26878 {|
26879 |-
26880 <!--c-->
26881 |-
26882 <!--c--> <!--d-->
26883 |}
26884 !! html
26885 <table>
26886 <tbody>
26887 <tr class='mw-empty-elt'></tr>
26888 <!--c-->
26889 <tr>
26890 <!--c--> </tr><!--d-->
26891 </tbody></table>
26892
26893 !!end
26894
26895 !!test
26896 Multi-line image caption generated by templates with/without trailing newlines
26897 !! wikitext
26898 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
26899 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
26900 !! html/parsoid
26901 <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>
26902 <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>
26903 !!end
26904
26905 !! test
26906 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
26907 !! options
26908 parsoid=html2wt
26909 !! html/parsoid
26910 <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>
26911
26912 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
26913 !! wikitext
26914 <includeonly>foo</includeonly>
26915 new para
26916
26917 [[Category:Foo]]
26918
26919 = new heading =
26920 !! end
26921
26922 ## PHP emits broken html for this, and since this is primarily
26923 ## a Parsoid serializer test, marking this Parsoid only
26924 !!test
26925 Improperly nested inline or quotes tags with whitespace in between
26926 !! wikitext
26927 <span> <s>x</span> </s>
26928 ''' ''x''' ''
26929 !! html/parsoid
26930 <p><span> <s>x</s></span><s> </s>
26931 <b> <i>x</i></b><i> </i>
26932 </p>
26933 !!end
26934
26935 !!test
26936 Encapsulate protected attributes from wt
26937 !! wikitext
26938 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
26939
26940 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
26941 | ok
26942 |}
26943 !! html/parsoid
26944 <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>
26945
26946 <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">
26947 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
26948 </tbody></table>
26949 !!end
26950
26951 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
26952 ## Having nested or stray pre tags results in the attempt to add duplicates,
26953 ## causing an assertion fail. This test tries to prevent that situation.
26954 !!test
26955 Ensure ParagraphWrapper can deal with stray closing pre tags
26956 !!options
26957 parsoid=wt2html
26958 !! wikitext
26959 plain text</pre>
26960 !! html/parsoid
26961 plain text
26962 !!end
26963
26964 !!test
26965 1. Ensure fostered text content is wrapped in element nodes
26966 !!options
26967 parsoid=wt2html
26968 !! wikitext
26969 <table>hi</table><table>ho</table>
26970 !! html/parsoid
26971 <p>hi</p>
26972 <table></table>
26973 <p>ho</p>
26974 <table></table>
26975 !!end
26976
26977 !!test
26978 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
26979 !!options
26980 parsoid=wt2html,wt2wt
26981 !! wikitext
26982 <table>
26983 <tr> || ||
26984 <td> a
26985 </table>
26986 !! html/parsoid
26987 <p> || ||
26988 </p><table>
26989 <tbody><tr><td> a</td></tr>
26990 </tbody></table>
26991 !!end
26992
26993 !!test
26994 Encapsulation properly handles null DSR information from foster box
26995 !!options
26996 parsoid=wt2html,wt2wt
26997 !! wikitext
26998 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
26999 !! html/parsoid
27000 <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>
27001 !!end
27002
27003 !!test
27004 1. Encapsulate foster-parented transclusion content
27005 !!options
27006 parsoid=wt2wt,wt2html
27007 !! wikitext
27008 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
27009 !! html/parsoid
27010 <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>
27011 <tbody>
27012 <tr>
27013 <td>bar</td>
27014 </tr>
27015 </tbody>
27016 </table>
27017 !!end
27018
27019 !!test
27020 2. Encapsulate foster-parented transclusion content
27021 !!options
27022 parsoid=wt2wt,wt2html
27023 !! wikitext
27024 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
27025 !! html/parsoid
27026 <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>
27027 <table>
27028 <tbody>
27029 <tr>
27030 <td>bar</td>
27031 </tr>
27032 </tbody>
27033 </table>
27034 !!end
27035
27036 !!test
27037 3. Encapsulate foster-parented transclusion content
27038 !!options
27039 parsoid=wt2wt,wt2html
27040 !! wikitext
27041 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27042 !! html/parsoid
27043 <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;]}">
27044 <p>foo</p>
27045 </div>
27046 <table>
27047 <tbody>
27048 <tr>
27049 <td>bar</td>
27050 </tr>
27051 </tbody>
27052 </table>
27053 !!end
27054
27055 !!test
27056 4. Encapsulate foster-parented transclusion content
27057 !!options
27058 parsoid=wt2wt,wt2html
27059 !! wikitext
27060 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
27061 !! html/parsoid
27062 <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;]}">
27063 <p>foo</p>
27064 </div>
27065 <table>
27066 <tbody>
27067 <tr>
27068 <td>bar</td>
27069 </tr>
27070 </tbody>
27071 </table>
27072 !!end
27073
27074 !!test
27075 5. Encapsulate foster-parented transclusion content
27076 !!options
27077 parsoid=wt2wt,wt2html
27078 !! wikitext
27079 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
27080 !! html/parsoid
27081 <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>
27082 <table>
27083 <tbody>
27084 <tr>
27085 <td>
27086 <div>
27087 <p>foo</p>
27088 </div>
27089 </td>
27090 </tr>
27091 </tbody>
27092 </table>
27093 !!end
27094
27095 !!test
27096 6. Encapsulate foster-parented transclusion content
27097 !!options
27098 parsoid=wt2wt,wt2html
27099 !! wikitext
27100 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
27101 !! html/parsoid
27102 <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>
27103 <table>
27104 <tbody>
27105 <tr>
27106 <td>
27107 <div>
27108 <p>foo</p>
27109 </div>
27110 </td>
27111 </tr>
27112 </tbody>
27113 </table>
27114 <p>ok</p>
27115 !!end
27116
27117 !!test
27118 7. Encapsulate foster-parented transclusion content
27119 !!options
27120 parsoid=wt2wt,wt2html
27121 !! wikitext
27122 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
27123 !! html/parsoid
27124 <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>
27125 <table>
27126 <tbody>
27127 <tr>
27128 <td>bar</td>
27129 </tr>
27130 </tbody>
27131 </table>
27132 !!end
27133
27134 # Note that the wt is broken on purpose: the = should be {{=}} if you
27135 # don't want it to be a template parameter key.
27136 !!test
27137 8. Encapsulate foster-parented transclusion content
27138 !!options
27139 parsoid=wt2wt,wt2html
27140 !! wikitext
27141 {{echo|a
27142 }}{|{{echo|style='color:red'}}
27143 |-
27144 |b
27145 |}
27146 !! html/parsoid
27147 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
27148 <span> </span>
27149 <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>
27150 <table>
27151 <tbody>
27152 <tr>
27153 <td>b</td>
27154 </tr>
27155 </tbody>
27156 </table>
27157 !!end
27158
27159 !!test
27160 9. Encapsulate foster-parented transclusion content
27161 !!options
27162 parsoid=wt2wt,wt2html
27163 !! wikitext
27164 <table>{{echo|hi</table>hello}}
27165 !! html/parsoid
27166 <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>
27167 !!end
27168
27169 !!test
27170 Table in fosterable position
27171 !!options
27172 parsoid=wt2html
27173 !! wikitext
27174 {{OpenTable}}
27175 <div>
27176 {|
27177 |}
27178 </div>
27179 |}
27180 !! html/parsoid
27181 <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">
27182 </span>
27183 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
27184
27185 <table>
27186 </table>
27187 !!end
27188
27189 # Parsoid only for T66747
27190 !! test
27191 Properly encapsulate empty-content transclusions in fosterable positions
27192 !! wikitext
27193 <table>
27194 {{#if:|
27195 <td>foo</td>
27196 }}
27197 </table>
27198 !! html/parsoid
27199 <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"}]]}'>
27200
27201 </table>
27202 !! end
27203
27204 !! test
27205 Always encapsulate foster box when template range is expanded to table
27206 !! options
27207 parsoid=wt2wt
27208 !! wikitext
27209 {|
27210 hello
27211 {{OpenTable}}
27212 |}
27213 !! html/parsoid
27214
27215 !! end
27216
27217 !! test
27218 T115289: Unclosed table
27219 !! wikitext
27220 {{echo|<table>}}<!--c-->[[Category:Two]]
27221 !! html/parsoid
27222 <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>
27223 !! end
27224
27225 !! test
27226 T115289: Don't migrate newlines out of tables with fostered content
27227 !! wikitext
27228 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
27229 !! html/parsoid
27230 <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>
27231 !! end
27232
27233 !! test
27234 T73074: More fostering fun
27235 !! wikitext
27236 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
27237 !! html/parsoid
27238 <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>
27239 !! end
27240
27241 !!test
27242 Support <object> element with .data attribute
27243 !!options
27244 parsoid=html2wt
27245 !! html/parsoid
27246 <object data="test.swf"></object>
27247 !! wikitext
27248 <object data="test.swf"></object>
27249 !!end
27250
27251 !! test
27252 Don't block XML namespace declaration
27253 !! wikitext
27254 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27255 !! html/php
27256 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
27257 </p>
27258 !! html/parsoid
27259 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
27260 !! end
27261
27262 # -----------------------------------------------------------------
27263 # The following section of tests are primarily to spec requirements
27264 # around Parsoid's serialization (old, new, edited content)
27265 #
27266 # All these tests are marked Parsoid html2wt and html2html only
27267 # ----------------------------------------------------------------
27268
27269 !! test
27270 Ignore rel attribute in a-tags during serialization to url-links
27271 !! options
27272 parsoid=html2wt
27273 !! html/parsoid
27274 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
27275 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
27276 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
27277 !! wikitext
27278 http://en.wikipedia.org/wiki/Foobar
27279 http://en.wikipedia.org/wiki/Foobar
27280 http://en.wikipedia.org/wiki/Foobar
27281 !! end
27282
27283 # 'mi' is a localinterwiki prefix as well as a language
27284 !! test
27285 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
27286 !! options
27287 parsoid=html2wt
27288 !! html/parsoid
27289 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
27290 !! wikitext
27291 [[Foo]]
27292 !! end
27293
27294 !! test
27295 Parsoid should accept interwiki shortcuts
27296 !! options
27297 parsoid=html2wt
27298 !! html/parsoid
27299 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
27300 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
27301 <a href='./fr:Foo'>Foo</a></p>
27302 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
27303 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
27304 <a href='fr%3AFoo'>Foo</a></p>
27305 <p><a href='FR%3AFoo'>Foo</a>
27306 <a href='./FR:Foo'>Foo</a></p>
27307 !! wikitext
27308 [[:fr:Foo|Foo]]
27309 [[:fr:Foo|Foo]]
27310 [[:fr:Foo|Foo]]
27311
27312 [[:fr:Foo|Foo]]
27313 [[:fr:Foo|Foo]]
27314 [[:fr:Foo|Foo]]
27315
27316 [[:fr:Foo|Foo]]
27317 [[:fr:Foo|Foo]]
27318 !! end
27319
27320 !! test
27321 Parsoid should not accept invalid interwiki shortcuts
27322 !! options
27323 parsoid=html2wt
27324 !! html/parsoid
27325 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
27326 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
27327 <a href='news:Foo'>Foo</a></p>
27328 !! wikitext
27329 [news:Foo Foo]
27330 [news:Foo Foo]
27331 [news:Foo Foo]
27332 !! end
27333
27334 # See T93839
27335 !! test
27336 New wikilinks should be serialized properly
27337 !! options
27338 parsoid=html2wt
27339 !! html/parsoid
27340 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
27341 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
27342 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
27343 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
27344 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
27345 !! wikitext
27346 [[Foo]]
27347 [[Foo]]
27348 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
27349 http://en.wikipedia.org/wiki/Foo
27350 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
27351 !! end
27352
27353 !! test
27354 New wiki links (href variations)
27355 !! options
27356 parsoid=html2wt
27357 !! html/parsoid
27358 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27359 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
27360 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
27361 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
27362 !! wikitext
27363 [[Foo_bar]]
27364 [[Foo_bar]]
27365 [[Foo_bar]]
27366 [[Toxine bactérienne]]
27367 !! end
27368
27369 !! test
27370 New wiki links (content string variations)
27371 !! options
27372 parsoid=html2wt
27373 !! html/parsoid
27374 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
27375 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
27376 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
27377 !! wikitext
27378 [[Foo_bar]]
27379 [[Foo bar]]
27380 [[Foo_bar|./Foo_bar]]
27381 !! end
27382
27383 !! test
27384 New category links (href variations)
27385 !! options
27386 parsoid=html2wt
27387 !! html/parsoid
27388 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
27389 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
27390 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
27391 !! wikitext
27392 [[Category:Toxine bactérienne]]
27393 [[Category:Toxine bactérienne]]
27394 [[Category:Toxine bactérienne]]
27395 !! end
27396
27397 !! test
27398 New sol transparent links don't need indent-pre nowiki protection
27399 !! options
27400 parsoid=html2wt
27401 language=de
27402 !! html/parsoid
27403 <link rel="mw:PageProp/redirect" href="./Main_Page">
27404 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
27405 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
27406 !! wikitext
27407 #WEITERLEITUNG [[Main Page]]
27408 <!-- this is good --> [[Category:Good]]
27409 <!-- this is great --> [[Kategorie:Great]]
27410 !! end
27411
27412 !! test
27413 New interlanguage links (href variations)
27414 !! options
27415 parsoid=html2wt
27416 !! html/parsoid
27417 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
27418 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
27419 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
27420 !! wikitext
27421 [[es:Toxine bactérienne]]
27422 [[es:Toxine_bactérienne]]
27423 [[es:Toxine_bactérienne]]
27424 !! end
27425
27426 !! test
27427 Image: Modifying size of an image (1)
27428 !! options
27429 parsoid={
27430 "modes": ["wt2wt"],
27431 "changes": [
27432 ["img[height]", "attr", "height", "22"],
27433 ["img[width]", "attr", "width", "200"]
27434 ]
27435 }
27436 !! wikitext
27437 [[Image:Foobar.jpg|230x230px]]
27438 !! wikitext/edited
27439 [[Image:Foobar.jpg|200x200px]]
27440 !!end
27441
27442 !! test
27443 Image: Modifying size of an image (2)
27444 !! options
27445 parsoid={
27446 "modes": ["wt2wt"],
27447 "changes": [
27448 ["img[height]", "attr", "height", "100"],
27449 ["img[width]", "attr", "width", "500"]
27450 ]
27451 }
27452 !! wikitext
27453 [[Image:Foobar.jpg|230x230px]]
27454 !! wikitext/edited
27455 [[Image:Foobar.jpg|500x500px]]
27456 !!end
27457
27458 # Change in size is ignored so long as class='mw-default-size'
27459 !! test
27460 Image: Modifying size of an image (3)
27461 !! options
27462 parsoid={
27463 "modes": ["wt2wt"],
27464 "changes": [
27465 ["figure[class]", "removeClass", "mw-default-size"],
27466 ["figure img", "attr", "height", "19"],
27467 ["figure img", "attr", "width", "170"]
27468 ]
27469 }
27470 !! wikitext
27471 [[Image:Foobar.jpg|thumb]]
27472 !! wikitext/edited
27473 [[Image:Foobar.jpg|thumb|170x170px]]
27474 !!end
27475
27476 !! test
27477 Image: Modifying alignment of an image (T50665)
27478 !! options
27479 parsoid={
27480 "modes": ["wt2wt"],
27481 "changes": [
27482 ["figure[class]", "removeClass", "mw-halign-right"],
27483 ["figure[class]", "addClass", "mw-halign-left"]
27484 ]
27485 }
27486 !! wikitext
27487 [[Image:Foobar.jpg|thumb|caption|right]]
27488 !! wikitext/edited
27489 [[Image:Foobar.jpg|thumb|caption|left]]
27490 !! end
27491
27492 !! test
27493 Image: Modifying mw-default-size of an frameless image (T64805)
27494 !! options
27495 parsoid={
27496 "modes": ["wt2wt"],
27497 "changes": [
27498 ["figure.mw-default-size", "removeClass", "mw-default-size"]
27499 ]
27500 }
27501 !! wikitext
27502 [[Image:Foobar.jpg|frameless|right]]
27503 !! wikitext/edited
27504 [[Image:Foobar.jpg|frameless|right|220x220px]]
27505 !! end
27506
27507 !! test
27508 Image: Modifying valign of an image (T51221)
27509 !! options
27510 parsoid={
27511 "modes": ["wt2wt"],
27512 "changes": [
27513 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
27514 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
27515 ]
27516 }
27517 !! wikitext
27518 [[File:Foobar.jpg|20px|middle]]
27519 !! wikitext/edited
27520 [[File:Foobar.jpg|20px|text-top]]
27521 !! end
27522
27523 !! test
27524 Image: Modifying alt attribute of an image (T58400)
27525 !! options
27526 parsoid={
27527 "modes": ["wt2wt"],
27528 "changes": [
27529 ["img[alt]", "attr", "alt", "some alternate edited text"]
27530 ]
27531 }
27532 !! wikitext
27533 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
27534 !! wikitext/edited
27535 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
27536 !!end
27537
27538 !! test
27539 Image: Modifying caption of an image
27540 !! options
27541 parsoid={
27542 "modes": ["wt2wt"],
27543 "changes": [
27544 ["figcaption", "text", "new caption"]
27545 ]
27546 }
27547 !! wikitext
27548 [[Image:Foobar.jpg|thumb|original caption]]
27549 !! wikitext/edited
27550 [[Image:Foobar.jpg|thumb|new caption]]
27551 !!end
27552
27553 !! test
27554 Image: empty alt attribute (T50924)
27555 !! options
27556 parsoid
27557 !! wikitext
27558 [[File:Foobar.jpg|thumb|alt=|bar]]
27559 !! html
27560 <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>
27561 !! end
27562
27563 !! test
27564 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
27565 !! options
27566 parsoid=html2wt
27567 language=ar
27568 disabled
27569 !! html/parsoid
27570 <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>
27571 !! wikitext
27572 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
27573 !! end
27574
27575 !! test
27576 Image: Block level image should have \n before and after
27577 !! wikitext
27578 123
27579 [[File:Foobar.jpg|right|thumb|150x150px]]
27580 456
27581 !! html/parsoid
27582 <p>123</p>
27583 <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>
27584 <p>456</p>
27585 !! end
27586
27587 !! test
27588 Image: New block level image should have \n before and after (existing content)
27589 !! wikitext
27590 123
27591 [[File:Foobar.jpg|right|thumb|150x150px]]
27592 456
27593 !! html/parsoid
27594 <p>123</p>
27595 <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>
27596 <p>456</p>
27597 !! end
27598
27599 !! test
27600 Image: upright option (parsoid)
27601 !! wikitext
27602 [[File:Foobar.jpg|thumb|upright|caption]]
27603 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
27604 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
27605 !! html/parsoid
27606 <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>
27607 <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>
27608 <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>
27609 !! end
27610
27611 !! test
27612 Image: upright option is ignored on inline and frame images (parsoid)
27613 !! wikitext
27614 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
27615 !! html/parsoid
27616 <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>
27617 !! end
27618
27619 !! test
27620 Image: in template parameter with empty parameter
27621 !! wikitext
27622 {{echo|[[File:Foobar.jpg|link=]]}}
27623 !! html/parsoid
27624 <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>
27625 !! end
27626
27627 !! test
27628 Image: from basic HTML (1)
27629 !! options
27630 parsoid=html2wt
27631 !! html/parsoid
27632 <span typeof="mw:Image">
27633 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27634 </span>
27635 !! wikitext
27636 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27637 !! end
27638
27639 !! test
27640 Image: from basic HTML (2)
27641 !! options
27642 parsoid=html2wt
27643 !! html/parsoid
27644 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
27645 !! wikitext
27646 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
27647 !! end
27648
27649 !! test
27650 Image: from basic HTML (3)
27651 !! options
27652 parsoid=html2wt
27653 !! html/parsoid
27654 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
27655 !! wikitext
27656 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
27657 !! end
27658
27659 !! test
27660 Image: from basic HTML (4)
27661 !! options
27662 parsoid=html2wt
27663 !! html/parsoid
27664 <img src="./File:Foobar.jpg">
27665 !! wikitext
27666 [[File:Foobar.jpg|link=]]
27667 !! end
27668
27669 !! test
27670 Image: Invalid title as link
27671 !! wikitext
27672 [[File:Foobar.jpg|link=<]]
27673 !! html/php
27674 <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>
27675 </p>
27676 !! html/parsoid
27677 <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>
27678 !! end
27679
27680 !! test
27681 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
27682 !! options
27683 parsoid=html2wt
27684 !! html/parsoid
27685 <ul>
27686 <li><p>foo</p></li>
27687 </ul>
27688 !! wikitext
27689 * foo
27690 !! end
27691
27692 !! test
27693 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
27694 !! options
27695 parsoid=html2wt
27696 !! html/parsoid
27697 <ul> <li>foo</li></ul>
27698 !! wikitext
27699 * foo
27700 !! end
27701
27702 !! test
27703 Don't strip leading whitespace when handling indent-pre suppressing tags
27704 !! options
27705 parsoid=html2wt
27706 !! html/parsoid
27707 <table>
27708 <tr><td> indented row</td></tr>
27709 </table>
27710 <blockquote><p>
27711 <b>This is very bold of you!</b>
27712 </p>
27713 <table><tr><td>
27714 indented cell (no pre-wrapping!)
27715 </td></tr></table>
27716 </blockquote>
27717 <p>foo</p>
27718 <div>bar</div>
27719 !! wikitext
27720 {|
27721 | indented row
27722 |}
27723 <blockquote>
27724 '''This is very bold of you!'''
27725
27726 {|
27727 |
27728 indented cell (no pre-wrapping!)
27729 |}
27730 </blockquote>
27731 foo
27732 <div>bar</div>
27733 !! end
27734
27735 !! test
27736 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
27737 !! options
27738 parsoid=html2wt
27739 !! html/parsoid
27740 <p>foo</p>
27741 <span>bar</span>
27742
27743 <span>foo2
27744 </span>bar2
27745
27746 <div>foo</div>
27747 <span>bar</span>
27748
27749 <div>
27750 <span>foo</span>
27751 </div>
27752 !! wikitext
27753 foo
27754
27755 <span>bar</span>
27756
27757 <span>foo2
27758 <nowiki> </nowiki></span>bar2
27759
27760 <div>foo</div>
27761 <nowiki> </nowiki><span>bar</span>
27762
27763 <div>
27764 <nowiki> </nowiki><span>foo</span>
27765 </div>
27766 !! end
27767
27768 !! test
27769 Lists: Dont insert newlines in a serialized list item.
27770 !! options
27771 parsoid=html2wt
27772 !! html/parsoid
27773 <ul><li>a<br>b</li><li>c</li></ul>
27774 !! wikitext
27775 * a<br />b
27776 * c
27777 !! end
27778
27779 !! test
27780 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
27781 !! options
27782 parsoid={
27783 "modes": ["html2wt"],
27784 "scrubWikitext": false
27785 }
27786 !! html/parsoid
27787 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27788 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27789
27790 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27791 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27792
27793 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
27794
27795 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27796 !! wikitext
27797 == hello there [[Category:A1]] ==
27798
27799 == [[Category:A2]] hi pal ==
27800
27801 == <!--foo--> [[Category:A3]] how goes it ==
27802
27803 == it goes well [[Category:A4]] <!--bar--> ==
27804
27805 ==howdy [[Category:A5]]==
27806
27807 == __TOC__ ok ==
27808 !! end
27809
27810 !! test
27811 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
27812 !! options
27813 parsoid={
27814 "modes": ["html2wt"],
27815 "scrubWikitext": true
27816 }
27817 !! html/parsoid
27818 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
27819 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
27820
27821 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
27822 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
27823
27824 <h2><meta property="mw:PageProp/toc" /> ok</h2>
27825 !! wikitext
27826 == hello there ==
27827 [[Category:A1]]
27828 [[Category:A2]]
27829
27830 == hi pal ==
27831
27832 <!--foo--> [[Category:A3]]
27833
27834 == how goes it ==
27835
27836 == it goes well ==
27837 [[Category:A4]] <!--bar-->
27838
27839 __TOC__
27840
27841 == ok ==
27842 !! end
27843
27844 !! test
27845 Headings: Don't hoist metas that come from templates
27846 !! options
27847 parsoid={
27848 "modes": ["html2wt"],
27849 "scrubWikitext": true
27850 }
27851 !! html/parsoid
27852 <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>
27853 !! wikitext
27854 == {{echo|foo [[Category:Foo]]}} ==
27855 !! end
27856
27857 !! test
27858 Headings: Category in ref isn't hoisted
27859 !! options
27860 parsoid={
27861 "modes": ["html2wt"],
27862 "scrubWikitext": true
27863 }
27864 !! html/parsoid
27865 <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>
27866
27867 <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>
27868 !! wikitext
27869 == foo <ref>bar
27870 [[Category:Baz]] </ref> ==
27871
27872 <references />
27873 !! end
27874
27875 !! test
27876 Parsoid: Serialize positional parameters with = in them as named parameter
27877 !! options
27878 parsoid=html2wt
27879 !! html/parsoid
27880 <p about="#mwt1" typeof="mw:Transclusion"
27881 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
27882
27883 <p about="#mwt1" typeof="mw:Transclusion"
27884 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
27885
27886 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27887 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27888 <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>
27889 !! wikitext
27890 {{echo|1=f=oo}}
27891
27892 {{echo|1=f=oo|2=bar}}
27893
27894 <!--Orig params with data-parsoid has heuristics for handling = chars-->
27895 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
27896 {{echo|<nowiki>f=oo</nowiki>|bar}}
27897 !! end
27898
27899 !! test
27900 Parsoid: Serialize positional parameters with = in extlink as named parameter
27901 !! options
27902 parsoid=html2wt
27903 !! html/parsoid
27904 <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>
27905 !! wikitext
27906 {{echo|1=http://stuff?is=ok}}
27907 !! end
27908
27909 !! test
27910 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
27911 !! options
27912 parsoid=html2wt
27913 !! html/parsoid
27914 <div>a<p>b</p></div>
27915 <div>a
27916 <p>b</p></div>
27917 <div>
27918 a
27919 <p>b</p></div>
27920 !! wikitext
27921 <div>a
27922 b
27923 </div>
27924 <div>a
27925 b
27926 </div>
27927 <div>
27928 a
27929
27930 b
27931 </div>
27932 !! end
27933
27934 !! test
27935 Substrings resembling wikitext in hrefs should not get nowiki escapes
27936 !! options
27937 parsoid=html2wt
27938 !! html/parsoid
27939 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
27940 !! wikitext
27941 [[Foo''bar''baz]]
27942 !! end
27943
27944 !! test
27945 Enforce single-line context in the serializer
27946 !! options
27947 parsoid=html2wt
27948 !! html/parsoid
27949 <h2>testing
27950 123</h2>
27951
27952 <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">
27953 </span><span about="#mwt1">you</span> </h2>
27954
27955 <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>
27956
27957 <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
27958 there</span></li></ol>
27959
27960 <ul><li>asd
27961 sdf</li></ul>
27962
27963 <ul><li>foo
27964 bar
27965 baz</li>
27966 <li>foo <b>bar</b>
27967 baz</li></ul>
27968
27969 <dl><dt>hi
27970 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
27971 ho</dd></dl>
27972
27973 <dl><dd> <table>
27974 <tbody><tr><td> ha
27975 ha
27976 ha</td></tr>
27977 </tbody></table></dd></dl>
27978 !! wikitext
27979 == testing 123 ==
27980
27981 == hi {{bogus|there
27982 you}} ==
27983
27984 == foo <ref>hello
27985 there</ref> ==
27986
27987 <references />
27988
27989 * asd sdf
27990
27991 * foo bar baz
27992 * foo '''bar''' baz
27993
27994 ; hi ho : hi ho
27995
27996 : {|
27997 | ha
27998 ha
27999 ha
28000 |}
28001 !! end
28002
28003 !! test
28004 Serialize new placeholder space without spans
28005 !! options
28006 parsoid=html2wt
28007 !! html/parsoid
28008 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
28009
28010 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
28011
28012 <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>
28013 !! wikitext
28014 foo : bar
28015
28016 foo : bar
28017
28018 <ref>foo : bar</ref>ok
28019 !! end
28020
28021
28022 #-----------------------
28023 # Tag minimization tests
28024 #-----------------------
28025
28026 !! test
28027 1. I/B quote minimization: wikitext-only tags should be combined
28028 !! options
28029 parsoid=html2wt
28030 !! html/parsoid
28031 <p><i>A</i><i>B</i></p>
28032 <p><b>A</b><b>B</b></p>
28033 <p><i>A</i><b><i>B</i></b></p>
28034 <p><b>A</b><i><b>B</b></i></p>
28035 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
28036 <p><i><b>A</b></i><i><b>B</b></i></p>
28037 <p><i><b>A</b></i><b><i>B</i></b></p>
28038 <p><b><i>A</i></b><i><b>B</b></i></p>
28039 !! wikitext
28040 ''AB''
28041
28042 '''AB'''
28043
28044 ''A'''B'''''
28045
28046 '''A''B'''''
28047
28048 '''A''BC''D'''
28049
28050 '''''AB'''''
28051
28052 '''''AB'''''
28053
28054 '''''AB'''''
28055 !! end
28056
28057 !! test
28058 2. I/B quote minimization: wikitext and html tags should not be combined
28059 !! options
28060 parsoid=html2wt
28061 !! html/parsoid
28062 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
28063 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
28064 !! wikitext
28065 ''A''<i>B</i>
28066
28067 ''A''<nowiki/>'''<i>B</i>'''
28068 !! end
28069
28070 !! test
28071 3. I/B quote minimization: templated content stops minimization
28072 !! options
28073 parsoid=html2wt
28074 !! html/parsoid
28075 <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>
28076 <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>
28077 !! wikitext
28078 ''A''{{echo|''B''}}
28079
28080 ''A''{{echo|'''''B'''''}}
28081 !! end
28082
28083 !! test
28084 4. I/B quote minimization: new content should be mimimized with adjacent old content
28085 !! options
28086 parsoid=html2wt
28087 !! html/parsoid
28088 <p><i>A</i><i>B</i></p>
28089 <p><b>A</b><b>B</b></p>
28090 <p><i>A</i><b><i>B</i></b></p>
28091 !! wikitext
28092 ''AB''
28093
28094 '''AB'''
28095
28096 ''A'''B'''''
28097 !! end
28098
28099 !! test
28100 5a. Merge adjacent quote nodes if they've been edited
28101 !! options
28102 parsoid={
28103 "modes": ["wt2wt", "selser"],
28104 "changes": [
28105 ["p", "contents", "remove", ":contains('b')"]
28106 ]
28107 }
28108 !! wikitext
28109 ''a''b''c''
28110 !! wikitext/edited
28111 ''ac''
28112 !! end
28113
28114 !! test
28115 5b. Merge adjacent quote nodes if they've been edited
28116 !! options
28117 parsoid={
28118 "modes": ["wt2wt", "selser"],
28119 "changes": [
28120 ["#x", "remove"]
28121 ]
28122 }
28123 !! wikitext
28124 ''a''<span id="x">b</span>''c''
28125 !! wikitext/edited
28126 ''ac''
28127 !! end
28128
28129 !! test
28130 1. Merge adjacent link nodes as long as at least one element is new
28131 !! options
28132 parsoid={
28133 "modes": ["html2wt"],
28134 "scrubWikitext": true
28135 }
28136 !! html/parsoid
28137 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28138 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28139 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
28140 !! wikitext
28141 [[Football]]
28142 [[Football]]
28143 [[Football|Foot]][[Football|ball]]
28144 !! end
28145
28146 !! test
28147 2. Merge adjacent link nodes and enable additional normalizations
28148 !! options
28149 parsoid={
28150 "modes": ["html2wt"],
28151 "scrubWikitext": true
28152 }
28153 !! html/parsoid
28154 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
28155 !! wikitext
28156 [[Football|''Football'']]
28157 !! end
28158
28159 !! test
28160 3. Don't merge adjacent link nodes if scrubWikitext is false
28161 !! options
28162 parsoid={
28163 "modes": ["html2wt"],
28164 "scrubWikitext": false
28165 }
28166 !! html/parsoid
28167 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
28168 !! wikitext
28169 [[Football|Foot]][[Football|ball]]
28170 !! end
28171
28172 #------------------------------
28173 # End of tag minimization tests
28174 #------------------------------
28175
28176 !!test
28177 T56262: New entities
28178 !! options
28179 parsoid=html2wt
28180 !! html/parsoid
28181 <span typeof="mw:Entity">&nbsp;</span>
28182 !! wikitext
28183 &nbsp;
28184 !! end
28185
28186 ## Note that there is no wikitext output for 'unknownproperty' ##
28187 ## Unknown magic words are silently dropped ##
28188
28189 !! test
28190 Magic words
28191 !! options
28192 parsoid=html2wt
28193 !! html/parsoid
28194 <meta property='mw:PageProp/toc' />
28195 <meta property='mw:PageProp/notoc' />
28196 <meta property='mw:PageProp/forcetoc' />
28197 <meta property='mw:PageProp/index' />
28198 <meta property='mw:PageProp/noindex' />
28199 <meta property='mw:PageProp/nogallery' />
28200 <meta property='mw:PageProp/noeditsection' />
28201 <meta property='mw:PageProp/notitleconvert' />
28202 <meta property='mw:PageProp/nocontentconvert' />
28203 <meta property='mw:PageProp/unknownproperty' />
28204 !! wikitext
28205 __TOC__
28206 __NOTOC__
28207 __FORCETOC__
28208 __INDEX__
28209 __NOINDEX__
28210 __NOGALLERY__
28211 __NOEDITSECTION__
28212 __NOTITLECONVERT__
28213 __NOCONTENTCONVERT__
28214 !! end
28215
28216 !! test
28217 Consecutive <pre>s should not get merged
28218 !! options
28219 parsoid=html2wt,html2html
28220 !! html/parsoid
28221 <pre>a</pre><pre>b</pre>
28222
28223 <pre>c
28224 </pre><pre>
28225 d</pre>
28226
28227 <pre>e
28228
28229 </pre><pre>
28230
28231 f</pre>
28232 !! wikitext
28233 a
28234
28235 b
28236
28237 c
28238
28239 d
28240
28241 e
28242
28243
28244
28245 f
28246 !! end
28247
28248 !! test
28249 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
28250 !! options
28251 parsoid=html2wt
28252 !! html/parsoid
28253 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
28254 !! wikitext
28255 [[Special:BookSources/1234567890|ISBN 1234567895]]
28256 !! end
28257
28258 !! test
28259 Edited RFC links not serializable as RFC links should serialize as extlinks
28260 !! options
28261 parsoid=html2wt
28262 !! html/parsoid
28263 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
28264 !! wikitext
28265 [https://tools.ietf.org/html/rfc123 New RFC]
28266 !! end
28267
28268 !! test
28269 Edited PMID links not serializable as PMID links should serialize as extlinks
28270 !! options
28271 parsoid=html2wt
28272 !! html/parsoid
28273 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
28274 !! wikitext
28275 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
28276 !! end
28277
28278 !! test
28279 WTS of autolinks with trailing/surrounding context
28280 !! options
28281 parsoid=html2wt
28282 !! html/parsoid
28283 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
28284 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
28285 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
28286 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
28287 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
28288 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
28289 !! wikitext
28290 http://cscott.net'''foo'''
28291
28292 http://cscott.net<b>foo</b>
28293
28294 '''http://cscott.net'''
28295
28296 '''http://cscott.net '''
28297
28298 '''http://cscott.net<nowiki/>x'''
28299
28300 http://cscott.net<nowiki/>x
28301 !! end
28302
28303 !! test
28304 WTS of autolinks with nowikis (round-trip)
28305 !! wikitext
28306 x<nowiki/>http://cscott.net<nowiki/>x
28307 !! html/parsoid
28308 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
28309 !! end
28310
28311 # this is the "easy" test because it leaves in place all the
28312 # data-parsoid information indicating this is an autolink
28313 !! test
28314 WTS of autolinks with escapes (editing)
28315 !! options
28316 parsoid={
28317 "modes": ["wt2wt"],
28318 "changes": [
28319 [ "span", "remove" ]
28320 ]
28321 }
28322 !! wikitext
28323 x<nowiki/>http://cscott.net<nowiki/>x
28324 !! wikitext/edited
28325 x<nowiki/>http://cscott.net<nowiki/>x
28326 !! end
28327
28328 !! test
28329 WTS of edited autolink-like text (T103364)
28330 !! options
28331 parsoid={
28332 "modes": ["wt2wt"],
28333 "changes": [
28334 [ "span[typeof]", "removeAttr", "typeof" ]
28335 ]
28336 }
28337 !! wikitext
28338 Not a link: <nowiki>http://example.com</nowiki>.
28339 !! wikitext/edited
28340 Not a link: <span><nowiki>http://example.com</nowiki></span>.
28341 !! end
28342
28343 !! test
28344 WTS of newly-authored autolink-like text (T103364)
28345 !! options
28346 parsoid=html2wt
28347 !! html/parsoid
28348 <p>http://example.com is not a link.</p>
28349 !! wikitext
28350 <nowiki>http://example.com</nowiki> is not a link.
28351 !! end
28352
28353 !! test
28354 WTS of autolink-like text after an autolink (T108563)
28355 !! options
28356 parsoid=html2wt
28357 !! html/parsoid
28358 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
28359 !! wikitext
28360 http://example.com <nowiki>http://example.com</nowiki> is not a link.
28361 !! end
28362
28363 !! test
28364 Magic links inside links (not autolinked)
28365 !! wikitext
28366 [[Foo|http://example.com]]
28367 [[Foo|RFC 1234]]
28368 [[Foo|PMID 1234]]
28369 [[Foo|ISBN 123456789x]]
28370
28371 [http://foo.com http://example.com]
28372 [http://foo.com RFC 1234]
28373 [http://foo.com PMID 1234]
28374 [http://foo.com ISBN 123456789x]
28375 !! html+tidy
28376 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
28377 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
28378 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
28379 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
28380 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
28381 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
28382 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
28383 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
28384 </p>
28385 !! html/parsoid
28386 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
28387 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
28388 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
28389 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
28390
28391 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
28392 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
28393 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
28394 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
28395 !! end
28396
28397 !! test
28398 Magic links inside image captions (autolinked)
28399 !! wikitext
28400 [[File:Foobar.jpg|thumb|http://example.com]]
28401 [[File:Foobar.jpg|thumb|RFC 1234]]
28402 [[File:Foobar.jpg|thumb|PMID 1234]]
28403 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
28404 !! html+tidy
28405 <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>
28406 <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>
28407 <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>
28408 <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>
28409 !! html/parsoid
28410 <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>
28411 <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>
28412 <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>
28413 <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>
28414 !! end
28415
28416 !! test
28417 WTS of magic word text (T109371)
28418 !! options
28419 parsoid=html2wt
28420 !! html/parsoid
28421 <p>RFC 1234</p>
28422 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
28423 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
28424 !! wikitext
28425 <nowiki>RFC 1234</nowiki>
28426
28427 [http://foo.com RFC 1234]
28428
28429 [[Foo|RFC 1234]]
28430 !! end
28431
28432 !! test
28433 Edited Redirect link should emit a non-piped wikitext link
28434 !! options
28435 parsoid=html2wt
28436 !! html/parsoid
28437 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
28438 !! wikitext
28439 #REDIRECT [[Bar]]
28440 !! end
28441
28442 !! test
28443 T75121: Infer extension name from typeOf if data-mw is not present
28444 !! options
28445 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28446 !! html/parsoid
28447 <div typeOf="mw:Extension/foo"></div>
28448 !! wikitext
28449 <foo />
28450 !! end
28451
28452 # Note that the <p> wrapping isn't present in PHP parser output
28453 # The important thing for this test is that P-wrapping doesn't
28454 # interfere with the <nowiki> protection for leading - in <td>
28455 # (which isn't necessary for <th>).
28456 !! test
28457 T88318: p-wrapped dash in table.
28458 !! options
28459 parsoid=html2wt,wt2wt
28460 !! html/parsoid
28461 <table><tbody>
28462 <tr><th><p>-</p></th><th><p>- </p></th></tr>
28463 <tr><td><p>-</p></td><td><p>- </p></td></tr>
28464 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
28465 </tbody></table>
28466 !! wikitext
28467 {|
28468 !-
28469 !-
28470 |-
28471 |<nowiki>-</nowiki>
28472 |<nowiki>- </nowiki>
28473 |-
28474 |<small>-</small>
28475 |<br />
28476 -
28477 |<br />
28478 -
28479 |}
28480 !! html/php+tidy
28481 <table>
28482 <tbody><tr>
28483 <th>-
28484 </th>
28485 <th>-
28486 </th></tr>
28487 <tr>
28488 <td>-
28489 </td>
28490 <td>-
28491 </td></tr>
28492 <tr>
28493 <td><small>-</small>
28494 </td>
28495 <td><br />
28496 <p>-
28497 </p>
28498 </td>
28499 <td><br />
28500 <p>-
28501 </p>
28502 </td></tr></tbody></table>
28503 !! end
28504
28505 !! test
28506 T149209: WTS: Handle newlines in table cells properly
28507 !! options
28508 parsoid=html2wt
28509 !! html/parsoid
28510 <table>
28511 <tbody>
28512 <tr><td>a
28513 b
28514 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
28515 <tr><td><p>x</p>
28516 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
28517 </tbody></table>
28518 <table>
28519 <tbody>
28520 <tr><th>a
28521 b
28522 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
28523 <tr><th><p>x</h>
28524 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
28525 </tbody></table>
28526 !! wikitext
28527 {|
28528 |a
28529 b
28530 |c
28531 |-
28532 |x
28533 {{!}}y
28534 |}
28535 {|
28536 !a
28537 b
28538 !c
28539 |-
28540 !x
28541 !y
28542 |}
28543 !! end
28544
28545 !! test
28546 T149209: Selser: Handle newlines in table cells properly
28547 !! options
28548 parsoid={
28549 "modes": ["selser"],
28550 "changes": [
28551 [ "#h1", "html", "a\nb\n" ],
28552 [ "#h2", "html", "a\nb\n" ],
28553 [ "#c1", "html", "a\nb\n" ],
28554 [ "#c2", "html", "<p>a</p>" ],
28555 [ "#c3", "html", "<p>a</p>" ],
28556 [ "#c4", "html", "edit-me<p>a</p>" ]
28557 ]
28558 }
28559 !! wikitext
28560 {|
28561 ! id="h1" |edit-me!!1
28562 |-
28563 ! id="h2" |edit-me||2
28564 |-
28565 | id="c1" |edit-me||3
28566 |-
28567 | id="c2" |edit-me||4
28568 |-
28569 | id="c3" |edit-me||p||q||r
28570 |-
28571 | id="c4" |edit-me||p||q||r
28572 |}
28573 !! wikitext/edited
28574 {|
28575 ! id="h1" |a
28576 b
28577 !1
28578 |-
28579 ! id="h2" |a
28580 b
28581 !2
28582 |-
28583 | id="c1" |a
28584 b
28585 |3
28586 |-
28587 | id="c2" |a
28588 |4
28589 |-
28590 | id="c3" |a
28591 |p||q||r
28592 |-
28593 | id="c4" |edit-me
28594 a
28595 |p||q||r
28596 |}
28597 !! end
28598
28599 !! test
28600 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
28601 !! options
28602 parsoid=html2wt
28603 !! html/parsoid
28604 <table id='mwAb'>
28605 <td id='mwAc'>foo</td>
28606 <td id='serialize-this'>bar</td>
28607 </table>
28608 !! wikitext
28609 {|
28610 |foo
28611 | id="serialize-this" |bar
28612 |}
28613 !! end
28614
28615 !! test
28616 Parsoid-like element ids should not be serialized to wikitext unless shadowed
28617 !! options
28618 parsoid=html2wt
28619 !! html/parsoid
28620 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
28621 !! wikitext
28622 <div id="hello">ok</div>
28623 !! end
28624
28625 !! test
28626 WTS change modes
28627 !! options
28628 parsoid={
28629 "modes": ["wt2wt"],
28630 "changes": [
28631 [ "#xyz", "before", "<b>before</b> stuff " ],
28632 [ "#xyz", "after", " stuff <i>after</i>" ],
28633 [ "#xyz", "html", "x <b>y</b> z" ]
28634 ]
28635 }
28636 !! wikitext
28637 <span id="xyz">hello</span>
28638 !! wikitext/edited
28639 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
28640 !! end
28641
28642 !! test
28643 Never serialize a-tag as html, regardless of what data-parsoid has to say
28644 !! options
28645 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28646 !! html/parsoid
28647 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
28648 !! wikitext
28649 [[Foo]]
28650 !! end
28651
28652 ## SSS FIXME: This is broken output nevertheless.
28653 ## What might be a reasonable non-broken output for this?
28654 ## This is an edge case unlikely to be seen in production
28655 ## that I am not wasting more time on this right now.
28656 !! test
28657 Never serialize a-tag as html, no matter what attributes it has
28658 !! options
28659 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
28660 !! html/parsoid
28661 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
28662 !! wikitext
28663 [http://boo.org http://boohoo.org]
28664 !! end
28665
28666 # Misnested is an indication that selser can reuse the source but these have
28667 # shown to sneak through on occasion. See T101768.
28668 # The original wikitext here is: [http://test.com [[one]] two three]
28669 !! test
28670 Strip span tags added to mark misnested links
28671 !! options
28672 parsoid=html2wt
28673 !! html/parsoid
28674 <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>
28675 !! wikitext
28676 [http://test.com][[one]] two three
28677 !! end
28678
28679 !! test
28680 Catch regression when unpacking misnested links
28681 !! options
28682 parsoid=wt2html
28683 !! wikitext
28684 {{echo|hi}}[http://example.com [[ho]]]
28685 !! html/parsoid
28686 <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>
28687 !! end
28688
28689 !! test
28690 Catch regression when unpacking with trailing content
28691 !! wikitext
28692 {{echo|Foo <references/> bar}}
28693 !! html/parsoid
28694 <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>
28695 !! end
28696
28697 !! test
28698 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
28699 !! options
28700 parsoid=html2wt
28701 !! html/parsoid
28702 <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|}"]}'>
28703 <tbody><tr><td>d
28704 </td></tr>
28705 </tbody></table>
28706 !! wikitext
28707 {{echo|a}}
28708 {|{{echo|c
28709 {{!}}d
28710 }}
28711 |}
28712 !! end
28713
28714 ## This test verifies the presence and computation of this attribute indirectly
28715 ## by making an edit and ensuring that the serialization is correct (which it would be
28716 ## only if firstWikitextNode is properly set).
28717 !! test
28718 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
28719 !! options
28720 parsoid= {
28721 "modes": ["wt2wt"],
28722 "changes": [
28723 [ "div#x", "remove" ],
28724 [ "div", "before", "<div>new</div>" ]
28725 ]
28726 }
28727 !! wikitext
28728 <div id="x">foo</div>
28729 {|
28730 {{echo|<div>boo</div>
28731 {{!}}b}}
28732 |c
28733 |}
28734 !! wikitext/edited
28735
28736 <div>new</div>
28737 {|
28738 {{echo|<div>boo</div>
28739 {{!}}b}}
28740 |c
28741 |}
28742 !! end
28743
28744 # --------------------------------------------
28745 # Tests spec'ing wikitext serialization norms |
28746 # --------------------------------------------
28747
28748 !! test
28749 Serialize multi-line indent-pre starting with wikitext syntax
28750 !! options
28751 parsoid=html2wt
28752 !! html/parsoid
28753 <pre>* 1
28754 ** 2
28755 * 3</pre>
28756 !! wikitext
28757 * 1
28758 ** 2
28759 * 3
28760 !! end
28761
28762 !! test
28763 1. Categories should always be serialized on their own line
28764 !! options
28765 parsoid=html2wt
28766 !! html/parsoid
28767 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
28768 !! wikitext
28769 foo
28770 [[Category:Foo]]
28771 bar
28772 !! end
28773
28774 !! test
28775 2. Categories that are part of templates should not introduce a line break
28776 !! wikitext
28777 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
28778 !! html/parsoid
28779 <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>
28780 !! end
28781
28782 # Careful while editing these next 2 tests. There are \u200f characters
28783 # before and after the <link> tags in the HTML and following some
28784 # of the categories in wikitext
28785 # Do not remove these characters in edits.
28786 #
28787 # As part of the serialization, these bidi characters will get stripped.
28788 !! test
28789 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
28790 !! options
28791 parsoid={
28792 "modes": ["html2wt"],
28793 "scrubWikitext": true
28794 }
28795 !! html/parsoid
28796 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
28797 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
28798 !! wikitext
28799 [[קטגוריה:טקסים]]
28800 [[קטגוריה: שיטות משפט]]
28801 !! end
28802
28803 !! test
28804 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
28805 !! options
28806 parsoid={
28807 "modes": ["html2wt"],
28808 "scrubWikitext": true
28809 }
28810 !! html/parsoid
28811 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
28812 !! wikitext
28813 [[קטגוריה:טקסים]]
28814 ‏y
28815 !! end
28816
28817 !! test
28818 Lists: Add space after bullets
28819 !! options
28820 parsoid=html2wt
28821 !! html/parsoid
28822 <ul>
28823 <li>foo</li>
28824 <li> bar</li>
28825 <li><span> baz</span></li>
28826 </ul>
28827 !! wikitext
28828 * foo
28829 * bar
28830 * <span> baz</span>
28831 !! end
28832
28833 !! test
28834 1. Headings: Add space before/after == (T53744)
28835 !! options
28836 parsoid=html2wt
28837 !! html/parsoid
28838 <h2>foo</h2>
28839 <h2> bar</h2>
28840 <h2>baz </h2>
28841 <h2><span> baz</span></h2>
28842 !! wikitext
28843 == foo ==
28844
28845 == bar ==
28846
28847 == baz ==
28848
28849 == <span> baz</span> ==
28850 !! end
28851
28852 !! test
28853 2. Headings: Add space before/after == even after hoisted content
28854 !! options
28855 parsoid={
28856 "modes": ["html2wt"],
28857 "scrubWikitext": true
28858 }
28859 !! html/parsoid
28860 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
28861 !! wikitext
28862 [[Category:A2]]
28863
28864 == ok ==
28865 !! end
28866
28867 !! test
28868 1. Headings: suppress newly created empty headings
28869 !! options
28870 parsoid={
28871 "modes": ["html2wt"],
28872 "scrubWikitext": true
28873 }
28874 !! html/parsoid
28875 <h2></h2>
28876 !! wikitext
28877 !! end
28878
28879 !! test
28880 2. Headings: don't suppress empty headings if scrubWikitext is false
28881 !! options
28882 parsoid=html2wt
28883 !! html/parsoid
28884 <h2></h2>
28885 !! wikitext
28886 ==<nowiki/>==
28887 !! end
28888
28889 !! test
28890 3. Headings: suppress empty headings on edits
28891 !! options
28892 parsoid={
28893 "modes": ["selser"],
28894 "scrubWikitext": true,
28895 "changes": [
28896 [ "#x", "remove"]
28897 ]
28898 }
28899 !! wikitext
28900 ==<span id="x">foo</span>==
28901 !! wikitext/edited
28902 !! end
28903
28904 !! test
28905 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
28906 !! options
28907 parsoid={
28908 "modes": ["html2wt"],
28909 "scrubWikitext": true
28910 }
28911 !! html/parsoid
28912 <h2>foo<br/>bar</h2>
28913 <h2>foo <span><br/>bar</span> baz</h2>
28914 !! wikitext
28915 == foo bar ==
28916
28917 == foo <span> bar</span> baz ==
28918 !! end
28919
28920 !! test
28921 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
28922 !! options
28923 parsoid={
28924 "modes": ["html2wt"],
28925 "scrubWikitext": false
28926 }
28927 !! html/parsoid
28928 <h2>foo<br/>bar</h2>
28929 !! wikitext
28930 == foo<br /> bar ==
28931 !! end
28932
28933 !! test
28934 1. WT Quote Tags: suppress newly created empty style tags
28935 !! options
28936 parsoid={
28937 "modes": ["html2wt"],
28938 "scrubWikitext": true
28939 }
28940 !! html/parsoid
28941 <i></i><b></b>
28942 !! wikitext
28943 !! end
28944
28945 !! test
28946 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
28947 !! options
28948 parsoid=html2wt
28949 !! html/parsoid
28950 <i></i><b></b>
28951 !! wikitext
28952 ''<nowiki/>'''''<nowiki/>'''
28953 !! end
28954
28955 !! test
28956 3. WT Quote Tags: suppress empty style tags on edits
28957 !! options
28958 parsoid={
28959 "modes": ["selser"],
28960 "scrubWikitext": true,
28961 "changes": [
28962 [ "#x", "remove"]
28963 ]
28964 }
28965 !! wikitext
28966 '''<span id="x">foo</span>'''
28967 !! wikitext/edited
28968 !! end
28969
28970 !! test
28971 1. Anchors: suppress newly created empty anchors
28972 !! options
28973 parsoid={
28974 "modes": ["html2wt"],
28975 "scrubWikitext": true
28976 }
28977 !! html/parsoid
28978 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28979 !! wikitext
28980 !! end
28981
28982 !! test
28983 2. Anchors: don't suppress empty anchors if scrubWikitext is false
28984 !! options
28985 parsoid={
28986 "modes": ["html2wt"],
28987 "scrubWikitext": false
28988 }
28989 !! html/parsoid
28990 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
28991 !! wikitext
28992 [[Test|<nowiki/>]]
28993 !! end
28994
28995 !! test
28996 3. Anchors: suppress empty anchors on edits
28997 !! options
28998 parsoid={
28999 "modes": ["selser"],
29000 "scrubWikitext": true,
29001 "changes": [
29002 [ "#x", "remove"]
29003 ]
29004 }
29005 !! wikitext
29006 [[Test|<span id="x">foo</span>]]
29007 !! wikitext/edited
29008 !! end
29009
29010 !! test
29011 3a. Anchors: do not suppress numbered extlinks
29012 !! options
29013 parsoid={
29014 "modes": ["wt2wt"],
29015 "scrubWikitext": true
29016 }
29017 !! wikitext
29018 [http://foo.com]
29019 !! html/parsoid
29020 <a rel="mw:ExtLink" href="http://foo.com"></a>
29021 !! end
29022
29023 !! test
29024 3b. Anchors: do not suppress numbered extlinks
29025 !! options
29026 parsoid={
29027 "modes": ["wt2wt"],
29028 "scrubWikitext": true,
29029 "changes": [
29030 [ "#x", "remove"]
29031 ]
29032 }
29033 !! wikitext
29034 [http://foo.com <span id="x">foo</span>]
29035 !! wikitext/edited
29036 [http://foo.com]
29037 !! end
29038
29039 !!test
29040 Normalizations should be restricted to edited content
29041 !!options
29042 parsoid={
29043 "modes": ["selser"],
29044 "scrubWikitext": true,
29045 "changes": [
29046 [ "h1", "before", "<i></i>"]
29047 ]
29048 }
29049 !!wikitext
29050 a
29051 = =
29052 b
29053 !!wikitext/edited
29054 a
29055 = =
29056 b
29057 !!end
29058
29059 !! test
29060 1. Multiple normalizations (html2wt)
29061 !! options
29062 parsoid={
29063 "modes": ["html2wt"],
29064 "scrubWikitext": true
29065 }
29066 !! html
29067 <h2><i></i></h2>
29068 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
29069 </a><b><i></i></b>x</p>
29070 !! wikitext
29071
29072 [[foo]]
29073 x
29074
29075 !! end
29076
29077 !! test
29078 2. Multiple normalizations (selser)
29079 !! options
29080 parsoid={
29081 "modes": ["selser"],
29082 "scrubWikitext": true,
29083 "changes": [
29084 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
29085 ]
29086 }
29087 !! wikitext
29088 <span id="x">foo</span>
29089 !! wikitext/edited
29090 <span id="x">foo</span>
29091
29092 x
29093 !! end
29094
29095 !! test
29096 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
29097 !! options
29098 parsoid={
29099 "modes": ["html2wt"],
29100 "scrubWikitext": true
29101 }
29102 !! html/parsoid
29103 <p> hi</p>
29104 <p> hello</p>
29105 !! wikitext
29106 hi
29107
29108 hello
29109 !! end
29110
29111 !! test
29112 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
29113 !! options
29114 parsoid=html2wt
29115 !! html/parsoid
29116 <p> hi</p>
29117 <p> hello</p>
29118 !! wikitext
29119 <nowiki> </nowiki>hi
29120
29121 <nowiki> </nowiki> hello
29122 !! end
29123
29124 !! test
29125 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
29126 !! options
29127 parsoid={
29128 "modes": ["html2wt"],
29129 "scrubWikitext": true
29130 }
29131 !! html/parsoid
29132 <p>Foo
29133 bar
29134 baz</p>
29135
29136 <table><tr><td>Foo
29137 bar
29138 baz bang</td></tr></table>
29139
29140 <p><!--boo--> foo
29141 bar</p>
29142
29143 <p> foo
29144 bar<span>boo</span></p>
29145 !! wikitext
29146 Foo
29147 bar
29148 baz
29149
29150 {|
29151 |Foo
29152 bar
29153 baz bang
29154 |}
29155
29156 <!--boo-->foo
29157 bar
29158
29159 foo
29160 bar<span>boo</span>
29161 !! end
29162
29163 !! test
29164 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
29165 !! options
29166 parsoid={
29167 "modes": ["selser"],
29168 "scrubWikitext": true,
29169 "changes": [
29170 [ "p", "html", " a\n b" ]
29171 ]
29172 }
29173 !! wikitext
29174 xyz
29175 !! wikitext/edited
29176 a
29177 b
29178 !! end
29179
29180 !! test
29181 1. New links that end in spaces
29182 !! options
29183 parsoid={
29184 "modes": ["html2wt"],
29185 "scrubWikitext": false
29186 }
29187 !! html/parsoid
29188 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29189 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29190 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29191 !! wikitext
29192 [[Berlin ]]<nowiki/>is the capital of Germany.
29193
29194 [[Foo ]]'''bar'''
29195
29196 [[Boston ]] is a city.
29197 !! end
29198
29199 !! test
29200 2. New links that end in spaces
29201 !! options
29202 parsoid={
29203 "modes": ["html2wt"],
29204 "scrubWikitext": true
29205 }
29206 !! html/parsoid
29207 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
29208 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
29209 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
29210 !! wikitext
29211 [[Berlin]] is the capital of Germany.
29212
29213 [[Foo]] '''bar'''
29214
29215 [[Boston]] is a city.
29216 !! end
29217
29218 !! test
29219 1. Table cells with escapable prefixes
29220 !! options
29221 parsoid={
29222 "modes": ["html2wt"],
29223 "scrubWikitext": false
29224 }
29225 !! html
29226 <table>
29227 <tr><td>a</td></tr>
29228 <tr><td>-</td></tr>
29229 <tr><td>+</td></tr>
29230 </table>
29231 !! wikitext
29232 {|
29233 |a
29234 |-
29235 |<nowiki>-</nowiki>
29236 |-
29237 |<nowiki>+</nowiki>
29238 |}
29239 !! end
29240
29241 !! test
29242 2. Table cells with escapable prefixes
29243 !! options
29244 parsoid={
29245 "modes": ["html2wt"],
29246 "scrubWikitext": true
29247 }
29248 !! html
29249 <table>
29250 <tr><td>a</td></tr>
29251 <tr><td>-</td></tr>
29252 <tr><td>+</td></tr>
29253 </table>
29254 !! wikitext
29255 {|
29256 |a
29257 |-
29258 | -
29259 |-
29260 | +
29261 |}
29262 !! end
29263
29264 !! test
29265 3a. Table cells with escapable prefixes after edits
29266 !! options
29267 parsoid={
29268 "modes": ["selser"],
29269 "scrubWikitext": true,
29270 "changes": [
29271 [ "table tbody tr:first-child td:first-child", "remove"]
29272 ]
29273 }
29274 !! wikitext
29275 {|
29276 |a||-
29277 |}
29278 !! wikitext/edited
29279 {|
29280 | -
29281 |}
29282 !! end
29283
29284 !! test
29285 3b. Table cells with escapable prefixes after edits
29286 !! options
29287 parsoid={
29288 "modes": ["selser"],
29289 "scrubWikitext": true,
29290 "changes": [
29291 [ "table tbody tr:first-child td:first-child", "html", "-" ],
29292 [ "#x", "remove" ]
29293 ]
29294 }
29295 !! wikitext
29296 {|
29297 |pqr
29298 |<span id="x">foo</span>+
29299 |}
29300 !! wikitext/edited
29301 {|
29302 | -
29303 | +
29304 |}
29305 !! end
29306
29307 # FIXME: This test will fail because
29308 # normalization doesn't realize that the id attribute
29309 # will eliminate the escapable scenario
29310 !! test
29311 4a. Table cells without escapable prefixes after edits
29312 !! options
29313 parsoid={
29314 "modes": ["selser"],
29315 "scrubWikitext": true,
29316 "changes": [
29317 [ "#x", "html", "-" ]
29318 ]
29319 }
29320 !! wikitext
29321 {|
29322 | id="x" |abcd
29323 |}
29324 !! wikitext/edited
29325 {|
29326 | id="x" |-
29327 |}
29328 !! end
29329
29330 ## This tests normalizer's ability to discriminate between
29331 ## cells having identical content.
29332 !! test
29333 4b. Table cells without escapable prefixes after edits
29334 !! options
29335 parsoid={
29336 "modes": ["selser"],
29337 "scrubWikitext": true,
29338 "changes": [
29339 [ "td", "html", "-" ]
29340 ]
29341 }
29342 !! wikitext
29343 {|
29344 |a||b
29345 |}
29346 !! wikitext/edited
29347 {|
29348 | -||-
29349 |}
29350 !! end
29351
29352 ## This tests normalizer's ability to not be tripped by
29353 ## comments (and whitespace)
29354 !! test
29355 4c. Table cells without escapable prefixes after edits
29356 !! options
29357 parsoid={
29358 "modes": ["selser"],
29359 "scrubWikitext": true,
29360 "changes": [
29361 [ "table tbody tr td:first-child", "remove" ]
29362 ]
29363 }
29364 !! wikitext
29365 {|
29366 |-
29367 <!--foo--> |a||-
29368 |}
29369 !! wikitext/edited
29370 {|
29371 |-
29372 <!--foo--> | -
29373 |}
29374 !! end
29375
29376 ## This tests normalizer's ability to handle HTML cells
29377 !! test
29378 4d. Table cells without escapable prefixes after edits
29379 !! options
29380 parsoid={
29381 "modes": ["selser"],
29382 "scrubWikitext": true,
29383 "changes": [
29384 [ "td", "html", "-" ]
29385 ]
29386 }
29387 !! wikitext
29388 <table>
29389 <tr><td>a</td></tr>
29390 </table>
29391 !! wikitext/edited
29392 <table>
29393 <tr><td>-</td></tr>
29394 </table>
29395 !! end
29396
29397 ## T111151 Remove font elements without attributes
29398 !! test
29399 5a. font tags without attributes should be dropped in scrubWikitext mode
29400 !! options
29401 parsoid={
29402 "modes": ["html2wt"],
29403 "scrubWikitext": true
29404 }
29405 !! html
29406 <font>foo</font>
29407 <font><font>bar</font></font>
29408 <font class="x">boo</font>
29409 !! wikitext
29410 foo
29411 bar
29412 <font class="x">boo</font>
29413 !! end
29414
29415 !! test
29416 5b. font tags should not be dropped without scrubWikitext being enabled
29417 !! options
29418 parsoid={
29419 "modes": ["html2wt"],
29420 "scrubWikitext": false
29421 }
29422 !! html
29423 <font>foo</font>
29424 !! wikitext
29425 <font>foo</font>
29426 !! end
29427
29428 !! test
29429 Escape nowiki DOM elements
29430 !! options
29431 parsoid=html2wt
29432 !! html/parsoid
29433 <nowiki><i>foo</i></nowiki>
29434 !! wikitext
29435 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
29436 !! end
29437
29438 # This is meant to be an interim fix while we go about figuring out
29439 # how to not introduce these trailing <nowiki/>s in the first place.
29440 !! test
29441 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
29442 !! options
29443 parsoid=html2wt
29444 !! html/parsoid
29445 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
29446 y</p>
29447 <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>
29448 <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>
29449 !! wikitext
29450 x
29451 y
29452
29453 {{echo|
29454 1 = <nowiki/>}}
29455
29456 {{echo|
29457 1 = <nowiki/>
29458 }}
29459 !! end
29460
29461 !! test
29462 New list is serialized on newlines
29463 !! options
29464 parsoid=html2wt
29465 !! html/parsoid
29466 <p>The quick brown fox jumps over the lazy dog.</p><ul>
29467 <li>Yesterday</li>
29468 <li>Today</li>
29469 <li>Tomorrow</li>
29470 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
29471 !! wikitext
29472 The quick brown fox jumps over the lazy dog.
29473
29474 * Yesterday
29475 * Today
29476 * Tomorrow
29477
29478 The quick onyx goblin jumps over the lazy dwarf.
29479 !! end
29480
29481 !! test
29482 New lists in formatting elements serialized w/o newlines
29483 !! options
29484 parsoid=html2wt
29485 !! html/parsoid
29486 <small>
29487
29488 <ul>
29489 <li>123</li>
29490 </ul>
29491
29492 </small>
29493
29494 <small><ul><li>hi</li></ul></small>
29495 !! wikitext
29496 <small>
29497 * 123
29498 </small>
29499
29500 <small>
29501 * hi
29502 </small>
29503 !! end
29504
29505 !! test
29506 New list in table doesn't need newlines
29507 !! options
29508 parsoid=html2wt
29509 !! html/parsoid
29510 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
29511 !! wikitext
29512 {|
29513 |
29514 * test
29515 * 123
29516 |}
29517 !! end
29518
29519 # ---------------------------------------------------
29520 # End of tests spec'ing wikitext serialization norms |
29521 # ---------------------------------------------------
29522
29523 # T104032
29524 !! test
29525 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
29526 !! options
29527 parsoid=html2wt
29528 !! html/parsoid
29529 a<p>b</p>
29530 <b>c</b><p>d</p>
29531 <table><tr>
29532 <td>a<p>b</p></td>
29533 <td><b>c</b><p>d</p></td>
29534 </tr></table>
29535 !! wikitext
29536 a
29537
29538 b
29539
29540 '''c'''
29541
29542 d
29543 {|
29544 |a
29545 b
29546 |'''c'''
29547 d
29548 |}
29549 !! end
29550
29551 !! test
29552 Anchor without href scenarios
29553 !! options
29554 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29555 !! html/parsoid
29556 <a class="bc"></a>
29557 <a class="no">dice</a>
29558 <a name="foo"></a>
29559 !! wikitext
29560
29561 dice
29562 <span name="foo"></span>
29563 !! end
29564
29565 !! test
29566 New transclusion added after a list should be serialized after the list
29567 !! options
29568 parsoid=html2wt
29569 !! html/parsoid
29570 <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>
29571 !! wikitext
29572 * a
29573 {{echo|foo}}
29574 !! end
29575
29576 # -----------------------------------------------------------------
29577 # End of section for Parsoid-only html2wt tests for serialization
29578 # of new content
29579 # -----------------------------------------------------------------
29580
29581 # -----------------------------------------------------------------
29582 # The following section of tests are primarily to spec behavior of
29583 # the selective serializer. All these tests have manual selser
29584 # changes. The automated selser changes for all tests handle the
29585 # wide variation of changes, but these tests here capture specs
29586 # deterministically.
29587 # ----------------------------------------------------------------
29588
29589 ## T90517
29590 !! test
29591 Selser: New comments should not be lost
29592 !! options
29593 parsoid={
29594 "modes": ["selser"],
29595 "changes": [
29596 [ "#a", "after", "<!--c1-->" ],
29597 [ "#b", "before", "<!--c2-->" ]
29598 ]
29599 }
29600 !! wikitext
29601 <span id="a">a</span>
29602
29603 <span id="b">b</span>
29604 !! wikitext/edited
29605 <span id="a">a</span><!--c1-->
29606
29607 <!--c2--><span id="b">b</span>
29608 !! end
29609
29610 ## T89383
29611 !! test
29612 Selser: Check for validity of DSR before using it
29613 !! options
29614 parsoid={
29615 "modes": ["selser"],
29616 "changes": [
29617 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
29618 ]
29619 }
29620 !! wikitext
29621 <span id="a">a</span>
29622 !! wikitext/edited
29623 {{DISPLAYTITLE:foo}}
29624 <span id="a">a</span>
29625 !! end
29626
29627 !! test
29628 1. DOMDiff: Changes to <ref> content should be looked up using id
29629 !! options
29630 parsoid={
29631 "modes": ["selser"],
29632 "changes": [
29633 ["#X", "after", "bar"],
29634 ["#Y", "after", "baz"]
29635 ]
29636 }
29637 !! wikitext
29638 X <ref><span id="X">foo</span></ref>
29639 Y <ref name="a" />
29640 <references>
29641 <ref name="a"><span id="Y">foo</span></ref>
29642 </references>
29643 !! wikitext/edited
29644 X <ref><span id="X">foo</span>bar</ref>
29645 Y <ref name="a" />
29646 <references>
29647 <ref name="a"><span id="Y">foo</span>baz</ref>
29648 </references>
29649 !! end
29650
29651 !! test
29652 2. DOMDiff: Changes to <ref> content should be looked up using id
29653 !! options
29654 parsoid={
29655 "modes": ["selser"],
29656 "changes": [
29657 ["#Z", "after", "bar"]
29658 ]
29659 }
29660 !! wikitext
29661 A <ref>foo bar for a</ref>
29662 B <ref group="X" name="b" />
29663
29664 <references />
29665
29666 <references group="X">
29667 <ref name="b"><span id="Z">foo</span></ref>
29668 </references>
29669 !! wikitext/edited
29670 A <ref>foo bar for a</ref>
29671 B <ref group="X" name="b" />
29672
29673 <references />
29674
29675 <references group="X">
29676 <ref name="b"><span id="Z">foo</span>bar</ref>
29677 </references>
29678 !! end
29679
29680 !! test
29681 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
29682 !! options
29683 parsoid={
29684 "modes": ["selser"],
29685 "changes": [
29686 [ "div:first-child", "text", "bar" ]
29687 ]
29688 }
29689 !! wikitext
29690 <div style="{{1x|color:red;}}%">foo</div>
29691 !! wikitext/edited
29692 <div style="{{1x|color:red;}}%">bar</div>
29693 !! end
29694
29695 !! test
29696 Empty LI (T49673)
29697 !! wikitext
29698 *a
29699 *
29700 *
29701 *b
29702 !! html+tidy
29703 <ul><li>a</li>
29704 <li class="mw-empty-elt"></li>
29705 <li class="mw-empty-elt"></li>
29706 <li>b</li></ul>
29707 !! end
29708
29709 !! test
29710 Thumbnail output
29711 !! wikitext
29712 [[File:Thumb.png|thumb]]
29713 !! html/php+tidy
29714 <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>
29715 !! html/parsoid
29716 <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>
29717 !! end
29718
29719 !! test
29720 unclosed internal link XSS (T137264)
29721 !! wikitext
29722 [[#%3Cscript%3Ealert(1)%3C/script%3E|
29723 !! html/php
29724 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
29725 </p>
29726 !! html/parsoid
29727 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
29728 !! end
29729
29730 !! test
29731 Validating that <style> isn't eaten by tidy (T167349)
29732 !! options
29733 styletag=1
29734 !! wikitext
29735 <div class="foo">
29736 <style>.foo::before { content: "<foo>"; }</style>
29737 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29738 </div>
29739 !! html/php+tidy
29740 <div class="foo">
29741 <style>.foo::before { content: "<foo>"; }</style>
29742 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
29743 </div>
29744 !! end
29745
29746 !! test
29747 Validating that <style> isn't wrapped in a paragraph (T186965)
29748 !! options
29749 styletag=1
29750 !! wikitext
29751 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29752
29753 <style>.foo::before { content: "<foo>"; }</style>
29754
29755 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29756
29757 But if it's on a line with other content, let it be wrapped.
29758
29759 <style>.foo::before { content: "<foo>"; }</style> bar
29760
29761 foo <style>.foo::before { content: "<foo>"; }</style>
29762
29763 foo <style>.foo::before { content: "<foo>"; }</style> bar
29764
29765 And the same if we have non-paragraph-breaking whitespace
29766
29767 foo
29768 <style>.foo::before { content: "<foo>"; }</style>
29769 bar
29770 !! html/php
29771 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29772 </p>
29773 <style>.foo::before { content: "<foo>"; }</style>
29774 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
29775 <p>But if it's on a line with other content, let it be wrapped.
29776 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
29777 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
29778 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
29779 </p><p>And the same if we have non-paragraph-breaking whitespace
29780 </p><p>foo
29781 <style>.foo::before { content: "<foo>"; }</style>
29782 bar
29783 </p>
29784 !! end
29785
29786 !! test
29787 Validating that <link> isn't wrapped in a paragraph (T186965)
29788 !! options
29789 styletag=1
29790 !! wikitext
29791 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29792
29793 <link rel="foo" href="bar"/>
29794
29795 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29796
29797 But if it's on a line with other content, let it be wrapped.
29798
29799 <link rel="foo" href="bar"/> bar
29800
29801 foo <link rel="foo" href="bar"/>
29802
29803 foo <link rel="foo" href="bar"/> bar
29804
29805 And the same if we have non-paragraph-breaking whitespace
29806
29807 foo
29808 <link rel="foo" href="bar"/>
29809 bar
29810 !! html/php
29811 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
29812 </p>
29813 <link rel="foo" href="bar"/>
29814 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
29815 <p>But if it's on a line with other content, let it be wrapped.
29816 </p><p><link rel="foo" href="bar"/> bar
29817 </p><p>foo <link rel="foo" href="bar"/>
29818 </p><p>foo <link rel="foo" href="bar"/> bar
29819 </p><p>And the same if we have non-paragraph-breaking whitespace
29820 </p><p>foo
29821 <link rel="foo" href="bar"/>
29822 bar
29823 </p>
29824 !! end
29825
29826 !! test
29827 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
29828 !! config
29829 wgFragmentMode=[ 'html5', 'legacy' ]
29830 !! wikitext
29831 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29832 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29833 !! html/php
29834 <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>
29835 <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>
29836 </p>
29837 !! html/parsoid
29838 <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>
29839 <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>
29840 !! end
29841
29842 !! test
29843 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
29844 !! config
29845 wgFragmentMode=[ 'legacy' ]
29846 !! wikitext
29847 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
29848 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
29849 !! html/php
29850 <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>
29851 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
29852 </p>
29853 !! end
29854
29855 !! test
29856 Decoding of HTML entities in embedded HTML tags
29857 !! wikitext
29858 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29859 !! html/php
29860 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
29861
29862 !! html/parsoid
29863 <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>
29864 !! end
29865
29866 !! test
29867 Decoding of HTML entities in indicator names for IDs (T104196)
29868 !! options
29869 parsoid=wt2html,html2html
29870 showindicators
29871 !! wikitext
29872 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29873 !! html/php
29874 1&2&3&amp;4&amp;amp;5=Indicator
29875
29876 !! html/parsoid
29877 <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>
29878 !! end
29879
29880 # this version of the test strips out the ambiguity so Parsoid rts cleanly
29881 !! test
29882 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
29883 !! options
29884 showindicators
29885 !! wikitext
29886 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
29887 !! html/php
29888 1&2&3&amp;4&amp;amp;5=Indicator
29889
29890 !! html/parsoid
29891 <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>
29892 !! end
29893
29894 # This fragment mode is what Parsoid supports.
29895 !! test
29896 HTML5 ids: fallback to legacy
29897 !! config
29898 wgFragmentMode=[ 'html5', 'legacy' ]
29899 !! wikitext
29900 ==Foo bar==
29901
29902 ==foo Bar==
29903
29904 ==Тест==
29905
29906 ==Тест==
29907
29908 ==тест==
29909
29910 ==Hey < # " > % : '==
29911 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29912
29913 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29914
29915 <!-- These two links should produce identical HTML -->
29916 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29917
29918 !! html/php
29919 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29920 <ul>
29921 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29922 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29923 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
29924 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
29925 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
29926 <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>
29927 </ul>
29928 </div>
29929
29930 <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>
29931 <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>
29932 <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>
29933 <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>
29934 <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>
29935 <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>
29936 <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>
29937 </p><p>💩 <span id="💩"></span>
29938 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
29939 </p>
29940 !! html/parsoid
29941 <h2 id="Foo_bar">Foo bar</h2>
29942
29943 <h2 id="foo_Bar_2">foo Bar</h2>
29944
29945 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
29946
29947 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
29948
29949 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
29950
29951 <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>
29952 <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>
29953
29954 <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>
29955
29956 <!-- These two links should produce identical HTML -->
29957 <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>
29958 !! end
29959
29960 # Parsoid doesn't support this mode
29961 !! test
29962 HTML5 ids: legacy with a fallback to modern
29963 !! config
29964 wgFragmentMode=[ 'legacy', 'html5' ]
29965 !! wikitext
29966 ==Foo bar==
29967
29968 ==foo Bar==
29969
29970 ==Тест==
29971
29972 ==Тест==
29973
29974 ==тест==
29975
29976 ==Hey < # " > % : '==
29977 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
29978
29979 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
29980
29981 <!-- These two links should produce identical HTML -->
29982 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
29983
29984 !! html/php
29985 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
29986 <ul>
29987 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
29988 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
29989 <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>
29990 <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>
29991 <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>
29992 <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>
29993 </ul>
29994 </div>
29995
29996 <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>
29997 <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>
29998 <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>
29999 <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>
30000 <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>
30001 <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>
30002 <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>
30003 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
30004 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
30005 </p>
30006 !! end
30007
30008 # Parsoid doesn't support this mode.
30009 !! test
30010 HTML5 ids: no legacy
30011 !! config
30012 wgFragmentMode=[ 'html5' ]
30013 !! wikitext
30014 ==Foo bar==
30015
30016 ==foo Bar==
30017
30018 ==Тест==
30019
30020 ==Тест==
30021
30022 ==тест==
30023
30024 ==Hey < # " > % : '==
30025 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
30026
30027 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
30028
30029 <!-- These two links should produce identical HTML -->
30030 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
30031
30032 !! html/php
30033 <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
30034 <ul>
30035 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
30036 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
30037 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
30038 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
30039 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
30040 <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>
30041 </ul>
30042 </div>
30043
30044 <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>
30045 <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>
30046 <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>
30047 <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>
30048 <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>
30049 <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>
30050 <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>
30051 </p><p>💩 <span id="💩"></span>
30052 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
30053 </p>
30054 !! end
30055
30056 !! test
30057 T90902: Normalize weird characters in section IDs
30058 !! config
30059 wgFragmentMode=[ 'html5', 'legacy' ]
30060 !! wikitext
30061 ==Foo&nbsp;bar==
30062 [[#Foo&nbsp;bar]]
30063
30064 !! html/php
30065 <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>
30066 <p><a href="#Foo_bar">#Foo&#160;bar</a>
30067 </p>
30068 !! html/parsoid
30069 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
30070 <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>
30071 !! end
30072
30073 !! test
30074 T51672: Test for brackets in attributes of elements in external link texts
30075 !! wikitext
30076 [http://example.com/ link <span title="title with [brackets]">span</span>]
30077 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
30078
30079 !! html/php
30080 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30081 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
30082 </p>
30083 !! html/parsoid
30084 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
30085 <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>
30086 !! end
30087
30088 !! test
30089 T72875: Test for brackets in attributes of elements in internal link texts
30090 !! wikitext
30091 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
30092 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
30093
30094 !! html/php
30095 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30096 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
30097 </p>
30098 !! html/parsoid
30099 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
30100 <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>
30101 !! end
30102
30103 !! test
30104 T179544: {{anchorencode:}} output should be always usable in links
30105 !! config
30106 wgFragmentMode=[ 'html5' ]
30107 !! wikitext
30108 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
30109 !! html/php
30110 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
30111 </p>
30112 !! html/parsoid
30113 <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>
30114 !! end
30115
30116 ## ------------------------------
30117 ## Parsoid section-wrapping tests
30118 ## ------------------------------
30119 !! test
30120 Section wrapping for well-nested sections (no leading content)
30121 !! options
30122 parsoid={
30123 "wrapSections": true
30124 }
30125 !! wikitext
30126 =1=
30127 a
30128
30129 =2=
30130 b
30131
30132 ==2.1==
30133 c
30134
30135 ==2.2==
30136 d
30137
30138 ===2.2.1===
30139 e
30140
30141 =3=
30142 f
30143 !! html/parsoid
30144 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30145 <p>a</p>
30146
30147 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30148 <p>b</p>
30149
30150 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30151 <p>c</p>
30152
30153 </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
30154 <p>d</p>
30155
30156 <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
30157 <p>e</p>
30158
30159 </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
30160 <p>f</p>
30161
30162 </section>
30163 !! end
30164
30165 !! test
30166 Section wrapping for well-nested sections (with leading content)
30167 !! options
30168 parsoid={
30169 "wrapSections": true
30170 }
30171 !! wikitext
30172 Para 1.
30173
30174 Para 2 with a <div>nested in it</div>
30175
30176 Para 3.
30177
30178 =1=
30179 a
30180
30181 =2=
30182 b
30183
30184 ==2.1==
30185 c
30186 !! html/parsoid
30187 <section data-mw-section-id="0"><p>Para 1.</p>
30188
30189 <p>Para 2 with a </p><div>nested in it</div>
30190
30191 <p>Para 3.</p>
30192
30193 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30194 <p>a</p>
30195
30196 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30197 <p>b</p>
30198
30199 <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
30200 <p>c</p>
30201
30202 </section></section>
30203 !! end
30204
30205 !! test
30206 Section wrapping with template-generated sections (good nesting 1)
30207 !! options
30208 parsoid={
30209 "wrapSections": true
30210 }
30211 !! wikitext
30212 =1=
30213 a
30214
30215 {{echo|1=
30216 ==1.1==
30217 b
30218 }}
30219
30220 ==1.2==
30221 c
30222
30223 =2=
30224 d
30225 !! html/parsoid
30226 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30227 <p>a</p>
30228
30229 <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">
30230 </span><p about="#mwt1">b</p>
30231 </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
30232 <p>c</p>
30233
30234 </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
30235 <p>d</p></section>
30236 !! end
30237
30238 # In this example, the template scope is mildly expanded to incorporate the
30239 # trailing newline after the transclusion since that is part of section 1.1.1
30240 !! test
30241 Section wrapping with template-generated sections (good nesting 2)
30242 !! options
30243 parsoid={
30244 "wrapSections": true,
30245 "modes": ["wt2html", "wt2wt"]
30246 }
30247 !! wikitext
30248 =1=
30249 a
30250
30251 {{echo|1=
30252 ==1.1==
30253 b
30254 ===1.1.1===
30255 d
30256 }}
30257 =2=
30258 e
30259 !! html/parsoid
30260 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30261 <p>a</p>
30262
30263 <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">
30264 </span><p about="#mwt1">b</p><span about="#mwt1">
30265 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
30266 </span><p about="#mwt1">d</p><span about="#mwt1">
30267 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
30268 <p>e</p></section>
30269 !! end
30270
30271 # In this example, the template scope is mildly expanded to incorporate the
30272 # trailing newline after the transclusion since that is part of section 1.2.1
30273 !! test
30274 Section wrapping with template-generated sections (good nesting 3)
30275 !! options
30276 parsoid={
30277 "wrapSections": true,
30278 "modes": ["wt2html", "wt2wt"]
30279 }
30280 !! wikitext
30281 =1=
30282 a
30283
30284 {{echo|1=
30285 x
30286 ==1.1==
30287 b
30288 ==1.2==
30289 c
30290 ===1.2.1===
30291 d
30292 }}
30293 =2=
30294 e
30295 !! html/parsoid
30296 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
30297 <p>a</p>
30298
30299 <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">
30300 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
30301 </span><p about="#mwt1">b</p><span about="#mwt1">
30302 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
30303 </span><p about="#mwt1">c</p><span about="#mwt1">
30304 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
30305 </span><p about="#mwt1">d</p><span about="#mwt1">
30306 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
30307 <p>e</p></section>
30308 !! end
30309
30310 # Because of section-wrapping and template-wrapping interactions,
30311 # the scope of the template is expanded so that the template markup
30312 # is valid in the presence of <section> tags.
30313 # This exercises the s1 is null scenario in the wrapSections code
30314 !! test
30315 Section wrapping with template-generated sections (bad nesting 1)
30316 !! options
30317 parsoid={
30318 "wrapSections": true
30319 }
30320 !! wikitext
30321 <div>
30322 a
30323
30324 {{echo|
30325 =1=
30326 b
30327 }}
30328
30329 c
30330 </div>
30331 !! html/parsoid
30332 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
30333 <p>a</p>
30334
30335 <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"]}'>
30336 </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
30337 </span><p about="#mwt1">b
30338 </p><span about="#mwt1">
30339
30340 </span><p about="#mwt1">c</p><span about="#mwt1">
30341 </span></section></div></section>
30342 !! end
30343
30344 # Because of section-wrapping and template-wrapping interactions,
30345 # the scope of the template is expanded so that the template markup
30346 # is valid in the presence of <section> tags.
30347 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
30348 !! test
30349 Section wrapping with template-generated sections (bad nesting 2)
30350 !! options
30351 parsoid={
30352 "wrapSections": true
30353 }
30354 !! wikitext
30355 =1=
30356 a
30357
30358 {{echo|1=
30359 =2=
30360 b
30361 ==2.1==
30362 c
30363 }}
30364
30365 d
30366
30367 =3=
30368 e
30369 !! html/parsoid
30370 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
30371 <p>a</p>
30372
30373 </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">
30374 </span><p about="#mwt1">b</p><span about="#mwt1">
30375 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
30376 </span><p about="#mwt1">c</p><span about="#mwt1">
30377
30378 </span><p about="#mwt1">d</p><span about="#mwt1">
30379
30380 </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
30381 <p>e</p></section>
30382 !! end
30383
30384 # Because of section-wrapping and template-wrapping interactions,
30385 # additional template wrappers are added to <section> tags
30386 # so that template wrapping semantics are valid whether section
30387 # tags are retained or stripped. But, the template scope can expand
30388 # greatly when accounting for section tags.
30389 # This exercises the s1 and s2 are in different subtrees scenario
30390 !! test
30391 Section wrapping with template-generated sections (bad nesting 3)
30392 !! options
30393 parsoid={
30394 "wrapSections": true,
30395 "modes": ["wt2html", "wt2wt"]
30396 }
30397 !! wikitext
30398 =1=
30399 a
30400
30401 {{echo|1=
30402 ==1.2==
30403 b
30404 =2=
30405 c
30406 }}
30407
30408 d
30409
30410 =3=
30411 e
30412 !! html/parsoid
30413 <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>
30414 <p>a</p>
30415
30416 <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">
30417 </span><p about="#mwt1">b</p><span about="#mwt1">
30418 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
30419 </span><p about="#mwt1">c</p>
30420
30421 <p>d</p>
30422 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
30423 <p>e</p></section>
30424 !! end
30425
30426 !! test
30427 Section wrapping with uneditable lead section + div wrapping multiple sections
30428 !! options
30429 parsoid={
30430 "wrapSections": true
30431 }
30432 !! wikitext
30433 foo
30434
30435 <div style="border:1px solid red;">
30436 =1=
30437 a
30438
30439 ==1.1==
30440 b
30441
30442 =2=
30443 c
30444 </div>
30445
30446 =3=
30447 d
30448
30449 ==3.1==
30450 e
30451 !! html/parsoid
30452 <section data-mw-section-id="-1"><p>foo</p>
30453
30454 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30455 <section data-mw-section-id="1"><h1 id="1">1</h1>
30456 <p>a</p>
30457
30458 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30459 <p>b</p>
30460
30461 </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30462 <p>c</p>
30463 </section></div>
30464
30465 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30466 <p>d</p>
30467
30468 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30469 <p>e</p>
30470 </section></section>
30471 !! end
30472
30473 !! test
30474 Section wrapping with editable lead section + div overlapping multiple sections
30475 !! options
30476 parsoid={
30477 "wrapSections": true
30478 }
30479 !! wikitext
30480 foo
30481
30482 =1=
30483 a
30484 <div style="border:1px solid red;">
30485 b
30486
30487 ==1.1==
30488 c
30489
30490 =2=
30491 d
30492 </div>
30493 e
30494
30495 =3=
30496 f
30497
30498 ==3.1==
30499 g
30500 !! html/parsoid
30501 <section data-mw-section-id="0"><p>foo</p>
30502
30503 </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
30504 <p>a</p>
30505 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
30506 <p>b</p>
30507
30508 <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
30509 <p>c</p>
30510
30511 </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
30512 <p>d</p>
30513 </section></div>
30514 <p>e</p>
30515
30516 </section><section data-mw-section-id="4"><h1 id="3">3</h1>
30517 <p>f</p>
30518
30519 <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
30520 <p>g</p>
30521 </section></section>
30522 !! end
30523
30524 !! test
30525 HTML header tags should not be wrapped in section tags
30526 !! options
30527 parsoid={
30528 "wrapSections": true
30529 }
30530 !! wikitext
30531 foo
30532
30533 <h1>a</h1>
30534
30535 =b=
30536
30537 <h1>c</h1>
30538
30539 =d=
30540 !! html/parsoid
30541 <section data-mw-section-id="0"><p>foo</p>
30542
30543 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
30544
30545 </section><section data-mw-section-id="1"><h1 id="b">b</h1>
30546
30547 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
30548
30549 </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
30550 !! end
30551
30552 !! test
30553 Lead section containing only whitespace and comments.
30554 !! options
30555 parsoid={
30556 "wrapSections": true
30557 }
30558 !! wikitext
30559
30560 <!-- this is a comment, presumably significant to editors -->
30561 =1=
30562 a
30563
30564 =2=
30565 b
30566 !! html/parsoid
30567 <section data-mw-section-id="0" data-parsoid="{}">
30568 <!-- this is a comment, presumably significant to editors -->
30569 </section><section data-mw-section-id="1"><h1 id="1">1</h1>
30570 <p>a</p>
30571
30572 </section><section data-mw-section-id="2"><h1 id="2">2</h1>
30573 <p>b</p></section>
30574 !! end
30575
30576 !! test
30577 Pseudo-sections emitted by templates should have id -2
30578 !! options
30579 parsoid={
30580 "wrapSections": true
30581 }
30582 !! wikitext
30583 foo
30584 {{echo|<div>
30585 ==a==
30586 ==b==
30587 </div>
30588 }}
30589 !! html/parsoid
30590 <section data-mw-section-id="-1"><p>foo</p>
30591 </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}}]}'>
30592 <section data-mw-section-id="-1"><h2 id="a">a</h2>
30593 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
30594 </section></div><span about="#mwt1">
30595 </span></section>
30596 !! end
30597
30598 ##########################################################################
30599 Tests demonstrating white-space insensitivity in input wikitext
30600 for wikitext headings, wikitext list items, and wikitext table captions,
30601 headings, and cells. HTML versions of the same should preserve whitespace.
30602 ##########################################################################
30603 !! test
30604 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
30605 !! wikitext
30606 __NOTOC__
30607 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
30608 == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
30609 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
30610 ; <!--term to define--> term : <!--term's definition--> definition
30611 {|
30612 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
30613 |-
30614 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
30615 |-
30616 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30617 |-
30618 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
30619 |-
30620 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
30621 |}
30622 : {|
30623 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
30624 |} foo <!--c1-->
30625 !! html/php+tidy
30626 <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>
30627 <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>
30628 <ul><li>List item</li></ul>
30629 <dl><dt>term&#160;</dt>
30630 <dd>definition</dd></dl>
30631 <table>
30632 <caption>Table Caption
30633 </caption>
30634 <tbody><tr>
30635 <th>Table Heading 1</th>
30636 <th>Table Heading 2
30637 </th></tr>
30638 <tr>
30639 <td>Table Cell 1</td>
30640 <td>Table Cell 2
30641 </td></tr>
30642 <tr>
30643 <td>class="foo"</td>
30644 <td>Table Cell 3
30645 </td></tr>
30646 <tr>
30647 <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
30648 </td></tr></tbody></table>
30649 <dl><dd><table>
30650 <tbody><tr>
30651 <td>Table Cell 1</td>
30652 <td>Table Cell 2
30653 </td></tr></tbody></table> foo</dd></dl>
30654 !! end
30655
30656 # Looks like <caption> is not accepted in HTML
30657 !! test
30658 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
30659 !! wikitext
30660 __NOTOC__
30661 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
30662 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
30663 <table>
30664 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
30665 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
30666 </table>
30667 !! html/php+tidy
30668 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
30669 <ul><li> List item </li></ul>
30670 <table>
30671 <tbody><tr><th> Table Heading </th><th></th></tr>
30672 <tr><td> Table Cell </td><th></th></tr>
30673 </tbody></table>
30674 !! end
30675
30676 !! test
30677 Do not trim whitespace in links and quotes
30678 !! wikitext
30679 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
30680 [[Foo| some text ]]
30681 !! html/php+tidy
30682 <p>foo <i> italic </i> and <b> bold </b>
30683 <a href="/wiki/Foo" title="Foo"> some text </a>
30684 </p>
30685 !! end
30686
30687 !! test
30688 Remove p tags surrounding a single element in a figcaption
30689 !! options
30690 parsoid=html2wt
30691 !! wikitext
30692 [[File:Foobar.jpg|right|200x200px|Caption]]
30693 !! html/parsoid
30694 <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>
30695 !! end
30696
30697 !! test
30698 Selser preserves lack of newline before list and allows newline after the list
30699 !! options
30700 parsoid={
30701 "modes": ["selser"],
30702 "scrubWikitext": true,
30703 "changes": [
30704 [ "ul", "after", "<p>footer</p>" ]
30705 ]
30706 }
30707 !! wikitext
30708 header
30709 *foo
30710 *bar
30711 !! wikitext/edited
30712 header
30713 *foo
30714 *bar
30715
30716 footer
30717 !! end
30718
30719
30720 !! test
30721 Selser does not introduce newlines between unedited paragraph preceding the list
30722 !! options
30723 parsoid={
30724 "modes": ["selser"],
30725 "changes": [
30726 [ "table tbody tr td p:last-child", "empty" ]
30727 ]
30728 }
30729 !! wikitext
30730 {|
30731 |
30732 header
30733 *foo
30734 *bar
30735 footer
30736 |}
30737 !! wikitext/edited
30738 {|
30739 |
30740 header
30741 *foo
30742 *bar
30743
30744 |}
30745 !! end
30746
30747 !! test
30748 Selser does not introduce newlines between unedited paragraph following the list
30749 !! options
30750 parsoid={
30751 "modes": ["selser"],
30752 "changes": [
30753 [ "table tbody tr td p:first-child", "empty" ]
30754 ]
30755 }
30756 !! wikitext
30757 {|
30758 |
30759 header
30760 *foo
30761 *bar
30762 footer
30763 |}
30764 !! wikitext/edited
30765 {|
30766 |
30767
30768 *foo
30769 *bar
30770 footer
30771 |}
30772 !! end
30773
30774 !! test
30775 Remove a list item but do not insert newline above list
30776 !! options
30777 parsoid={
30778 "modes": ["selser"],
30779 "changes": [
30780 [ "ul li:last-child", "remove" ]
30781 ]
30782 }
30783 !! wikitext
30784 header
30785 *foo
30786 *bar
30787 footer
30788 !! wikitext/edited
30789 header
30790 *foo
30791 footer
30792 !! end